First time here? Check our help page!
1

Problem with EMS code to control window operation according to indoor CO2 levels [closed]

I'm using EMS to set the window operation (open = 1, closed = 0) according to the zone CO2 levels (over 800 ppm the window should open). It's working fine but the problem is that the window state changes each timestep (reaches the target - window opens / the next timestep is below the target - window closes... and so on). Any suggestions on how I could overcome this oscillation?

My code is:

EnergyManagementSystem:Sensor,
  Num_People,
  Ocupacao_Z1,
  People Occupant Count;

EnergyManagementSystem:Sensor,
  Sensor_CO2,
  Z1,
  Zone Air CO2 Concentration;

EnergyManagementSystem:Actuator,
  Window,
  Window,
  Schedule:Constant,
  Schedule Value;

EnergyManagementSystem:Program,
  CO2_window_control,
  IF (Num_People > 0) && (Sensor_CO2 >= 800),
  SET Window = 1,
  ELSE,
  SET Window = 0,
  ENDIF;

Thank you.

Leticia's avatar
13
Leticia
asked 2023-02-01 08:03:51 -0500
Aaron Boranian's avatar
14.1k
Aaron Boranian
updated 2023-02-01 09:50:17 -0500
edit flag offensive 0 remove flag reopen merge delete

Closed for the following reason "the question is answered, right answer was accepted" by Leticia 2023-02-02 02:33:29 -0500

Comments

@Leticia the EMS program will be called each timestep, which is why the actuator for the window opening schedule also can change each timestep. Are you saying that you want the window opening schedule to change at a larger frequency (i.e. hourly), or that the window opening actuator is oscillating back and forth every timestep when it shouldn't?

Aaron Boranian's avatar Aaron Boranian (2023-02-01 09:49:52 -0500) edit

Hi Aaron. I want the window opening actuator to stop oscillating. I think Eric's suggestion of adding a deadband will solve my problem, thank you!

Leticia's avatar Leticia (2023-02-02 02:32:12 -0500) edit
add a comment see more comments

1 Answer

2

You could add a deadband to the program, which could be something like:

IF (Num_People > 0) && (Sensor_CO2 >=800 + deadband/2),
  SET Window = 1,
ELSIF (Sensor_CO2 <= 800 - deadband/2),
  SET Window = 0,
ENDIF

Or you could use trend variables and add hysteresis.

ericringold's avatar
10.6k
ericringold
answered 2023-02-01 12:38:40 -0500, updated 2023-02-01 12:44:24 -0500
edit flag offensive 0 remove flag delete link

Comments

Hi Eric. That will solve my problem, thanks so much for your help!

Leticia's avatar Leticia (2023-02-02 02:32:40 -0500) edit

Hi @Eric Ringold. Sorry, but I'm not being able to find out how I could set the deadband. Could you help me, please?

Leticia's avatar Leticia (2023-02-03 05:01:24 -0500) edit

What have you tried?

ericringold's avatar ericringold (2023-02-03 10:14:02 -0500) edit

Hi @Eric Ringold. I just tried to use a fixed value for the deadband but the oscillation continues. I would have to include a different rule for the deadband (such as: when the CO2 sensor result is within the deadband, the window state should be the same as the previous timestep) but I don't know how to do that. Could you help me? Thank you.

Leticia's avatar Leticia (2023-02-06 02:51:15 -0500) edit

This answer describes using EnergyManagementSystem:GlobalVariable to store and retrieve a value from the previous timestep. Also I'm not sure if ERL can evaluate the multi-step expression as I've written in my example above, so you might want to break the logic into individual steps, or nesting IF statements instead of IF ... && ....

ericringold's avatar ericringold (2023-02-06 09:45:29 -0500) edit
add a comment see more comments