Core Classes
frads.EnergyPlusSetup
EnergyPlusSetup(epmodel, weather_file=None, enable_radiance=False, nproc=1, initialize_radiance=True, output_directory='./')
EnergyPlus Simulation Setup.
Attributes:
Name | Type | Description |
---|---|---|
api |
EnergyPlusAPI object |
|
epw |
Weather file path |
|
actuator_handles |
Actuator Handles |
|
variable_handles |
Variable handles |
|
construction_handles |
Construction Handles |
|
actuators |
List of actuators available |
|
model |
EnergyPlusModel object |
|
state |
EnergyPlusState object |
|
handles |
Handles object |
Class for setting up and running EnergyPlus simulations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
epmodel
|
EnergyPlusModel
|
EnergyPlusModel object |
required |
weather_file
|
None | str
|
Weather file path. (default: None) |
None
|
enable_radiance
|
bool
|
If True, enable Radiance for Three-Phase Method. (default: False) |
False
|
Examples:
actuate
Set or update the operating value of an actuator in the EnergyPlus model.
If actuator has not been requested previously, it will be requested. Set the actuator value to the value specified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
component_type
|
str
|
The actuator category, e.g. "Weather Data" |
required |
name
|
str
|
The name of the actuator to retrieve, e.g. "Outdoor Dew Point" |
required |
key
|
str
|
The instance of the variable to retrieve, e.g. "Environment" |
required |
value
|
float
|
The value to set the actuator to |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the actuator is not found |
Examples:
actuate_cfs_state
Set construction state for a surface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
window
|
str
|
The name of the surface to set the CFS state for. |
required |
cfs_state
|
str
|
The name of the complex fenestration system (CFS) state to set the surface to. |
required |
Examples:
actuate_cooling_setpoint
actuate_heating_setpoint
Set heating setpoint for a zone.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zone
|
str
|
The name of the zone to set the heating setpoint for. |
required |
value
|
float
|
The value to set the heating setpoint to. |
required |
Example
epsetup.actuate_cooling_setpoint("zone1", 20)
actuate_lighting_power
calculate_edgps
Calculate enhanced simplified daylight glare probability in a zone.
The view is positioned at the center of the zone by default, with direction facing the windows weighted by window area. Users can modify the view position and direction through rconfig before calling initialize_radiance().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zone
|
str
|
Name of the zone. |
required |
cfs_name
|
dict[str, str]
|
Dictionary of windows and their complex fenestration state. |
required |
Returns:
Type | Description |
---|---|
tuple[float, float]
|
Tuple of (enhanced simplified DGP, simplified DGP). |
Raises:
Type | Description |
---|---|
KeyError
|
If zone not found in model. |
Examples:
calculate_mev
Calculate menalonpic illuminance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zone
|
str
|
Name of the zone. |
required |
cfs_name
|
dict[str, str]
|
Dictionary of windows and their complex fenestration state. |
required |
Returns:
Type | Description |
---|---|
float
|
Menalonpic vertical illuminance. |
Raises:
Type | Description |
---|---|
KeyError
|
If zone not found in model. |
Examples:
calculate_wpi
Calculate workplane illuminance in a zone.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zone
|
str
|
Name of the zone. |
required |
cfs_name
|
dict[str, str]
|
Name of the complex fenestration state. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
Workplane illuminance in lux. |
Raises:
Type | Description |
---|---|
ValueError
|
If zone not found in model. |
Examples:
get_cfs_state
Return the current complex fenestration state with input window name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
window
|
str
|
name of the window |
required |
Returns:
Type | Description |
---|---|
str
|
name of the cfs state |
get_datetime
Get the current date and time from EnergyPlus Run time datatime format with iso_8601_format = yes. hour 0-23, minute 10 - 60 v23.2.0
Returns:
Type | Description |
---|---|
datetime
|
datetime object |
get_diffuse_horizontal_illuminance
Get diffuse horizontal illuminance.
Returns:
Type | Description |
---|---|
float
|
Diffuse horizontal illuminance in lux. |
Example
epsetup.get_diffuse_horizontal_illuminance()
get_diffuse_horizontal_irradiance
Get diffuse horizontal irradiance.
Returns:
Type | Description |
---|---|
float
|
Diffuse horizontal irradiance in W/m2. |
Example
epsetup.get_diffuse_horizontal_irradiance()
get_direct_normal_illuminance
get_direct_normal_irradiance
get_total_sky_cover
Get total sky cover.
Returns:
Type | Description |
---|---|
float
|
Total sky cover in fraction. |
Example
epsetup.get_total_sky_cover()
get_variable_value
Get the value of a variable in the EnergyPlus model during runtime. The variable must be requested before it can be retrieved. If this method is called in a callback function, the variable will be requested automatically. So avoid having other methods called get_variable_value in the callback function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the variable to retrieve, e.g. "Outdoor Dew Point" |
required |
key
|
str
|
The instance of the variable to retrieve, e.g. "Environment" |
required |
Returns:
Type | Description |
---|---|
float
|
The value of the variable |
Raises:
Type | Description |
---|---|
KeyError
|
If the key is not found |
ValueError
|
If the variable is not found |
Examples:
initialize_radiance
Initialize Radiance for Three-Phase Method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zones
|
None | list[str]
|
List of zones to initialize. If None, initialize all zones. |
None
|
nproc
|
int
|
Number of processors to use for generating matrices. |
1
|
request_variable
Request a variable from the EnergyPlus model for access during runtime.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the variable to retrieve, e.g. "Outdoor Dew Point" |
required |
key
|
str
|
The instance of the variable to retrieve, e.g. "Environment" |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Examples:
run
run(output_directory='./', output_prefix='eplus', output_suffix='L', silent=False, annual=False, design_day=False)
Run EnergyPlus simulation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_directory
|
None | str
|
Output directory path. (default: current directory) |
'./'
|
output_prefix
|
None | str
|
Prefix for output files. (default: eplus) |
'eplus'
|
output_suffix
|
None | str
|
Suffix style for output files. (default: L) L: Legacy (e.g., eplustbl.csv) C: Capital (e.g., eplusTable.csv) D: Dash (e.g., eplus-table.csv) |
'L'
|
silent
|
bool
|
If True, do not print EnergyPlus output to console. (default: False) |
False
|
annual
|
bool
|
If True, force run annual simulation. (default: False) |
False
|
design_day
|
bool
|
If True, force run design-day-only simulation. (default: False) |
False
|
Examples:
set_callback
Set callback function for EnergyPlus runtime API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method_name
|
str
|
Name of the method to set callback for. |
required |
func
|
Callable
|
Callback function. |
required |
Raises:
Type | Description |
---|---|
AttributeError
|
If method_name is not found in EnergyPlus runtime API. |
Examples:
frads.EnergyPlusModel
Bases: EnergyPlusModel
EnergyPlus Model object
Attributes:
Name | Type | Description |
---|---|---|
walls_window |
list of walls with windows |
|
floors |
list of floors |
|
lighting_zone |
list of lighting zones |
|
zones |
list of zones |
add_glazing_system
Add glazing system to EnergyPlusModel's epjs dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
glzsys
|
GlazingSystem
|
GlazingSystem object |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If solar and photopic results are not computed. |
Examples:
add_lighting
Add lighting object to EnergyPlusModel's epjs dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zone
|
str
|
Zone name to add lighting to. |
required |
lighting_level
|
float
|
Lighting level in Watts. |
required |
replace
|
bool
|
If True, replace existing lighting object in zone. |
False
|
Raises:
Type | Description |
---|---|
ValueError
|
If zone not found in model. |
ValueError
|
If lighting already exists in zone and replace is False. |
Examples:
add_output
Add an output variable or meter to the epjs dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_type
|
str
|
Type of the output. "variable" or "meter". |
required |
output_name
|
str
|
Name of the output variable or meter. |
required |
reporting_frequency
|
str
|
Reporting frequency of the output variable or meter. |
'Timestep'
|
Raises:
Type | Description |
---|---|
ValueError
|
If output_type is not "variable" or "meter". |
Examples:
Model Loading and Conversion
frads.load_energyplus_model
Load EnergyPlus model from IDF or epJSON file.
Supports loading EnergyPlus models from both IDF (Input Data File) and epJSON (EnergyPlus JSON) formats. IDF files are automatically converted to epJSON format during loading.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fpath
|
str | Path
|
Path to the EnergyPlus model file (.idf or .epJSON/.json). |
required |
Returns:
Type | Description |
---|---|
EnergyPlusModel
|
EnergyPlusModel object containing the parsed building model data. |
Raises:
Type | Description |
---|---|
ValueError
|
If file extension is not .idf, .epJSON, or .json. |
FileNotFoundError
|
If the specified file does not exist. |
Examples:
frads.epmodel_to_radmodel
Convert EnergyPlus model to Radiance models where each zone is a separate model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ep_model
|
EnergyPlusModel
|
EnergyPlus model. |
required |
epw_file
|
None | str
|
EnergyPlus weather file path. Defaults to None. |
None
|
add_views
|
bool
|
Add views to the model. Such views will be positioned at the center of the zone facing windows weighted by window area. Defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Radiance models. |
Examples:
Utility Functions
frads.ep_datetime_parser
Parse date and time from EnergyPlus output format.
EnergyPlus outputs dates and times in "MM/DD HH:MM:SS" format. This function handles the special case where EnergyPlus uses "24:00:00" to represent midnight of the next day.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inp
|
str
|
Date and time string from EnergyPlus output (e.g., "01/15 14:30:00"). |
required |
Returns:
Type | Description |
---|---|
datetime
|
A datetime object representing the parsed date and time. |
Examples: