Initial Commit
This commit is contained in:
67
Boiler_2_Stufig_Mit_Fueler/README.md
Normal file
67
Boiler_2_Stufig_Mit_Fueler/README.md
Normal file
@@ -0,0 +1,67 @@
|
||||
# Manager_1
|
||||
Beschreibung des Moduls.
|
||||
|
||||
### Inhaltsverzeichnis
|
||||
|
||||
1. [Funktionsumfang](#1-funktionsumfang)
|
||||
2. [Voraussetzungen](#2-voraussetzungen)
|
||||
3. [Software-Installation](#3-software-installation)
|
||||
4. [Einrichten der Instanzen in IP-Symcon](#4-einrichten-der-instanzen-in-ip-symcon)
|
||||
5. [Statusvariablen und Profile](#5-statusvariablen-und-profile)
|
||||
6. [WebFront](#6-webfront)
|
||||
7. [PHP-Befehlsreferenz](#7-php-befehlsreferenz)
|
||||
|
||||
### 1. Funktionsumfang
|
||||
|
||||
*
|
||||
|
||||
### 2. Voraussetzungen
|
||||
|
||||
- IP-Symcon ab Version 7.1
|
||||
|
||||
### 3. Software-Installation
|
||||
|
||||
* Über den Module Store das 'Manager_1'-Modul installieren.
|
||||
* Alternativ über das Module Control folgende URL hinzufügen
|
||||
|
||||
### 4. Einrichten der Instanzen in IP-Symcon
|
||||
|
||||
Unter 'Instanz hinzufügen' kann das 'Manager_1'-Modul mithilfe des Schnellfilters gefunden werden.
|
||||
- Weitere Informationen zum Hinzufügen von Instanzen in der [Dokumentation der Instanzen](https://www.symcon.de/service/dokumentation/konzepte/instanzen/#Instanz_hinzufügen)
|
||||
|
||||
__Konfigurationsseite__:
|
||||
|
||||
Name | Beschreibung
|
||||
-------- | ------------------
|
||||
|
|
||||
|
|
||||
|
||||
### 5. Statusvariablen und Profile
|
||||
|
||||
Die Statusvariablen/Kategorien werden automatisch angelegt. Das Löschen einzelner kann zu Fehlfunktionen führen.
|
||||
|
||||
#### Statusvariablen
|
||||
|
||||
Name | Typ | Beschreibung
|
||||
------ | ------- | ------------
|
||||
| |
|
||||
| |
|
||||
|
||||
#### Profile
|
||||
|
||||
Name | Typ
|
||||
------ | -------
|
||||
|
|
||||
|
|
||||
|
||||
### 6. WebFront
|
||||
|
||||
Die Funktionalität, die das Modul im WebFront bietet.
|
||||
|
||||
### 7. PHP-Befehlsreferenz
|
||||
|
||||
`boolean GEF_BeispielFunktion(integer $InstanzID);`
|
||||
Erklärung der Funktion.
|
||||
|
||||
Beispiel:
|
||||
`GEF_BeispielFunktion(12345);`
|
||||
45
Boiler_2_Stufig_Mit_Fueler/form.json
Normal file
45
Boiler_2_Stufig_Mit_Fueler/form.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"type": "Label",
|
||||
"caption": "Konfiguration der nötigen Schaltkontakte und Nennleistungen"
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "IdleCounterMax",
|
||||
"caption": "Zyklen zwischen zwei Leisutungsänderungen",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "BoilerLeistungTeillast",
|
||||
"caption": "Leistug Teillast",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "BoilerLeistungVolllast",
|
||||
"caption": "Leistug Vollast",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
"type": "SelectVariable",
|
||||
"name": "Boilertemperatur",
|
||||
"caption": "Variable für Boilertemperatur",
|
||||
"test": true
|
||||
},
|
||||
{
|
||||
"type": "SelectVariable",
|
||||
"name": "Kontakt_Teillast",
|
||||
"caption": "Schaltkontakt Teillast",
|
||||
"test": true
|
||||
},
|
||||
{
|
||||
"type": "SelectVariable",
|
||||
"name": "Kontakt_Volllast",
|
||||
"caption": "Schaltkontakt Volllast",
|
||||
"test": true
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
12
Boiler_2_Stufig_Mit_Fueler/module.json
Normal file
12
Boiler_2_Stufig_Mit_Fueler/module.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"id": "{64ECCE9F-7757-0ABA-0B81-501108A25565}",
|
||||
"name": "Boiler_2_Stufig_Mit_Fueler",
|
||||
"type": 3,
|
||||
"vendor": "Belevo AG",
|
||||
"aliases": [],
|
||||
"parentRequirements": [],
|
||||
"childRequirements": [],
|
||||
"implemented": [],
|
||||
"prefix": "GEF",
|
||||
"url": ""
|
||||
}
|
||||
221
Boiler_2_Stufig_Mit_Fueler/module.php
Normal file
221
Boiler_2_Stufig_Mit_Fueler/module.php
Normal file
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
|
||||
class Boiler_2_Stufig_Mit_Fueler extends IPSModule
|
||||
{
|
||||
public function Create()
|
||||
{
|
||||
parent::Create();
|
||||
|
||||
// Prioritäten
|
||||
$this->RegisterVariableInteger("LockPrio", "LockPrio");
|
||||
$this->RegisterVariableInteger("UserPrio", "UserPrio");
|
||||
|
||||
// Energiehandling
|
||||
$this->RegisterVariableBoolean("Idle", "Idle", "", 0);
|
||||
$this->RegisterVariableInteger("CurrentPower", "CurrentPower", "", 0);
|
||||
$this->RegisterVariableFloat("UsedEnergy", "UsedEnergy", "", 0);
|
||||
$this->RegisterVariableString("PowerSteps", "PowerSteps"); // PowerSteps-Variable registrieren
|
||||
|
||||
// Trägheit system
|
||||
$this->RegisterPropertyInteger("IdleCounterMax", 2);
|
||||
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
|
||||
$this->SetValue("IdleCounter", 0);
|
||||
|
||||
// Boiler spezifische Properties
|
||||
$this->RegisterPropertyInteger("BoilerLeistungTeillast", 3000);
|
||||
$this->RegisterPropertyInteger("BoilerLeistungVolllast", 6000);
|
||||
$this->RegisterPropertyInteger("Boilertemperatur", 0);
|
||||
|
||||
// Boiler spezifische Variablen
|
||||
$this->RegisterVariableInteger("Boilermintemp","Boilermintemp","",45);
|
||||
$this->RegisterVariableInteger("Boilermaxtemp","Boilermaxtemp","",60);
|
||||
$this->RegisterVariableInteger("Boilerlegiotemp","Boilerlegiotemp","",65);
|
||||
$this->RegisterVariableInteger("LegioCounter", "LegioCounter", "", 0);
|
||||
|
||||
// Schaltkontakte
|
||||
$this->RegisterPropertyInteger("Kontakt_Teillast", 0);
|
||||
$this->RegisterPropertyInteger("Kontakt_Volllast", 0);
|
||||
|
||||
// Initialisieren
|
||||
$this->SetValue("Idle", true);
|
||||
}
|
||||
|
||||
public function ApplyChanges()
|
||||
{
|
||||
parent::ApplyChanges();
|
||||
}
|
||||
|
||||
// Aktionen verarbeiten
|
||||
public function RequestAction($Ident, $Value)
|
||||
{
|
||||
switch ($Ident) {
|
||||
case "SetCurrentPower":
|
||||
$this->SetCurrentPower($Value);
|
||||
break;
|
||||
case "GetCurrentData":
|
||||
return $this->GetCurrentData($Value);
|
||||
default:
|
||||
throw new Exception("Invalid Ident");
|
||||
}
|
||||
}
|
||||
|
||||
// Methode zum Setzen des aktuellen Stromverbrauchs
|
||||
public function SetCurrentPower(int $power)
|
||||
{
|
||||
// Schalte Kontakt Teillast und Vollast entsprechend der Power-Einstellung
|
||||
if ($power == $this->ReadPropertyInteger("BoilerLeistungVolllast")) {
|
||||
SetValue($this->ReadPropertyInteger("Kontakt_Volllast"), true);
|
||||
SetValue($this->ReadPropertyInteger("Kontakt_Teillast"), false);
|
||||
} elseif (
|
||||
$power == $this->ReadPropertyInteger("BoilerLeistungTeillast")
|
||||
) {
|
||||
SetValue($this->ReadPropertyInteger("Kontakt_Volllast"), false);
|
||||
SetValue($this->ReadPropertyInteger("Kontakt_Teillast"), true);
|
||||
} else {
|
||||
SetValue($this->ReadPropertyInteger("Kontakt_Volllast"), false);
|
||||
SetValue($this->ReadPropertyInteger("Kontakt_Teillast"), false);
|
||||
}
|
||||
|
||||
// Prüfe auf Änderung der Power im Vergleich zur letzten Einstellung
|
||||
$lastPower = GetValue($this->GetIDForIdent("CurrentPower"));
|
||||
if ($power != $lastPower) {
|
||||
$this->SetValue("Idle", false);
|
||||
$this->SetValue(
|
||||
"IdleCounter",
|
||||
$this->ReadPropertyInteger("IdleCounterMax")
|
||||
);
|
||||
}
|
||||
|
||||
// Setze die neue CurrentPower
|
||||
$this->SetValue("CurrentPower", $power);
|
||||
|
||||
// IdleCounter verarbeiten
|
||||
$this->ProcessIdleCounter();
|
||||
}
|
||||
|
||||
// Methode zum Abrufen der aktuellen Daten
|
||||
public function GetCurrentData(bool $Peak)
|
||||
{
|
||||
$LegioCounter = $this->GetValue("LegioCounter");
|
||||
|
||||
$boilerTemp = GetValue($this->ReadPropertyInteger("Boilertemperatur"));
|
||||
$minTemp = $this->GetValue("Boilermintemp");
|
||||
$maxTemp = $this->GetValue("Boilermaxtemp");
|
||||
$LegioTemp = $this->GetValue("Boilerlegiotemp");
|
||||
$teilLeistung = $this->ReadPropertyInteger("BoilerLeistungTeillast");
|
||||
$vollLeistung = $this->ReadPropertyInteger("BoilerLeistungVolllast");
|
||||
|
||||
$AktuelleVollast = GetValue(
|
||||
$this->ReadPropertyInteger("Kontakt_Volllast")
|
||||
);
|
||||
$AktuelleTeillast = GetValue(
|
||||
$this->ReadPropertyInteger("Kontakt_Teillast")
|
||||
);
|
||||
|
||||
if ($boilerTemp > $LegioTemp) {
|
||||
$LegioCounter = 0;
|
||||
} else {
|
||||
$LegioCounter = $LegioCounter + 1;
|
||||
}
|
||||
if ($LegioCounter > 69120) {
|
||||
$maxTemp = $LegioTemp;
|
||||
}
|
||||
if ($LegioCounter > 120960 && $this->ist_nachts()) {
|
||||
$minTemp = $LegioTemp;
|
||||
}
|
||||
|
||||
$this->SetValue("LegioCounter", $LegioCounter);
|
||||
|
||||
if ($Peak) {
|
||||
if ($boilerTemp < $minTemp) {
|
||||
$this->SetValue(
|
||||
"PowerSteps",
|
||||
json_encode([0, $teilLeistung, $vollLeistung])
|
||||
);
|
||||
} elseif (
|
||||
$boilerTemp < $minTemp + 5 &&
|
||||
($AktuelleVollast || $AktuelleTeillast)
|
||||
) {
|
||||
$this->SetValue(
|
||||
"PowerSteps",
|
||||
json_encode([0, $teilLeistung, $vollLeistung])
|
||||
);
|
||||
} else {
|
||||
$this->SetValue("PowerSteps", json_encode([0]));
|
||||
}
|
||||
} else {
|
||||
if ($boilerTemp < $minTemp) {
|
||||
$this->SetValue("PowerSteps", json_encode([$vollLeistung]));
|
||||
} elseif (
|
||||
$boilerTemp < $minTemp + 5 &&
|
||||
($AktuelleVollast || $AktuelleTeillast)
|
||||
) {
|
||||
$this->SetValue("PowerSteps", json_encode([$vollLeistung]));
|
||||
} elseif ($boilerTemp < $maxTemp - 5) {
|
||||
$this->SetValue(
|
||||
"PowerSteps",
|
||||
json_encode([0, $teilLeistung, $vollLeistung])
|
||||
);
|
||||
} elseif (
|
||||
$boilerTemp < $maxTemp &&
|
||||
($AktuelleVollast || $AktuelleTeillast)
|
||||
) {
|
||||
$this->SetValue(
|
||||
"PowerSteps",
|
||||
json_encode([0, $teilLeistung, $vollLeistung])
|
||||
);
|
||||
} else {
|
||||
$this->SetValue("PowerSteps", json_encode([0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function ProcessIdleCounter()
|
||||
{
|
||||
// IdleCounter auslesen und verarbeiten
|
||||
$idleCounter = $this->GetValue("IdleCounter");
|
||||
if ($idleCounter > 0) {
|
||||
$this->SetValue("Idle", false);
|
||||
$this->SetValue("IdleCounter", $idleCounter - 1);
|
||||
} else {
|
||||
$this->SetValue("Idle", true);
|
||||
}
|
||||
}
|
||||
|
||||
private function CheckIdle($power)
|
||||
{
|
||||
$lastpower = GetValue("CurrentPower");
|
||||
if ($lastpower != GetValue("CurrentPower")) {
|
||||
$this->SetValue("Idle", false);
|
||||
$this->SetValue(
|
||||
"IdleCounter",
|
||||
$this->ReadPropertyInteger("IdleCounterMax")
|
||||
);
|
||||
}
|
||||
// IdleCounter auslesen und verarbeiten
|
||||
$idleCounter = $this->GetValue("IdleCounter");
|
||||
if ($idleCounter > 0) {
|
||||
$this->SetValue("Idle", false);
|
||||
$this->SetValue("IdleCounter", $idleCounter - 1);
|
||||
} else {
|
||||
$this->SetValue("Idle", true);
|
||||
}
|
||||
}
|
||||
|
||||
private function ist_nachts()
|
||||
{
|
||||
date_default_timezone_set("Europe/Berlin"); // Setze hier deine Zeitzone
|
||||
|
||||
$aktuelle_zeit = strtotime(date("H:i")); // Aktuelle Zeit in Stunden und Minuten umwandeln
|
||||
$start_nacht = strtotime("22:00"); // Startzeit der Nacht (22 Uhr)
|
||||
$ende_nacht = strtotime("07:00"); // Endzeit der Nacht (7 Uhr)
|
||||
|
||||
if ($aktuelle_zeit >= $start_nacht || $aktuelle_zeit < $ende_nacht) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user