Decoupling OpenStudio measure energy consumption from building energy consumption

asked 2024-08-26 15:47:31 -0600

AvgStudent's avatar

Hi, I am working on an OpenStudio measure of an electrical storage device. During its charging phase, the device is meant to be charged according to the difference between a user-defined maximum building power and the current power demand of the building (building_power_dmd). This value is referred to as 'available_charging_power'.

Hence, the electrical charging power for the storage device, referred to as 'storage_electric_pwr', should be limited by the 'available_charging_power' variable.

My problem is twofold: First, a problem arises from the global variable 'Facility Total Electricity Demand Rate' containing within itself the 'storage_electric_pwr' value of the last timestep. Technically, this shouldn't be a problem since I am using global variables and can retrieve previous values. However, I cannot be sure of the exact values contained in the 'Facility Total Electricity Demand Rate' variable (previous or current demand values) since the storage device is a user-defined plant component and I am unsure whether the Erl program is launched before or after other plant calculations. How can I know what value is contained within the global variable 'Facility Total Electricity Demand Rate' at the beginning of the Erl execution? Is this value updated in real-time during the execution of the Erl program?

Secondly, I am also unsure if, how, and when the Erl program reiterates itself within the same timestep. I haven't found a built-in reiterate function in the EMS documentation but that might also be the main reason I cannot get a working program. Since the 'storage_electric_pwr' and 'available_charging_power' variables depend on each-other, this loop seems to spiral out of control. I coded the Erl with the intent of keeping the previous timestep value for storage_electric_pwr and substracting it from the Facility Total Electricity Demand. What would you recommend in order to keep the value from changing within the same timestep? Would a Trend variable be adequate? If so, is there a function to call a single value from a Trend Variable instead of the min, max and avg trend functions?

Here is the link to the source code: https://github.com/Houssem-Eddine-You...

Disclaimers: I am not the original programmer and the contacts on the GitHub page aren't mine. Some changes have also been made to the original code.

Thanks for your help.

edit retag flag offensive close merge delete