no message
This commit is contained in:
@@ -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);`
|
||||
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"type": "ExpansionPanel",
|
||||
"caption": "Ziel-Module",
|
||||
"items": [
|
||||
{
|
||||
"type": "SelectInstance",
|
||||
"name": "CapacityTargetInstance",
|
||||
"caption": "Instanz für Kapazität / Auf das Nachladen"
|
||||
},
|
||||
{
|
||||
"type": "ValidationTextBox",
|
||||
"name": "CapacityTargetProperty",
|
||||
"caption": "Property-Name Kapazität"
|
||||
},
|
||||
{
|
||||
"type": "SelectInstance",
|
||||
"name": "PowerTargetInstance",
|
||||
"caption": "Instanz für Peakleistung"
|
||||
},
|
||||
{
|
||||
"type": "ValidationTextBox",
|
||||
"name": "PowerTargetProperty",
|
||||
"caption": "Property-Name Leistung"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "ExpansionPanel",
|
||||
"caption": "Monatswerte",
|
||||
"items": [
|
||||
{ "type": "NumberSpinner", "name": "CapacityJanuary", "caption": "Kapazität Januar [%]", "suffix": " %" },
|
||||
{ "type": "NumberSpinner", "name": "PowerJanuary", "caption": "Leistung Januar [W]", "suffix": " W" },
|
||||
|
||||
{ "type": "NumberSpinner", "name": "CapacityFebruary", "caption": "Kapazität Februar [%]", "suffix": " %" },
|
||||
{ "type": "NumberSpinner", "name": "PowerFebruary", "caption": "Leistung Februar [W]", "suffix": " W" },
|
||||
|
||||
{ "type": "NumberSpinner", "name": "CapacityMarch", "caption": "Kapazität März [%]", "suffix": " %" },
|
||||
{ "type": "NumberSpinner", "name": "PowerMarch", "caption": "Leistung März [W]", "suffix": " W" },
|
||||
|
||||
{ "type": "NumberSpinner", "name": "CapacityApril", "caption": "Kapazität April [%]", "suffix": " %" },
|
||||
{ "type": "NumberSpinner", "name": "PowerApril", "caption": "Leistung April [W]", "suffix": " W" },
|
||||
|
||||
{ "type": "NumberSpinner", "name": "CapacitySummer", "caption": "Kapazität Sommer Mai–September [%]", "suffix": " %" },
|
||||
{ "type": "NumberSpinner", "name": "PowerSummer", "caption": "Leistung Sommer Mai–September [W]", "suffix": " W" },
|
||||
|
||||
{ "type": "NumberSpinner", "name": "CapacityOctober", "caption": "Kapazität Oktober [%]", "suffix": " %" },
|
||||
{ "type": "NumberSpinner", "name": "PowerOctober", "caption": "Leistung Oktober [W]", "suffix": " W" },
|
||||
|
||||
{ "type": "NumberSpinner", "name": "CapacityNovember", "caption": "Kapazität November [%]", "suffix": " %" },
|
||||
{ "type": "NumberSpinner", "name": "PowerNovember", "caption": "Leistung November [W]", "suffix": " W" },
|
||||
|
||||
{ "type": "NumberSpinner", "name": "CapacityDecember", "caption": "Kapazität Dezember [%]", "suffix": " %" },
|
||||
{ "type": "NumberSpinner", "name": "PowerDecember", "caption": "Leistung Dezember [W]", "suffix": " W" }
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": "Button",
|
||||
"caption": "Werte sofort übernehmen",
|
||||
"onClick": "Peakshaving_ApplyCurrentValues($id);"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"id": "{10371F76-D0A9-80A7-8EA5-43DB636CC5C5}",
|
||||
"name": "Peakshaving",
|
||||
"type": 3,
|
||||
"vendor": "Belevo AG",
|
||||
"aliases": [],
|
||||
"parentRequirements": [],
|
||||
"childRequirements": [],
|
||||
"implemented": [],
|
||||
"prefix": "GEF",
|
||||
"url": ""
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
class Peakshaving extends IPSModule
|
||||
{
|
||||
public function Create()
|
||||
{
|
||||
parent::Create();
|
||||
|
||||
// Ziel-Instanzen und Property-Namen
|
||||
$this->RegisterPropertyInteger('CapacityTargetInstance', 0);
|
||||
$this->RegisterPropertyString('CapacityTargetProperty', 'AufdasNachladen');
|
||||
|
||||
$this->RegisterPropertyInteger('PowerTargetInstance', 0);
|
||||
$this->RegisterPropertyString('PowerTargetProperty', 'Peakleistung');
|
||||
|
||||
// Monatswerte
|
||||
$this->RegisterPropertyFloat('CapacityJanuary', 11);
|
||||
$this->RegisterPropertyFloat('PowerJanuary', 42000);
|
||||
|
||||
$this->RegisterPropertyFloat('CapacityFebruary', 11);
|
||||
$this->RegisterPropertyFloat('PowerFebruary', 42000);
|
||||
|
||||
$this->RegisterPropertyFloat('CapacityMarch', 8);
|
||||
$this->RegisterPropertyFloat('PowerMarch', 43000);
|
||||
|
||||
$this->RegisterPropertyFloat('CapacityApril', 8);
|
||||
$this->RegisterPropertyFloat('PowerApril', 44000);
|
||||
|
||||
$this->RegisterPropertyFloat('CapacitySummer', 8);
|
||||
$this->RegisterPropertyFloat('PowerSummer', 44000);
|
||||
|
||||
$this->RegisterPropertyFloat('CapacityOctober', 12);
|
||||
$this->RegisterPropertyFloat('PowerOctober', 43000);
|
||||
|
||||
$this->RegisterPropertyFloat('CapacityNovember', 12);
|
||||
$this->RegisterPropertyFloat('PowerNovember', 43000);
|
||||
|
||||
$this->RegisterPropertyFloat('CapacityDecember', 12);
|
||||
$this->RegisterPropertyFloat('PowerDecember', 43000);
|
||||
|
||||
// Statusvariablen
|
||||
$this->RegisterVariableFloat('ActiveCapacity', 'Kapazität Peakshaving', '~Intensity.100', 10);
|
||||
$this->RegisterVariableFloat('ActivePower', 'Leistung Peakshaving', '~Watt', 20);
|
||||
|
||||
$this->EnableAction('ActiveCapacity');
|
||||
$this->EnableAction('ActivePower');
|
||||
|
||||
// Einmal täglich prüfen/übernehmen
|
||||
$this->RegisterTimer('DailyUpdate', 0, 'Peakshaving_ApplyCurrentValues($_IPS[\'TARGET\']);');
|
||||
}
|
||||
|
||||
public function ApplyChanges()
|
||||
{
|
||||
parent::ApplyChanges();
|
||||
|
||||
// täglich um 00:05 Uhr
|
||||
$this->SetTimerInterval('DailyUpdate', 24 * 60 * 60 * 1000);
|
||||
|
||||
// Beim Übernehmen der Modul-Konfiguration direkt aktuelle Werte setzen
|
||||
$this->ApplyCurrentValues();
|
||||
}
|
||||
|
||||
public function RequestAction($Ident, $Value)
|
||||
{
|
||||
switch ($Ident) {
|
||||
case 'ActiveCapacity':
|
||||
SetValueFloat($this->GetIDForIdent('ActiveCapacity'), (float)$Value);
|
||||
$this->ApplyCapacityToTarget((float)$Value);
|
||||
break;
|
||||
|
||||
case 'ActivePower':
|
||||
SetValueFloat($this->GetIDForIdent('ActivePower'), (float)$Value);
|
||||
$this->ApplyPowerToTarget((float)$Value);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception('Ungültiger Ident: ' . $Ident);
|
||||
}
|
||||
}
|
||||
|
||||
public function ApplyCurrentValues()
|
||||
{
|
||||
$values = $this->GetValuesForCurrentMonth();
|
||||
|
||||
SetValueFloat($this->GetIDForIdent('ActiveCapacity'), $values['capacity']);
|
||||
SetValueFloat($this->GetIDForIdent('ActivePower'), $values['power']);
|
||||
|
||||
$this->ApplyCapacityToTarget($values['capacity']);
|
||||
$this->ApplyPowerToTarget($values['power']);
|
||||
|
||||
echo 'Peakshaving Werte wurden übernommen.' . PHP_EOL;
|
||||
}
|
||||
|
||||
private function GetValuesForCurrentMonth()
|
||||
{
|
||||
$month = (int)date('n');
|
||||
|
||||
switch ($month) {
|
||||
case 1:
|
||||
return [
|
||||
'capacity' => $this->ReadPropertyFloat('CapacityJanuary'),
|
||||
'power' => $this->ReadPropertyFloat('PowerJanuary')
|
||||
];
|
||||
|
||||
case 2:
|
||||
return [
|
||||
'capacity' => $this->ReadPropertyFloat('CapacityFebruary'),
|
||||
'power' => $this->ReadPropertyFloat('PowerFebruary')
|
||||
];
|
||||
|
||||
case 3:
|
||||
return [
|
||||
'capacity' => $this->ReadPropertyFloat('CapacityMarch'),
|
||||
'power' => $this->ReadPropertyFloat('PowerMarch')
|
||||
];
|
||||
|
||||
case 4:
|
||||
return [
|
||||
'capacity' => $this->ReadPropertyFloat('CapacityApril'),
|
||||
'power' => $this->ReadPropertyFloat('PowerApril')
|
||||
];
|
||||
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
return [
|
||||
'capacity' => $this->ReadPropertyFloat('CapacitySummer'),
|
||||
'power' => $this->ReadPropertyFloat('PowerSummer')
|
||||
];
|
||||
|
||||
case 10:
|
||||
return [
|
||||
'capacity' => $this->ReadPropertyFloat('CapacityOctober'),
|
||||
'power' => $this->ReadPropertyFloat('PowerOctober')
|
||||
];
|
||||
|
||||
case 11:
|
||||
return [
|
||||
'capacity' => $this->ReadPropertyFloat('CapacityNovember'),
|
||||
'power' => $this->ReadPropertyFloat('PowerNovember')
|
||||
];
|
||||
|
||||
case 12:
|
||||
return [
|
||||
'capacity' => $this->ReadPropertyFloat('CapacityDecember'),
|
||||
'power' => $this->ReadPropertyFloat('PowerDecember')
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'capacity' => 0,
|
||||
'power' => 0
|
||||
];
|
||||
}
|
||||
|
||||
private function ApplyCapacityToTarget(float $value)
|
||||
{
|
||||
$instanceID = $this->ReadPropertyInteger('CapacityTargetInstance');
|
||||
$property = $this->ReadPropertyString('CapacityTargetProperty');
|
||||
|
||||
$this->ApplyPropertyToInstance($instanceID, $property, $value);
|
||||
}
|
||||
|
||||
private function ApplyPowerToTarget(float $value)
|
||||
{
|
||||
$instanceID = $this->ReadPropertyInteger('PowerTargetInstance');
|
||||
$property = $this->ReadPropertyString('PowerTargetProperty');
|
||||
|
||||
$this->ApplyPropertyToInstance($instanceID, $property, $value);
|
||||
}
|
||||
|
||||
private function ApplyPropertyToInstance(int $instanceID, string $property, float $value)
|
||||
{
|
||||
if ($instanceID <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IPS_InstanceExists($instanceID)) {
|
||||
$this->SendDebug('Peakshaving', 'Ziel-Instanz existiert nicht: ' . $instanceID, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($property === '') {
|
||||
$this->SendDebug('Peakshaving', 'Kein Property-Name gesetzt.', 0);
|
||||
return;
|
||||
}
|
||||
|
||||
IPS_SetProperty($instanceID, $property, $value);
|
||||
|
||||
if (!IPS_ApplyChanges($instanceID)) {
|
||||
$this->SendDebug(
|
||||
'Peakshaving',
|
||||
'IPS_ApplyChanges fehlgeschlagen für Instanz ' . $instanceID . ', Property ' . $property,
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user