First time here? Check out the Help page!
1 | initial version |
My first question would be to ask whether you actually need to do that during the simulation or not, otherwise just do it as a post processing step...
Assuming you need the current max from 0 to current timestep, at each timestep, there is a way to do it I can think of. One caveat is that it involves using a TrendVariable and TrendVariables store things at the Zone timestep, so you're going to have a few differences if you were looking for something at a detailed timestep (such as HVAC variables)
EnergyManagementSystem:Sensor,
Qdot_DXCoil_Sens, !- Name
Main Cooling Coil 1, !- Output:Variable or Output:Meter Index Key Name
Cooling Coil Sensible Cooling Rate; !- Output:Variable or Output:Meter Name
EnergyManagementSystem:GlobalVariable,
GlobalMax; !- Erl Variable 1 Name
EnergyManagementSystem:TrendVariable,
PreviousMaxTrend, !- Name
GlobalMax, !- EMS Variable Name
1; !- Number of Timesteps to be Logged
EnergyManagementSystem:ProgramCallingManager,
Store Max Program Calling Mgr, !- Name
EndOfZoneTimestepBeforeZoneReporting, !- EnergyPlus Model Calling Point
StoreMaxProgram; !- Program Name 1
EnergyManagementSystem:Program,
StoreMaxProgram, !- Name
Set previousMax = @TrendValue PreviousMaxTrend 1, !- Program Line 1
Set GlobalMax = @Max previousMax Qdot_DXCoil_Sens; !- Program Line 2
EnergyManagementSystem:OutputVariable,
Output Max, !- Name
GlobalMax, !- EMS Variable Name
Averaged, !- Type of Data in Variable
SystemTimeStep, !- Update Frequency
, !- EMS Program or Subroutine Name
; !- Units
Output:Variable,*,Output Max,Detailed;
Output:Variable,Main Cooling Coil 1,Cooling Coil Sensible Cooling Rate,Detailed;
In post processing, I'm calculating the cummulative max of the actual variables. As you can see, there IS a gap between the one I computed in the EMS with the actual one at Detailed timestep
A resource consuming alternative (and my first intuition) was to just make a huge Trend variable, and call @TrendMax
on it. https://bigladdersoftware.com/epx/docs/9-5/ems-application-guide/built-in-functions.html#table:built-in-functions-for-trend-variables-in-erl
EnergyManagementSystem:TrendVariable,
TemptrendLog1, !- Name
AverageBuildingTemp, !- EMS Variable Name
8760; !- Number of Timesteps to be Logged
Then in a program
Set Max1 = @TrendMax TemptrendLog1 8760