This introduces a PID controller for openHAB.
A PID controller can be used for closed-loop controls. For example:
- Heating: A sensor measures the room temperature.
The PID controller calculates the heater’s valve opening, so that the room temperature is kept at the setpoint.
- Lighting: A light sensor measures the room’s illuminance.
The PID controller controls the dimmer of the room’s lighting, so that the illuminance in the room is kept at a constant level.
- PV zero export: A meter measures the power at the grid point of the building.
The PID controller calculates the amount of power the battery storage system needs to feed-in or charge the battery, so that the building’s grid power consumption is around zero,
i.e. PV generation, battery storage output power and the building’s power consumption are at balance.
Here is a step response of a PV zero export system, realized with this controller. It shows an increase of the power supply setpoint from the grid by 1kW. The P, I and D parts are summed to form the output of the controller, i.e. the charging power of the battery system. The actual value is the power flow from/into the grid.
You see that the grid power consumption is held at a constant level, although the PV generated power is fluctuating (orange line in the upper chart).
The controller can be used via Rules:
The JAR file can be dropped into the
addons folder to make the PID trigger and action module available in the rule engine.
The documentation is available here. There’s also a guidance on how to tune your PID controller.