From 858aa47d00fd40ec9780af740b01ef237fd673e7 Mon Sep 17 00:00:00 2001 From: Uwe Jakobeit Date: Sun, 5 Apr 2026 15:17:27 +0200 Subject: [PATCH] static_cast supplied for definition 'MAX'; take-over ST-code comments for orientation --- controller/Controller.h | 249 ++++++++++++++++++++++------------------ 1 file changed, 138 insertions(+), 111 deletions(-) diff --git a/controller/Controller.h b/controller/Controller.h index ae42cbd..25fc90f 100755 --- a/controller/Controller.h +++ b/controller/Controller.h @@ -33,6 +33,7 @@ Notes: [Any relevant details, such as dependencies, usage examples, or kno #include #include #include +#include // std:max //UJ: not yet needed, future use // #include @@ -44,6 +45,8 @@ Notes: [Any relevant details, such as dependencies, usage examples, or kno #include "datamodel.h" #include "util.h" +using namespace std; + const double PI_CONST = 3.14159265358979323846; @@ -965,7 +968,7 @@ void Step(void) Regler_Heizung_MAX); } - /* Berechnung Stellgrad Heizung Mittelwert * + /* Berechnung Stellgrad Heizung Mittelwert */ if (!Startup_finished || !is_valid(Stellgrad_Heizung_Mittelwert)) { Stellgrad_Heizung_Mittelwert = 0.0; @@ -993,12 +996,10 @@ void Step(void) // die schon berechnet sind, und lassen Stellgrade der restlichen Aktoren, // falls nicht berechnet, auf gültigen Default stehen. - // Regelabweichung Kühlung - // F_ PID PID_Cooling() + /* Regelabweichung Kühlung */ double Regelabweichung_Kuehlung = Regelabweichung_Temperatur; - // Gradient Regelabweichgun Kuehlung - + /* Gradient Regelabweichgun Kuehlung */ if (!Startup_finished) { Regelabweichung_Kuehlung_Gradient = 0.0; @@ -1011,8 +1012,7 @@ void Step(void) 2.0); } - // Faktor Kuehlung - + /* Faktor Kuehlung */ if (!Startup_finished || Temperatursprung) { Faktor_Kuehlung = 5.0; @@ -1026,9 +1026,9 @@ void Step(void) Faktor_Kuehlung = std::max(Faktor_Kuehlung - sampling_time / 60.0, 0.2); } - // --------------------------- Gegenheizen Band !!! Überwacher !!!!! + /* Gegenheizen Band */ double Regelabweichung_Entfeuchtung = Regelabweichung_Feuchte; - if (!Startup_finished || Temperatursprung || (Counter_Temperatursprung > -600.0 && Faktor_Gegenheizen_Band == 10.0)) + if (!Startup_finished || Temperatursprung || (Counter_Temperatursprung > -600.0 && Faktor_Gegenheizen_Band == 10.0)) // 111 { Faktor_Gegenheizen_Band = 10.0; } @@ -1042,7 +1042,8 @@ void Step(void) Faktor_Gegenheizen_Band = std::min(Faktor_Gegenheizen_Band + sampling_time / 60.0, 10.0); } - } else if (Stellgrad_Heizung_Mittelwert - Sollwert_Gegenheizen > 1.0 && Stellgrad_Kuehlung_Mittelwert < -5.0) + } + else if (Stellgrad_Heizung_Mittelwert - Sollwert_Gegenheizen > 1.0 && Stellgrad_Kuehlung_Mittelwert < -5.0) { if (Regelabweichung_Entfeuchtung < -0.5) { @@ -1059,25 +1060,18 @@ void Step(void) } // --------------------------- Gegenheizen Band - // -----------------------Sollwert Gegenheizen für I-Anteilverschiebung + /* Sollwert Gegenheizen für I-Anteilverschiebung Kühlen */ + constexpr double Faktor_Entfeuchtung_Kuehlung = 0.0; + double Offset_Kuehlung = Faktor_Entfeuchtung_Kuehlung * Stellgrad_Entfeuchtung_Mittelwert * + std::max((50.0 - Stellgrad_Heizung_Mittelwert) / (50 - 0.0), + 0.0) * (8.0 - Stellgrad_Befeuchtung_Standby) / (8.0 - 2.0); - double Faktor_Entfeuchtung_Kuehlung = 0.0; - double Offset_Kuehlung = Faktor_Entfeuchtung_Kuehlung; - Offset_Kuehlung = Faktor_Entfeuchtung_Kuehlung * Stellgrad_Entfeuchtung_Mittelwert * - std::max((50.0 - Stellgrad_Heizung_Mittelwert) / (50 - 0.0), 0.0) * (8.0 - Stellgrad_Befeuchtung_Standby) / (8.0 - 2.0); - - // P-Anteil Kühlung + // UJ: Wertezuweisung in ST-Codenicht identifizierbar + // Ist '0.0' zulässig ? double P_Anteil_Kuehlung = 0.0; - if (!Startup_finished) - { - P_Anteil_Kuehlung = 0.0; - } - else - { - P_Anteil_Kuehlung = 100.0 / Regler_Kuehlung_Xp * Faktor_Kuehlung * Regelabweichung_Kuehlung; - } - // Begrenzung I-Anteil Kühlung bei Türöffnung + + /* Begrenzung I-Anteil Kühlung bei Türöffnung */ double Regler_Kuehlung_MAX = 0; double Regler_Kuehlung_MIN = 0; double Regler_Kuehlung_I_Anteil_MAX = 0; @@ -1100,8 +1094,17 @@ void Step(void) Regler_Kuehlung_MAX); } - // f_PID_Cooling.Step(...) - // I Anteil Kühlung + // P-Anteil Kühlung + if (!Startup_finished) + { + P_Anteil_Kuehlung = 0.0; + } + else + { + P_Anteil_Kuehlung = 100.0 / Regler_Kuehlung_Xp * Faktor_Kuehlung * Regelabweichung_Kuehlung; + } + + /* I Anteil Kühlung */ if (!Startup_finished) { I_Anteil_Kuehlung = 0.0; @@ -1115,8 +1118,7 @@ void Step(void) Regler_Kuehlung_I_Anteil_MAX); } - // D-Anteil Kühlung - + /* D-Anteil Kühlung */ if (!Startup_finished) { D_Anteil_Kuehlung = 0.0; @@ -1128,8 +1130,7 @@ void Step(void) D_Anteil_Kuehlung) / (Tau_Kuehlung_Tv / sampling_time); } - // Berechnung Stellgrad Kühlung - // f_ + /* Berechnung Stellgrad Kühlung */ if (Counter_Tuer_offen > 60.0 || !Startup_finished) { Stellgrad_Kuehlung = 0.0; @@ -1141,8 +1142,7 @@ void Step(void) Regler_Kuehlung_MAX); } - // Berechnung Stellgrad Mittelwert - + /* Berechnung Stellgrad Mittelwert Mittelwert */ if (!Startup_finished) { Stellgrad_Kuehlung_Mittelwert = 0.0; @@ -1153,14 +1153,13 @@ void Step(void) Stellgrad_Kuehlung - 0.5 * 100.0 * Regler_Kuehlung_Xp, Stellgrad_Kuehlung + 0.5 * 100.0 / Regler_Kuehlung_Xp); } - // ------------------- F_ PID PID_Cooling() - - // PID Regler Feuchte - // f_PID_Humidiy + /* ------------------ *) + (* PID Regler Feuchte *) + (* ------------------ */ Regelabweichung_Feuchte = Sollwert_Feuchte_Absolut - Istwert_Feuchte; - // Berechnung Regelabweichung Feuchte Mittelwert + /* Berechnung Regelabweichung Feuchte Mittelwert */ if (!Startup_finished) { Regelabweichung_Feuchte_Mittelwert = 0.0; @@ -1172,8 +1171,7 @@ void Step(void) Regelabweichung_Feuchte + 10.0); } - // Feuchtesprung - // f_PID_Hunidity.HandleJump(...) + /* Feuchtesprung */ if (!Startup_finished) { Counter_Feuchtesprung = 0.0; @@ -1185,19 +1183,18 @@ void Step(void) else if (std::abs(Regelabweichung_Feuchte) < 2.0 || std::abs(Regelabweichung_Feuchte_Mittelwert) < 2.0) { Counter_Feuchtesprung = std::min(Counter_Feuchtesprung - sampling_time, 0.0); - } else if (std::abs(Regelabweichung_Feuchte_Mittelwert) > 5.0) + } + else if (std::abs(Regelabweichung_Feuchte_Mittelwert) > 5.0) { Counter_Feuchtesprung = std::max(Counter_Feuchtesprung + sampling_time, -120.0); } Feuchtesprung = (Counter_Feuchtesprung > 0.0 || (Feuchtesprung && Counter_Feuchtesprung > -120.0)); - // Regelabweichung Befeuchtung - + /* Regelabweichung Befeuchtung */ double Regelabweichung_Befeuchtung = Regelabweichung_Feuchte; - // Gradient regelabweichung Feuchte - + /* Gradient Regelabweichung Feuchte */ if (!Startup_finished) { Regelabweichung_Befeuchtung_Gradient = 0.0; @@ -1211,7 +1208,7 @@ void Step(void) 5.0); } - // Begrenzung I-Anteil bei Türöffnung + /* Begrenzung I-Anteil Befeuchtung bei Türöffnung */ double Regler_Befeuchtung_MIN = 0.0; double Regler_Befeuchtung_MAX = 0.0; double Regler_Befeuchtung_I_Anteil_MIN = 0.0; @@ -1243,8 +1240,7 @@ void Step(void) Regler_Befeuchtung_I_Anteil_MAX = limit(100.0, Regler_Befeuchtung_I_Anteil_MIN, Stellgrad_Befeuchtung_Mittelwert); } - // Anteil P-Anteil Befeuchtung bei Feuchtesprung und Türöffnung - + /* Anpassung P-Anteil Befeuchtung bei Feuchtesprung und Türöffnung */ if (Counter_Tuer_geschlossen < 180.0 && Feuchtesprung) { Regler_Befeuchtung_Xp = Regler_Befeuchtung_Xp * 2.0; @@ -1258,8 +1254,7 @@ void Step(void) Regler_Befeuchtung_Xp = Regler_Befeuchtung_Xp * (1.0 + Stellgrad_Entfeuchtung_Mittelwert / -100.0); } - // P-Anteil Befeuchtung - + /* P-Anteil Befeuchtung */ if (!Startup_finished) { P_Anteil_Befeuchtung = 0.0; @@ -1269,8 +1264,7 @@ void Step(void) P_Anteil_Befeuchtung = 100.0 / Regler_Befeuchtung_Xp * Regelabweichung_Befeuchtung; } - // I-Anteil Befeuchtung - + /* I-Anteil Befeuchtung */ if (!Startup_finished) { I_Anteil_Befeuchtung = 0.0; @@ -1282,7 +1276,7 @@ void Step(void) Regler_Befeuchtung_I_Anteil_MAX); } - // D-Anteil Befeuchtung + /* D-Anteil Befeuchtung */ if (!Startup_finished) { D_Anteil_Befeuchtung = 0.0; @@ -1293,8 +1287,7 @@ void Step(void) D_Anteil_Befeuchtung) / (Tau_Befeuchtung_Tv / sampling_time); } - // Z-Anteil Befeuchtung - + /* Z-Anteil Befeuchtung */ if (!Startup_finished || Feuchtesprung) { Z_Anteil_Befeuchtung = 0.0; @@ -1306,8 +1299,11 @@ void Step(void) Regelabweichung_Befeuchtung_alt_alt)) / sampling_time - Z_Anteil_Befeuchtung) / (Tau_Befeuchtung_Tz / sampling_time); } + + // UJ - nächste Zeile steht nicht im ST-Code // Regler_Befeuchtung_MAX = 10.0; - // Berechnung Stellgrad Befeuchtung + + /* Berechnung Stellgrad Befeuchtung */ if (Counter_Tuer_offen > 60.0 || !Startup_finished) { Stellgrad_Befeuchtung = 0.0; @@ -1319,8 +1315,7 @@ void Step(void) Regler_Befeuchtung_MAX); } - // Berechnung Stellgrad befeuchtung Mittelwert - + /* Berechnung Stellgrad Befeuchtung Mittelwert */ if (!Startup_finished) { Stellgrad_Befeuchtung_Mittelwert = 0.0; @@ -1332,6 +1327,7 @@ void Step(void) Stellgrad_Befeuchtung + 5.0 * 100.0 / Regler_Befeuchtung_Xp); } + /* Berechnung Stellgrad Befeuchtung Mittelwert */ if (!Startup_finished) { Stellgrad_Befeuchtung_Standby = 4.0; @@ -1343,12 +1339,11 @@ void Step(void) 8.0); } - // Regelabweichung Entfeuchtung + /* Regelabweichung Entfeuchtung */ Regelabweichung_Entfeuchtung = Regelabweichung_Feuchte; - // Gradient Regelabweichung Entfeuchtung - + /* Gradient Regelabweichung Entfeuchtung */ if (!Startup_finished) { Regelabweichung_Entfeuchtung_Gradient = 0.0; @@ -1362,8 +1357,7 @@ void Step(void) 5.0); } - // Faktor Entfeuchtung - + /* Faktor Entfeuchtung */ if (!Startup_finished) { Faktor_Entfeuchtung = 5.0; @@ -1377,8 +1371,7 @@ void Step(void) Faktor_Entfeuchtung = std::max(Faktor_Entfeuchtung - sampling_time, 0.2); } - // Gegenbefeuchten Band - + /* Gegenbefeuchten Band */ if (!Startup_finished || Feuchtesprung || (Counter_Feuchtesprung > -600.0 && Faktor_Gegenbefeuchten_Band == 5.0)) { @@ -1412,13 +1405,26 @@ void Step(void) Faktor_Gegenbefeuchten_Band = std::max(Faktor_Gegenbefeuchten_Band - sampling_time / 60.0, 0.2); } - // Sollwert Gegenbefeuchten für I-Anteilverschiebung - + /* Sollwert Gegenbefeuchten für I-Anteilverschiebung Entfeuchten */ Sollwert_Gegenbefeuchten = 6.0 - 4.0 * (-Stellgrad_Entfeuchtung_Mittelwert / 100.0); double Offset_Entfeuchtung = 0.0 * Stellgrad_Kuehlung_Mittelwert; - //(* P-Anteil Entfeuchtung *) + /* + (* Begrenzung Stellgrad und I-Anteil Entfeuchtung bei Türöffnung *) + IF Counter_Tuer_geschlossen < 180.0 OR Counter_Tuer_offen > 0.0 THEN + Regler_Entfeuchtung_MAX := I_Anteil_Entfeuchtung; + Regler_Entfeuchtung_MIN := -100.0; + Regler_Entfeuchtung_I_Anteil_MAX := I_Anteil_Entfeuchtung; + Regler_Entfeuchtung_I_Anteil_MIN := LIMIT(-100.0 - P_Anteil_Entfeuchtung, Regler_Entfeuchtung_MIN, Regler_Entfeuchtung_I_Anteil_MAX); + ELSE + Regler_Entfeuchtung_MAX := 0.0; + Regler_Entfeuchtung_MIN := -100.0; + Regler_Entfeuchtung_I_Anteil_MAX := 1.5 / Regler_Entfeuchtung_Xp * 100.0; + Regler_Entfeuchtung_I_Anteil_MIN := LIMIT(-100.0 - P_Anteil_Entfeuchtung + Regelabweichung_Entfeuchtung_Gradient / 20.0 * 100.0, Regler_Entfeuchtung_MIN, Regler_Entfeuchtung_I_Anteil_MAX); + END_IF; + */ + /* P-Anteil Entfeuchtung */ double P_Anteil_Entfeuchtung = 0.0; if (!Startup_finished) { @@ -1428,7 +1434,8 @@ void Step(void) { P_Anteil_Entfeuchtung = 100.0 / Regler_Entfeuchtung_Xp * Faktor_Entfeuchtung * Regelabweichung_Entfeuchtung; } - // I-Anteil Entfeuchtung + + /* I-Anteil Entfeuchtung */ if (!Startup_finished) { I_Anteil_Entfeuchtung = 0.0; @@ -1440,7 +1447,8 @@ void Step(void) Regler_Entfeuchtung_I_Anteil_MIN, Regler_Entfeuchtung_I_Anteil_MAX); } - // D-Anteil Entfeuchtung + + /* D-Anteil Entfeuchtung */ if (!Startup_finished) { D_Anteil_Entfeuchtung = 0.0; @@ -1452,8 +1460,8 @@ void Step(void) D_Anteil_Entfeuchtung) / (Tau_Entfeuchtung_Tv / sampling_time); } - // Begrenzung Stellgrad und I-Anteil - + /* Begrenzung Stellgrad und I-Anteil */ + // UJ - Im ST-Code sthet das weiter oben ! if ((Counter_Tuer_geschlossen < 180.0) || (Counter_Tuer_offen > 0.0)) { Regler_Entfeuchtung_MAX = I_Anteil_Entfeuchtung; @@ -1473,8 +1481,7 @@ void Step(void) Regler_Entfeuchtung_I_Anteil_MAX); } - // Berechnung Stellgrad Entfeuchtung - + /* Berechnung Stellgrad Entfeuchtung */ if (Counter_Tuer_offen > 60.0 || !Startup_finished) { Stellgrad_Entfeuchtung = 0.0; @@ -1486,8 +1493,7 @@ void Step(void) Regler_Entfeuchtung_MAX); } - // Berechnung Stellgrad entfeuchtung Mittelwert - + /* Berechnung Stellgrad Entfeuchtung Mittelwert */ if (!Startup_finished) { Stellgrad_Entfeuchtung_Mittelwert = 0.0; @@ -1499,8 +1505,9 @@ void Step(void) Stellgrad_Entfeuchtung + 5.0 * 100.0 / Regler_Entfeuchtung_Xp); } - // PID Regler Tür - // f_PID_Door(...) + /* --------------- *) + (* PID Regler Tuer *) + (* --------------- */ double Offset_Temperatur_Tuer; if (Feuchtesprung) { @@ -1513,21 +1520,20 @@ void Step(void) 1.0); } - // Regelabweichung - if (!Tuer_offen || std::abs(Regelabweichung_Tuer) > std::abs(Sollwert_Temperatur + Offset_Temperatur_Tuer - Istwert_Temperatur_Tuer)) + /* Regelabweichung */ + if (!Tuer_offen || + std::abs(Regelabweichung_Tuer) > std::abs(Sollwert_Temperatur + Offset_Temperatur_Tuer - Istwert_Temperatur_Tuer)) { Regelabweichung_Tuer = Sollwert_Temperatur + Offset_Temperatur_Tuer - Istwert_Temperatur_Tuer; } - // P-Anteil - - // Anti-Windup über dynamisches Integrator Clamping - + /* Anti-Windup über dynamisches Integrator Clamping */ double Regler_Tuer_MAX = limit( (100.0 + Stellgrad_Kuehlung) / (100.0 - 80.0) * 100.0, 0.0, 100.0); double Regler_Tuer_MIN = 0.0; double Regler_Tuer_I_Anteil_MAX = limit(100.0 - P_Anteil_Tuer, 0.0, Regler_Tuer_MAX); double Regler_Tuer_I_Anteil_MIN = 0.0; + /* P-Anteil */ if (!Startup_finished) { P_Anteil_Tuer = 0.0; @@ -1537,7 +1543,7 @@ void Step(void) P_Anteil_Tuer = 100.0 / Regler_Tuer_Xp * Regelabweichung_Tuer; } - // I-Anteil + /* I-Anteil */ if (!Startup_finished) { I_Anteil_Tuer = 0.0; @@ -1553,8 +1559,8 @@ void Step(void) Regler_Tuer_I_Anteil_MIN, Regler_Tuer_I_Anteil_MAX); } - // D-Anteil + /* D-Anteil */ if (!Startup_finished) { D_Anteil_Tuer = 0.0; @@ -1566,7 +1572,7 @@ void Step(void) } double Stellgrad_Tuer; - // Berechnung Stellgrad Tür + /* Berechnung Stellgrad */ if (Tuer_offen || !Startup_finished) { Stellgrad_Tuer = limit(P_Anteil_Tuer + I_Anteil_Tuer + D_Anteil_Tuer, @@ -1574,8 +1580,10 @@ void Step(void) Regler_Tuer_MAX); } - // Kennfelder Kühlung/Entfeuchtung - + /* --------------------------------- */ + /* Kennfelder Kühlung/Entfeuchtung */ + /* --------------------------------- */ + /* Grundskalierung Überhitzung über Kennfeld */ int Index_Ueberhitzung = 1; while (Kennfeld_Ueberhitzung[0][Index_Ueberhitzung] < Istwert_Temperatur && Index_Ueberhitzung < 12) { @@ -1594,7 +1602,7 @@ void Step(void) (Interpolation_Ueberhitzung + Kennfeld_Ueberhitzung[3][Index_Ueberhitzung - 1]) * (1.0 - Interpolation_Ueberhitzung); - //(* Entfeuchtung und Abtauung aus Kennfeld *) + /* Entfeuchtung und Abtauung aus Kennfeld */ int Index_Entfeuchtung = 1; // todo uj - warum nicht mit 0 starten? while ((Kennfeld_Entfeuchtung[0][Index_Entfeuchtung] < Istwert_Temperatur) && (Index_Ueberhitzung < 12)) { @@ -1614,12 +1622,11 @@ void Step(void) double Abtauzyklus_Dauer = Kennfeld_Entfeuchtung[3][Index_Entfeuchtung] * Interpolation_Entfeuchtung + Kennfeld_Entfeuchtung[3][Index_Entfeuchtung - 1] * (1.0 - Interpolation_Entfeuchtung); - // Ende - f_PID_Door(...) + /* -------------------- */ + /* Überhitzungsregelung */ + /* -------------------- */ - // Überhitzungsregelung - - // Temperatur Verdampferausgang PT1 - // f_PT1.Vapourize(...) + /* Temperatur Verdampferausgang PT1 */ if (!Startup_finished) { Istwert_Temperatur_Verdampferausgang_PT1 = Istwert_Temperatur_Verdampferausgang; @@ -1630,15 +1637,14 @@ void Step(void) Istwert_Temperatur_Verdampferausgang_PT1) / (60.0 * 4.0); } - // Skalierung Überhitzung + /* Skalierung Überhitzung */ if (Istwert_Temperatur_Verdampferausgang < (Istwert_Temperatur + Sollwert_Ueberhitzung)) { Counter_Durchzug = MIN(Counter_Durchzug + sampling_time, 10.0); } else { - // uj-todo; template for MAX - // Counter_Durchzug = MAX(MAX(Counter_Durchzug-sampling_time,-10),0); + Counter_Durchzug = MAX((Counter_Durchzug - sampling_time),static_cast(-10)); } if (Counter_Durchzug >= 10.0) { @@ -1651,10 +1657,11 @@ void Step(void) double Skalierung_Ueberhitzung_PT1 = Skalierung_Ueberhitzung_Kennfeld_Max; - // Magnetventil Kühlung - - // Stellgrad Kühlung + /* -------------------- */ + /* Magnetventil Kühlung */ + /* -------------------- */ + /* Stellgrad Kühlung */ if (Counter_Verdichter_aus > 60.0 && Counter_Verdichter_aus < 600.0) { Stellgrad_Kuehlventil = 1.0; @@ -1668,15 +1675,34 @@ void Step(void) Stellgrad_Kuehlventil = MAX(-Stellgrad_Kuehlung, 0.0) * Skalierung_Ueberhitzung_PT1 * Counter_Kuehlung_Freigabe; } - // Ende - f_PT1.Vapourize(...) + /* Puls Pause Generierung Kühlung */ + /* UJ: Aus ST-Code (Original) + * Todo - Konvertieren + Zyklus_Kuehlventil := Zyklus_Kuehlventil + sampling_time; - // PWM Generierung Kuehlventil - // bool step(double Stellgrad,double sampling_time){ + IF Ausgabe_Kuehlventil > 0.0 THEN + Kuehlventil := NOT Status_Untertemperatur; + Ausgabe_Kuehlventil := Ausgabe_Kuehlventil - sampling_time; + IF Ausgabe_Kuehlventil < 0.0 THEN + Zykluszeit_Kuehlventil := Zykluszeit_Kuehlventil - Ausgabe_Kuehlventil * 100.0 / MAX(Stellgrad_Kuehlventil, sampling_time / Zykluszeit_Kuehlventil_MAX * 100.0); + Ausgabe_Kuehlventil := 0.0; + END_IF; + ELSE + Kuehlventil := FALSE; + END_IF; - // f_PWMCoolingValve.Step(...) - Kuehlventil = PWM_Kuehlventil.step(Stellgrad_Kuehlventil, sampling_time); + IF Stellgrad_Kuehlventil > sampling_time / Zykluszeit_Kuehlventil_MAX * 100.0 THEN + IF Zyklus_Kuehlventil >= Zykluszeit_Kuehlventil OR Zyklus_Kuehlventil >= MAX(2.0 * Zykluszeit_Kuehlventil_MIN, sampling_time * 100.0 / Stellgrad_Kuehlventil) THEN + Ausgabe_Kuehlventil := MIN(Ausgabe_Kuehlventil + Stellgrad_Kuehlventil / 100.0 * Zykluszeit_Kuehlventil_MIN, Zykluszeit_Kuehlventil); + Zykluszeit_Kuehlventil := Zykluszeit_Kuehlventil_MIN; + Zyklus_Kuehlventil := 0.0; + END_IF; + END_IF; + */ - // Magnetventil Entfeuchtung + /* ------------------------- */ + /* Magnetventil Entfeuchtung */ + /* ------------------------- */ double T_Entfeuchtung; if (!Startup_finished) @@ -1696,8 +1722,8 @@ void Step(void) -30.0, Istwert_Temperatur); } - // Stellgrad Entfeuchtung + /* Stellgrad Entfeuchtung */ if (Istwert_Temperatur > 120.0 || Counter_Entfeuchtung_Freigabe <= 0.0) { Stellgrad_Entfeuchtungsventil = 0.0; @@ -1708,7 +1734,7 @@ void Step(void) Counter_Entfeuchtung_Freigabe; } - // Abtauzyklus + /* Abtauzyklus */ bool Freigabe_Abtauzyklus = Istwert_Feuchte > Sollwert_Feuchte_Absolut + 2.5; if (!Freigabe_Abtauzyklus) { @@ -1718,7 +1744,8 @@ void Step(void) Counter_Freigabe_Abtauzyklus += sampling_time; } double Skalierung_Abtauzyklus_Dauer = 0.0; - ; + + if (Abtauzyklus_Pause > 0.0 && Abtauzyklus_Dauer > 0.0) { Skalierung_Abtauzyklus_Dauer = limit(Counter_Freigabe_Abtauzyklus / (10.0 * (Abtauzyklus_Pause + Abtauzyklus_Dauer) * 60.0),