Hi @edpmay
I can say that with the current version of HB is very challenging to do that. Since the HVAC systems in the HB itself do not take inputs such as schedule, control type, etc.
The only way that I can offer is to modify the produced idf from the HB and doing the job with something like Python.
I can see from your IDF when I run the simulation that the availability schedule name for your PTHP is Always On Discreet
. Please find the below picture
This is not what you desire for. You need to change that on something your own design one like below. You need to also change the last item that is supply air fan operating mode schedule name to Always On Discrete
Then you need to define that Ed_PTHP_SCHEDULE in IDF.
Now the main challenge of IronBug is that the control type of what you need to make a component sensitive to a signal should be Fractional_Alternate
. I could not find that control type in the IB. Please find the below picture for the type of the control you need to apply for.
I faced this because I am doing control engineering at large-scale community buildings, where distinct signals play important role such as price, schedule, etc etc. So you need that flexibility in your algorithm. Additionally, the main challenge of the EnergyPlus is that streamlining what you are desire, if you are not interested to use FMU, is gonna be challenging since you need to stop the simulation for a bit, doing some processing, and based on the processing, modifying your inputs in the IDF and run the IDF for new timestep. I post this here
Next modification is that you need to define the ScheduleTypeLimits
as below
ScheduleTypeLimits,
Fractional_Alternate, !- Name
0, !- Lower Limit Value
1, !- Upper Limit Value
Discrete; !- Numeric Type
This gives you the opportunity to force everything on/off and has priority to everything. Then you need to Define the Schedule you set in your Zone HVAC PTHP. That could be something like below:
Schedule:Compact,
Ed_PTHP_SCHEDULE, !- Name
Fractional_Alternate, !- Schedule Type Limits Name
Through: 12/31, !- Field 1
For Monday, !- Field 2
Until: 24:00, !- Field 3
1, !- Value Until Time 3
For Tuesday, !- Field 4
Until: 24:00, !- Field 5
1, !- Value Until Time 5
For Wednesday, !- Field 6
Until: 24:00, !- Field 7
1, !- Value Until Time 7
For Thursday, !- Field 8
Until: 24:00, !- Field 9
1, !- Value Until Time 9
For Friday, !- Field 10
Until: 24:00, !- Field 11
1, !- Value Until Time 11
For SummerDesignDay, !- Field 12
Until: 24:00, !- Field 13
1, !- Value Until Time 13
For WinterDesignDay, !- Field 14
Until: 24:00, !- Field 15
1, !- Value Until Time 15
For Sunday, !- Field 16
Until: 24:00, !- Field 17
0, !- Value Until Time 17
For Saturday, !- Field 18
Until: 24:00, !- Field 19
0, !- Value Until Time 19
For Holiday, !- Field 20
Until: 24:00, !- Field 21
0, !- Value Until Time 21
For CustomDay1, !- Field 22
Until: 24:00, !- Field 23
0, !- Value Until Time 23
For CustomDay2, !- Field 24
Until: 24:00, !- Field 25
0; !- Value Until Time 25
Note: E+ has a methodology to name the days as normal days from Monday to Friday, Holiday, Winter design day and summer design day, Custom Day 1 and 2. All of them can be modulated. For each later you need to set the proper actuator in you Python code.
Next step, you need to use an API in your Python code to run the IDF, I do recommend to use API from locally installed E+, better the latest versions after V24. This API is located in the dir of the installation.
Then you need to make an actuator handler for your code to get to the schedule
Something like
self.schedule_handle_pthp = self.api.exchange.get_actuator_handle(
state_argument, “Schedule:Compact”, “Schedule Value”, “Ed_PTHP_SCHEDULE”
)
Then you need to take the time you need to On or Off:
This could be something like
current_hour = self.api.exchange.hour(state_argument)
current_minute = self.api.exchange.minutes(state_argument)
current_time = current_hour + current_minute / 60.0
Then you need to set your rule to on and off, something like below: (This is for all the days regardless of the characteristics of the day). Note that the below code has the priority of what you put in the IDF in terms of on and off for the PTHP.
if 6 <= current_time < 8:
# From 6:00 to 8:00, PTHP off (value 0)
self.api.exchange.set_actuator_value(state_argument, self.schedule_handle_pthp, 0)
else:
# Other times, PTHP on (value 1)
self.api.exchange.set_actuator_value(state_argument, self.schedule_handle_pthp, 1)
I hope this help.