Multiple input output PID controller

Hi I have a project where i need to control two analog inputs on a thyristor. I currently use two separate PID controllers. PID1 generates a output based on the process temperature and Set point. PID2 generates a output based on the process current draw and Set point.

I have the flow already set up to control with fixed set point values and it all functions well when its ramping to the temperature set point. As soon as the temperature PID starts to decrease the output to avoid over shooting, the current PID starts to ramp up output to counter act the decrease in temperature output as it want to maintain the current set point.

There is some more development required in this project but its way above my capabilities, i am lookig for someone to with experience in PID controllers and specifically sequence based control models as the next step will be to control the thyrister based on a target temperature ramp rate and soak time.

Any help or lead will be greatly appreciated

Welcome to the forum @FHI

Can you explain in a bit more detail what you have please? Perhaps a diagram showing the relationships between the process and the sensors and drive circuitry. If you just hand draw something and photograph it then you can paste an image directly here.

Also which PID node are you using?

Hi Colin

Thank you, i will try and explain it better. i am measuring two process values, 1. temperature and 2. Current drawn by the element by means of a CT coil. There is a current limit on the heating wire i am using and that why i have to limit the current supplied to the heater.

for the set values I am currently using fixed values for the temperature and current set points.

Both PID outputs Temperature and Current are calculated by their respective PID nodes and outputted to the thyristor. as mentioned when operating below the temperature set point everything is fine. unfortunately as soon as you get close to the set point the temperature pid starts to cut back on its output. as a result a drop in current is then measured by the ct coil and the current pid than increases its output counteracting the temperature pid output.

I am using the node-red-contrib-pid

I hope this clarifies it more

I think what you want is to use Cascade Control. This article gives a pretty good descrition of what it is.
It uses two nested controllers, controlling different aspects of the process.
The inner loop controls the current in the heater, so it senses the current and controls it to match a given current setpoint. Obviously that loop would be arranged to limit the maximum current by limiting the setpoint range it accepts.
The outer loop measures the process temperature, but its control output is used as the setpoint for the current controller. So for an output of 1 it would set the setpoint of the inner loop to the maximum value.

Thanks Colin

I have worked with some cascade controllers in the past, and also thought of using it here unfortunately the arrangement of the heating elements change depending on the workpiece, so while one heater would only require 50 amps a different setup may require as much as 150amps. If I implement the cascade control as mentioned the current will ramp up to 150 and burn out the small element.

How does your existing scheme address that?

It does not and that's the problem the interaction between the two pid controllers is what I am trying to solve. I am hoping someone has experience in interacting loop controls

Each of the pid controllers works fine on their own its only when i have them working in conjunction that i het the counteracting issues

How are you limiting the current?

Its controled by the thyristor chopping the ac sine wave

I meant how are you limiting the Max current. You said that is one of the key things you need to do.

Yes by chopping the ac power wave to the element ypu can limmit the current its similar to pwm type control on a dc device

Not that. I understood earlier that the max limit is not fixed, and said that is why cascade will not work. How are you managing that?

Let me ask a different question. Do you know in advance what the current limit is for the next run? If so then what is the problem? Just make the draw current setpoint limit variable and set it as part of the recipe for the run. If you are heating significant different loads then you may need to adjust the tuning constants too.

Yes i do know the current limmit beforehand and currently am usingbit in the exact manner you are describing. The problem is that they are couter acting each other. Think of the thyristor as a unit with two accelerator pedals one controls the temperature and one controls the current. As rhe temperature gets close to the set pint the temperature pid decreases the force applied to the temperature pedal but when the decrese is measured by the current pid it increases its force as it wants to maintain the set current. This results in the total force not reducing as it should until the vakue on the temperature side is around zero resulting in a severe overshoot

We seem to be going round in circles.

Your solution does not use the pid controllers in cascade. Use the Temperature controller to generate the setpoint for for the current controller (scaled so that the max output from the temperature controller is the max allowed current, with some safety margin in case of overshoot). Then when the temperature is a long way from the temperature setpoint it will ask for the max safe current, and as the temperature rises it will reduce the current setpoint.

I think this will work, because i have two outputs I was stuck on keeping them seperate while what your suggesting is exactly the solution. Is it possible to make the use a normal scale node and have the max value as a variable. Thanks for your help

Hi Colin thank you for bearing with me, I have modified the flow to cascade the two pid's and its working very well. I am using a range node to scale the max current value from the output of the temperature pid.
I would like to be able to change the target range max value from a dashboard input. I have searched for possible answers but only find examples using static range values.

The Range node cannot be scaled dynamically. You can easily do this by storing the max value from the dashboard in a flow context variable ("maxCurrent" for example) remove Range node and instead use a Function node containing something like

const max = flow.get("maxCurrent") || 0
msg.payload = msg.payload * max

The || 0 is to ensure that if the flow variable has not yet been initialised then then the max current will be 0.

Thank you Colin

I have managed to get it working perfectly, while writing the function node I realized that i can accomplish the same function by using standard nodes.

The solution I have currently
I save the max current value to a global max value from the dashboard .
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.

I am glad to say that I have tested it and it work well, thank you for your help.