Git Product home page Git Product logo

frads's Introduction

Install + Test Upload Python Package Downloads

frads: Framework for lighting and energy simulation

This is the repository for frads development. frads faciliates lighting and energy simulation by calling Radiance and EnergyPlus within the Python environment. Radiance is a free and open-source, raytracing-based lighting engine that is used extensively by engineering firms for innovative solar control, lighting, and daylighting design to improve the energy efficiency of buildings. With matrix algebraic methods, climate-based annual simulations can now be conducted in less than two minutes. frads automates setup of these simulations by providing end users with an open-source, high-level abstraction of the Radiance command-line workflow (Unix toolbox model), helping to reduce the steep learning curve and associated user errors. frads also provides the necessary infrastructure needed for seamless integration of Radiance and other modeling tools, such as EnergyPlus.

Contact/ Support

We welcome beta users of frads. Feel free to post questions and suggestions in the Discussion section of this GitHub site or contact the principal author at [email protected]. Information about Radiance can be found at: https://www.radiance-online.org . The Radiance community is active and welcomes new users via the Radiance Discourse site or Unmet Hours.

Testing

frads uses Radiance tools in its implementation. Radiance models have been rigorously tested and validated using laboratory and outdoor field data, demonstrating its superior performance in delivering photometrically accurate, photorealistic results. Each Radiance commit and release is tested using the GitHub Action system. Unit tests were developed for most of the major Radiance programs. Tests are performed using Radiance radcompare, which was designed specifically to test Monte Carlo ray-tracing algorithms. Integration tests are the main type of test performed for frads commit and releases. These tests also use the GitHub Action system.

Releases

frads is a work in progress (see to-do list below). frads has been tested on the latest official release of Radiance (September 2020, v5.3) but may not have been tested on the latest HEAD release, which contains source code changes made as recently as yesterday. frads has also been tested on the latest official EnergyPlus release (> v9.3).

Installation

Before you can use frads, you need to install it.

Install Python

Being a Python based library, you'll need to install Python first. Python version 3.8 or newer is required for frads.

Get the latest version of Python at https://www.python.org/downloads/ or with your operating system’s package manager.

You can verify that Python is installed by typing python from your cmd/powershell/terminal; you should see something like:

$ python
Python 3.X.X
[GCC 4.x] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

After you have Python installed, you should have pip command available in your shell environment as well. You can then use pip to install frads:

Install frads

After you have pyenergyplus installed, you can then use pip to install frads:

$ python -m pip install frads

Verifying

To verify that frads can be seen by Python, type python from your shell. Then at the Python prompt, try to import frads

>>> import frads
>>> print(frads.__version__)
1.0.0

Reference

Wang, T., "Frads: A Python Library for Radiance Simulation Control", 2021 Radiance workshop, Bilbao, Spain, August 19, 2021, ppt , voice recording

Wang, T., Ward, G., and Lee, E.S. (2021), A Python Library for Radiance Matrix-based Simulation Control and EnergyPlus Integration, Proceedings of Building Simulation 2021, International Building Performance Simulation Association, Bruges, September 1-3, 2021. Publication to be posted: pdf

frads's People

Contributors

cjkohler avatar eslee556556 avatar tammieyu avatar taoning avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

frads's Issues

Map the annual illuminance results to the timestep for each they correspond to

Right now, for an annual simulation the result are returned as an array. There needs to be a way through which it is possible to map a specific row of the results to a timestep (point in time)
For example, for the code snippet below....


# Instantiate a Two Phase Run
workflow2=methods.TwoPhaseMethod(config=config)

# Set up the matrices for the two phase run
workflow2.generate_matrices()

# Run the simulation and return a numpy array.
rsults = workflow2.calculate_sensor_from_wea('Perimeter_bot_ZN_1_Perimeter_bot_ZN_1_Floor')

...the results are returned as a dataframe below:
image

Currently, it is not possible to know which row/column of the above dataframe corresponds to which timestep.

A utility function for calculating view factors

Given a radiance scene containing polygons, it would be useful to have a utility function that calculates view factors for every surface in the scene.
For example, if a scene contains 100 polygons, then the function should generate a 100 x 100 dataframe where each line contains the view factor for a specific surface and all the other surfaces in the scene.

Include a reference models and weather files

Include reference models and weather files for convenience.

from frads.data_sets import reference_models, weather_files

epmodel = load_energyplus_model(reference_models["medium-office"])
epw_file = weather_files["us-il-chicago"]

Add a way to know the available actuators and output variables

It would be nice to have a way to find out what actuators and variables are available during runtime and what output variables can the simulation generate.

Currently, actuators are defined by component_type, name, and key. It would be nice to be able to search actuators by component type, name, or key.

Ideally, there will be a function that checks the actuator and variable names before running the simulation. If the name doesn't exist, then generate suggested variable names.

Zip input data and results of pywincalc glazing system calc.

It'd be nice to be able to zip input data and results of glazing system calc and reuse it later or share with others. Such zipped file can also be used to generate other Radiance primitives.

The zipped file structure may look something like this:

  • system.json
  • layers
    -- layer1.json
    -- lyaer2.xml
  • system
    --system.xml

There should be some rudimentary check of data integrity between system.json and other files such as any direct modification would render the zipped file invalid.

We need to add methods inside GlazingSystem class to generate such zip file and also a classmethod instantiate a GlazingSystem class with such file.

Implement specific actuator

Based on the current generic implementation of EnergyPlusSetup.actuate, implement some commonly used actuators such as:

  • actuate_construction_state(surface_name, state)
  • actuate_heating_setpoint(zone_name, value)
  • actuate_cooling_setpoint(zone_name, value)
  • actuate_lighting_power(zone_name, value)

encapsulate radiance related workflow inside EnergyPlusSetup

Right users trying to use Radiance workflow when running EnergyPlus simulation needs to manually setup Radiance workflow outside.

It'd be nice encapsulate and automatically generate such Radiance workflow inside EnergyPlusSetup object. All required data for Radiance workflow should be inside EnergyPlusSetup already.

Automatically request variables from callback function

Right now users have to manually request variables that they're trying to access in the callback function.

We can alternatively analyze the syntax of the callback function to identify the requested variable name and key.

Gen room command does not work

I am currently working through this tutorial.

https://lbnl-eta.github.io/frads/how-to/guide_rad1/

gen room 12 14 3
-w 0.4 1 2.5 1.8
-w 3.3 1 2.5 1.8
-w 6.2 1 2.5 1.8
-w 9.1 1 2.5 1.8
-t 0.1 -n aroom

does not work. It returns me the following error:

gen room 12 14 3 \
-w 0.4 1 2.5 1.8
-w 3.3 1 2.5 1.8
-w 6.2 1 2.5 1.8
-w 9.1 1 2.5 1.8 \
-t 0.1 -n aroom
usage: gen room [-h] [-w start_x start_z width height] [-n NAME] [-t Facade thickness] [-r ROTATE] width depth flrflr flrclg
gen room: error: the following arguments are required: flrclg

Just to be sure, I currently have version:

In [1]: import frads

In [2]: print(frads.version)
0.2.10

However the installation of the below did not quite work, because a file was missing:

pip install git+https://github.com/taoning/pyenergyplus_wheels
Collecting git+https://github.com/taoning/pyenergyplus_wheels
Cloning https://github.com/taoning/pyenergyplus_wheels to /private/var/folders/c2/tthc2_6j741c3rvx9vpjppwh0000gn/T/pip-req-build-ihxnqfnq
Running command git clone --filter=blob:none --quiet https://github.com/taoning/pyenergyplus_wheels /private/var/folders/c2/tthc2_6j741c3rvx9vpjppwh0000gn/T/pip-req-build-ihxnqfnq
Resolved https://github.com/taoning/pyenergyplus_wheels to commit 664456bc5428ad50ace2c2bc729bbc486afa0435
Preparing metadata (setup.py) ... done
Collecting pyenergyplus@ https://github.com/taoning/pyenergyplus/raw/main/wheels/darwin/pyenergyplus-23.1.0-py3-none-macosx_10_13_x86_64.whl
ERROR: HTTP error 404 while getting https://github.com/taoning/pyenergyplus/raw/main/wheels/darwin/pyenergyplus-23.1.0-py3-none-macosx_10_13_x86_64.whl
ERROR: Could not install requirement pyenergyplus@ https://github.com/taoning/pyenergyplus/raw/main/wheels/darwin/pyenergyplus-23.1.0-py3-none-macosx_10_13_x86_64.whl from https://github.com/taoning/pyenergyplus/raw/main/wheels/darwin/pyenergyplus-23.1.0-py3-none-macosx_10_13_x86_64.whl (from pyenergyplus-wheels==0.1.0) because of HTTP error 404 Client Error: Not Found for url: https://github.com/taoning/pyenergyplus/raw/main/wheels/darwin/pyenergyplus-23.1.0-py3-none-macosx_10_13_x86_64.whl for URL https://github.com/taoning/pyenergyplus/raw/main/wheels/darwin/pyenergyplus-23.1.0-py3-none-macosx_10_13_x86_64.whl

Desktop (please complete the following information):

  • OS: [MacOS]
  • Browser [Safari]

Converter for window construction from EnergyPlus model to Radiance model

Current: can only handle simple glazing systems and complex fenestration construction state conversion from EnergyPlus to Radiance

New feature: A converter that handles other EnergyPlus window construction modeling methods

  1. Analyze the methods used in EnergyPlus file
  2. Generate corresponding BRTDfunc/ BSDF for Radiance

View factors between sky and surfaces

Dear all,

In the context of outdoor long wave radiation, it is necessary to calculate view factors between surfaces and also between the surface and the sky.

Using the surfaces_view_factor function, is there a way to determine the view factors between, for example, the sky and the ground and a given geometry and in between ground and geometry?

The sky is discretized following the Reinhart sky model for a usage with daylight coefficient for shortwave radiation with the following skyglow.rad file:

#@rfluxmtx u=+Y h=u
void glow groundglow
0
0
4 1 1 1 0

groundglow source ground
0
0
4 0 0 -1 180

#@rfluxmtx u=+Y h=r1
void glow skyglow
0
0
4 1 1 1 0

skyglow source skydome
0
0
4 0 0 1 180

Sincerely,
Arthur

Add methods to write out Radiance geometry.

It would be nice to have a way to write out zones from an IDF directly as radFiles. For example, it should be possible to write out the geometry of Perimeter_bot_ZN_1 as a series of rad files.

api=EnergyPlusAPI()
epModel=fr.load_epmodel(Path('in.idf'),api)

mdl=fr.epjson2rad(epModel.epjs,'in.epw')
config=methods.WorkflowConfig.from_dict(mdl['Perimeter_bot_ZN_1'])

Migrating to using epmodel

Now that we have epmodel, we should use it for our EnergyPlus model modification and validation.

For example. adding a CFS to an EnergyPlus model now should look something like this:

import epmodel
import json

with open("model.epJSON", "r") as f:
    data = json.load(f)
model = epmodel.EnergyPlusModel.model_validate(data)

# add CFS, data validation happens automatically here
model.construction_complex_fenestration_state = {
    "cfs1": epmodel.ConstructionComplexFenestrationState(
        ...
    )
}
  1. We can start by creating a new branch and add epmodel to the list of dependencies
  2. Figure out a way to convert a frads.GlazingSystem object into a epmodel.ConstructionComplexFenestrationState object.
  3. Maybe frads.EnergyPlusModel class becomes a subclass of epmodel.EnergyPlusModel?

Check EnergyPlus model validity using epjson schema

Running or parsing invalid EnergyPlus model gives obscure error message that are difficult to figure out.

We should be able to check the validity of the epjson model against the schema before doing anything.

This would requires some 3rd party json schema validator, which can be problematic to maintain later on.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.