Open mldichter opened 4 years ago
Having the same issue with DistrictHeating:Facilty the EMS sensor reports different values from the one I have in the output variables files.
This is a matter of selecting the correct calling point. These are the pertinent parts of the idf file linked to this issue:
EnergyManagementSystem:Sensor,
Pre_EMS_Net_Electricity, !- Name
Whole Building, !- Output:Variable or Output:Meter Index Key Name
Facility Net Purchased Electric Energy; !- Output:Variable or Output:Meter Name
EnergyManagementSystem:ProgramCallingManager,
Read_EMS_Write_Caller, !- Name
AfterPredictorAfterHVACManagers, !- EnergyPlus Model Calling Point
Read_Write_Net_Electricity; !- Program Name 1
EnergyManagementSystem:Program,
Read_Write_Net_Electricity, !- Name
SET EMS_Net_Electricity = Pre_EMS_Net_Electricity; !- Program Line 1
EnergyManagementSystem:OutputVariable,
EMS_Net_Electricity, !- Name
EMS_Net_Electricity, !- EMS Variable Name
Summed, !- Type of Data in Variable
SystemTimestep, !- Update Frequency
Read_Write_Net_Electricity, !- EMS Program or Subroutine Name
J; !- Units
Meter:Custom,
EMS Net Facility Electricity Meter, !- Name
Electricity, !- Fuel Type
, !- Key Name 1
EMS_Net_Electricity; !- Output Variable or Meter Name 1
Output:Variable,
Whole Building, !- Key Value
Facility Net Purchased Electric Energy, !- Variable Name
Hourly; !- Reporting Frequency
Output:Meter,
EMS Net Facility Electricity Meter, !- Key Name
Hourly; !- Reporting Frequency
The idf file linked above is using calling point AfterPredictorAfterHVACManagers
. The "Managers" in this calling point name are the setpoint managers and availability managers, so this is before the HVAC systems and electric power manager have been simulated. Using the "detailed" reporting frequency shows how the values lag by one system timestep.
The only calling point that will work is EndOfSystemTimestepBeforeHVACReporting
. This sets the EMS variable after the electric power manager has been simulated, but before the output variables and meters are accumulated during HVACReporting. One might also think that an EndOfZoneTimestep* calling point would work, but that is not the case since the new EMS output variable has been specified as a system timestep variable.
@mjwitte I have tried with all the combination none of them is working. MY EMS configuration below with Ideal Loads.
Whene I compare DisrictHeating:Facility with my heat_power I get completely different values. I also attach my idf. test_idf_epw.zip
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:SENSOR ===========
EnergyManagementSystem:Sensor,
T_in, !- Name
Block1:ZoneWest, !- Output:Variable or Output:Meter Index Key Name
Zone Mean Air Temperature; !- Output:Variable or Output:Meter Name
EnergyManagementSystem:Sensor,
mdot, !- Name
BLOCK1:ZONEWEST IDEAL LOADS AIR, !- Output:Variable or Output:Meter Index Key Name
Zone Ideal Loads Supply Air Mass Flow Rate; !- Output:Variable or Output:Meter Name
EnergyManagementSystem:Sensor,
heat_power, !- Name
DistrictHeating:Facility,!- Output:Variable or Output:Meter Index Key Name
DistrictHeating:Facility;!- Output:Variable or Output:Meter Name
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:PROGRAMCALLINGMANAGER ===========
EnergyManagementSystem:ProgramCallingManager,
sensors, !- Name
EndOfSystemTimestepBeforeHVACReporting, !- EnergyPlus Model Calling Point
getSensors; !- Program Name 1
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:PROGRAM ===========
EnergyManagementSystem:Program,
getSensors, !- Name
; !- Program Line 1
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:OUTPUTVARIABLE ===========
EnergyManagementSystem:OutputVariable,
T_in, !- Name
T_in, !- EMS Variable Name
Averaged, !- Type of Data in Variable
ZoneTimestep, !- Update Frequency
, !- EMS Program or Subroutine Name
C; !- Units
EnergyManagementSystem:OutputVariable,
heat_power, !- Name
heat_power, !- EMS Variable Name
Averaged, !- Type of Data in Variable
SystemTimestep, !- Update Frequency
, !- EMS Program or Subroutine Name
J; !- Units
EnergyManagementSystem:OutputVariable,
mdot, !- Name
mdot, !- EMS Variable Name
Summed, !- Type of Data in Variable
ZoneTimestep, !- Update Frequency
, !- EMS Program or Subroutine Name
kg/s; !- Units
Does this work? You could look at the EDD with this, maybe get more insight.
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:SENSOR ===========
EnergyManagementSystem:Sensor,
T_in_sen, !- Name
Block1:ZoneWest, !- Output:Variable or Output:Meter Index Key Name
Zone Mean Air Temperature; !- Output:Variable or Output:Meter Name
EnergyManagementSystem:Sensor,
mdot_sen, !- Name
BLOCK1:ZONEWEST IDEAL LOADS AIR, !- Output:Variable or Output:Meter Index Key Name
Zone Ideal Loads Supply Air Mass Flow Rate; !- Output:Variable or Output:Meter Name
EnergyManagementSystem:Sensor,
heat_power_sen, !- Name
DistrictHeating:Facility,!- Output:Variable or Output:Meter Index Key Name
DistrictHeating:Facility;!- Output:Variable or Output:Meter Name
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:PROGRAMCALLINGMANAGER ===========
EnergyManagementSystem:ProgramCallingManager,
sensors, !- Name
EndOfSystemTimestepBeforeHVACReporting, !- EnergyPlus Model Calling Point
getSensors; !- Program Name 1
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:PROGRAM ===========
EnergyManagementSystem:Program,
getSensors, !- Name
SET T_in_var = T_in_sen, !- Program Line 1
SET mdot_var = mdot_sen, !- Program Line 2
SET T_in_var = T_in_sen; !- Program Line 3
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:OUTPUTVARIABLE ===========
EnergyManagementSystem:OutputVariable,
T_in, !- Name
T_in_var, !- EMS Variable Name
Averaged, !- Type of Data in Variable
ZoneTimestep, !- Update Frequency
, !- EMS Program or Subroutine Name
C; !- Units
EnergyManagementSystem:OutputVariable,
heat_power, !- Name
heat_power_var, !- EMS Variable Name
Averaged, !- Type of Data in Variable
SystemTimestep, !- Update Frequency
, !- EMS Program or Subroutine Name
J; !- Units
EnergyManagementSystem:OutputVariable,
mdot, !- Name
mdot_var, !- EMS Variable Name
Summed, !- Type of Data in Variable
ZoneTimestep, !- Update Frequency
, !- EMS Program or Subroutine Name
kg/s; !- Units
@bonnema my problem is with DistrictHeating:Facility
that if compared with the one in the output:variable file they mismatch. I can read the others without writing down the program.
@LorenzoBottaccioli, in your heat_power
EnergyManagementSystem:OutputVariable you have set the Type of Data in Variable field to Averaged
. In order to compare to the DistrictHeating:Facility
meter, you should set this field to Summed
.
@mjwitte, I think your calling point comment above still applies and you can reclose this issue.
@bonnema I tried as you said. Still not working. There is one time step difference now. The one of EMS seems to be reporting the previous one.
Date/Time | EMS:heat_power [J](TimeStep) | DistrictHeating:Facility [J](TimeStep)
01/01 00:15:00 | 0 | 2890621.648
01/01 00:30:00 | 2890621.648 | 2940704.733
01/01 00:45:00 | 2940704.733 | 2999981.2
01/01 01:00:00 | 2999981.2 | 3070781.035
Here part of the IDF
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:SENSOR ===========
EnergyManagementSystem:Sensor,
T_in, !- Name
Block1:ZoneWest, !- Output:Variable or Output:Meter Index Key Name
Zone Mean Air Temperature; !- Output:Variable or Output:Meter Name
EnergyManagementSystem:Sensor,
heat_power, !- Name
DistrictHeating:Facility,!- Output:Variable or Output:Meter Index Key Name
DistrictHeating:Facility;!- Output:Variable or Output:Meter Name
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:PROGRAMCALLINGMANAGER ===========
EnergyManagementSystem:ProgramCallingManager,
sensorsTemp, !- Name
EndOfSystemTimestepBeforeHVACReporting, !- EnergyPlus Model Calling Point
getSensors; !- Program Name 1
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:PROGRAM ===========
EnergyManagementSystem:Program,
getSensors, !- Name
; !- Program Line 1
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:OUTPUTVARIABLE ===========
EnergyManagementSystem:OutputVariable,
T_in, !- Name
T_in, !- EMS Variable Name
Averaged, !- Type of Data in Variable
ZoneTimestep, !- Update Frequency
, !- EMS Program or Subroutine Name
C; !- Units
EnergyManagementSystem:OutputVariable,
heat_power, !- Name
heat_power, !- EMS Variable Name
Summed, !- Type of Data in Variable
ZoneTimestep, !- Update Frequency
, !- EMS Program or Subroutine Name
J; !- Units
@LorenzoBottaccioli, a one timestep lag is relatively common in EMS programs. You may be able to try different calling points or the new(ish) python plugin system and see if they provide the solution you're looking for. I am not entirely sure of the intent of your program and as such it is hard to comment in more detail.
@bonnema I'm trying to understand the EMS usage to create an std link with the gym environment in order to develop Reinforcement learning algorithms for Model Predictive control. Tnx for your suggestion.
Thanks @LorenzoBottaccioli. FWIW, adding the Output:EnergyManagementSystem object to your IDF with the last field set to Verbose
will give line-by-line execution of the EMS program(s) in the .edd file that will then be generated. That can be helpful for debugging, but can lead to large files if turned on for annual simulations.
I'm keeping this open. I've been doing some experimenting with this file. Output variable sensors align when the appropriate calling point is used, but there is a real lag when using meters as a sensor.
@mjwitte any updates on this? Just tidying up some quiet issues. Thanks!
No updates from me. It appears to be a real issue for meters. Fair game for anyone who wants to try fixing it.
Issue overview
EMS incorrectly reads the Facility Net Purchased Electric Energy output variable. The value being read from the output variable and rewritten to a meter is not the value of the output variable in the CSV file with errors on the order of 10^7.
Details
Some additional details for this issue (if relevant):
Checklist
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.