New in the Community? Get started here

Schneider Electric Exchange Community

Discuss and solve problems in energy management and automation. Join conversations and share insights on products and solutions. Co-innovate and collaborate with a global network of peers.

Register Now
Resource Advisor - Performance Analytics Forum
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Calculating Off Peak Waste

This recipe is part of the Calculated Measurments Cookbook



Continuing on from our use of a 'Mask' to achieve seasonal segregation of data, in conjunction with a schedule (Using Data 'Mask' to Manage Seasonal Schedules in PAM). We have also found a way to dashboard off-peak waste.


Assuming the minimum consumption in off peak periods is a reasonable 'base' and that anything in off peak periods is 'waste', we can use the following calculations to chart.


This would apply for other situations where you want to separate out consumption above a minimum when looking over specific scheduled periods too (Im thinking any sort of off-peak waste).


We find the minimum with:


Edit: Thanks to Anthony Gray​ for showing me the null handling and IF statement capability to improve the expression! Originally, the min per year would treat missing data as a 0, so would not work properly if we had any missing data.  The new expression is below, the previous below it:


SUM PER _30minutes(  // this is to DIS-aggregate the yearly min back down to intervals
  [[DisaggregationMethod=>Constant]]MIN PER YEAR(

  SUM PER _30minutes(

  IF([Other:Reference Data][units] * {SiteSchedule([[IntervalSize=>30]]30 minute,Weekday/end,WD:1,WE:0)} == 0 , 1 , [[IgnoreDirectives:false]][[NullHandling:ReturnNull]] null )

  * [Electricity:ENERGY][kWh]



* 1.1 // Adds 10% offset from the minimum


SUM PER _30minutes (


SUM PER _30minutes(

((1-[Other:Reference Data][units]

*{SiteSchedule(30 minute,Weekday/end,WD:1,WE:0)})

* [Electricity:ENERGY][kWh] )+([Other:Reference Data][units]

*{SiteSchedule(30 minute,Weekday/end,WD:1,WE:0)}*1000000) / makes periods that are 0 really big, so that the min per year doesnt pickup 0's all the time

))*1.1 /Adds 10% to the minimum



Waste is then:


SUM PER _30minute( / for some reason even though minimum use would come out OK, I had to do this to get it to chart OK at a lower granularity

((1-[Other:Reference Data][units]

*{SiteSchedule(30 minute,Teaching Period,Teaching:1,0)})

* [Electricity:ENERGY][kWh] ) / non-teaching period energy less


((1-[Other:Reference Data][units]

  *{SiteSchedule(30 minute,Teaching Period,Teaching:1,0)}))* [Electricity:Minimum Use][kWh] ) / minimum use value across non-teaching periods


Similarly, we look at teaching energy:


[Other:Reference Data][units] * {SiteSchedule(30 minute,Teaching Period,Teaching:1,After Teaching:0)}* [Electricity:ENERGY][kWh]


[Other:Reference Data][units] * {SiteSchedule(30 minute,Teaching Period,Teaching:1,After Teaching:0)} * [Electricity:Minimum Use][kWh]


Re: Calculating Off Peak Waste

Fwiw, I am not sure these are the most elegant expressions.  They do tend to take a fair while to load, particularly when looking at a total over the past 12 months (eg annual pie chart).

Any tips for speed optimisation would be much appreciated! Anthony Gray​, Brian Kohler​?

For example, does anyone know if its faster to have a full equation, rather than reference another calculated measurement?

Would better bracket parsing help?  eg for 'teaching' would I be better off having (A-B)*Z*Y instead of Z*Y*A - Z*Y*B?



Re: Calculating Off Peak Waste

For what it's worth, the mysterious [[IntervalSize=>30]] and [[IgnoreDirectives:false]][[NullHandling:ReturnNull]] directives are workarounds to avoid a couple of issues in the calculation feature which have now been fixed and will be deployed as part of the normal release cycle (meaning in about a month).  After that, they won't be necessary which will leave the expression a bit  more readable and more importantly something you could figure out.

Also, the need to multiply the IF() statement by the energy rather than just putting the energy in as the 'true' operand is another workaround, I'm checking into that now and would like to remove it too.  It would be most natural if that could just be

IF([Other:Reference Data][units] * {SiteSchedule(30 minute,Weekday/end,WD:1,WE:0)} == 0 , [Electricity:ENERGY][kWh] , null )

but that doesn't work yet.


Re: Calculating Off Peak Waste

I'd like to put Kim KREUTZ, Etienne FRAISSE and Adrià Casas in a head to head battle of PAM Calculated Expressions wizardry.  See who can make the most complicated yet truly interesting expression.  It would be an epic battle!

Michael Schmitz

Re: Calculating Off Peak Waste

I think Kim would win

It is really interesting indeed.


Re: Calculating Off Peak Waste

Im not sure about that Etienne!