58 lines
2.2 KiB
PHP
58 lines
2.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Belevo\EnelixEMS;
|
|
|
|
/**
|
|
* Gemeinsame Registrierung und Sollwert-Bereinigung aller EMS-Verbraucher.
|
|
*
|
|
* Das Trait ist noch keine vollstaendige Steuerungsimplementierung. Die
|
|
* konkreten Module ergaenzen Geraeteanbindung, Leistungsangebot und Zustand.
|
|
*/
|
|
trait VerbraucherBasisTrait
|
|
{
|
|
protected function verwerfeSollwert(): void
|
|
{
|
|
// Lokale Ersatzleistungen nicht bei jedem weiteren Timeout kurz auf 0 setzen.
|
|
if (!(bool) $this->leseZustand('SollwertGueltig')) {
|
|
return;
|
|
}
|
|
$this->setzeZustand('SollwertGueltig', false);
|
|
$this->setzeZustand('Sollleistung', 0);
|
|
}
|
|
|
|
protected function bereinigeUngueltigenSollwert(): void
|
|
{
|
|
// Auch vor dem Update gespeicherte, bereits ungueltige Vorgaben bereinigen.
|
|
if (!(bool) $this->leseZustand('SollwertGueltig')) {
|
|
$this->setzeZustand('Sollleistung', 0);
|
|
}
|
|
}
|
|
|
|
protected function registriereVerbraucherBasis(): void
|
|
{
|
|
$this->RegisterPropertyInteger('PrioritaetPV', 0);
|
|
$this->RegisterPropertyInteger('PrioritaetPeak', 0);
|
|
$this->RegisterPropertyInteger('Meldeintervall', 10);
|
|
$this->RegisterPropertyInteger('VorgabeTimeout', 120);
|
|
$this->RegisterPropertyBoolean('EinstellungenInVisu', false);
|
|
$this->RegisterPropertyBoolean('LoggingEin', false);
|
|
|
|
$this->RegisterVariableBoolean('Aktiv', 'Aktiv', '~Switch', 10);
|
|
$this->EnableAction('Aktiv');
|
|
}
|
|
|
|
protected function registriereVerbraucherDiagnose(): void
|
|
{
|
|
$this->RegisterVariableFloat('Istleistung', 'Istleistung', '', 20);
|
|
$this->RegisterVariableInteger('Leistungsquelle', 'Leistungsquelle', '', 30);
|
|
$this->RegisterVariableInteger('Sollleistung', 'Sollleistung', '', 40);
|
|
$this->RegisterVariableBoolean('SollwertGueltig', 'Sollwert gueltig', '~Switch', 50);
|
|
$this->RegisterVariableBoolean('Verfuegbar', 'Verfuegbar', '~Switch', 60);
|
|
$this->RegisterVariableBoolean('AenderungMoeglich', 'Aenderung moeglich', '~Switch', 70);
|
|
$this->RegisterVariableBoolean('Stoerung', 'Stoerung', '', 80);
|
|
$this->RegisterVariableString('Stoertext', 'Stoertext', '', 90);
|
|
}
|
|
}
|