EMS negative number - not a question
It took me couple of hours to figure out that EMS (in energyplus) cannot use negative numbers. Any negative number has to be written as 0-number. For eg., -1 is 0 - 1. Since nothing showed up in unmet-hoooooours regarding this, I thought I will save some person future hours by posting this.
Thanks @Rohini. You might want to open up a GitHub issue for this (https://github.com/NREL/EnergyPlus/is...).
Note: this is documented in the EMS Application Guide, albeit as a comment in the example file here. The issue could be submitted as a request for better Erl documentation.
There are situations where the parser now throws in a zero to handle the unary minus operator as you would expect (eg. Set x = - 1,). But in general it is always safer to use ( 0 - 1) in complex expressions.
Another non-intuitive EMS behavior: If you reference a variable that was never previously defined/initialized, it is automatically defaulted to zero. So, for example, if you reference an indoor temperature variable that you intend to add an EMS sensor for, but forget to add the sensor, the indoor temperature variable will have a value of zero and no error is reported. It's easy for a subtle bug like this in your EMS program to go undetected.
See https://github.com/NREL/EnergyPlus/is...