@Nanna_Agesen I imagine you would want to set a negative target or multiply the PID output by -1.
@fwolter
The PID controller seems to be ignoring the āLoop Timeā setting. I have it set to 480000 but it still appears to be triggering and creating an output every minute, rather than every 8 minutes. Is this something you fixed in a later version?
The output is also updated when the input or the setpoint changes.
Ah - OK , that will explain it then! It might be useful if there was a setting in the controller to reduce the frequency of triggers on a time basis, although maybe this would compromise the āpurityā of the PID controller. I can achieve a similar effect by making changes to my rules.
By the way, for a bit of background, I am using the PID controller to control battery-powered TRVs so wanted to reduce the frequency of small valve position changes to improve battery life. Iāve also been experimenting with a āminimum percentage changeā figure in my rules and ignoring small control output changes this way too.
Many PID controllers have a dead time, exactly as you describing. That might be a useful feature for this PID, too.
Ok, new to this PID thingā¦
I have a Eurotronic TRV that does not work very well (its own PID does overheat often), so I am experimenting with this automation addon.
First, thank you for providing it
So I installed the addon, and created items for it.
triggers:
- id: "1"
configuration:
input: gTemp_living
setpoint: pid_LRM_step
kp: 50
kd: 0
kdTimeConstant: 1
commandItem: pid_LRM_RESET
ki: 0.1
loopTime: 60000
type: pidcontroller.trigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
output: pid_LRM_o
pInspector: pid_LRM_p
iInspector: pid_LRM_i
dInspector: pid_LRM_d
type: pidcontroller.action
Then I have two rules to complement the PID:
rule "PID Workaround"
when
Item pid_LRM_o changed
then
var Number oldValue = (trv_n2_valve_aperture.state as Number)
var Number newValue = (pid_LRM_o.state as Number)
if (newValue < 0) {
newValue = 0
pid_LRM_RESET.sendCommand("RESET")
}
else if (newValue > 100) newValue = 100
else newValue = (newValue + 0.5).intValue
if (newValue != oldValue) {
trv_n2_valve_aperture.sendCommand(newValue)
}
end
rule "PID Reset"
when
Item pid_LRM_step changed
then
// reset PID controller
pid_LRM_RESET.sendCommand("RESET")
end
I will see overtime.
Since this heating PID is only controlling heating and not cooling, I also put in the workaround rule a test to reset the PID when the input temperature is equal or greater than the setpoint (negative PID output). If not, it builds up a negative integral value that IMO is not accurate here.
Yes, I had been wondering about that; as a radiator is unable to cool the room when there is an external influence heating it (e.g. it warms up outside). A large negative integral builds up which then delays the valve from opening as it should when the room cools again (e.g. when it gets colder outside).
Hello to all,
I have updated to openHAB 3.2.0.M1 and I have checked the rules, there I got the problem that the status is āuninitilizedā.
There seems a problem with āpidcontroller.actionā.
Does somebody have the same behaviour?
@Morgano @bolemo Iām able to relate concerning the negative integral part. Honestly, Iām using an old version of the PID controller where the limits on the integral part can still be applied, because I donāt know how to use the reset method in my use case (PV zero export). I then removed the limits as they seem hackish from a controlling point of view. On the other side you can achieve results fast by limiting the i-part, if you arenāt a control expert, which I guess is the majority of the users. I think I will add them again.
@Koechi The custom action module was dropped because the OH core already provides a module for that purpose. Simply add an āItem Actionā instead:
See PID Controller Automation - Automation | openHAB
To configure a rule, you need to add a Trigger (āPID controller triggersā) and an Action (āItem Actionā). Select the Item you like to control in the āItem Actionā and leave the command empty.
@fwolter Thank you for your feedback.
I have replaced in all rules type: pidcontroller.action with core.ItemCommandAction.
Now the rule is active again.
triggers:
- id: "1"
configuration:
input: KnxEGWohnzimmerIstTemp
setpoint: KnxEGWohnzimmerSollTemp
kp: 65
kd: 0
kdTimeConstant: 1
commandItem: cInspectorLivingRoom
ki: 0.2
loopTime: 600000
type: pidcontroller.trigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
output: outputLivingRoom
pInspector: pInspectorLivingRoom
iInspector: iInspectorLivingRoom
dInspector: dInspectorLivingRoom
eInspector: eInspectorLivingRoom
type: core.ItemCommandAction
@george.erhan Thereās a use case for battery powered heating valve actuators to update the output less frequently, when the setpoint is reached to save battery. Maybe there are other use cases where minor changes to the output should be avoided. Are there any PID mechanisms we can implement in this PID controller to support this use case? It seems Iām missing the correct search terms to find anything useful on this topic concerning control theory. Can you point me in the right direction?
Hi, I was just upgrading my whole solution to new instance of OH 3.1 - I saw that PID is now added to default plugin list but there seem to be changes compared to previous implementation.
It took me some time to figure it out - AFAIK:
- output changed to itemName
- pidcontroller.action ā core.ItemCommandAction
Where there any other changes?
PS. Next time it would be nice to add it somewhere to the official documentation. Probably rule sample (as text would also be a nice starting point)
PS2. Addon is not throwing any error if items for debugging are not existing but are placed in the rule (at least I think the rule was not executed at all)
Sample:
triggers:
- id: "1"
configuration:
input: Filip_Virtual_Temperature
setpoint: Filip_Desired_SetPoint
kp: 65
kd: 0
kdTimeConstant: 1
ki: 0.1
loopTime: 60000
type: pidcontroller.trigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
output: Filip_Desired_Dimmer
type: pidcontroller.action
Would become
triggers:
- id: "1"
configuration:
input: Filip_Virtual_Temperature
setpoint: Filip_Desired_SetPoint
kp: 65
kd: 0
kdTimeConstant: 1
ki: 0.1
loopTime: 60000
type: pidcontroller.trigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
itemName: Filip_Desired_Dimmer
type: core.ItemCommandAction
The change was done to a milestone release. It was mentioned here: New Automation: PID Controller - #91 by fwolter. Breaking changes to milestone releases are not announced separately, since itās prototype code.
Would be awesome if you could add an example to the documentation!
I added a pull request logging an error message if an inspector Item doesnāt exist.
Thanks I didnāt spotted it.
Regarding documentation - Iām planning to write a tutorial on how I have set up my heaters using your PID controller. I hope it would be enough documentation on possible approach. I was just surprised that my rules stopped working all of a sudden and tracking down the issue was hard as I couldnāt figure out what is wrong.
You (and possibly others) might take a look here ā Set up house heating using Eurotronic Spirit actuators with PID control and "manual" control
Any suggestions are welcome.
@fwolter
Iām having some trouble with the new version of PID controller after upgrading to openHAB Stable 3.1.0.
I have removed the 3.1.0-SNAPSHOT jar from the addons folder.
I donāt see any error messages in the log but the PID controller rule no longer responds to a āRESETā command.
Here is one of my PID controller configs:
triggers:
- id: "1"
configuration:
input: BedroomMultisensorSensorTemperature
setpoint: BedroomTrvPidSetpoint
kp: 100
kd: 0
kdTimeConstant: 1
commandItem: BedroomTrvPidCommandItem
ki: 0.5
loopTime: 480000
type: pidcontroller.trigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
output: BedroomTrvPidValvePosition
pInspector: BedroomTrvPidPInspectorItem
iInspector: BedroomTrvPidIInspectorItem
dInspector: BedroomTrvPidDInspectorItem
eInspector: BedroomTrvPidErrorInspectorItem
type: pidcontroller.action
My āResetā rule looks like this:
rule "Bedroom TRV PID controller reset"
when
Item BedroomTrvPidControllerResetScene changed to ON
then
// reset PID controller
logInfo("Bedroom", "Manual request, resetting Bedroom TRV PID controller")
BedroomTrvPidCommandItem.sendCommand("RESET")
BedroomTrvPidCommandItem.sendCommand("")
end
When it was working before I found I had to send an empty string after the āRESETā otherwise it sticks on āRESETā and the PID controller cannot see the change the next time it is run.
It seems you run a pre-3.1.0 version, if your posted config is working. You are using the action type pidcontroller.action
which should be core.ItemCommandAction
, now. Also, the inspector items must be configured within the trigger module. Your config before the edit looked better.
The issue with the self-resetting RESET command should have been fixed in 3.1.0.
@fwolter
Thanks for the info. I think I am closer, but it is still not working.
Part of the problem is that I had renamed the prototype JAR
org.openhab.automation.pidcontroller-3.1.0-SNAPSHOT.jar
to
org.openhab.automation.pidcontroller-3.1.0-SNAPSHOT.jar.old
in my
/usr/share/openhab/addons
directory but it was still loading it. I could see this by checking in the openHAB cli:
openhab-cli console
then running
bundle:list
The old PID controller add-on was still showing at the bottom of the list:
255 ? Active ? 75 ? 3.1.0 ? openHAB Add-ons :: Bundles :: Transformation Service :: Map
256 ? Active ? 80 ? 3.1.0 ? openHAB UI :: Bundles :: Basic UI
257 ? Active ? 80 ? 3.1.0 ? openHAB UI :: Bundles :: HABPanel UI
258 ? Active ? 80 ? 3.1.0 ? openHAB UI :: Bundles :: Icon Set :: Classic
259 ? Active ? 80 ? 3.1.0.202101141550 ? openHAB Add-ons :: Bundles :: Automation :: PID Controller
So I removed the JAR completely and restarted openHAB. I also modified my PID rules as below:
triggers:
- id: "1"
configuration:
setpoint: BedroomTrvPidSetpoint
iInspector: BedroomTrvPidIInspectorItem
kp: 100
pInspector: BedroomTrvPidPInspectorItem
kdTimeConstant: 1
dInspector: BedroomTrvPidDInspectorItem
input: BedroomMultisensorSensorTemperature
eInspector: BedroomTrvPidErrorInspectorItem
kd: 0
commandItem: BedroomTrvPidCommandItem
ki: 0.5
loopTime: 480000
type: pidcontroller.trigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
itemName: BedroomTrvPidValvePosition
type: core.ItemCommandAction
I now get the following error in the Rule:
HANDLER_INITIALIZING_ERROR
Missing handler 'pidcontroller.trigger' for module '1'
It seems that the PID Controller add-on is not installed and I couldnāt see anywhere to install it in the GUI.
I tried clearing the cache:
sudo systemctl stop openhab
sudo rm -rf /var/lib/openhab/cache/*
sudo rm -rf /var/lib/openhab/tmp/*
sudo systemctl start openhab
but this has not helped.