Question-and-Answer Resource for the Building Energy Modeling Community
Get s tarted with the Help page
Ask Your Question

Find the largest number Peak using EMS

asked 2021-05-21 10:00:36 -0500

Prethvi Raj gravatar image

updated 2021-05-25 07:32:43 -0500

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.

C:\fakepath\Find the largest number in a series of data.JPG


Prethvi Raj, Building Performance Analyst, TRAJECT 361.

edit retag flag offensive close merge delete



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.
Prethvi Raj gravatar image Prethvi Raj  ( 2021-05-25 10:02:29 -0500 )edit

Have you considered using the PythonPlugin instead of EMS?

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

I have encountered a similar error; see this post:

sashadf1 gravatar image sashadf1  ( 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.

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

3 Answers

Sort by ยป oldest newest most voted

answered 2021-05-26 18:45:54 -0500

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.

edit flag offensive delete link more

answered 2021-05-25 05:14:25 -0500

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

  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

  GlobalMax;                    !- Erl Variable 1 Name

   PreviousMaxTrend,   !- Name
   GlobalMax,          !- EMS Variable Name
   1;                  !- Number of Timesteps to be Logged

  Store Max Program Calling Mgr,  !- Name
  EndOfZoneTimestepBeforeZoneReporting,  !- EnergyPlus Model Calling Point
  StoreMaxProgram;                !- Program Name 1

  StoreMaxProgram,                !- Name
  Set previousMax = @TrendValue PreviousMaxTrend 1,  !- Program Line 1
  Set GlobalMax = @Max previousMax Qdot_DXCoil_Sens; !- Program Line 2

  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

image description

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.

 TemptrendLog1,        !- Name
 AverageBuildingTemp,     !- EMS Variable Name
 8760;                     !- Number of Timesteps to be Logged

Then in a program

Set Max1 = @TrendMax TemptrendLog1 8760
edit flag offensive delete link more

Your Answer

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

Add Answer


Question Tools

1 follower


Asked: 2021-05-21 10:00:36 -0500

Seen: 60 times

Last updated: Jun 06