You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've implemented a custom logic in Python using the EnergyPlus API to generate simulation results. However, I'm facing an issue where the updated values of variables are not reflected in the output files.
Problem:
During the runtime of the simulation, I have custom logic in place to update the value of the actuator on each timestamp. However, despite observing these updates during runtime, the generated output files (e.g., <Prefix>out.csv, <Prefix>ssz.csv, <Prefix>szsz.csv) do not reflect these changes. I've also attempted to generate a CSV file of output using ReadVarsESO.exe, but the changes are not captured there either.
Efforts:
I have thoroughly debugged the code and confirmed that during runtime, the values of the actuators are indeed being updated as expected. Here's a snippet of the output showing the actuator values being updated:
import sys
from pyenergyplus.api import EnergyPlusAPI
one_time = True
zone_air_temp = 0
fan_actuator = 0
def my_callback(state):
global one_time, zone_air_temp, fan_actuator
if one_time:
if not api.exchange.api_data_fully_ready(state):
return
zone_air_temp = api.exchange.get_variable_handle(state, "Zone Air Temperature", "Thermal Zone 1")
fan_actuator = api.exchange.get_actuator_handle(state, "Fan", "Fan Air Mass Flow Rate", "Standard Fan")
one_time = False
zone_air_temp_value = api.exchange.get_variable_value(state, zone_air_temp)
print("zone_air_temp : ", zone_air_temp_value)
fan_actuator_value = api.exchange.get_actuator_value(state, fan_actuator)
print("actuator_value : ",fan_actuator_value)
# Custom logic is here:
api.exchange.set_actuator_value(state, fan_actuator, zone_air_temp_value-4)
fan_actuator_value = api.exchange.get_actuator_value(state,fan_actuator)
print("actuator_updated_value : ",fan_actuator_value)
api = EnergyPlusAPI()
state = api.state_manager.new_state()
api.runtime.callback_end_zone_timestep_after_zone_reporting(state, my_callback)
api.exchange.request_variable(state, "Fan Air Mass Flow Rate", "Thermal Zone 1")
api.runtime.run_energyplus(state, sys.argv[1:])
Request for Assistance:
I'm relatively new to working with EnergyPlus and the EnergyPlus API. I would appreciate any insights or suggestions on why the updated variable values are not being reflected in the output files. Additionally, if there are any alternative methods to capture these changes effectively, I'm open to exploring those as well.
Thank you for your assistance.
The text was updated successfully, but these errors were encountered:
Description:
I've implemented a custom logic in Python using the EnergyPlus API to generate simulation results. However, I'm facing an issue where the updated values of variables are not reflected in the output files.
Problem:
During the runtime of the simulation, I have custom logic in place to update the value of the actuator on each timestamp. However, despite observing these updates during runtime, the generated output files (e.g.,
<Prefix>out.csv
,<Prefix>ssz.csv
,<Prefix>szsz.csv
) do not reflect these changes. I've also attempted to generate a CSV file of output usingReadVarsESO.exe
, but the changes are not captured there either.Efforts:
I have thoroughly debugged the code and confirmed that during runtime, the values of the actuators are indeed being updated as expected. Here's a snippet of the output showing the actuator values being updated:
Code Snippet:
Request for Assistance:
I'm relatively new to working with EnergyPlus and the EnergyPlus API. I would appreciate any insights or suggestions on why the updated variable values are not being reflected in the output files. Additionally, if there are any alternative methods to capture these changes effectively, I'm open to exploring those as well.
Thank you for your assistance.
The text was updated successfully, but these errors were encountered: