# Multiple input output PID controller

**URL:** <https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955>\
**Category:** General\
**Created:** [5 June 2023 09:55 UTC](https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955 "2023-06-05T09:55:05Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 June 2023 09:50 UTC](https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955/21 "2023-06-07T09:50:37Z")

</div>

You should scale it, not clamp. Otherwise the PID node does not know that it is off the end of the linear scale and will keep trying to increase the current. Then when it gets near the setpoint the integral term will have to wind back the excess till it gets below the limit again. That will increase the overshoot that you get.

---

<div class="post-metadata">

**Author:** ![FHI](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fhi/32/80390_2.png) [@FHI](https://discourse.nodered.org/u/FHI)\
**Post date:** [7 June 2023 09:55 UTC](https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955/22 "2023-06-07T09:55:21Z")

</div>

Yes it is scaled, I have just scaled the output to correlate with current instead of just an analog value

---

<div class="post-metadata">

**Author:** ![cameo69](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cameo69/32/66593_2.png) [@cameo69](https://discourse.nodered.org/u/cameo69)\
**Post date:** [7 June 2023 10:00 UTC](https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955/23 "2023-06-07T10:00:26Z")

</div>

Hi @FHI, this is interesting. Albeit I know little about it, I would like to know more. Would you mind describing or even posting a small sample flow so that the interested reader can try what you are doing?  
Also, may I ask how you have coupled the node red to the hardware; i.e. what's the hardware that allows node-red to control the thyristor?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 June 2023 10:03 UTC](https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955/24 "2023-06-07T10:03:48Z")

</div>

> [@FHI](#):
>
> Yes it is scaled,

That is not what I understand from your description. Can you export the pid node and the nodes preparing the current setpoint so that I can understand?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 June 2023 14:01 UTC](https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955/25 "2023-06-07T14:01:25Z")

</div>

Or to ask the question a different way, if the limit is 50A, and the outer PID sends an output of 0.7, what setpoint is passed to the current pid? If the outer PID sends 0.8 what setpoint is passed to the current pid?

---

<div class="post-metadata">

**Author:** ![FHI](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fhi/32/80390_2.png) [@FHI](https://discourse.nodered.org/u/FHI)\
**Post date:** [8 June 2023 06:02 UTC](https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955/26 "2023-06-08T06:02:38Z")

</div>

so if the main pid controller outputs a value of 0,7 i take that and multiply is by the limit, in this case 50. the set point for the slave pid will therefor then be 35

---

<div class="post-metadata">

**Author:** ![FHI](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fhi/32/80390_2.png) [@FHI](https://discourse.nodered.org/u/FHI)\
**Post date:** [8 June 2023 06:23 UTC](https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955/27 "2023-06-08T06:23:54Z")

</div>

Hi Camoeo69,  
Cascade control is common in industrial heating applications, I have implemented similar systems in the past where i need to control and internal temperature via a external heater on some reactor systems. For this project I was stuck thinking that i need something more complex to manage the control becase of the two outputs required, luckily Colin made several good suggestions that was easy to implement and made the system function as required.

The flow is quite simple where the inputs are a set point value that I get from a dashboard input. A analog input from a type k signal conditioner that is scaled to the process temperature, all of the inputs are connected to a node\_red\_contrib\_pid node and a scaled output is routed to a analog output this is the complete loop for the temperature control. This loop is than duplicated for the current control with a few differences. The current pid controller receives its set point value from the temperature pid output ( he output is scaled to current with a max allowable current limit) the output from this pid is also routed to a analog output and on to the thysristor  
I will post the complete flow once I have it working perfectly.  
I am using a Industrial Shields Raspberry pi plc to control the thyristor.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 June 2023 08:54 UTC](https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955/28 "2023-06-08T08:54:29Z")

</div>

> [@FHI](#):
>
> so if the main pid controller outputs a value of 0,7 i take that and multiply is by the limit, in this case 50. the set point for the slave pid will therefor then be 35

That seems ok, but I am still confused by your description, which does not seem to say that.

> [@FHI](#):
>
> The temperature pid output is then ranged to the available 0 to 100 amps of the thyristor, then a switch node checks the output value vs the max value if is smaller it passes trough to the cascade pid via output 1, if it exceeds the max value it goes to output 2 which is connected to a change node that modifies the value to the max value, and then connects to the cascade pid.

Which seems to say that, for a max current of 50, that if the pid output scaled to 100 is less than 50 then that is passed straight through, but if it is greater than 50 then it is 'modified to the max value'. So any PID value \> 0.5 would be set to 50.

I would have thought that all you need is a node to multiply the PID output by the maximum allowed current.

---

<div class="post-metadata">

**Author:** ![FHI](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fhi/32/80390_2.png) [@FHI](https://discourse.nodered.org/u/FHI)\
**Post date:** [8 June 2023 09:55 UTC](https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955/29 "2023-06-08T09:55:45Z")

</div>

I have now simplified it further, I now use the 0 to 1 output from the master pid and simply multiply that by the max current allowed this is then the set point for the cascade pid

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 June 2023 10:09 UTC](https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955/30 "2023-06-08T10:09:05Z")

</div>

Great, that is the way I would do it.

---

<div class="post-metadata">

**Author:** ![FHI](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fhi/32/80390_2.png) [@FHI](https://discourse.nodered.org/u/FHI)\
**Post date:** [8 June 2023 12:32 UTC](https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955/31 "2023-06-08T12:32:17Z")

</div>

It took a while but i got there in the end. I now need help with a sequence unit to control the ramp rate. I have made a new topic for it

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 August 2023 12:32 UTC](https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955/32 "2023-08-07T12:32:36Z")

</div>

Closed on 7 August 2023 12:32 UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.

[Previous page](https://discourse.nodered.org/t/multiple-input-output-pid-controller/78955.md?page=1)
