New Automation: PID Controller

I’m sure I must be missing something, but I can’t find the CommandItem in the configuration which can be used for the RESET of the I (and D) part? I am running the latest official OpenHAB release 3.3.

Here is the configuration that is produced when I add a rule with the PID-Controller template.

configuration: {}
triggers:
  - id: "1"
    configuration:
      input: BathRoom_PIDController_Input_Temperature
      setpoint: BathRoom_PIDController_Input_SetPoint
      iInspector: BathRoom_PIDController_Output_IInspector
      kp: 20
      eInspector: BathRoom_PIDController_Output_ErrorInspector
      pInspector: BathRoom_PIDController_Output_PInspector
      kd: 0
      kdTimeConstant: 0
      dInspector: BathRoom_PIDController_Output_DInspector
      ki: 0.1
      loopTime: 60000
    type: pidcontroller.trigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: BathRoom_PIDController_Output
    type: core.ItemCommandAction

It seems to be missing in the trigger module definition in the code. Did you try to add it manually to your configuration?

configuration:
    commandItem: MyResetItem
...

Manual addition seems to work. Thanks!

Hi,
actually I’m trying to setup the PID Controller the fist time.
Setup: Eurotronic Spirit Zwave Heating Regulator, Aquara Temperature Sensor.

But every time if I try to enable the rule, I received errors:

023-01-01 19:46:41.369 [WARN ] [.handler.PIDControllerTriggerHandler] - Setpoint item: TestPidSetpoint: Not a number: UnDefType: NULL

Here is my setup

That’s the pid config

Thats the Eurotronic Spirit with the setpoint

So could someone give me a hint what this error message means?
The Setpoint from the Zwave is a Number…

Actually it is working, or it seems to.
But I can not see any output

2023-01-01 23:18:36.695 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TestPid_Setpoint' changed from 20 °C to 22 °C

2023-01-01 23:18:36.706 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TestPid_P' changed from 18.599999999999994 to 38.599999999999994

2023-01-01 23:18:36.707 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TestPid_I' changed from 2.604102399999999 to 2.962670666666666

2023-01-01 23:18:36.711 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TestPid_D' changed from 0.00000007086713177090044 to 0.0014856740146629624

2023-01-01 23:18:36.713 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TestPid_E' changed from 1.8599999999999994 to 3.8599999999999994

2023-01-01 23:18:40.966 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TestPid_I' changed from 2.962670666666666 to 2.990115266666666

2023-01-01 23:18:40.969 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TestPid_D' changed from 0.0014856740146629624 to 0.0014855683869956279

This is the setting:

and this the setting item ( Dimmer item of the eurotronic )

Don’t have time now to go thru setup you have but I would recommend to go and check my how to ‘tutorial’.

I saw this doc from you.
but in the first quick reading my thought was that it is not for my use case, because I want to play a little bit with the pid controller in general.
I think that the pid controller can be used out of the box.
so define input item and output item and it works.

nearly it is so, but not for the output.
but thanks again for the hint with you documentation.
I will read it with more concentration.
maybe I will find the solution why I see no output in my side.

I just scrolled thru and I think I know what you are trying to do. I can’t remember it now but I think it wasn’t that simple because of underlying metric casting.

Spirit needed an Integer value 0 - 100 while PID provides Float as output.

When I was setting it up it wasn’t also possible to limit output to range so I was getting numbers like -356,28… What also wasn’t proper value for dimmer.

I think this is why I ended up with virtual items.
But tbh I can’t recall now.

If I see correctly, you linked the setpoint Item of the PID controller to the setpoint Channel of the device. The PID controller’s setpoint item needs to be an independent Item, not linked to anything, otherwise the system can behave weird.

yes you’right. I just want to use the output of the pid directly for the zwave eurotronic dimmer.
if this will not work, ok virtual items are also OK.

But my problem actually is, that I can not see any output of the pid on the logs.
I can see changing of debug items for p, I, d and error.
but no sent command to my dimmer item.
that’s confusing

hmm. the pid controller, or the rule that uses the pid controller has an item to send the command to.
in my case I want to use the eurotronic dimmer item as the item to sent to.
the setpoint comes from the user

Can you post the code of the rule, the PID controller is configured in? (Click on the Code tab in the rule settings)

Here it is:

configuration: {}
triggers:
  - id: 58d52f8e-62b7-416b-9f23-c5f957f8f573
    label: PID Controller Trigger
    configuration:
      input: TestPid_ActTemp
      setpoint: TestPid_Setpoint
      iInspector: TestPid_I
      kp: 10
      eInspector: TestPid_E
      pInspector: TestPid_P
      kd: 0.8
      kdTimeConstant: 1
      dInspector: TestPid_D
      ki: 0.1
      loopTime: 60000
    type: pidcontroller.trigger
conditions: []
actions:
  - inputs: {}
    id: "1"
    configuration:
      itemName: Testht_Dimmer
    type: core.ItemCommandAction

and that my desired setup

According to the name of your output Item, I assume it’s of type Dimmer. Try to make it Number as @Dominik_Jeziorski already pointed out.

ok,. if I create a new item, just a virtual item as number,
it works.
so I need to create an additional rule that does the transfer.

one question again.
is there a way to disable the pod controller or does this make sense.
in my rules for example if I’m leaving home i switch off my. heating regulator.
but the pid controller is still running, producing output in the logs. so. is there a way to disable it until I’m coming back home?

Best way is to lower the setpoint to the desired value if you’re not at home. I don’t see any reason for disabling or pausing the controller when you leave as physics will continue.

1 Like

ok in generally you’re right.
but in this case the pid controller still produces logs.
I just want to prevent filling my Logs with all this changes because they make no sense if I’m not at home.

and even if I lower the temperature, the pid will not reach the target, because the actuator is off…

Ok, but if there is no way, that I will leave it as it is now.
thanks

With all honesty I don’t really understand why you have problem with that.

Usually logs will rotate so if you will set it to like static 10MB size + rotate of 5 files - you will not use more space than that.

Second thought is that typically you should forget about it and don’t look inside at all unless issue will occur. In my case I barely look inside and when I do - I’ll would search for something specific.

~60 lines of logs per hour shouldn’t be that much and if you are affraid about wear of SD card then solution is to create in memory drive that will host data that can vanish (RAM disk).

That’s my opinion - I work at company where we generate up to 10TB of logs daily out of few hundred different apps so few lines here doesn’t bother me at all.

I don’t really have any thought how to disable those completely. There is no off option in controller.