I am trying to use the DataExchange API to read the hourly "Site Outdoor Air Drybulb Temperature" variable. The code I use is from the official documentation:
one_time = True
api_ready = False
outdoor_dry_sensor = 0
outdoor_temp = []
def time_step_handler(state):
global api_ready, one_time, outdoor_dry_sensor
sys.stdout.flush()
if one_time:
if api.exchange.api_data_fully_ready(state):
api_ready = True
outdoor_dry_sensor = api.exchange.get_variable_handle(
state, u"Site Outdoor Air Drybulb Temperature", u"ENVIRONMENT"
)
if outdoor_dry_sensor == -1:
sys.exit(1)
one_time = False
if api_ready:
oa_temp = api.exchange.get_variable_value(state, outdoor_dry_sensor)
outdoor_temp.append(oa_temp)
api = EnergyPlusAPI()
state = api.state_manager.new_state()
api.runtime.callback_end_zone_timestep_after_zone_reporting(state, time_step_handler)
api.runtime.run_energyplus(args)
These are some of my relevant simulation parameters:
Timestep = 1
RunPeriod from 1/1 to 1/2
SizingPeriod:WeatherFileDays from 1/1 to 1/2
so I expected to get an "outdoor_temp" of size 48 that has weather data from day1 and day2. but I get an "outdoor_temp" of size 240 that has weather data of day1 and day2 in this order:
day1 day1 day1 day1 day2 day1 day1 day1 day1 day2
What am I doing wrong?