This commit is contained in:
@@ -113,6 +113,8 @@ function enelixDemoInstall(): array
|
||||
$batteryManagement = enelixDemoEnsureVariable($technical, 'BatterieManagement', 'Batterie Managementregister', 1, '', 0, 340);
|
||||
$batteryMode = enelixDemoEnsureVariable($technical, 'BatterieModus', 'Batterie Modusregister', 1, '', 0, 350);
|
||||
$batteryRegisterPower = enelixDemoEnsureVariable($technical, 'BatterieRegisterLeistung', 'Batterie Leistungsregister', 2, 'ENELIX.Demo.PowerPositive', 0.0, 360);
|
||||
$inverterActual = enelixDemoEnsureVariable($technical, 'WechselrichterIstleistung', 'PV-Wechselrichter Istleistung', 2, 'ENELIX.Demo.PowerPositive', 0.0, 370);
|
||||
$inverterLimit = enelixDemoEnsureVariable($technical, 'WechselrichterLeistungsgrenze', 'PV-Wechselrichter Leistungsgrenze', 2, 'ENELIX.Demo.PowerPositive', max(0.0, (float) GetValue($peak)), 380);
|
||||
$chartUpdated = enelixDemoEnsureVariable($technical, 'LetztesDiagrammUpdate', 'Letztes Diagramm-Update', 1, '', 0, 390);
|
||||
IPS_SetHidden($chartUpdated, true);
|
||||
|
||||
@@ -136,10 +138,10 @@ function enelixDemoInstall(): array
|
||||
foreach ([$boiler11, $boiler12, $boiler21, $boiler22, $dryContact, $buffer1, $buffer2] as $actorId) {
|
||||
IPS_SetVariableCustomAction($actorId, $actorScript);
|
||||
}
|
||||
foreach ([$batteryManagement, $batteryMode, $batteryRegisterPower] as $registerId) {
|
||||
foreach ([$batteryManagement, $batteryMode, $batteryRegisterPower, $inverterLimit] as $registerId) {
|
||||
IPS_SetVariableCustomAction($registerId, $registerScript);
|
||||
}
|
||||
foreach ([$temp1, $temp2, $bufferTemp, $outsideTemp, $batteryMaxCharge, $batteryMaxDischarge, $batterySoc, $batteryActual] as $sensorId) {
|
||||
foreach ([$temp1, $temp2, $bufferTemp, $outsideTemp, $batteryMaxCharge, $batteryMaxDischarge, $batterySoc, $batteryActual, $inverterActual] as $sensorId) {
|
||||
SetValue($sensorId, GetValue($sensorId));
|
||||
}
|
||||
|
||||
@@ -285,6 +287,9 @@ function enelixDemoInstall(): array
|
||||
'ACNennleistung_kW' => $pvNennleistungKw,
|
||||
'ACEinspeisegrenze_kW' => 0.0,
|
||||
'ACBezugsgrenze_kW' => 0.0,
|
||||
'IstleistungVariableID' => $inverterActual,
|
||||
'BegrenzungVariableID' => $inverterLimit,
|
||||
'Begrenzungsart' => 'watt',
|
||||
]];
|
||||
$pvKonfiguration = [[
|
||||
'ID' => 'demo-pv-1',
|
||||
@@ -325,6 +330,10 @@ function enelixDemoInstall(): array
|
||||
'VerbraucherTimeout' => 15,
|
||||
'SollwertSolarladen' => 0.0,
|
||||
'Umschaltdifferenz' => 0.0,
|
||||
'EinspeisebegrenzungAktiv' => true,
|
||||
'Einspeisegrenze' => 3000.0,
|
||||
'Einspeisetoleranz' => 100.0,
|
||||
'NetzfahrplanAktiv' => false,
|
||||
'AnlagenWechselrichter' => json_encode(
|
||||
$wechselrichterKonfiguration,
|
||||
JSON_THROW_ON_ERROR
|
||||
@@ -476,7 +485,11 @@ function enelixDemoTick(string $source = 'Manual'): void
|
||||
$sun = ($hour >= 6.0 && $hour <= 18.0)
|
||||
? max(0.0, sin(M_PI * ($hour - 6.0) / 12.0))
|
||||
: 0.0;
|
||||
$pv = $peak * $sun * (1.0 - ($environment['cloud'] * 0.0085));
|
||||
$pvAvailable = $peak * $sun * (1.0 - ($environment['cloud'] * 0.0085));
|
||||
$inverterActual = enelixDemoRequiredId($technical, 'WechselrichterIstleistung');
|
||||
$inverterLimit = enelixDemoRequiredId($technical, 'WechselrichterLeistungsgrenze');
|
||||
$pv = enelixDemoLimitPvPower($pvAvailable, (float) GetValue($inverterLimit));
|
||||
SetValue($inverterActual, round($pv, 1));
|
||||
|
||||
$contacts = [
|
||||
'boiler11' => enelixDemoRequiredId($technical, 'Boiler1Stufe1'),
|
||||
@@ -541,6 +554,11 @@ function enelixDemoTick(string $source = 'Manual'): void
|
||||
IPS_RequestAction($consumerId, 'Melden', true);
|
||||
}
|
||||
IPS_RequestAction($manager, 'Regeln', true);
|
||||
$pv = enelixDemoLimitPvPower(
|
||||
$pvAvailable,
|
||||
(float) GetValue($inverterLimit)
|
||||
);
|
||||
SetValue($inverterActual, round($pv, 1));
|
||||
}
|
||||
|
||||
$battery = $managerReady
|
||||
@@ -597,6 +615,11 @@ function enelixDemoTick(string $source = 'Manual'): void
|
||||
}
|
||||
}
|
||||
|
||||
function enelixDemoLimitPvPower(float $availablePower, float $limitPower): float
|
||||
{
|
||||
return min(max(0.0, $availablePower), max(0.0, $limitPower));
|
||||
}
|
||||
|
||||
function enelixDemoRenderFlow(array $state): string
|
||||
{
|
||||
$format = static fn (float $value): string => number_format($value, 0, ',', "'");
|
||||
|
||||
Reference in New Issue
Block a user