Skip to content
Snippets Groups Projects
Commit f8648d78 authored by Peter Altenbernd's avatar Peter Altenbernd
Browse files

Bugfixes HotwaterControl

parent 4d33cccb
No related branches found
No related tags found
No related merge requests found
......@@ -144,33 +144,22 @@ void HeatControl::grant(bool ON)
*/
void HeatControl::suspend(bool maxTemp)
{
// qDebug() << "XXXXX HeatControl::suspend(" << maxTemp << ")" << name();
// if (not maxTemp) // setzt auf MinTemp, falls Zeit um
// checkSusExpiration();
Suspension suspendedOld = m_suspended;
if (maxTemp)
m_suspended = Suspension::MaxTemp;
else
// if (m_suspended != Suspension::MaxTemp) // nicht überschreiben
m_suspended = Suspension::MinTemp;
// Zeit wird nur neu gesetzt, wenn sich der Zustand ändert:
if (suspendedOld != m_suspended) {
QDateTime now = SHsensor::currentTime();
// QTime newExpireTime = SHsensor::currentTime().addSecs(60*suspensionTime());
QDateTime newExpireTime = now.addSecs(60*suspensionTime());
// if (now < m_startTimeDay and newExpireTime > m_startTimeDay) // es ist noch Nacht, aber potenzielle expireTime liegt im Tag
// m_expireTime = m_startTimeDay; // => Setze expireTime auf Tagesbeginn
// else
m_expireTime = newExpireTime;
}
// qDebug() << "-> HeatControl::suspend" << (int) m_suspended << m_expireTime << "XXXXXXXXXXXXXX";
}
......@@ -329,6 +318,15 @@ bool HeatControl::suspended() const
/*
*
*/
QDateTime HeatControl::expireTime() const
{
return m_expireTime;
}
/*
*
*/
......
......@@ -45,7 +45,7 @@ public:
void checkMaxTempSus(bool supplyPossible);
void checkMinTempSus(bool supplyPossible);
QString output() const;
virtual QString output() const;
signals:
......@@ -107,6 +107,8 @@ public:
static void remoteOn(int pos);
static void resumeMode(int pos);
QDateTime expireTime() const;
private:
static HeatControl * C[SHNodeIdSize * SHSensorIdSize];
static QFile m_file;
......
......@@ -15,20 +15,37 @@ HotwaterControl::HotwaterControl(SHactuator *swtch, QObject *parent) :
}
/*
*
*/
bool HotwaterControl::maxReached() const
unsigned int HotwaterControl::relevantDemand() const
{
unsigned int ivalue;
if (m_switch->switchState() == SHactuator::State::ON) {
QString svalue= m_consumer->value();
bool ok;
int fvalue = svalue.toFloat(&ok);
ivalue = svalue.toUInt(&ok);
if (not ok)
return true; // diskuabel!
ivalue = 0; // diskuabel!
} else if (suspended())
ivalue = 0;
else
ivalue = m_switch->powerDemand();
return ivalue;
}
return (fvalue <= 0); // ggf. <= 10 o.Ä.
/*
*
*/
bool HotwaterControl::maxReached() const
{
return (relevantDemand() <= 0); // ggf. <= 10 o.Ä.
}
......@@ -51,3 +68,16 @@ int HotwaterControl::suspensionTime() const
/*
*
*/
QString HotwaterControl::output() const
{
return " " + name() + "(" + QString::number(relevantDemand()) + "):";
}
......@@ -13,10 +13,17 @@ private:
friend class TestSHserver;
SHsensor *m_consumer; // weil Tasmota
// bool m_usePresetDemand = true; // veranschlagten Wert setzen, bis ON
unsigned int relevantDemand() const;
virtual bool maxReached() const override;
virtual bool minReached() const override;
virtual int suspensionTime() const override;
virtual QString output() const override;
};
......
......@@ -88,8 +88,6 @@ void SolarControl::process() {
s_output += "ON";
} else {
swtch->grant(false); // switch off
swtch->checkMaxTempSus(supplyPossible); // ggf. auf MaxTemp Suspension setzen
if (swtch->suspended()) // Zeit ggf. abgelaufen
......@@ -100,6 +98,8 @@ void SolarControl::process() {
if (swtch->suspended()) // check reset im Zustand MinTemp (weil die Rahmenbedingungen sich geändert haben)
swtch->checkResetSus(supplyPossible);
swtch->grant(false); // switch off
s_output += swtch->susName();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment