8

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.

Rohini's avatar
683
Rohini
asked 2015-08-24 15:51:27 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2017-04-02 20:05:56 -0500
edit flag offensive 0 remove flag close merge delete

Comments

2

Thanks @Rohini. You might want to open up a GitHub issue for this (https://github.com/NREL/EnergyPlus/is...).

__AmirRoth__'s avatar __AmirRoth__ (2015-08-24 15:59:33 -0500) edit
3

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.

ericringold's avatar ericringold (2015-08-24 16:18:40 -0500) edit
3

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.

Archmage's avatar Archmage (2015-08-24 16:36:18 -0500) edit
2

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...

shorowit's avatar shorowit (2015-08-24 17:33:00 -0500) edit
add a comment see more comments

1 Answer

3

FYI, the use of negative numbers has been corrected in the latest release of V8.4 and should be available for download today or very soon. Keep in mind that not all possible uses of a negative sign may have been corrected at this point in time.

rraustad's avatar
13.8k
rraustad
answered 2015-12-18 13:31:47 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments