Commit 846e1069 authored by Jörg Weingrill's avatar Jörg Weingrill
Browse files

new PID parameters

parent 42703beb
......@@ -3,7 +3,7 @@
<POU Name="ThermoControl" Id="{1f9d7f6a-1997-4aa3-a06e-f5ddd853de00}" SpecialFunc="None">
<Declaration><![CDATA[PROGRAM ThermoControl
VAR
heater_mode: E_ThermoMode := E_ThermoMode.heater_pid;
heater_mode: E_ThermoMode := E_ThermoMode.heater_off;
pressure_voltage: REAL;
dewar_pressure: REAL;
......@@ -32,6 +32,12 @@ VAR
temperaturestring,
coldheadstring,
setpointstring: STRING(255);
Tu : REAL := 11.0; // dead time after power on
Tg : REAL := 420.0; // response time
dx : REAL := 0.27;
dy : REAL := 1638.4;
Ks, Xp, Kp, Tn, Tv: REAL;
END_VAR
VAR CONSTANT
heater_max : LREAL := 16384.0;
......@@ -63,7 +69,7 @@ ELSIF avg_pressure < 5E-5 THEN // we don't need any heater, we are still cooling
heater_mode := E_ThermoMode.heater_off;
END_IF
IF avg_temperature < -100.0 THEN // we are in target range of the PID loop
IF avg_temperature < dewar_setpoint+0.01 THEN // we are in target range of the PID loop
heater_mode := E_ThermoMode.heater_pid;
END_IF
......@@ -75,13 +81,24 @@ IF dewar_setpoint > 0.0 THEN
heater_mode := E_ThermoMode.heater_simple;
END_IF
Ks := dx / dy; //[%]
// Tu ... dead time after power is switched on
// Tg ... response time
// dy ... heater_value [%]
// dx ... temperature change [%]
Xp := Ks * Tu/(0.6*Tg);
Kp := 1.0 / Xp;
Tn := 1.0 * Tg;
Tv := 0.5 * Tu;
fbPIRegler(fSetpointValue := dewar_setpoint,
fActualValue := avg_temperature,
bReset := heater_mode <> E_ThermoMode.heater_pid,
fCtrlCycleTime := 1.0, //0.002,
fKp := 6169.1542,
fTn := 310.0,
fTv := 4.5,
fCtrlCycleTime := 0.1, //0.002,
fKp := Kp, //6169.1542,
fTn := Tn, //310.0,
fTv := Tv, //4.5,
fCtrlOutput => pid_output,
nErrorStatus => PIDError);
......@@ -97,7 +114,7 @@ CASE heater_mode OF
heater_value := 0.0;
END_IF
E_ThermoMode.heater_pid:
heater_value := pid_output;
heater_value := MIN(pid_output, LREAL_TO_INT(heater_max));
END_CASE
......@@ -132,7 +149,7 @@ Temperature3Event( Trigger := (dewar_temperature3 < -180.0) OR (dewar_temperatur
OffMessage := 'OK',
OffLevel := ADSLOG_MSGTYPE_HINT);
HTMLTimer(IN := TRUE AND NOT HTMLTimer.Q, PT := T#1M);
HTMLTimer(IN := TRUE AND NOT HTMLTimer.Q, PT := T#5M);
pressurestring := CONCAT('Dewar Pressure$T', LREAL_TO_FMTESTR(avg_pressure, 2, TRUE));
temperaturestring := CONCAT('<br>$NDewar Temperature$T', LREAL_TO_FMTSTR(avg_temperature ,2, TRUE));
coldheadstring := CONCAT('<br>$NCold Head$T', LREAL_TO_FMTSTR(dewar_temperature1, 2, TRUE));
......@@ -167,7 +184,14 @@ HTMLLog(Trigger := HTMLTimer.Q,
<LineId Id="592" Count="1" />
<LineId Id="365" Count="3" />
<LineId Id="372" Count="3" />
<LineId Id="638" Count="1" />
<LineId Id="634" Count="1" />
<LineId Id="640" Count="0" />
<LineId Id="636" Count="1" />
<LineId Id="631" Count="0" />
<LineId Id="579" Count="0" />
<LineId Id="649" Count="1" />
<LineId Id="648" Count="0" />
<LineId Id="581" Count="8" />
<LineId Id="255" Count="0" />
<LineId Id="90" Count="1" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment