Files
BinderBeispielRegler/app/datamodel.h
2026-04-06 01:03:19 +02:00

200 lines
6.7 KiB
C++
Executable File

#ifndef DATAMODEL_H
#define DATAMODEL_H
/*
File: datamodel.h
Description: This is a C++ source file containing definitions for the project's datamodel .
Rev: 0.1
Created: 20.03.2026
Author: Uwe Jakobeit
Copyright: Binder GmbH TUT
Purpose: Definitions, constants used by the datamodel are collected here
Notes: [Any relevant details, such as dependencies, usage examples, or known issues.]
*/
#include <QList>
#include "dataset.h"
#define HeadlineOverheat Kennfeld_Ueberhitzung
#define HeadlineOverheatDefault Kennfeld_Ueberhitzung_Default
// Inputs for the component 'control-algorithm', not (only) to be seen als physical inputs e.g. from a sensor
typedef struct Inputs
{
struct BinInputs {
// Eingangswerte aus bool_inXX / real_inXX / reset_flag
bool reset_flag{};
bool Sammelalarm_quittiert{};
bool Tuer_offen{};
bool Sollwert_Feuchte_aktiv{};
bool Steuerkontakt_Standby{};
bool Steuerkontakt_Befeuchtung_aus{};
bool Steuerkontakt_Entfeuchtung_aus{};
bool Entleerbehaelter_Oben{};
bool Wasserkanister_leer{};
bool Entleerbehaelter_Unten{};
bool Sammelalarm{};
} bin;
struct AnalogInputs {
double Istwert_Temperatur{};
double Sollwert_Temperatur{};
double Temperaturband{};
double Istwert_Ueberwachungsregler{};
double Klasse_Ueberwachungsregler{};
double Grenzwert_Untertemperatur{};
double Istwert_Feuchte{};
double Sollwert_Feuchte{};
double Feuchteband{};
double Sollwert_Luefter{};
double Istwert_Temperatur_Tuer{};
double Istwert_Temperatur_Verdampferausgang{};
double Temperatur_Feuchtemodul{};
double Bandalarm_nach{};
double Betauungsschutz{};
double real_in11{}; // du nutzt real_in11 später direkt in alarm_15 ?? uj - todo : Kann das weg?
} analog;
}Input_t;
typedef struct Outputs
{
struct AnalogOutputs {
// real_outXX (nur die, die du im ST setzt)
double real_out01{};
double real_out02{};
double real_out04{};
double real_out05{};
double real_out06{};
double real_out07{};
double real_out08{};
double real_out09{};
double real_out10{};
double real_out11{};
double real_out12{};
double real_out13{};
double real_out14{};
double real_out16{};
double Stellgrad_Feuchtemodul{}; // ...out17
double real_out18{};
double real_out19{};
double real_out20{};
double real_out21{};
double real_out25{};
double real_out26{};
double Stellgrad_Heizung{};
double Stellgrad_Kuehlung{};
double Stellgrad_Befeuchtung{};
double Stellgrad_Entfeuchtung{};
double Counter_Tuer{};
} analog;
struct BinOutputs {
// bool_outXX
bool bool_out01{};
bool bool_out02{};
bool bool_out03{};
bool bool_out07{};
bool bool_out09{};
bool bool_out11{};
bool bool_out12{};
bool bool_out13{};
bool bool_out14{};
bool bool_out16{};
bool bool_out17{};
bool bool_out18{};
bool bool_out19{};
bool bool_out20{};
bool bool_out21{};
bool bool_out23{};
} bin;
}Output_t;
static constexpr double sampling_time = 0.25;
typedef struct Counter
{
}Counter_t;
class IInputs {
public:
virtual ~IInputs() = default;
// Pure virtual function returning a pointer to a vector
virtual QList<Input_t>* getInputs() = 0;
};
class DataModel: public IInputs
{
public:
DataModel();
QList<Input_t>* getInputs() override;
private:
Input_t input;
QList<Input_t> in{ input };
#ifndef BUILD_TARGET_SOM
QList<QList<double>> Kennfeld_Ueberhitzung;
QList<QList<double>> Kennfeld_Entfeuchtung;
QList<QList<double>> Kennfeld_Regler_Heizung_Xp;
QList<QList<double>> Kennfeld_Ueberhitzung_Default = {
{-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}, // 0: Temperatur
{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}, // 1: Skalierung Min
{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}, // 1: Skalierung Max
{-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} // 3: Sollwert Überhitzung
};
QList<QList<double>> Kennfeld_Entfeuchtung_Default{
{ -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}, // 0: Temperatur
{ 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}, // 1: Skalierung Entfeuchtung
{ 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}, // 2: Abtauzyklus Pause
{ 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} // 3: Abtauzyklus Dauer
};
QList<double> Kennfeld_Regler_Heizung_Xp_Default{
0.2, 0.5, 0.8, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
QList<double> Kennfeld_Regler_Kuehlung_Xp{
0.1, 0.1, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.0};
QList<QList<double>> Kennfeld_Regler_Befeuchtung_Xp{
{1.00, 0.54, 0.31, 0.18, 0.11, 0.07, 0.05, 0.03, 0.02},
{1.00, 0.54, 0.31, 0.18, 0.11, 0.07, 0.05, 0.03, 0.02},
{1.00, 0.54, 0.31, 0.18, 0.11, 0.07, 0.05, 0.03, 0.02},
{1.00, 0.54, 0.31, 0.18, 0.11, 0.07, 0.05, 0.03, 0.02},
{1.00, 0.54, 0.31, 0.18, 0.11, 0.07, 0.05, 0.03, 0.02},
{1.00, 0.54, 0.31, 0.18, 0.11, 0.07, 0.05, 0.03, 0.02},
{1.00, 0.54, 0.31, 0.18, 0.11, 0.07, 0.05, 0.03, 0.02},
{1.00, 0.54, 0.31, 0.18, 0.11, 0.07, 0.05, 0.03, 0.02},
{1.00, 0.54, 0.31, 0.18, 0.11, 0.07, 0.05, 0.03, 0.02}};
QList<QList<double>> Kennfeld_Regler_Entfeuchtung_Xp{
{1.00, 0.80, 0.60, 0.50, 0.40, 0.35, 0.30, 0.25, 0.20},
{1.00, 0.80, 0.60, 0.50, 0.40, 0.35, 0.30, 0.25, 0.20},
{1.00, 0.80, 0.60, 0.50, 0.40, 0.35, 0.30, 0.25, 0.20},
{1.00, 0.80, 0.60, 0.50, 0.40, 0.35, 0.30, 0.25, 0.20},
{1.00, 0.80, 0.60, 0.50, 0.40, 0.35, 0.30, 0.25, 0.20},
{1.00, 0.80, 0.60, 0.50, 0.40, 0.35, 0.30, 0.25, 0.20},
{1.00, 0.80, 0.60, 0.50, 0.40, 0.35, 0.30, 0.25, 0.20},
{1.00, 0.80, 0.60, 0.50, 0.40, 0.35, 0.30, 0.25, 0.20},
{1.00, 0.80, 0.60, 0.50, 0.40, 0.35, 0.30, 0.25, 0.20}};
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}};
#endif
};
#endif // DATAMODEL_H