Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PID with STM32 for dummies tuning Ziegler-Nichols.

Status
Not open for further replies.

Coper

Member level 4
Member level 4
Joined
Mar 16, 2017
Messages
69
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
773
I would like to use PID to control the heating of the liquid.
I have about 3kg of liquid, a 16-bit temperature sensor and a 400W electric heater
I want to use the CMSIS PID from the DPS library as an algorithm.
For tuning, I should be fine with the Ziegler-Nichols method.


Maybe I'm stubborn, but tuning is not completely clear to me.

  • The system is cold temperature =20C, time zero, heating off.
  • I turn on the heater and measure the temperature every second.
  • After some time the temperature is 120C, at this temperature I turn everything off for safety reasons, it is 20% above the maximum working temperature, etc.
I can make a graph with time on the x-axis and temperature on the y-axis. I can read the dead time and the time constant tau from the graph.

I don't know what to do with
Calculate the process gain (gp) as follows:

gp = change in PV [in %] / change in CO [in %]“

My Controllel Output changed from off to on that's a 100% change, Process Value changed from 20C to 120C. I really don't know what the percentage change is, should it also be taken as a 100% change and gp=1 boost or what?
 

It is not different than a home thermostat which just uses an error comparator and some hysteresis like 0.5 deg C to control on or off.
Here in Europe we have a lot of massive houses (concrete walls) with a high thermal capacity.
A room thermostat only with hysteresis would not work satisfactory. They would cause a lot of overshoot. Cold hot, cold, hot....with a period time in the hours.

Thus our room thermostats include an "integrating part" designed as heater inside the thermostat.
When the thermostat is ON, the inside heater also is ON.
So from a signal view our thermostats are PWM generators, where
* the period time is in the 10 minutes
* the duty cycle represents the difference between setup_temperature and room_temperature.

Klaus
 

The process variable changed from 20 to 90, but it is not clear to me from which whole, i.e. by what percentage did it change?
You want to compute relative deg 'C/W as 20'C at 0% heat and 50% heat at 200W your target is +70'C.
Does the apartment have a 100% temperature to which the temperature would rise at 100% heating power?
depends on ambient heat and max temp.
What if I can't test it because of the protected circuits?
No need to test near unsafe limits. But a good manual plot test and use your PID mind to anticipate a null overshoot and plot your best-case curve T & P out vs t. If you need to prevent the thermal cycling of the heater, then you will need a solid-state power control where full or half-cycles ON OFF may be quick enough to have a low error response as a linear control.

Assumptions & Suggestions

1. CO at 50% of 400W = 200W,
2. ΔT = 70 °C has the power gain of Ap=70/200 °C/W
3. This thermal gain is only in the positive direction, the heat loss being a small percentage of the heat added means the gain will be much lower after overshoot (when the error is positive), so the design target of overshoot ought to be near 0 with critical control of Kd and Ki and with low anti-windup aka. saturated error limits.
3. Latency is from the heater to sensor, td. What is the heater surface temp in these 3 minutes?
4. tau, τ = 63% of 70 = 44.1 °C Define tau for both solid and liquid.
5. Create a closed loop block diagram with variables for mass, power, temperature, latency, and cooling rate and define your process limits and error tolerance specs. 'C.

6. I think your goal is to heat up to some variable mass volumes in the least time with some acceptable temperature error from all sources. ( thermal gradients, latency, thermal cycling)

7. You may want more than 1 temp sensor for reliability or to measure gradients.
--- Updated ---

So from a signal view our thermostats are PWM generators, where
* the period time is in the 10 minutes
* the duty cycle represents the difference between setup_temperature and room_temperature.
I recall studying thermostats at Univ. (circa '70) when doing homework at night in an empty class. The home mercury-switched heater thermostats were different and used a small printed-circuit heater to reduce the hysteresis and integrate the heat just as KlausST said. The hot water heating systems at Univ. used linear water valves to have a proportional linear control system. The PID variables were somehow pneumatically adjusted.
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top