Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page

# Find the largest number Peak using EMS

Hi there,

Is there a function that finds the largest number in the series of data in our EMS library?

I'm trying to find the maximum peak in this graph.

Regards,

Prethvi Raj, Building Performance Analyst, TRAJECT 361.

edit retag close merge delete

1

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,

** Severe  ** Invalid Output:Variable or Output:Meter Index Key Name =BASE:ZONE
**   ~~~   ** For Output:Variable or Output:Meter = ZONE IDEAL LOADS SUPPLY AIR TOTAL COOLING RATE
**   ~~~   ** Entered in EnergyManagementSystem:Sensor=ZONE_IDEAL_LOADS_SUPPLY_AIR_TOTAL_COOLING_RATE_BASE_ZONE
**   ~~~   ** Unique Key Name not found.

( 2021-05-25 10:02:29 -0500 )edit

Have you considered using the PythonPlugin instead of EMS?

( 2021-05-25 10:15:38 -0500 )edit

I have encountered a similar error; see this post: https://unmethours.com/question/54746...

( 2021-05-27 08:21:47 -0500 )edit

@Prethvi Raj this isn't an answer. Please move to a comment or edit your original question, thanks.

( 2021-06-01 12:14:03 -0500 )edit

Sort by ยป oldest newest most voted

Another approach is to use the Output:Table:Annual object, which offers a lot of flexibility for how information is reported. For example, you can specify the Output:Variable of interest and choose Maximum for the Aggregation Type.

If you want the maximum of an EMS variable instead of a built-in E+ output, you just need one additional step where an EnergyManagementSystem:OutputVariable references the EMS variable -- then it can be used in an Output:Variable for the above approach.

more

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 @TrendMaxon 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

more

Please start posting anonymously - your entry will be published after you log in or create a new account.