Some reconstruction and formatting

This commit is contained in:
Uwe Jakobeit
2026-04-04 22:13:21 +02:00
parent 47196263f8
commit fe49b993b4

View File

@@ -648,7 +648,9 @@ void Step(void)
if (Temperatursprung)
{
Sollwert_Feuchte_Absolut = limit(Sollwert_Feuchte * p_H2Omax_Sollwert / p_H2Omax_Istwert, 0.0, Sollwert_Feuchte);
Sollwert_Feuchte_Absolut = limit(Sollwert_Feuchte * p_H2Omax_Sollwert / p_H2Omax_Istwert,
0.0,
Sollwert_Feuchte);
}
else
{
@@ -663,7 +665,7 @@ void Step(void)
// ------------------
// Überwachungsregler
// ------------------
Modus_Ueberwachungsregler = static_cast<std::uint32_t>(UTILITY_FUNCTIONS::GET_VALUE_DINT(71,0,3,0));
Modus_Ueberwachungsregler = UTILITY_FUNCTIONS::GET_VALUE_DINT(71,0,3,0);
Grenzwert_Uebertemperatur = UTILITY_FUNCTIONS::GET_VALUE_REAL(71,0,4,0);
Offset_Ueberwachungsregler = UTILITY_FUNCTIONS::GET_VALUE_REAL(71,0,5,0);
@@ -701,7 +703,7 @@ void Step(void)
Counter_Status_Uebertemperatur = 0;
}
Status_Uebertemperatur = (Counter_Status_Uebertemperatur >= static_cast<std::uint32_t>(10 * 4));
Status_Uebertemperatur = (Counter_Status_Uebertemperatur >= 10 * 4);
StatusQuittierung_Uebertemperatur = (Status_Uebertemperatur && Counter_Status_Uebertemperatur < static_cast<std::uint32_t>(11 * 4)) ||
(StatusQuittierung_Uebertemperatur && Sammelalarm_quittiert);
@@ -2268,33 +2270,95 @@ void Step(void)
private:
// ===== ST: VAR CONSTANT =====
static constexpr double sampling_time = 0.25;
// Zeitkonstanten etc.
static constexpr double Tau_Heizung_Tv = 10.0;
static constexpr double Regler_Kuehlung_Tv = 5.0;
static constexpr double Tau_Kuehlung_Tv = 30.0;
double Theta_I_Kuehlung = 1.0;
// Reglerparameter
double Regler_Befeuchtung_Tv = 30.0;
double Regler_Befeuchtung_Tn = 100.0;
double Regler_Befeuchtung_Tz = 1200.0;
double Tau_Befeuchtung_Tv = 10.0;
double Tau_Befeuchtung_Tz = 5.0;
double Regler_Entfeuchtung_Tv = 5.0;
double Regler_Entfeuchtung_Tn = 200.0;
double Tau_Entfeuchtung_Tv = 60.0;
double Theta_I_Entfeuchtung = 0.1;
double C_Entfeuchtung = 200.0;
double U_Entfeuchtung = 0.4;
double P_Entfeuchtung = 500.0;
double Regler_Tuer_Tn = 700.0;
double Regler_Tuer_Tv = 60.0;
double Tau_Tuer_Tv = 60.0;
double Drehzahl_Verdichter_MIN = 1800.0;
double Drehzahl_Verdichter_MAX = 4500.0;
double Drehzahl_Verdichter_adaptiv = 0.0;
const double Temperatur_Feuchtemodul_MAX = 200.0;
double Sollwert_Temperatur_Feuchtemodul_MIN = 110.0;
double Sollwert_Temperatur_Feuchtemodul_MAX = 130.0;
double Durchflussmenge_Einlassventil_Feuchtemodul = 400.0;
double Durchflussmenge_Abschlaemmventil_Feuchtemodul = 1500.0;
// Faktoren
static constexpr double F_Xp_Heizung = 3.8;
static constexpr double F_Xp_Kuehlung = 33.6;
static constexpr double F_Xp_Befeuchtung_BINDER = 131.0;
static constexpr double F_Xp_Entfeuchtung = 100.0;
static constexpr double F_Xp_Tuer = 10.0;
/////////////////////////////////////////
/// VAR, VAR RETAIN
double Abschlaemmintegral = 0.0;
//######################################
double Regelabweichung_Tuer_alt{};
double Regler_Heizung_Xp{};
double Regler_Kuehlung_Xp{};
double Regler_Befeuchtung_Xp{};
double Regler_Entfeuchtung_Xp{};
double Regler_Tuer_Xp{};
static constexpr std::array<std::array<double, 13>, 4> Kennfeld_Ueberhitzung{
{// 0: Temperatur
std::array<double, 13>{-20.0, -10.0, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0,
60.0, 70.0, 80.0, 90.0, 100.0},
// 1: Skalierung Min
std::array<double, 13>{0.01, 0.02, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7,
0.8, 0.9, 1.0, 1.0},
// 2: Skalierung Max
std::array<double, 13>{0.01, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,
1.0, 1.0, 1.0},
// 3: Sollwert Überhitzung
std::array<double, 13>{-6.0, -8.0, -10.0, -8.0, -6.0, -8.0, -10.0, -12.0,
-16.0, -20.0, -24.0, -28.0, -32.0}}};
{// 0: Temperatur
std::array<double, 13>{-20.0, -10.0, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0,
60.0, 70.0, 80.0, 90.0, 100.0},
// 1: Skalierung Min
std::array<double, 13>{0.01, 0.02, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7,
0.8, 0.9, 1.0, 1.0},
// 2: Skalierung Max
std::array<double, 13>{0.01, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,
1.0, 1.0, 1.0},
// 3: Sollwert Überhitzung
std::array<double, 13>{-6.0, -8.0, -10.0, -8.0, -6.0, -8.0, -10.0, -12.0,
-16.0, -20.0, -24.0, -28.0, -32.0}}};
static constexpr std::array<std::array<double, 13>, 4> Kennfeld_Entfeuchtung{
{// 0: Temperatur
std::array<double, 13>{-20.0, -10.0, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0,
60.0, 70.0, 80.0, 90.0, 100.0},
// 1: Skalierung Entfeuchtung
std::array<double, 13>{0.08, 0.08, 0.08, 0.10, 0.12, 0.14, 0.16, 0.18,
0.20, 0.22, 0.24, 0.26, 0.28},
// 2: Abtauzyklus Pause
std::array<double, 13>{120.0, 120.0, 120.0, 120.0, 120.0, 90.0, 60.0,
60.0, 60.0, 0.0, 0.0, 0.0, 0.0},
// 3: Abtauzyklus Dauer
std::array<double, 13>{60.0, 60.0, 60.0, 30.0, 20.0, 10.0, 8.0, 4.0, 2.0,
0.0, 0.0, 0.0, 0.0}}};
{// 0: Temperatur
std::array<double, 13>{-20.0, -10.0, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0,
60.0, 70.0, 80.0, 90.0, 100.0},
// 1: Skalierung Entfeuchtung
std::array<double, 13>{0.08, 0.08, 0.08, 0.10, 0.12, 0.14, 0.16, 0.18,
0.20, 0.22, 0.24, 0.26, 0.28},
// 2: Abtauzyklus Pause
std::array<double, 13>{120.0, 120.0, 120.0, 120.0, 120.0, 90.0, 60.0,
60.0, 60.0, 0.0, 0.0, 0.0, 0.0},
// 3: Abtauzyklus Dauer
std::array<double, 13>{60.0, 60.0, 60.0, 30.0, 20.0, 10.0, 8.0, 4.0, 2.0,
0.0, 0.0, 0.0, 0.0}}};
// Kennfelder (nur die, die oben genutzt werden; den Rest kannst du genauso
// hinzufügen)
@@ -2334,21 +2398,18 @@ private:
std::array<double, 9>{1.00, 0.80, 0.60, 0.50, 0.40, 0.35, 0.30, 0.25, 0.20},
std::array<double, 9>{1.00, 0.80, 0.60, 0.50, 0.40, 0.35, 0.30, 0.25, 0.20}}};
static constexpr std::array<std::array<double, 11>, 3>
static constexpr std::array<std::array<double, 11>, 3>
Kennfeld_Sollwert_Feuchte_Limit{
{std::array<double, 11>{0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100},
std::array<double, 11>{80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80},
std::array<double, 11>{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}};
// Zeitkonstanten etc.
static constexpr double Tau_Heizung_Tv = 10.0;
QList<QList<double>> Kennfeld_Sollwert_Feuchte_Limit_List{
{0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100},
{80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
// Faktoren
static constexpr double F_Xp_Heizung = 3.8;
static constexpr double F_Xp_Kuehlung = 33.6;
static constexpr double F_Xp_Befeuchtung_BINDER = 131.0;
static constexpr double F_Xp_Entfeuchtung = 100.0;
static constexpr double F_Xp_Tuer = 10.0;
// ===== ST: VAR (Zustände / Merker) =====
// (ich halte hier nur die, die im übersetzten Teil genutzt werden; den Rest
@@ -2361,17 +2422,18 @@ private:
double Regelabweichung_Befeuchtung_alt = 0.0;
double P_Anteil_Befeuchtung = 0.0;
double Counter_Entfeuchtung_Freigabe = 0.0;
bool Freigabe_Entfeuchtung = false;
double Counter_Heizung_Freigabe = 0.0;
bool Freigabe_Heizung = false;
double Counter_Befeuchtung_Freigabe = 0.0;
bool Freigabe_Befeuchtung = false;
bool Abtauzyklus = false;
double Counter_Zyklus_Entleeren = 0.0;
double Drehzahl_Verdichter_Kuehlung = 0.0;
double Drehzahl_Verdichter_Entfeuchtung = 0.0;
double Drehzahl_Verdichter = 0.0;
bool Freigabe_Entfeuchtung = false;
bool Freigabe_Heizung = false;
bool Freigabe_Befeuchtung = false;
bool Abtauzyklus = false;
/*PWM(double zyklus_min, double zyklus_max, double initial_zykluszeit = -1.0)
noexcept : Zyklus(0.0), Ausgabe(0.0), Zykluszeit((initial_zykluszeit > 0.0) ?
initial_zykluszeit : zyklus_max), Zyklus_MIN(zyklus_min),
@@ -2389,20 +2451,17 @@ private:
PWM PWM_Entfeuchtungsventil = {10.0, 600.0, 0.0};
double Istwert_Ueberwachungsregler{};
std::uint32_t Modus_Ueberwachungsregler{};
int32_t Modus_Ueberwachungsregler{};
double Offset_Ueberwachungsregler{};
double Klasse_Ueberwachungsregler{};
bool Wasserkanister_leer{};
double Regler_Tuer_Tn = 700.0;
double Regler_Tuer_Tv = 60.0;
double Tau_Tuer_Tv = 60.0;
double Regler_Entfeuchtung_MAX = 0.0;
double Regler_Entfeuchtung_MIN = 0.0;
double Regler_Entfeuchtung_I_Anteil_MAX = 0.0;
double Regler_Entfeuchtung_I_Anteil_MIN = 0.0;
bool Freigabe_Kuehlung = false;
double Sollwert_Temperatur_Feuchtemodul_MIN = 110.0;
double Sollwert_Temperatur_Feuchtemodul_MAX = 130.0;
double Zyklus_Entleeren_Mittelwert = 600.0;
double Grenzwert_Uebertemperatur{};
@@ -2429,9 +2488,9 @@ private:
bool Sammelalarm{};
bool Sammelalarm_quittiert{};
bool Sammelalarm_quittiert_alt{};
double Regler_Kuehlung_Tv = 5.0;
double Tau_Kuehlung_Tv = 30.0;
double Theta_I_Kuehlung = 1.0;
// Feuchte absolut
double p_H2Omax_Sollwert{};
@@ -2447,13 +2506,11 @@ private:
double Counter_Tuer_geschlossen{};
double Istwert_Temperatur_Tuer{};
double Regelabweichung_Tuer{};
double Regelabweichung_Tuer_alt{};
double Abschlaemmintegral = 0.0;
double Standby_Feuchtemodul = 0.0;
double Regelabweichung_Befeuchtung_alt_alt = 0.0;
double Regelabweichung_Entfeuchtung_alt = 0.0;
double Durchflussmenge_Einlassventil_Feuchtemodul = 400.0;
double Durchflussmenge_Abschlaemmventil_Feuchtemodul = 1500.0;
// Startup / reset
std::uint32_t Counter_reset_flag{};
@@ -2477,17 +2534,7 @@ private:
std::uint16_t Index_Temperatur{};
std::uint16_t Index_Temperatur_ohne_Feuchte{};
// Reglerparameter
double Regler_Heizung_Xp{};
double Regler_Kuehlung_Xp{};
double Regler_Befeuchtung_Xp{};
double Regler_Entfeuchtung_Xp{};
double Regler_Tuer_Xp{};
double Regler_Befeuchtung_Tv = 30.0;
double Regler_Befeuchtung_Tn = 100.0;
double Regler_Befeuchtung_Tz = 1200.0;
double Tau_Befeuchtung_Tv = 10.0;
double Tau_Befeuchtung_Tz = 5.0;
// Regelkern Temperatur
double Sollwert_Temperatur_MIN{};
@@ -2541,7 +2588,6 @@ private:
const double Regler_Kuehlung_Tn = 200.0;
double Stellgrad_Feuchtemodul_Boost{};
const double Temperatur_Feuchtemodul_MAX = 200.0;
// Feuchte - nur Platzhalter (weil spätere Ausdrücke referenzieren)
double Regelabweichung_Feuchte{};
@@ -2612,17 +2658,10 @@ private:
bool Entleerbehaelter_Oben{};
bool Entleerbehaelter_Unten{};
double Counter_Wasserkanister_leer{};
double Regler_Entfeuchtung_Tv = 5.0;
double Regler_Entfeuchtung_Tn = 200.0;
double Tau_Entfeuchtung_Tv = 60.0;
double Theta_I_Entfeuchtung = 0.1;
double C_Entfeuchtung = 200.0;
double U_Entfeuchtung = 0.4;
double P_Entfeuchtung = 500.0;
double Regler_Entfeuchten_I_Anteil_MIN = 0.0;
double Drehzahl_Verdichter_MIN = 1800.0;
double Drehzahl_Verdichter_MAX = 4500.0;
double Drehzahl_Verdichter_adaptiv = 0.0;
// Alarmbits mit Selbsthaltung
bool alarm_09{};