Open hotswapster opened 10 months ago
Greetings. How did you test it? Can you share details of your simulation or real setup?
Hi Hj,
I am using a simulation because I wanted to see it working before implementing, and it wasn't clear to me whether value
or output
should be used to drive the process output.
Here is my test setup:
Process used to test:
To test the proportional control I did it with kp1, ki0, kd0 Dt 5 seconds. Followed by kp2, ki0, kd0. Teh results are here:
Here you can see upon a PV change,
value
proportional does not change betweeh kp1 and kp2 however, the output changes by double (expected behaviour). This says to me that value
is the input, not the output. and Output
is the to be used to control the process.
kp1, ki100, kd0
To test the integral I did a similar test, I introduced an error by changing the PV from 27 to 35. value
changed byt the same amout as the input.
For output
, upon a PV change, the proportional reacted immediately, and then repeated at the Dt
time later (expected behaviour). This leads me to believe that output1
should be used to control the process. However, it also suffers from integral windup and does not appear to have a "range". It is possible to do a range with a separate node, but that doesn't fix the windup. As you can see from the pic below, the windup can end up making output
well over 10000 when it should never exceed 100% (or 100 or full scale of the output).
a. What is the purpose of value
? and can you provide an example when to use it please?
b. Is output
intended to be used to drive the process output?
c. How is integral windup managed?
Ok, before proceeding - let me add few points
This is how the SV vs PV response looks when we test it with simulator
Remember - the PV in real life application does not directly jump from one value to other - it either gradually increases or decreases as per PID parameters and the saturation that you are seeing is due to the lack of correct response from system - it tries to correct the error but that type of PV is never possible in real scenarios.
So I hooked it up in my loop. I have a fermenter which has an exothermic reaction on the inside, as well as the heat from the environment, then this PID loop reads the temperature inside the fermenter and adjusts the glycol cooling water flow.
I used msg.payload.output
with a range node to control the loop, not msg.payload.value
. Using msg.payload.output
I can see the P and I functions working. The example you have provided in examples/easy-pid-controller.json
appears to suggest msg.payload.value
should be used to control the loop.
Lines 82-98 of easy-pid.js
appear to me to just map the input to a range and then set that as value
. Therefore value
is just the input value to the PID block and not the output
. README.md also says:
Value: The mapped control signal according to the sensor type (0-10V or 4-20mA).
I interpret this as the output signal.
So my questions are:
a. What is the purpose of value
? (Is it to describe the input to the PID block or the output?)
b. Is output
intended to be used to drive the process output? (Where as the example shows that value
should be used).
Remember - the PV in real life application does not directly jump from one value to other - it either gradually increases or decreases as per PID parameters and the saturation that you are seeing is due to the lack of correct response from system - it tries to correct the error but that type of PV is never possible in real scenarios.
I understand this but there can still be occurrences where integral windup can be experienced. For example, in my setup, if my glycol chiller can't provide enough cooling, or there are multiple days in a row over 40degreesC followed by a cold day of 20, it's possible the integral component of this loop won't recover quick enough due to integral windup.
Hi. Can you share the characteristic data screenshot you obtained from the process?
Log all parameters coming from the node into influxdb and use grafana to visualize it.
Let's delve into the code to clarify these concerns:
Lines 82-98: if (node.sensor_type === "0-10V") { signal = scaledOutput 10; // Map to [0, 10] value = mapToRange(node.currentValue, node.range_min, node.range_max, 0, 10); // Map current value to [0, 10] } else { signal = 4 + scaledOutput 16; // Map to [4, 20] value = mapToRange(node.currentValue, node.range_min, node.range_max, 4, 20); // Map current value to [4, 20] } From the above:
signal is derived directly from the PID's output (called pidOutput) and is then scaled to either 0-10V or 4-20mA depending on the node.sensor_type. This represents the output from the PID block.
value is a mapping of the current process value (node.currentValue, which is essentially the current temperature of the fermenter in your scenario) into either the 0-10V or 4-20mA scale. This represents the scaled input to the PID block.
Now, addressing your specific questions:
a. What is the purpose of value? value represents the current process variable (e.g., the temperature inside the fermenter) mapped to the appropriate sensor range (0-10V or 4-20mA). It provides a perspective on the current state of the process in the context of the sensor range. While this could be useful for visualization or diagnosis purposes, it's not the "control" signal.
b. Is output intended to be used to drive the process output? (Whereas the example shows that value should be used). Yes, the output (represented as signal in the code) is the scaled control signal derived from the PID's computations. This should drive your actuator, such as the valve controlling the glycol cooling water flow. Given its derivation directly from the PID computation, it would be the appropriate field to use for actuating changes in the process.
In summary:
Use output to control your loop. value can be used for diagnostic or visualization purposes to see the mapped input to the PID block
It may be my lack of understanding with this node, and I'm happy to be corrected. But my assumption was the
value
control signal (0-10v or 4-20mA), on the output of the node, would be used to drive the actuator.I have observed that
value
follows the PV only, and has no PID control applied.output
appears to have the PID applied to it as the response changes with proportional and integral settings. However the integral drives this signal past the outputs limits.value
signal and used to control the process.output
the signal to use for controlling the process? If so, why is the output wider than 0-100% and how is integral windup prevented?This picture shows![pid3](https://github.com/hj91/node-red-contrib-easy-pid-controller/assets/29253772/677308a7-403a-46ce-b916-e1756788a034)
value
followsPV
and that PID is not applied toValue
.Happy to provide any more information, or accept any guidance from mis-understandings.