sschultewolter
Well-known member
- Beiträge
- 54
- Punkte Reaktionen
- 0
-> Hier kostenlos registrieren
Hallo, ich stehe gerade wieder bei AS auf dem Schlauch.
Ich benötige einen PID-Regler für eine Leistungsreglung eines Brenners.
Gegeben sind mir Ist-Wert -> actValue, Soll-Wert -> setValue. Der Brenner soll von 0-100% Prozent fahren. Gibt es hierfür eine einfachere Methode (Keine Zweipunktregelung). Der Brenner wird über den Analog Output mittel 0..10V angesteuert.
Ich benötige einen PID-Regler für eine Leistungsreglung eines Brenners.
Gegeben sind mir Ist-Wert -> actValue, Soll-Wert -> setValue. Der Brenner soll von 0-100% Prozent fahren. Gibt es hierfür eine einfachere Methode (Keine Zweipunktregelung). Der Brenner wird über den Analog Output mittel 0..10V angesteuert.
Code:
PROGRAM _INIT
(* Init variables *)
setValue := 1000;
start := FALSE;
tuningRequest := LCPID_TUNE_REQU_OFF;
(* Parameters for PID tuning *)
LCPIDTune_0.Y_min := 0;
LCPIDTune_0.Y_max := 32767;
LCPIDTune_0.Y0 := 6300;
LCPIDTune_0.Y1 := 11300;
LCPIDTune_0.X0 := 250;
LCPIDTune_0.X_min := -10000;
LCPIDTune_0.X_max := 10000;
LCPIDTune_0.P_manualAdjust := 0;
LCPIDTune_0.I_manualAdjust := 0;
LCPIDTune_0.D_manualAdjust := 0;
LCPIDTune_0.pAddPar := ADR(addParameter);
LCPIDTune_0.pOptions_osc := ADR(oscOptions);
LCPIDTune_0.pOptions_step := ADR(stepOptions);
(* Parameters for PID controller *)
LCPID_0.A := 0;
LCPID_0.Y_man := 100;
LCPID_0.Y_fbk := 100;
LCPID_0.hold_I := FALSE;
LCPID_0.out_mode := LCPID_OUT_MODE_AUTO;
(* Parameters for extruder simulation model *)
extruderLCRSimModExt.enable := 1;
extruderLCRSimModExt.Tt_h := 900000; (* microseconds *)
extruderLCRSimModExt.Tt_c := 500000; (* microseconds *)
extruderLCRSimModExt.k_h := 39;
extruderLCRSimModExt.k_c := 0.012;
extruderLCRSimModExt.PT2_T1 := 5.0;
extruderLCRSimModExt.PT2_T2 := 12.5;
extruderLCRSimModExt.Temp_amb := 250;
extruderLCRSimModExt.Temp_c := 250;
extruderLCRSimModExt.Alpha_c := 0.0;
END_PROGRAM
PROGRAM _CYCLIC
(* Time base counter *)
baseLCCounter();
(* PID tuning *)
LCPIDTune_0.enable := start;
LCPIDTune_0.okToStep := LCPIDTune_0.rdyToStep;
LCPIDTune_0.request := tuningRequest;
LCPIDTune_0.basetime := baseLCCounter.mscnt;
LCPIDTune_0(); (* LCPIDTune function block call *)
IF LCPIDTune_0.state = LCPID_TUNE_STATE_FINISHED THEN
tuningRequest := LCPID_TUNE_REQU_OFF;
END_IF
(* PID controller *)
LCPID_0.enable := start;
LCPID_0.ident := LCPIDTune_0.ident; (* ident of PIDTune -> provides parameters (Kp, Tn, Tv, ...) *)
LCPID_0.W := setValue;
LCPID_0.X := actValue;
LCPID_0.basetime := baseLCCounter.mscnt;
LCPID_0(); (* LCPID function block call *)
manipulatedVar := LCPID_0.Y;
(* Extruder simulation model *)
extruderLCRSimModExt.Alpha_h := INT_TO_REAL(manipulatedVar) / 327.67;
extruderLCRSimModExt(); (* LCRSimModExt function block call *)
actValue := REAL_TO_INT(extruderLCRSimModExt.y);
END_PROGRAM