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

EMS in EnergyPlus: problem with the logistic regression equation

asked 2024-07-10 13:28:56 -0500

paulabf's avatar

updated 2024-07-11 08:35:41 -0500

I'm using EMS to set a logistic regression equation and predict the window status in the simulation. However, when I include the entire equation (B0 + B1 * RH + B2 * CO2 + B3 * Top * RH), the windows remain always closed (0). I tried changing the parameters, and the window status varied between 0 and 1 with these equations:

B0 + B1 * RH + B1 * CO2 + B1 * Top * RH

B0 + B1 * RH + B2 * CO2 + B1 * Top * RH

B0 + B1 * RH + B3 * CO2 + B1 * Top * RH

If I replace B1 with B2 or B3 in the interction with Top*RH or if I remove that part of the equation (B0 + B1 * RH + B2 * CO2), the window stays closed the whole time as well.

My input objects for 'EnergyManagementSystem:Program' are:

image description

Thank you for any help!

edit retag flag offensive close merge delete


@paulabf it doesn't look like the lines of your EMS Program were added correctly -- can you please edit your post and try to include that again?

Aaron Boranian's avatar Aaron Boranian  ( 2024-07-10 14:30:59 -0500 )edit

What calling point are you using (EMS:ProgramCallingManager). Also, use Output:EnergyManagementSystem with the field EnergyPlus Runtime Language Debug Output Level and look at the eplusout.edd and you'll see how each line is evaluated.

Julien Marrec's avatar Julien Marrec  ( 2024-07-16 05:01:52 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2024-07-10 16:51:47 -0500

updated 2024-07-11 17:53:22 -0500

This may or may not be the issue, but you should use lots of parentheses to make sure compound expressions are evaluated in the order you desire. For example, instead of:

B0 + B1 * RH + B1 * CO2 + B1 * Top * RH


B0 + (B1 * RH) + (B1 * CO2) + (B1 * Top * RH)

You can read about this more in the EMS Expressions documentation where it states:

For complicated expressions, it helps to make heavy use of parentheses in your equations. By using parentheses with proper algebraic evaluation in mind to group terms, you can help the Erl parser. The language processor is simplistic compared to a full-blown programming language and sometimes has problems applying the rules of algebra. It is safer to err on the side of extra parentheses and to inspect the results of complex expressions in the EDD output.

edit flag offensive delete link more


And if that doesn't help, you could try splitting the expression into multiple lines of EMS to ensure that each part is evaluating as you expect.

shorowit's avatar shorowit  ( 2024-07-10 16:52:53 -0500 )edit

Your Answer

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

Add Answer

Training Workshops


Question Tools


Asked: 2024-07-10 13:12:42 -0500

Seen: 60 times

Last updated: Jul 11