Comments (8)
Greetings. How did you test it? Can you share details of your simulation or real setup?
from node-red-contrib-easy-pid-controller.
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:
- Set controller to MAN
- Change PID settings in node
- Deploy changes
- set SV to 27
- set PV to 27
- Set AUTO.
Proportional Testing
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.
Integral Testing
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?
from node-red-contrib-easy-pid-controller.
Ok, before proceeding - let me add few points
- Do not use inject node to manually test easy-pid-controller. The feedback mechanism logic will not work properly
- I use a valve simulator to test this node - it basically uses mqtt to receive SV from this node and in turn processes it to get PV which is then fed back to this node. It uses mqtt broker to get and receive values from multiple locations.
- Refer the flow provided in examples/ use it with the simulator
- Please check this code - https://github.com/hj91/simple-pid-controller/blob/main/mqtt-pid.js which will prove as start point to write your own simulator using nodejs - modify and enhance it as per your requirement.
from node-red-contrib-easy-pid-controller.
This is how the SV vs PV response looks when we test it with simulator
from node-red-contrib-easy-pid-controller.
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.
from node-red-contrib-easy-pid-controller.
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.
from node-red-contrib-easy-pid-controller.
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.
from node-red-contrib-easy-pid-controller.
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
from node-red-contrib-easy-pid-controller.
Related Issues (4)
- I - value limit HOT 10
- Add the ability to stop PID HOT 1
- PID setpoint tracking HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-red-contrib-easy-pid-controller.