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

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

asked 2023-02-01 08:03:51 -0600

Leticia's avatar

updated 2023-02-01 09:50:17 -0600

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.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Leticia
close date 2023-02-02 02:33:29.084763

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 -0600 )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 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-02-01 12:38:40 -0600

updated 2023-02-01 12:44:24 -0600

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.

edit flag offensive delete link more

Comments

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

Leticia's avatar Leticia  ( 2023-02-02 02:32:40 -0600 )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 -0600 )edit

What have you tried?

ericringold's avatar ericringold  ( 2023-02-03 10:14:02 -0600 )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 -0600 )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 -0600 )edit

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2023-02-01 08:03:26 -0600

Seen: 216 times

Last updated: Feb 06 '23