no message
This commit is contained in:
67
Puffer/README.md
Normal file
67
Puffer/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);`
|
||||||
21
Puffer/form.json
Normal file
21
Puffer/form.json
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
{
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "Label",
|
||||||
|
"caption": "Konfiguration der nötigen Schaltkontakte und Nennleistungen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "NumberSpinner",
|
||||||
|
"name": "Interval",
|
||||||
|
"caption": "Intervall Neuberechnung der Werte Erst für spätere Versionen, aktuell auf 5 lassen!",
|
||||||
|
"suffix": "Sekunden"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "NumberSpinner",
|
||||||
|
"name": "IdleCounterMax",
|
||||||
|
"caption": "Zyklen zwischen zwei Leistungsänderungen (Multipliziert sich mit Interval)",
|
||||||
|
"suffix": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
12
Puffer/module.json
Normal file
12
Puffer/module.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"id": "{225BCE4B-2498-C994-6F15-E36D0C8BD8EA}",
|
||||||
|
"name": "Puffer",
|
||||||
|
"type": 3,
|
||||||
|
"vendor": "Belevo AG",
|
||||||
|
"aliases": [],
|
||||||
|
"parentRequirements": [],
|
||||||
|
"childRequirements": [],
|
||||||
|
"implemented": [],
|
||||||
|
"prefix": "GEF",
|
||||||
|
"url": ""
|
||||||
|
}
|
||||||
183
Puffer/module.php
Normal file
183
Puffer/module.php
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
|
||||||
|
<?php
|
||||||
|
class Puffer extends IPSModule
|
||||||
|
{
|
||||||
|
public function Create()
|
||||||
|
{
|
||||||
|
parent::Create();
|
||||||
|
// Boiler spezifische Properties
|
||||||
|
|
||||||
|
$this->RegisterPropertyInteger("PufferLeistung", 6000);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Variabeln für Kommunkation mit Manager
|
||||||
|
$this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio");
|
||||||
|
$this->RegisterVariableInteger("PV_Prio", "PV_Prio");
|
||||||
|
$this->RegisterVariableBoolean("Idle", "Idle", "", 0);
|
||||||
|
$this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0);
|
||||||
|
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0);
|
||||||
|
$this->RegisterVariableString("PowerSteps", "PowerSteps");
|
||||||
|
$this->RegisterVariableInteger("Power", "Power", '', 0);
|
||||||
|
$this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving", "", true);
|
||||||
|
$this->RegisterVariableInteger("Leistung_Delta", "Leistung_Delta", "", 0);
|
||||||
|
// Hilfsvariabeln für Idle zustand
|
||||||
|
$this->RegisterPropertyInteger("IdleCounterMax", 2);
|
||||||
|
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
|
||||||
|
$this->SetValue("IdleCounter", 0);
|
||||||
|
// Initialisiere Idle
|
||||||
|
$this->SetValue("Idle", true);
|
||||||
|
$this->RegisterTimer("Timer_Do_UserCalc_Boiler",$this->ReadPropertyInteger("Interval")*1000,"IPS_RequestAction(" .$this->InstanceID .', "Do_UserCalc", "");');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ApplyChanges()
|
||||||
|
{
|
||||||
|
parent::ApplyChanges();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function RequestAction($Ident, $Value)
|
||||||
|
{
|
||||||
|
switch ($Ident) {
|
||||||
|
case "SetAktuelle_Leistung":
|
||||||
|
$this->SetValue("Power", (int)$Value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "GetCurrentData":
|
||||||
|
$this->SetValue("Is_Peak_Shaving", (bool)$Value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Do_UserCalc":
|
||||||
|
$this->SetAktuelle_Leistung($this->GetValue("Power"));
|
||||||
|
$this->GetCurrentData($this->GetValue("Is_Peak_Shaving"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("Invalid Ident");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Methode zum Setzen des aktuellen Stromverbrauchs
|
||||||
|
public function SetAktuelle_Leistung(int $power)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Setze die neue Aktuelle_Leistung
|
||||||
|
$this->SetValue("Aktuelle_Leistung", $power);
|
||||||
|
$this->SetValue("Bezogene_Energie", ($this->GetValue("Bezogene_Energie") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600))));
|
||||||
|
// IdleCounter verarbeiten
|
||||||
|
$this->ProcessIdleCounter();
|
||||||
|
}
|
||||||
|
// Methode zum Abrufen der aktuellen Daten
|
||||||
|
public function GetCurrentData(bool $Peak)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$boilertemperatur_glätten = $this->ReadPropertyBoolean("Puffertemperatur_glätten");
|
||||||
|
if ($boilertemperatur_glätten) {
|
||||||
|
// Wenn Glättung aktiviert ist, führe das Glätten durch
|
||||||
|
$boilerFuehlerPT1ID = $this->ReadPropertyInteger("Pufferfuehler_PT1");
|
||||||
|
|
||||||
|
if (IPS_VariableExists($boilerFuehlerPT1ID)) {
|
||||||
|
$boilerPT1 = GetValue($boilerFuehlerPT1ID);
|
||||||
|
} else {
|
||||||
|
$boilerPT1 = 0.0; // Standardwert
|
||||||
|
}
|
||||||
|
|
||||||
|
$boilerTempID = $this->GetIDForIdent("Boilertemperatur");
|
||||||
|
if (IPS_VariableExists($boilerTempID)) {
|
||||||
|
$boilerTemp = $this->GetValue("Boilertemperatur");
|
||||||
|
} else {
|
||||||
|
$boilerTemp = 0.0; // Standardwert
|
||||||
|
}
|
||||||
|
|
||||||
|
// PT
|
||||||
|
$time_constant= $this->ReadPropertyInteger("ZeitKonstante");
|
||||||
|
$delta_t = 5; // Zeitdifferenz zwischen den Messungen (30 Sekunden)
|
||||||
|
$alpha = $delta_t / ($time_constant + $delta_t);
|
||||||
|
$newBoilerTemp = $boilerTemp + $alpha * ($boilerPT1 - $boilerTemp);
|
||||||
|
$this->SetValue("Puffertemperatur", $newBoilerTemp);
|
||||||
|
} else {
|
||||||
|
// Wenn Glättung nicht aktiviert ist, setze die Boilertemperatur direkt auf den Wert des Boilerfühlers
|
||||||
|
$boilerFuehlerPT1ID = $this->ReadPropertyInteger("Pufferfuehler_PT1");
|
||||||
|
|
||||||
|
if (IPS_VariableExists($boilerFuehlerPT1ID)) {
|
||||||
|
$boilerPT1 = GetValue($boilerFuehlerPT1ID);
|
||||||
|
} else {
|
||||||
|
$boilerPT1 = 0.0; // Standardwert
|
||||||
|
}
|
||||||
|
// Setze Boilertemperatur direkt auf den Wert des Boilerfühlers
|
||||||
|
$this->SetValue("Puffertemperatur", $boilerPT1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$at = GetValue($this->ReadPropertyInteger("Aussentemp"));
|
||||||
|
$this->SetValue("Aussentemperatur", $at);
|
||||||
|
$m = $this->GetValue("Steigung");
|
||||||
|
$minVT = $this->ReadPropertyInteger("MinVT_Temp"); // z.B. 20
|
||||||
|
$maxVT = $this->ReadPropertyInteger("MaxVT_Temp"); // z.B. 80
|
||||||
|
$maxAT = $this->ReadPropertyInteger("MaxAT_Temp"); // z.B. 20
|
||||||
|
$minAT = $this->ReadPropertyInteger("MinAT_Temp"); // z.B. 0
|
||||||
|
$m = ($maxVT - $minVT) / ($minAT - $maxAT);
|
||||||
|
$this->SetValue("Steigung", $m);
|
||||||
|
if ($at < $minAT){
|
||||||
|
$VT = $maxVT;
|
||||||
|
} elseif ($at > $maxAT){
|
||||||
|
$VT = $minVT;
|
||||||
|
} else {
|
||||||
|
$VT = $m * $at + $maxVT;
|
||||||
|
}
|
||||||
|
$this->SetValue("Maximaltemperatur", $VT );
|
||||||
|
$boilerTemp = $this->GetValue("Puffertemperatur");
|
||||||
|
$pufferLeistung = $this->ReadPropertyInteger("PufferLeistung");
|
||||||
|
$pufferTeilLeistung = $this->ReadPropertyInteger("PufferTeilLeistung");
|
||||||
|
$hyst = $this->GetValue("Hysterese");
|
||||||
|
|
||||||
|
if($VT < $boilerTemp){
|
||||||
|
$this->SetValue("Hysterese", false );
|
||||||
|
}elseif($VT-5 >= $boilerTemp){
|
||||||
|
$this->SetValue("Hysterese", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Peak) {
|
||||||
|
$this->SetValue( "PowerSteps", json_encode([0]) );
|
||||||
|
} else {
|
||||||
|
if ($boilerTemp < $VT && $hyst== true) {
|
||||||
|
$this->SetValue("PowerSteps", json_encode([0,$pufferTeilLeistung ,$pufferLeistung]));
|
||||||
|
} elseif ($boilerTemp > $VT - 5 && $hyst== false) {
|
||||||
|
$this->SetValue("PowerSteps", json_encode([0]));
|
||||||
|
} 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("Aktuelle_Leistung");
|
||||||
|
if ($lastpower != GetValue("Aktuelle_Leistung")) {
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user