EMS incorrectly reads output variable

asked 2019-09-06 18:38:57 -0500

mldichter gravatar image

updated 2019-09-09 19:55:38 -0500

I am trying to read the Facility Net Purchased Electric Energy output variable using EMS to change behavior of equipment in the simulation, but 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. To show this, I have EMS read a Sensor for the Facility Net Purchased Electric Energy output variable and then write out that value into a custom meter.

image description

Most of the time, the difference is around 10^-13, but other times the difference is enormous.

Here is a google drive link to a minimal working example with the important objects listed below

There are quite a few places that could be messing up the EMS read and write:

EnergyManagementSystem:ProgramCallingManager
    !- EnergyPlus Model Calling Point

EnergyManagementSystem:OutputVariable
    !- Update Frequency
    !- EMS Program or Subroutine Name

I don't know what the problem could be though. I tried a lot of plausible combinations of choices for those fields, but none of them have been close to correct for the entire simulation. Any ideas?

!-   ===========  ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:SENSOR ===========

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


!-   ===========  ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:PROGRAMCALLINGMANAGER ===========

EnergyManagementSystem:ProgramCallingManager,
    Read_EMS_Write_Caller,   !- Name
    AfterPredictorAfterHVACManagers,  !- EnergyPlus Model Calling Point
    Read_Write_Net_Electricity;  !- Program Name 1


!-   ===========  ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:PROGRAM ===========

EnergyManagementSystem:Program,
    Read_Write_Net_Electricity,  !- Name
    SET EMS_Net_Electricity = Pre_EMS_Net_Electricity;  !- Program Line 1


!-   ===========  ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:OUTPUTVARIABLE ===========

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

!-   ===========  ALL OBJECTS IN CLASS: OUTPUT:VARIABLE ===========

Output:Variable,
    Whole Building,          !- Key Value
    Facility Net Purchased Electric Energy,  !- Variable Name
    Hourly;                  !- Reporting Frequency


!-   ===========  ALL OBJECTS IN CLASS: OUTPUT:METER ===========

Output:Meter,
    EMS Net Facility Electricity Meter,  !- Key Name
    Hourly;                  !- Reporting Frequency


!-   ===========  ALL OBJECTS IN CLASS: METER:CUSTOM ===========

Meter:Custom,
    EMS Net Facility Electricity Meter,  !- Name
    Electricity,             !- Fuel Type
    ,                        !- Key Name 1
    EMS_Net_Electricity;     !- Output Variable or Meter Name 1
edit retag flag offensive close merge delete