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)
Implementation details
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;
Proof of the Caveat I mentionned
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
Alternative: huge trend variable with TrendMax
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/doc...
EnergyManagementSystem:TrendVariable,
TemptrendLog1, !- Name
AverageBuildingTemp, !- EMS Variable Name
8760; !- Number of Timesteps to be Logged
Then in a program
Set Max1 = @TrendMax TemptrendLog1 8760
Hi Julien, Thank you for the explanation and I just need the solution as a post-processing step. Here, I'm trying to find the peak cooling demand of a particular zone.
However, an error appears,
Have you considered using the PythonPlugin instead of EMS?
I have encountered a similar error; see this post: https://unmethours.com/question/54746...
@Prethvi Raj this isn't an answer. Please move to a comment or edit your original question, thanks.