Compare commits
359 Commits
cc5dad6d9a
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c7606d871 | |||
| 64ddebd851 | |||
| 83cc605b9d | |||
| 327f992280 | |||
| 6f335c1fc8 | |||
| b013e90616 | |||
| bb6d40def7 | |||
| 5ff36f9392 | |||
| 2ebfafbef4 | |||
| 7ac5330541 | |||
| 47ffbf23aa | |||
| 4a04fbc7bc | |||
| d0d4c1142b | |||
| 6d097e8557 | |||
| 8cffdc6581 | |||
| f6afc892d3 | |||
| b3f6ad62e0 | |||
| 097299a5d5 | |||
| 4a22c921ae | |||
| 5b6f236abb | |||
| a302f9163c | |||
| b330058d5b | |||
| 80b4f78684 | |||
| b7c140dd11 | |||
| 11f3bf378a | |||
| 572484ca9f | |||
| f58925ea7a | |||
| 5ecd1ea494 | |||
| a1493642d4 | |||
| adbb95c6b8 | |||
| ae3798f706 | |||
| c178a49376 | |||
| c233d35289 | |||
| b1a37a2372 | |||
| 8bab4b44f6 | |||
| f7b91d0c9e | |||
| b90e097e84 | |||
| 9323554526 | |||
| ce07977b20 | |||
| b14bfd2035 | |||
| d4edb78d37 | |||
| dff98c2ad8 | |||
| 6440778972 | |||
| f0d9b1b6c8 | |||
| bb87d0dcce | |||
| fcdb1c22a8 | |||
| 531c7907cd | |||
| 7f4f9db4f7 | |||
| 63d35ffc3b | |||
| 8d3f10277c | |||
| 2e69afa9f4 | |||
| 8772f14e8c | |||
| ebf76fd518 | |||
| 8a557a30c5 | |||
| e15847cc88 | |||
| 1e82108c61 | |||
| dda7f4de9a | |||
| f001b2603e | |||
| 7a07a0acc2 | |||
| cfe11677c6 | |||
| 564b7815f2 | |||
| 50ad7deac9 | |||
| 9e8e503241 | |||
| 2db228a937 | |||
| 7175befb8f | |||
| f7344ce35d | |||
| 88ea835aa1 | |||
| eda14a74c6 | |||
| 28fb62c88c | |||
| 43939e8a03 | |||
| 6af357ae95 | |||
| 8ee5263475 | |||
| aa80e1b6ca | |||
| b57cef1bec | |||
| 00b3c7b723 | |||
| df7d776f8e | |||
| 5a375640c1 | |||
| 44d22755e5 | |||
| 071443a656 | |||
| 35cbfb4fab | |||
| 922a5c0c49 | |||
| 87b30c9c8c | |||
| 791c7eb04c | |||
| 43a9d29a3a | |||
| 960e56b6f9 | |||
| 87a49c00ce | |||
| 5ad3490438 | |||
| 00fde8f7b0 | |||
| 6ea256910d | |||
| 6037ade2cc | |||
| a338d5fbc2 | |||
| 797861ce3d | |||
| 2df0f44722 | |||
| 4544832391 | |||
| be7161d2b9 | |||
| 0816a3751c | |||
| b6ed0f9582 | |||
| 446ed0926e | |||
| f54d3dabeb | |||
| 6f4cbb798b | |||
| 7833978aea | |||
| deec2aafda | |||
| 38b335e7f7 | |||
| 2939722a59 | |||
| 2bbca149c4 | |||
| c11362dd77 | |||
| a6f48db791 | |||
| 622c57af96 | |||
| 80890e4e12 | |||
| b8bf4b0028 | |||
| 9334d3aac3 | |||
| 0fc488974a | |||
| 2178860a51 | |||
| cfcf6ba43c | |||
| 11d72eca10 | |||
| 99aba58f34 | |||
| 584d69b471 | |||
| 7850533911 | |||
| eb90029ad6 | |||
| 724f3b0d2a | |||
| a57a76972d | |||
| 91e4709612 | |||
| 944817950a | |||
| 88b6c60890 | |||
| 6757682399 | |||
| f11255b071 | |||
| 1e23489346 | |||
| 4f7ecf1aae | |||
| daff7a81e5 | |||
| f35c43bacd | |||
| 912e3ad3df | |||
| 851dc7d70e | |||
| ccb068dd5d | |||
| 57a4594e38 | |||
| 6094694809 | |||
| c9426c1bfc | |||
| 17fe281fa3 | |||
| 1ee6b409aa | |||
| 8dd82f1abd | |||
| 015b1fc441 | |||
| e21f760e13 | |||
| 5aa44ad8a2 | |||
| 8f051aced5 | |||
| e6cd727fc1 | |||
| 494984734b | |||
| 47beb18f0b | |||
| 41c53c7a8f | |||
| f887dba1e8 | |||
| 7db0667bd0 | |||
| e22ebf328a | |||
| e12c192e2d | |||
| f89ff7f200 | |||
| 7314b81cc6 | |||
| c6245d870e | |||
| 20bafaf68f | |||
| 936a7ab46e | |||
| 1d099588d2 | |||
| a902604003 | |||
| 1e7efaef6e | |||
| d6a5d2c1f2 | |||
| 875c40e179 | |||
| 4a3fb06b21 | |||
| 92e4393b12 | |||
| b8783ebba4 | |||
| 658b9626b4 | |||
| b5973a5878 | |||
| 716538c758 | |||
| 11be77f8dd | |||
| afc72486b9 | |||
| 76464b66cf | |||
| a5ea4c75ce | |||
| 8c5a9c5e61 | |||
| 9bbbad260a | |||
| 09962a8cd0 | |||
| ab9eec4249 | |||
| c5ec334421 | |||
| 1e0b314f2a | |||
| 979fa1a44f | |||
| b779f4ce42 | |||
| 2847607983 | |||
| cf126855ba | |||
| c6a8c32a65 | |||
| 78668405bc | |||
| cdc7d762d8 | |||
| 6e9835d852 | |||
| 9e6ffb3c01 | |||
| 4648c5e404 | |||
| 0b9d53fff9 | |||
| 9f22ae0aa7 | |||
| ef49957d7f | |||
| 8148d62484 | |||
| 2eab6b60ec | |||
| a314141093 | |||
| fc411e0d5f | |||
| d23b317093 | |||
| ff9fc91aae | |||
| 5b57f2637a | |||
| 010f6c5785 | |||
| 6cffe2715f | |||
| b79e0d1430 | |||
| adf6b573de | |||
| 20228fbcf1 | |||
| 9319e3a2f8 | |||
| 391184a26e | |||
| 4afd1cf6fa | |||
| f235142561 | |||
| e06333be0b | |||
| 31d950f6d2 | |||
| 3390330a82 | |||
| 225e254366 | |||
| d94837f597 | |||
| e859ead314 | |||
| ba9c92c4ac | |||
| b0929f77a9 | |||
| 2c86a7c181 | |||
| 18cbf73cd0 | |||
| 83bf7c5907 | |||
| 5df7c0c305 | |||
| f80ebc8367 | |||
| 519e845eeb | |||
| 230e8bd890 | |||
| a61ca6cff4 | |||
| eed1e585d6 | |||
| 0e9ad10626 | |||
| 9ed5471d6a | |||
| 234482bd8d | |||
| 1a07130db2 | |||
| ba2cdaede8 | |||
| 4535be0f2c | |||
| 41b4a85409 | |||
| 1207792810 | |||
| 63912b3606 | |||
| 3be124e81f | |||
| 422ea69b4f | |||
| 0a6ce80266 | |||
| b83d9459eb | |||
| a25f440097 | |||
| b241cc3f77 | |||
| cfb196f346 | |||
| 83c74ad05d | |||
| 27536d3d16 | |||
| 33667256ec | |||
| 5db059fc51 | |||
| 2a605a6138 | |||
| bf79f30e76 | |||
| ce57b11224 | |||
| 4711fb0208 | |||
| 2f68634145 | |||
| f21acfe6a6 | |||
| 110120f398 | |||
| ba8e3af69b | |||
| b1d8dbeeaf | |||
| 9bb2b90ce0 | |||
| aa01389bf3 | |||
| a86c8dba66 | |||
| 7ac31ef2a2 | |||
| bbb8ee8bfe | |||
| 692bf28e0c | |||
| 322c4acbb5 | |||
| d345d26b1e | |||
| f5d6ad2a72 | |||
| 3f86c5583a | |||
| bb16399d7d | |||
| 05f4b8b32d | |||
| 09f1c52f87 | |||
| 6cb64b47fa | |||
| 13ff15a0d9 | |||
| 1699ad4e7c | |||
| ff747d1f04 | |||
| 3a18f52492 | |||
| 80e35c372e | |||
| d1f0b876aa | |||
| feb7301fc1 | |||
| f4e87772e1 | |||
| d2bae877a4 | |||
| 90701ec350 | |||
| b7ef02eb86 | |||
| ba99c8f2e3 | |||
| fdc23168b3 | |||
| 4335c37d9f | |||
| 13f458e10c | |||
| 1627f81b9e | |||
| 03e02558d5 | |||
| 94778e2209 | |||
| e99c5c0902 | |||
| c8d5bb3ab4 | |||
| 499eddccb9 | |||
| 26ec00c63e | |||
| aafd768e94 | |||
| 78be02d507 | |||
| 78299cee43 | |||
| e31ad76616 | |||
| 2c01458065 | |||
| 3651502d6e | |||
| f0de973f26 | |||
| 394b797e84 | |||
| 9f18caf7d0 | |||
| 883b3815be | |||
| a36c575ad7 | |||
| a6a758b332 | |||
| cc3cb5fd38 | |||
| ca74e3d946 | |||
| 7f5a6bcade | |||
| 65d2be480f | |||
| 38f450b00e | |||
| 26fd4a4159 | |||
| 25630326c7 | |||
| b6a1625433 | |||
| 195209a6da | |||
| 06a8327619 | |||
| 5f127b9ede | |||
| 284ed6ff3b | |||
| b28d9b94ce | |||
| da24c80b6c | |||
| 2c37115071 | |||
| e7a95c36da | |||
| 58421f7fbd | |||
| 800d56907c | |||
| 2ca3b5b83d | |||
| b55e8c67af | |||
| 9f9207f17f | |||
| 40b995d5e3 | |||
| 31a9f0afe7 | |||
| 14ff6781c2 | |||
| a514a45a3b | |||
| 9b1008d7f5 | |||
| 459c115a7d | |||
| 1b20b2e637 | |||
| 422ea912b0 | |||
| 4e6f5f6fb7 | |||
| 6650164acc | |||
| b68db49f72 | |||
| 558fd9aa4e | |||
| b4de095a20 | |||
| cd9209f800 | |||
| 47bf006229 | |||
| 7a4af1a67f | |||
| f3e7d81fb5 | |||
| 7daa8b7671 | |||
| 7680feda8d | |||
| b46b09ba29 | |||
| 3098547209 | |||
| 3180ac7922 | |||
| 9d628b7a3f | |||
| 17ca7c4c63 | |||
| 3a0eb6113e | |||
| 62e397db10 | |||
| 376dcc121e | |||
| 391f5716e1 | |||
| c0cc49261b | |||
| 37f5c3bede | |||
| f5ddc77d36 | |||
| 920bd27e9e | |||
| 51e038400b | |||
| 353b8afb3d | |||
| 1d4914dbf1 | |||
| 4213aa4804 | |||
| 74a38694cb | |||
| 43bf2194cb |
+135
-108
@@ -4,121 +4,148 @@
|
||||
"type": "Label",
|
||||
"caption": "🧾 Abrechnungseinstellungen"
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"type": "List",
|
||||
"name": "Users",
|
||||
"caption": "Benutzerliste",
|
||||
"add": true,
|
||||
"delete": true,
|
||||
"sortable": true,
|
||||
"columns": [
|
||||
{ "caption": "ID", "name": "id", "width": "10%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{ "caption": "Name", "name": "name", "width": "20%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{ "caption": "Adresse", "name": "address", "width": "20%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{ "caption": "Ort", "name": "city", "width": "20%", "add": "", "edit": { "type": "ValidationTextBox" } }
|
||||
]
|
||||
|
||||
"type": "SelectMedia",
|
||||
"name": "LogoMediaID",
|
||||
"caption": "Logo auswählen"
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"type": "List",
|
||||
"name": "PowerMeters",
|
||||
"caption": "Stromzählerliste",
|
||||
"add": true,
|
||||
"delete": true,
|
||||
"sortable": true,
|
||||
"columns": [
|
||||
{ "caption": "ID", "name": "id", "width": "10%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{ "caption": "Name", "name": "name", "width": "20%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{ "caption": "Var. Verbrauch", "name": "var_consumption", "width": "20%", "add": 0, "edit": { "type": "SelectVariable" } },
|
||||
{ "caption": "Var. Rückspeisung", "name": "var_feed", "width": "20%", "add": 0, "edit": { "type": "SelectVariable" } },
|
||||
{ "caption": "Benutzer-ID", "name": "user_id", "width": "20%", "add": "", "edit": { "type": "ValidationTextBox" } }
|
||||
]
|
||||
"type": "ValidationTextBox",
|
||||
"name": "PropertyText",
|
||||
"caption": "Liegenschaft"
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"type": "List",
|
||||
"name": "WaterMeters",
|
||||
"caption": "Verbrauchszählerliste",
|
||||
"add": true,
|
||||
"delete": true,
|
||||
"sortable": true,
|
||||
"columns": [
|
||||
{ "caption": "ID", "name": "id", "width": "10%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{ "caption": "Name", "name": "name", "width": "20%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{ "caption": "Var. Verbrauch", "name": "var_consumption", "width": "20%", "add": 0, "edit": { "type": "SelectVariable" } },
|
||||
{ "caption": "Benutzer-ID", "name": "user_id", "width": "20%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{
|
||||
"caption": "Zählertyp",
|
||||
"name": "meter_type",
|
||||
"width": "20%",
|
||||
"add": "Warmwasser",
|
||||
"edit": {
|
||||
"type": "Select",
|
||||
"options": [
|
||||
{ "caption": "Warmwasser", "value": "Warmwasser" },
|
||||
{ "caption": "Kaltwasser", "value": "Kaltwasser" },
|
||||
{ "caption": "Wärme", "value": "Wärme" }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
"type": "ValidationTextBox",
|
||||
"name": "FooterText",
|
||||
"caption": "Fusszeile"
|
||||
},
|
||||
{
|
||||
"type": "Label",
|
||||
"caption": "⚖️ Mehrwertsteuer (MWST)"
|
||||
},
|
||||
{
|
||||
"type": "CheckBox",
|
||||
"name": "EnableVAT",
|
||||
"caption": "Mehrwertsteuer berechnen und ausweisen"
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "VATPercentage",
|
||||
"caption": "MWST-Satz in %",
|
||||
"digits": 2,
|
||||
"minimum": 0,
|
||||
"maximum": 100
|
||||
},
|
||||
{
|
||||
"type": "Label",
|
||||
"caption": "🏦 QR-Einzahlungsschein Daten"
|
||||
},
|
||||
{
|
||||
"type": "ValidationTextBox",
|
||||
"name": "CreditorName",
|
||||
"caption": "Rechnungssteller Name"
|
||||
},
|
||||
{
|
||||
"type": "ValidationTextBox",
|
||||
"name": "CreditorAddress",
|
||||
"caption": "Rechnungssteller Strasse/Nr."
|
||||
},
|
||||
{
|
||||
"type": "ValidationTextBox",
|
||||
"name": "CreditorCity",
|
||||
"caption": "Rechnungssteller PLZ/Ort"
|
||||
},
|
||||
{
|
||||
"type": "ValidationTextBox",
|
||||
"name": "BankIBAN",
|
||||
"caption": "Bank IBAN"
|
||||
},
|
||||
{
|
||||
"type": "List",
|
||||
"name": "Users",
|
||||
"caption": "Benutzerliste",
|
||||
"add": true,
|
||||
"delete": true,
|
||||
"sortable": true,
|
||||
"columns": [
|
||||
{ "caption": "ID", "name": "id", "width": "10%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{ "caption": "Name", "name": "name", "width": "20%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{ "caption": "Adresse", "name": "address", "width": "20%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{ "caption": "Ort", "name": "city", "width": "20%", "add": "", "edit": { "type": "ValidationTextBox" } }
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"type": "List",
|
||||
"name": "Tariffs",
|
||||
"caption": "Tarifübersicht",
|
||||
"add": true,
|
||||
"delete": true,
|
||||
"sortable": true,
|
||||
"columns": [
|
||||
{
|
||||
"caption": "Startdatum",
|
||||
"name": "start",
|
||||
"width": "20%",
|
||||
"add": "",
|
||||
"edit": { "type": "SelectDate" }
|
||||
},
|
||||
{
|
||||
"caption": "Enddatum",
|
||||
"name": "end",
|
||||
"width": "20%",
|
||||
"add": "",
|
||||
"edit": { "type": "SelectDate" }
|
||||
},
|
||||
{
|
||||
"caption": "Tarif (Rp/Einheit)",
|
||||
"name": "price",
|
||||
"width": "20%",
|
||||
"add": 0,
|
||||
"edit": { "type": "NumberSpinner", "digits": 3, "minimum": 0 }
|
||||
},
|
||||
{
|
||||
"caption": "Einheit",
|
||||
"name": "unit_type",
|
||||
"width": "20%",
|
||||
"add": "Netztarif",
|
||||
"edit": {
|
||||
"type": "Select",
|
||||
"options": [
|
||||
{ "caption": "Netztarif", "value": "Netztarif" },
|
||||
{ "caption": "Einspeisetarif", "value": "Einspeisetarif" },
|
||||
{ "caption": "Solartarif", "value": "Solartarif" },
|
||||
{ "caption": "Warmwasser", "value": "Warmwasser" },
|
||||
{ "caption": "Kaltwasser", "value": "Kaltwasser" },
|
||||
{ "caption": "Wärme", "value": "Wärme" }
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
"type": "List",
|
||||
"name": "PowerMeters",
|
||||
"caption": "Stromzählerliste",
|
||||
"add": true,
|
||||
"delete": true,
|
||||
"sortable": true,
|
||||
"columns": [
|
||||
{ "caption": "ID", "name": "id", "width": "10%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{ "caption": "Name", "name": "name", "width": "20%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{ "caption": "Var. Verbrauch", "name": "var_consumption", "width": "20%", "add": 0, "edit": { "type": "SelectVariable" } },
|
||||
{ "caption": "Var. Rückspeisung", "name": "var_feed", "width": "20%", "add": 0, "edit": { "type": "SelectVariable" } },
|
||||
{ "caption": "Benutzer-ID", "name": "user_id", "width": "20%", "add": "", "edit": { "type": "ValidationTextBox" } }
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "List",
|
||||
"name": "WaterMeters",
|
||||
"caption": "Verbrauchszählerliste",
|
||||
"add": true,
|
||||
"delete": true,
|
||||
"sortable": true,
|
||||
"columns": [
|
||||
{ "caption": "ID", "name": "id", "width": "10%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{ "caption": "Name", "name": "name", "width": "20%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{ "caption": "Var. Verbrauch", "name": "var_consumption", "width": "20%", "add": 0, "edit": { "type": "SelectVariable" } },
|
||||
{ "caption": "Benutzer-ID", "name": "user_id", "width": "20%", "add": "", "edit": { "type": "ValidationTextBox" } },
|
||||
{
|
||||
"caption": "Zählertyp",
|
||||
"name": "meter_type",
|
||||
"width": "20%",
|
||||
"add": "Warmwasser",
|
||||
"edit": {
|
||||
"type": "Select",
|
||||
"options": [
|
||||
{ "caption": "Warmwasser", "value": "Warmwasser" },
|
||||
{ "caption": "Kaltwasser", "value": "Kaltwasser" },
|
||||
{ "caption": "Wärme", "value": "Wärme" }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "List",
|
||||
"name": "Tariffs",
|
||||
"caption": "Tarifübersicht",
|
||||
"add": true,
|
||||
"delete": true,
|
||||
"sortable": true,
|
||||
"columns": [
|
||||
{ "caption": "Startdatum", "name": "start", "width": "20%", "add": "", "edit": { "type": "SelectDate" } },
|
||||
{ "caption": "Enddatum", "name": "end", "width": "20%", "add": "", "edit": { "type": "SelectDate" } },
|
||||
{ "caption": "Tarif (Rp/Einheit)", "name": "price", "width": "20%", "add": 0, "edit": { "type": "NumberSpinner", "digits": 3, "minimum": 0 } },
|
||||
{
|
||||
"caption": "Einheit",
|
||||
"name": "unit_type",
|
||||
"width": "20%",
|
||||
"add": "Netztarif",
|
||||
"edit": {
|
||||
"type": "Select",
|
||||
"options": [
|
||||
{ "caption": "Netztarif", "value": "Netztarif" },
|
||||
{ "caption": "Einspeisetarif", "value": "Einspeisetarif" },
|
||||
{ "caption": "Solartarif", "value": "Solartarif" },
|
||||
{ "caption": "Warmwasser", "value": "Warmwasser" },
|
||||
{ "caption": "Kaltwasser", "value": "Kaltwasser" },
|
||||
{ "caption": "Wärme", "value": "Wärme" }
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+600
-239
File diff suppressed because it is too large
Load Diff
@@ -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,112 @@
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"type": "Label",
|
||||
"caption": "Aufgepasst: Bei Goodwe nur Ladenvariabel auswählen und entladen Dummy Variabel.\nGoodwe braucht nur eine Leistungssoll Variabel. Entlade NICHT auf gleiche Variabel setzen wie Laden\nGoodwe: Laden=11, Entladen=12,\nSolaredge: Laden=3, Entladen=4\nDefault: Laden=1, Entladen=2"
|
||||
},
|
||||
{
|
||||
"type":"List",
|
||||
"name":"Batteries",
|
||||
"caption":"Batterien mit Typ, Leistung und kapazität",
|
||||
"add":true,
|
||||
"delete":true,
|
||||
"columns":[
|
||||
{
|
||||
"caption":"Typ",
|
||||
"name":"typ",
|
||||
"width":"100px",
|
||||
"add":"Stufe",
|
||||
"edit":{
|
||||
"type":"ValidationTextBox"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption":"Leistung in W",
|
||||
"name":"powerbat",
|
||||
"width":"150px",
|
||||
"add":5000,
|
||||
"edit":{
|
||||
"type":"NumberSpinner"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption":"Kapazität in kWh",
|
||||
"name":"capazity",
|
||||
"width":"200px",
|
||||
"add":60,
|
||||
"edit":{
|
||||
"type":"NumberSpinner"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption":"SoC",
|
||||
"name":"soc",
|
||||
"width":"200px",
|
||||
"add":0,
|
||||
"edit":{
|
||||
"type":"SelectVariable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption":"Batterieleistung Laden",
|
||||
"name":"powerbat_laden",
|
||||
"width":"200px",
|
||||
"add":0,
|
||||
"edit":{
|
||||
"type":"SelectVariable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption":"Batterieleistung Entladen",
|
||||
"name":"powerbat_entladen",
|
||||
"width":"200px",
|
||||
"add":0,
|
||||
"edit":{
|
||||
"type":"SelectVariable"
|
||||
}
|
||||
}
|
||||
,
|
||||
{
|
||||
"caption": "Register Laden/Entladen Modus",
|
||||
"name": "register_ladenentladen_modus",
|
||||
"width": "260px",
|
||||
"add": 0,
|
||||
"edit": {
|
||||
"type": "SelectVariable"
|
||||
}
|
||||
}
|
||||
,
|
||||
{
|
||||
"caption": "Aktuelle Batterieleistung",
|
||||
"name": "register_bat_power",
|
||||
"width": "260px",
|
||||
"add": 0,
|
||||
"edit": {
|
||||
"type": "SelectVariable"
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "SDL_Leistung_Laden",
|
||||
"caption": "SDL_Leistung_Laden",
|
||||
"suffix": "W"
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "SDL_Leistung_Entladen",
|
||||
"caption": "SDL_Leistung_Entladen",
|
||||
"suffix": "W"
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "UpdateInterval",
|
||||
"caption": "Neuberechnung alle",
|
||||
"suffix": "Sekunden",
|
||||
"minimum": 0,
|
||||
"maximum": 86400
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"id": "{843EB84A-5180-6B47-A72E-9CDBE59DD9D3}",
|
||||
"name": "Bat_EV_SDL_V1",
|
||||
"type": 3,
|
||||
"vendor": "Belevo AG",
|
||||
"aliases": ["DemoAlias"],
|
||||
"parentRequirements": [],
|
||||
"childRequirements": [],
|
||||
"implemented": [],
|
||||
"prefix": "GEF",
|
||||
"url": ""
|
||||
}
|
||||
@@ -0,0 +1,881 @@
|
||||
<?php
|
||||
|
||||
class Bat_EV_SDL_V1 extends IPSModule
|
||||
{
|
||||
private const HOURS = 0.5; // 30 Minuten
|
||||
|
||||
public function Create()
|
||||
{
|
||||
parent::Create();
|
||||
|
||||
// Properties
|
||||
$this->RegisterPropertyString("Batteries", "[]");
|
||||
//$this->RegisterPropertyInteger("$upKWh + $underKWh)", 0);
|
||||
$this->RegisterPropertyInteger("SDL_Leistung_Laden", 0);
|
||||
$this->RegisterPropertyInteger("SDL_Leistung_Entladen", 0); // W
|
||||
$this->RegisterPropertyInteger("UpdateInterval", 5); // Minuten
|
||||
|
||||
// Status
|
||||
$this->RegisterVariableBoolean("State", "Aktiv", "~Switch", 1);
|
||||
$this->EnableAction("State");
|
||||
|
||||
// Prozentwerte
|
||||
$this->RegisterVariableFloat("SDL_Pos", "SDL Energie verfügbar (%)", "", 10);
|
||||
$this->RegisterVariableFloat("SoC_EV", "EV Energie verfügbar (%)", "", 11);
|
||||
|
||||
// Variablen
|
||||
$this->RegisterVariableFloat("Nennleistung_Soll_EV", "Nennleistung Soll EV", "", 2);
|
||||
$this->RegisterVariableFloat("Nennleistung_Soll_SDL", "Nennleistung Soll SDL", "", 3);
|
||||
$this->RegisterVariableFloat("Aktuelle_Leistung_EV", "Aktuelle Leistung EV", "", 5);
|
||||
$this->RegisterVariableFloat("Aktuelle_Leistung_SDL", "Aktuelle Leistung SDL", "", 4);
|
||||
$this->RegisterVariableFloat("P_SDL_laden", "P SDL laden max (W)", "", 21);
|
||||
$this->RegisterVariableFloat("P_SDL_entladen", "P SDL entladen max (W)", "", 22);
|
||||
$this->RegisterVariableFloat("P_EV_laden", "P EV laden max (W)", "", 31);
|
||||
$this->RegisterVariableFloat("P_EV_entladen", "P EV entladen max (W)", "", 32);
|
||||
|
||||
// Debug
|
||||
$this->RegisterVariableString("CalcJSON", "Berechnung (JSON)", "", 99);
|
||||
|
||||
// Timer: wichtig -> Prefix muss passen
|
||||
$this->RegisterTimer("UpdateTimer", 0, 'GEF_Update($_IPS["TARGET"]);');
|
||||
}
|
||||
|
||||
public function ApplyChanges()
|
||||
{
|
||||
parent::ApplyChanges();
|
||||
|
||||
$intervalSec = (int)$this->ReadPropertyInteger("UpdateInterval");
|
||||
$this->SetTimerInterval("UpdateTimer", ($intervalSec > 0) ? $intervalSec * 1000 : 0);
|
||||
|
||||
// Cache neu bauen (force)
|
||||
$this->BuildBatteryCache(true);
|
||||
|
||||
$this->Update();
|
||||
}
|
||||
|
||||
public function RequestAction($Ident, $Value)
|
||||
{
|
||||
if ($Ident === "State") {
|
||||
SetValue($this->GetIDForIdent("State"), (bool)$Value);
|
||||
if ((bool)$Value) {
|
||||
$this->Update();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Exception("Invalid Ident: " . $Ident);
|
||||
}
|
||||
|
||||
public function Update()
|
||||
{
|
||||
|
||||
|
||||
// Reentranzschutz – verhindert parallele Update()-Läufe
|
||||
$semKey = 'BatEVSDL_Update_' . $this->InstanceID;
|
||||
|
||||
if (!IPS_SemaphoreEnter($semKey, 5000)) {
|
||||
// Überspringen, wenn bereits ein Lauf aktiv ist
|
||||
$this->SendDebug("Update", "SKIP (Semaphore locked)", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
|
||||
if (!GetValue($this->GetIDForIdent("State"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Cache nur neu bauen, wenn nötig
|
||||
$this->BuildBatteryCache(false);
|
||||
|
||||
$cache = json_decode($this->GetBufferSafe("BatCacheJSON"), true);
|
||||
if (!is_array($cache) || empty($cache["bats"])) {
|
||||
$this->WriteAllZero("cache empty/invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
$calc = [
|
||||
"inputs" => $cache["inputs"] ?? [],
|
||||
"batteries" => [],
|
||||
"total" => []
|
||||
];
|
||||
|
||||
// Summen
|
||||
$sdlDisKW_ges = 0.0;
|
||||
$evDisKW_ges = 0.0;
|
||||
$sdlChKW_ges = 0.0;
|
||||
$evChKW_ges = 0.0;
|
||||
|
||||
$real_kWh_ev_ges = 0.0;
|
||||
$real_kWh_sdl_ges = 0.0;
|
||||
|
||||
$SDL_kWh_ges = 0.0;
|
||||
$EV_kWh_ges = 0.0;
|
||||
$totalCapKWh = 0.0;
|
||||
|
||||
foreach ($cache["bats"] as $i => $c) {
|
||||
|
||||
$capKWh = (float)($c["capKWh"] ?? 0.0);
|
||||
if ($capKWh <= 0.0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// dynamisch: SoC lesen
|
||||
$socVarId = (int)($c["socVarId"] ?? 0);
|
||||
$socPct = $this->ReadSocPercent($socVarId);
|
||||
|
||||
$real_kWh = $capKWh / 100.0 * $socPct;
|
||||
|
||||
// vorkalkuliert:
|
||||
$typ = (string)($c["typ"] ?? ("Bat " . ($i + 1)));
|
||||
$underKWh = (float)($c["underKWh"] ?? 0.0);
|
||||
$upKWh = (float)($c["upKWh"] ?? 0.0);
|
||||
$SDL_kWh = (float)($c["SDL_kWh_total"] ?? 0.0);
|
||||
$EV_kWh = (float)($c["EV_kWh_total"] ?? 0.0);
|
||||
|
||||
$sdlShareKW_laden = (float)($c["sdlShareKW_laden"] ?? 0.0);
|
||||
$sdlShareKW_entladen = (float)($c["sdlShareKW_entladen"] ?? 0.0);
|
||||
$evShareKW_laden = (float)($c["evShareKW_laden"] ?? 0.0);
|
||||
$evShareKW_entladen = (float)($c["evShareKW_entladen"] ?? 0.0);
|
||||
|
||||
|
||||
|
||||
// Defaults
|
||||
$EV_SOC = 0.0;
|
||||
$SDL_SOC = 0.0;
|
||||
|
||||
$sdlDisKW = 0.0; $evDisKW = 0.0;
|
||||
$sdlChKW = 0.0; $evChKW = 0.0;
|
||||
|
||||
$real_kWh_ev = 0.0;
|
||||
$real_kWh_sdl = 0.0;
|
||||
|
||||
// --- Deine 3 Fälle ---
|
||||
if ($underKWh <= $real_kWh && $upKWh >= $real_kWh) {
|
||||
|
||||
|
||||
$denSDL = ($capKWh - $upKWh + $underKWh);
|
||||
if ($denSDL > 0.0) {
|
||||
$SDL_SOC = 100.0 * $underKWh / $denSDL;
|
||||
} else {
|
||||
$SDL_SOC = 0.0;
|
||||
}
|
||||
$SDL_SOC = is_finite($SDL_SOC) ? max(0.0, min(100.0, $SDL_SOC)) : 0.0;
|
||||
|
||||
|
||||
if ($EV_kWh > 0.0) {
|
||||
$EV_SOC = 100.0 * ($real_kWh - $underKWh) / $EV_kWh;
|
||||
} else {
|
||||
$EV_SOC = 0.0; // definierter Fallback
|
||||
}
|
||||
$EV_SOC = is_finite($EV_SOC) ? max(0.0, min(100.0, $EV_SOC)) : 0.0;
|
||||
|
||||
|
||||
|
||||
|
||||
$sdlDisKW = $sdlShareKW_entladen;
|
||||
$evDisKW = $evShareKW_entladen;
|
||||
$sdlChKW = $sdlShareKW_laden;
|
||||
$evChKW = $evShareKW_laden;
|
||||
|
||||
$real_kWh_ev = $real_kWh - $underKWh;
|
||||
$real_kWh_sdl = $underKWh;
|
||||
|
||||
} elseif ($upKWh < $real_kWh) {
|
||||
|
||||
$EV_SOC = 100.0;
|
||||
|
||||
$den1 = ($capKWh - $real_kWh + $underKWh);
|
||||
$den2 = (2.0 * $underKWh);
|
||||
|
||||
if ($den1 > 0.0 && $den2 > 0.0) {
|
||||
$SDL_SOC = min(100.0, ($den1 / $den2) * 100.0);
|
||||
} else {
|
||||
$SDL_SOC = 0.0;
|
||||
}
|
||||
$SDL_SOC = is_finite($SDL_SOC) ? max(0.0, min(100.0, $SDL_SOC)) : 0.0;
|
||||
|
||||
$sdlDisKW = $sdlShareKW_entladen;
|
||||
$evDisKW = $evShareKW_entladen;
|
||||
$sdlChKW = $sdlShareKW_laden;
|
||||
$evChKW = 0.0;
|
||||
|
||||
$real_kWh_ev = $capKWh - ($capKWh - $upKWh + $underKWh);
|
||||
$real_kWh_sdl = ($capKWh - $upKWh + $underKWh) - ($capKWh - $real_kWh);
|
||||
|
||||
} elseif ($underKWh > $real_kWh) {
|
||||
|
||||
$EV_SOC = 0.0;
|
||||
|
||||
$den = $upKWh + $underKWh;
|
||||
$SDL_SOC = ($den > 0.0) ? ($real_kWh * 100.0 / $den) : 0.0;
|
||||
$SDL_SOC = is_finite($SDL_SOC) ? max(0.0, min(100.0, $SDL_SOC)) : 0.0;
|
||||
|
||||
$sdlDisKW = $sdlShareKW_entladen;
|
||||
$evDisKW = 0.0;
|
||||
$sdlChKW = $sdlShareKW_laden;
|
||||
$evChKW = $evShareKW_laden;
|
||||
|
||||
$real_kWh_ev = 0.0;
|
||||
$real_kWh_sdl = $real_kWh;
|
||||
}
|
||||
|
||||
// Null/Full
|
||||
if ($real_kWh <= 0.0) {
|
||||
$sdlDisKW = 0.0;
|
||||
$real_kWh_ev = 0.0;
|
||||
$real_kWh_sdl = 0.0;
|
||||
} elseif ($real_kWh >= $capKWh) {
|
||||
$sdlChKW = 0.0;
|
||||
//$real_kWh_ev = $capKWh - ($upKWh + $underKWh);
|
||||
//$real_kWh_sdl = $upKWh + $underKWh;
|
||||
|
||||
$real_kWh_ev = $EV_kWh;
|
||||
$real_kWh_sdl = $SDL_kWh;
|
||||
}
|
||||
|
||||
$real_kWh_ev = max(0.0, $real_kWh_ev);
|
||||
$real_kWh_sdl = max(0.0, $real_kWh_sdl);
|
||||
|
||||
// Summen
|
||||
$totalCapKWh += $capKWh;
|
||||
|
||||
$sdlDisKW_ges += $sdlDisKW;
|
||||
$evDisKW_ges += $evDisKW;
|
||||
$sdlChKW_ges += $sdlChKW;
|
||||
$evChKW_ges += $evChKW;
|
||||
|
||||
$real_kWh_ev_ges += $real_kWh_ev;
|
||||
$real_kWh_sdl_ges += $real_kWh_sdl;
|
||||
|
||||
$SDL_kWh_ges += $SDL_kWh;
|
||||
$EV_kWh_ges += $EV_kWh;
|
||||
|
||||
$calc["batteries"][] = [
|
||||
"idx" => $c["idx"] ?? $i,
|
||||
"typ" => $typ,
|
||||
"SoC_varId" => $socVarId,
|
||||
"SoC_pct" => round($socPct, 3),
|
||||
"Effektive kWh" => round($real_kWh, 3),
|
||||
|
||||
"EV_SOC" => round($EV_SOC, 3),
|
||||
"SDL_SOC" => round($SDL_SOC, 3),
|
||||
|
||||
"EV_kWh" => round($real_kWh_ev, 3),
|
||||
"SDL_kWh" => round($real_kWh_sdl, 3),
|
||||
|
||||
"under_grenze_kWh" => round($underKWh, 3),
|
||||
"up_grenze_kWh" => round($upKWh, 3),
|
||||
|
||||
"SDL_Charge_kW" => round($sdlChKW, 3),
|
||||
"SDL_Discharge_kW" => round($sdlDisKW, 3),
|
||||
"EV_Charge_kW" => round($evChKW, 3),
|
||||
"EV_Discharge_kW" => round($evDisKW, 3),
|
||||
];
|
||||
}
|
||||
|
||||
$evPosPct = ($EV_kWh_ges > 0.0) ? ($real_kWh_ev_ges / $EV_kWh_ges * 100.0) : 0.0;
|
||||
$sdlPosPct = ($SDL_kWh_ges > 0.0) ? ($real_kWh_sdl_ges / $SDL_kWh_ges * 100.0) : 0.0;
|
||||
|
||||
$this->SetIdentValue("SDL_Pos", round($sdlPosPct, 3));
|
||||
$this->SetIdentValue("SoC_EV", round($evPosPct, 3));
|
||||
|
||||
$this->SetIdentValue("P_SDL_laden", round($sdlChKW_ges * 1000.0, 0));
|
||||
$this->SetIdentValue("P_SDL_entladen", round($sdlDisKW_ges * 1000.0, 0));
|
||||
$this->SetIdentValue("P_EV_laden", round($evChKW_ges * 1000.0, 0));
|
||||
$this->SetIdentValue("P_EV_entladen", round($evDisKW_ges * 1000.0, 0));
|
||||
|
||||
$calc["total"] = [
|
||||
"SDL_SoC_pct" => round($sdlPosPct, 3),
|
||||
"EV_SoC_pct" => round($evPosPct, 3),
|
||||
|
||||
"SDL_kWh_total" => round($SDL_kWh_ges, 3),
|
||||
"EV_kWh_total" => round($EV_kWh_ges, 3),
|
||||
|
||||
"SDL_Charge_kW" => round($sdlChKW_ges, 3),
|
||||
"SDL_Discharge_kW" => round($sdlDisKW_ges, 3),
|
||||
"EV_Charge_kW" => round($evChKW_ges, 3),
|
||||
"EV_Discharge_kW" => round($evDisKW_ges, 3),
|
||||
|
||||
"totalCap_kWh" => round($totalCapKWh, 3)
|
||||
];
|
||||
|
||||
$this->SetIdentValue("CalcJSON", json_encode($calc, JSON_PRETTY_PRINT));
|
||||
$this->ApplySetpoints();
|
||||
|
||||
|
||||
} catch (Throwable $e) {
|
||||
$this->SendDebug("Update ERROR", $e->getMessage() . " @ " . $e->getFile() . ":" . $e->getLine(), 0);
|
||||
$this->WriteAllZero("Exception: " . $e->getMessage());
|
||||
}
|
||||
finally {
|
||||
IPS_SemaphoreLeave($semKey); // ✅ Tür immer wieder aufschließen
|
||||
}
|
||||
}
|
||||
|
||||
private function BuildBatteryCache(bool $force): void
|
||||
{
|
||||
$batteriesRaw = $this->ReadPropertyString("Batteries");
|
||||
//$sdlTotalW = max(0, (int)$this->ReadPropertyInteger("SDL_Leistung"));
|
||||
$sdlTotalW_laden = max(0, (int)$this->ReadPropertyInteger("SDL_Leistung_Laden"));
|
||||
$sdlTotalW_entladen = max(0, (int)$this->ReadPropertyInteger("SDL_Leistung_Entladen"));
|
||||
$hours = self::HOURS;
|
||||
|
||||
$hash = md5(json_encode([
|
||||
"Batteries" => $batteriesRaw,
|
||||
"SDL_W_Laden" => $sdlTotalW_laden,
|
||||
"SDL_W_Entladen" => $sdlTotalW_entladen,
|
||||
"hours" => $hours
|
||||
]));
|
||||
|
||||
$oldHash = $this->GetBufferSafe("BatCacheHash");
|
||||
if (!$force && $oldHash === $hash) {
|
||||
return;
|
||||
}
|
||||
|
||||
$batteries = json_decode($batteriesRaw, true);
|
||||
if (!is_array($batteries)) $batteries = [];
|
||||
|
||||
$sumBatPowerW = 0.0;
|
||||
foreach ($batteries as $b) {
|
||||
$p = (float)($b["powerbat"] ?? 0);
|
||||
if ($p > 0) $sumBatPowerW += $p;
|
||||
}
|
||||
|
||||
$cache = [
|
||||
"inputs" => [
|
||||
"SDL_Leistung_W_laden" => $sdlTotalW_laden,
|
||||
"SDL_Leistung_W_entladen" => $sdlTotalW_entladen,
|
||||
"SumBatPower_W" => round($sumBatPowerW, 0),
|
||||
"hours" => $hours
|
||||
],
|
||||
"bats" => []
|
||||
];
|
||||
|
||||
if ($sumBatPowerW <= 0.0) {
|
||||
$this->SetBuffer("BatCacheHash", $hash);
|
||||
$this->SetBuffer("BatCacheJSON", json_encode($cache));
|
||||
$this->SendDebug("Cache", "sumBatPowerW=0 -> empty cache", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
$sumBatPowerkW = $sumBatPowerW / 1000.0;
|
||||
//$sdlTotalkW = $sdlTotalW / 1000.0;
|
||||
|
||||
$sdlTotalkW_laden = $sdlTotalW_laden / 1000.0;
|
||||
$sdlTotalkW_entladen = $sdlTotalW_entladen / 1000.0;
|
||||
|
||||
foreach ($batteries as $idx => $b) {
|
||||
|
||||
$pBatW = max(0.0, (float)($b["powerbat"] ?? 0));
|
||||
$pBatkW = $pBatW / 1000.0;
|
||||
|
||||
$capKWh = max(0.0, (float)($b["capazity"] ?? 0));
|
||||
if ($capKWh <= 0.0) continue;
|
||||
|
||||
$socVarId = (int)($b["soc"] ?? 0);
|
||||
$typ = (string)($b["typ"] ?? ("Bat " . ($idx + 1)));
|
||||
|
||||
|
||||
// Mit laden und entladen unterschiedlich
|
||||
//----------------------------------------------------
|
||||
$sdlShareKW_laden = ($sumBatPowerkW > 0.0) ? ($sdlTotalkW_laden / $sumBatPowerkW * $pBatkW) : 0.0;
|
||||
$evShareKW_laden = $pBatkW - $sdlShareKW_laden;
|
||||
$upKWh = $capKWh - $sdlShareKW_laden * 0.5;
|
||||
|
||||
$sdlShareKW_entladen = ($sumBatPowerkW > 0.0) ? ($sdlTotalkW_entladen / $sumBatPowerkW * $pBatkW) : 0.0;
|
||||
$evShareKW_entladen = $pBatkW - $sdlShareKW_entladen;
|
||||
$underKWh = $sdlShareKW_entladen * 0.5;
|
||||
|
||||
$SDL_kWh = $underKWh + ($capKWh -$upKWh);
|
||||
$EV_kWh = $capKWh - $SDL_kWh;
|
||||
//----------------------------------------------------
|
||||
|
||||
$cache["bats"][] = [
|
||||
"idx" => $idx,
|
||||
"typ" => $typ,
|
||||
|
||||
"socVarId" => $socVarId,
|
||||
"capKWh" => $capKWh,
|
||||
|
||||
"pBatW" => $pBatW,
|
||||
"sdlShareKW_laden" => $sdlShareKW_laden,
|
||||
"sdlShareKW_entladen" => $sdlShareKW_entladen,
|
||||
"evShareKW_laden" => $evShareKW_laden,
|
||||
"evShareKW_entladen" => $evShareKW_entladen,
|
||||
|
||||
"underKWh" => $underKWh,
|
||||
"upKWh" => $upKWh,
|
||||
|
||||
"SDL_kWh_total" => $SDL_kWh,
|
||||
"EV_kWh_total" => $EV_kWh
|
||||
];
|
||||
}
|
||||
|
||||
$this->SetBuffer("BatCacheHash", $hash);
|
||||
$this->SetBuffer("BatCacheJSON", json_encode($cache));
|
||||
|
||||
$this->SendDebug("Cache", "Battery cache rebuilt (" . count($cache["bats"]) . " bats)", 0);
|
||||
}
|
||||
|
||||
private function GetBufferSafe(string $name): string
|
||||
{
|
||||
$v = $this->GetBuffer($name);
|
||||
return is_string($v) ? $v : "";
|
||||
}
|
||||
|
||||
private function WriteAllZero(string $reason): void
|
||||
{
|
||||
$this->SetIdentValue("SDL_Pos", 0.0);
|
||||
$this->SetIdentValue("SoC_EV", 0.0);
|
||||
|
||||
$this->SetIdentValue("P_SDL_laden", 0.0);
|
||||
$this->SetIdentValue("P_SDL_entladen", 0.0);
|
||||
|
||||
$this->SetIdentValue("P_EV_laden", 0.0);
|
||||
$this->SetIdentValue("P_EV_entladen", 0.0);
|
||||
|
||||
$this->SetIdentValue("CalcJSON", json_encode(["error" => $reason], JSON_PRETTY_PRINT));
|
||||
}
|
||||
|
||||
private function SetIdentValue(string $ident, $value): void
|
||||
{
|
||||
$id = @$this->GetIDForIdent($ident);
|
||||
if ($id <= 0) {
|
||||
$this->SendDebug(__FUNCTION__, "Ident nicht gefunden: $ident", 0);
|
||||
return;
|
||||
}
|
||||
SetValue($id, $value);
|
||||
}
|
||||
|
||||
private function ReadSocPercent(int $varId): float
|
||||
{
|
||||
// Falls jemand statt Variable direkt 0..100 einträgt
|
||||
if ($varId >= 0 && $varId <= 100 && !IPS_VariableExists($varId)) {
|
||||
return (float)$varId;
|
||||
}
|
||||
|
||||
if ($varId <= 0 || !IPS_VariableExists($varId)) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
$v = GetValue($varId);
|
||||
if (!is_numeric($v)) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
$soc = (float)$v;
|
||||
if ($soc < 0.0) $soc = 0.0;
|
||||
if ($soc > 100.0) $soc = 100.0;
|
||||
|
||||
return $soc;
|
||||
}
|
||||
|
||||
public function ApplySetpoints(): void
|
||||
{
|
||||
$pEvW = (float) GetValue($this->GetIDForIdent("Nennleistung_Soll_EV"));
|
||||
$pSdlW = (float) GetValue($this->GetIDForIdent("Nennleistung_Soll_SDL"));
|
||||
|
||||
//Diverenz zwischen EV und SDl berechnen
|
||||
|
||||
|
||||
// Methode für priorisierung
|
||||
$distribution = $this->CalculateBatteryDistribution($pEvW,$pSdlW);
|
||||
|
||||
|
||||
$this->WriteBatteryPowerSetpoints($distribution);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private function CalculateBatteryDistribution(float $pEvW, float $pSdlW): array
|
||||
{
|
||||
$calcJsonId = $this->GetIDForIdent("CalcJSON");
|
||||
// Fallback, falls Variable leer ist oder nicht existiert
|
||||
if (!IPS_VariableExists($calcJsonId)) {
|
||||
return [];
|
||||
}
|
||||
$rawJson = (string)GetValue($calcJsonId);
|
||||
if (empty($rawJson)) {
|
||||
return [];
|
||||
}
|
||||
$calc = json_decode($rawJson, true);
|
||||
$batteries = $calc['batteries'] ?? [];
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// Hilfsfunktion: Verteilungslogik (Closure)
|
||||
// ---------------------------------------------------------
|
||||
$distributePower = function(float $targetPower, string $mode) use ($batteries): array {
|
||||
// Initialisierung des Ergebnis-Arrays (Key = idx, Value = zugewiesene Watt)
|
||||
$result = [];
|
||||
foreach ($batteries as $bat) {
|
||||
$result[$bat['idx']] = 0.0;
|
||||
}
|
||||
|
||||
if (abs($targetPower) < 0.01) {
|
||||
return $result; // Nichts zu tun
|
||||
}
|
||||
|
||||
$isCharge = ($targetPower > 0);
|
||||
$absPower = abs($targetPower);
|
||||
// Relevante Keys basierend auf Modus (EV oder SDL) und Richtung (Laden/Entladen)
|
||||
$socKey = ($mode === 'EV') ? 'EV_SOC' : 'SDL_SOC';
|
||||
// Achtung: JSON Limits sind in kW, wir rechnen in Watt -> * 1000
|
||||
$limitKey = $isCharge ? $mode . '_Charge_kW' : $mode . '_Discharge_kW';
|
||||
|
||||
// 1. Batterien vorbereiten und gruppieren nach gerundetem SoC
|
||||
$groups = [];
|
||||
foreach ($batteries as $bat) {
|
||||
$soc = (int)round($bat[$socKey]); // Auf ganze Zahl runden
|
||||
$maxW = ((float)$bat[$limitKey]) * 1000.0; // kW in Watt umrechnen
|
||||
$groups[$soc][] = [
|
||||
'idx' => $bat['idx'],
|
||||
'maxW' => $maxW
|
||||
];
|
||||
}
|
||||
|
||||
// 2. Sortieren der Gruppen
|
||||
// Laden: Wenig SoC zuerst (ASC) -> leere füllen
|
||||
// Entladen: Viel SoC zuerst (DESC) -> volle leeren
|
||||
if ($isCharge) {
|
||||
ksort($groups);
|
||||
} else {
|
||||
krsort($groups);
|
||||
}
|
||||
|
||||
// 3. Verteilung
|
||||
$remainingNeeded = $absPower;
|
||||
|
||||
foreach ($groups as $soc => $groupBatteries) {
|
||||
if ($remainingNeeded <= 0.01) break;
|
||||
|
||||
// Gesamte verfügbare Leistung in dieser SoC-Gruppe ermitteln
|
||||
$groupTotalCapacity = 0.0;
|
||||
foreach ($groupBatteries as $gb) {
|
||||
$groupTotalCapacity += $gb['maxW'];
|
||||
}
|
||||
|
||||
// Wie viel können wir dieser Gruppe zuteilen?
|
||||
// Entweder alles was die Gruppe kann, oder den Restbedarf
|
||||
$powerForThisGroup = min($remainingNeeded, $groupTotalCapacity);
|
||||
|
||||
// Proportionale Aufteilung innerhalb der Gruppe
|
||||
// Falls Gruppe Kapazität 0 hat (Defekt/Voll), verhindern wir DivByZero
|
||||
if ($groupTotalCapacity > 0) {
|
||||
$ratio = $powerForThisGroup / $groupTotalCapacity;
|
||||
foreach ($groupBatteries as $gb) {
|
||||
$assigned = $gb['maxW'] * $ratio;
|
||||
$result[$gb['idx']] = $assigned;
|
||||
}
|
||||
}
|
||||
|
||||
$remainingNeeded -= $powerForThisGroup;
|
||||
}
|
||||
|
||||
// Wenn wir entladen, müssen die Werte negativ sein
|
||||
if (!$isCharge) {
|
||||
foreach ($result as $idx => $val) {
|
||||
$result[$idx] = -$val;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// Hauptablauf
|
||||
// ---------------------------------------------------------
|
||||
|
||||
// 1. Berechnung für EV und SDL getrennt durchführen
|
||||
$evDistribution = $distributePower($pEvW, 'EV');
|
||||
$sdlDistribution = $distributePower($pSdlW, 'SDL');
|
||||
|
||||
// 2. Ergebnisse zusammenführen und Output formatieren
|
||||
$finalOutput = [];
|
||||
|
||||
foreach ($batteries as $bat) {
|
||||
$idx = $bat['idx'];
|
||||
// Summe der beiden Anforderungen (kann sich gegenseitig aufheben)
|
||||
$valEv = $evDistribution[$idx] ?? 0.0;
|
||||
$valSdl = $sdlDistribution[$idx] ?? 0.0;
|
||||
$totalW = $valEv + $valSdl;
|
||||
|
||||
// Aufteilen in Charge / Discharge für das Return-Format
|
||||
$chargeW = 0.0;
|
||||
$dischargeW = 0.0;
|
||||
|
||||
if ($totalW > 0) {
|
||||
$chargeW = abs($totalW);
|
||||
} else {
|
||||
$dischargeW = abs($totalW);
|
||||
}
|
||||
|
||||
// JSON Objekt erstellen
|
||||
$finalOutput[] = [
|
||||
"idx" => $idx,
|
||||
"typ" => (string)$bat['typ'], // Typ als String beibehalten
|
||||
"chargeW" => round($chargeW, 0), // Optional: runden für sauberes JSON
|
||||
"dischargeW" => round($dischargeW, 0)
|
||||
];
|
||||
}
|
||||
|
||||
$batteriesRaw = json_decode($this->ReadPropertyString("Batteries"));
|
||||
|
||||
$totalPower_ist = 0;
|
||||
|
||||
foreach ($batteriesRaw as $bat) {
|
||||
$totalPower_ist += (-1)*GetValue($bat->register_bat_power);
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// ALT (nicht mehr gebraucht) -> AUSKOMMENTIERT
|
||||
// ----------------------------
|
||||
/*
|
||||
$sumReq = (abs($pEvW) + abs($pSdlW));
|
||||
$sumReqRel = ($pEvW + $pSdlW);
|
||||
|
||||
if($sumReq==0){
|
||||
|
||||
$this->SetValue("Aktuelle_Leistung_EV", $totalPower_ist / 2);
|
||||
$this->SetValue("Aktuelle_Leistung_SDL", $totalPower_ist / 2);
|
||||
|
||||
}else{
|
||||
|
||||
if($pEvW>=0){
|
||||
$this->SetValue("Aktuelle_Leistung_EV",((1+($totalPower_ist-$sumReqRel) / $sumReq)) * $pEvW);
|
||||
}else{
|
||||
$this->SetValue("Aktuelle_Leistung_EV",((1-($totalPower_ist-$sumReqRel) / $sumReq)) * $pEvW);
|
||||
}
|
||||
|
||||
if($pSdlW>=0){
|
||||
$this->SetValue("Aktuelle_Leistung_SDL",((1+($totalPower_ist-$sumReqRel) / $sumReq)) * $pSdlW);
|
||||
}else{
|
||||
$this->SetValue("Aktuelle_Leistung_SDL",((1-($totalPower_ist-$sumReqRel) / $sumReq)) * $pSdlW);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// ----------------------------
|
||||
// NEU (genau deine gewünschte Logik)
|
||||
// aktuelle - EV_SOLL = aktuelle SDL
|
||||
// aktuelle - SDL_SOLL = aktuelle EV
|
||||
// ----------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
$eps = 0.01;
|
||||
|
||||
$aktEV = 0.0;
|
||||
$aktSDL = 0.0;
|
||||
|
||||
// Optional: Wenn einer 0 ist -> aktiver Kanal bekommt totalPower_ist
|
||||
if (abs($pEvW) < $eps && abs($pSdlW) < $eps) {
|
||||
|
||||
$aktEV = 0.0;
|
||||
$aktSDL = 0.0;
|
||||
|
||||
} elseif (abs($pEvW) < $eps) {
|
||||
|
||||
$aktEV = 0.0;
|
||||
$aktSDL = $totalPower_ist;
|
||||
|
||||
} elseif (abs($pSdlW) < $eps) {
|
||||
|
||||
$aktEV = $totalPower_ist;
|
||||
$aktSDL = 0.0;
|
||||
|
||||
} else {
|
||||
|
||||
// Beide aktiv
|
||||
$sameDirection = (($pEvW > 0 && $pSdlW > 0) || ($pEvW < 0 && $pSdlW < 0));
|
||||
|
||||
if ($sameDirection) {
|
||||
// Regel A: gleiche Richtung -> Ist proportional nach |Soll| aufteilen
|
||||
$sumAbs = abs($pEvW) + abs($pSdlW);
|
||||
|
||||
if ($sumAbs < $eps) {
|
||||
// Fallback
|
||||
$aktEV = $totalPower_ist / 2.0;
|
||||
$aktSDL = $totalPower_ist / 2.0;
|
||||
} else {
|
||||
$aktEV = $totalPower_ist * (abs($pEvW) / $sumAbs);
|
||||
$aktSDL = $totalPower_ist - $aktEV; // Summe bleibt exakt totalPower_ist
|
||||
}
|
||||
|
||||
} else {
|
||||
// Regel B: gegensätzliche Richtung -> Sollwerte anzeigen
|
||||
$aktEV = $pEvW;
|
||||
$aktSDL = $pSdlW;
|
||||
}
|
||||
}
|
||||
|
||||
$this->SetValue("Aktuelle_Leistung_EV", (float)$aktEV);
|
||||
$this->SetValue("Aktuelle_Leistung_SDL", (float)$aktSDL);
|
||||
*/
|
||||
|
||||
$eps = 0.01;
|
||||
|
||||
$sumSoll = (float)($pEvW + $pSdlW);
|
||||
|
||||
if (abs($sumSoll) > $eps) {
|
||||
// Normalfall: wir skalieren so, dass EV+SDL genau totalPower_ist ergibt
|
||||
$factor = (float)($totalPower_ist / $sumSoll);
|
||||
|
||||
$aktEV = (float)($pEvW * $factor);
|
||||
$aktSDL = (float)($pSdlW * $factor);
|
||||
|
||||
} else {
|
||||
// Sonderfall: Soll hebt sich nahezu auf (sumSoll ~ 0)
|
||||
// -> wenn Ist ebenfalls ~0: Soll anzeigen
|
||||
if (abs($totalPower_ist) < 50.0) { // 50W Toleranz kannst du anpassen
|
||||
$aktEV = (float)$pEvW;
|
||||
$aktSDL = (float)$pSdlW;
|
||||
} else {
|
||||
// Ist ist nicht 0 obwohl Sollsumme 0 -> Abweichung zuweisen (z.B. SDL)
|
||||
$aktEV = (float)$pEvW;
|
||||
$aktSDL = (float)($totalPower_ist - $aktEV);
|
||||
// Alternative: Abweichung EV geben:
|
||||
// $aktSDL = (float)$pSdlW;
|
||||
// $aktEV = (float)($totalPower_ist - $aktSDL);
|
||||
}
|
||||
}
|
||||
|
||||
$this->SetValue("Aktuelle_Leistung_EV", $aktEV);
|
||||
$this->SetValue("Aktuelle_Leistung_SDL", $aktSDL);
|
||||
|
||||
|
||||
|
||||
return $finalOutput;
|
||||
}
|
||||
|
||||
|
||||
private function WriteBatteryPowerSetpoints(array $distribution): void
|
||||
{
|
||||
IPS_LogMessage(
|
||||
__FUNCTION__,
|
||||
"distribution=" . json_encode($distribution, JSON_PRETTY_PRINT)
|
||||
);
|
||||
|
||||
$batteriesCfg = json_decode($this->ReadPropertyString("Batteries"), true);
|
||||
if (!is_array($batteriesCfg) || empty($batteriesCfg)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($distribution as $d) {
|
||||
|
||||
$idx = (int)($d["idx"] ?? -1);
|
||||
if ($idx < 0 || !isset($batteriesCfg[$idx])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$cfg = $batteriesCfg[$idx];
|
||||
|
||||
$typ = (string)($d["typ"] ?? ($cfg["typ"] ?? ("Bat " . ($idx + 1))));
|
||||
|
||||
// ✅ immer positiv
|
||||
$chargeW = max(0.0, (float)($d["chargeW"] ?? 0.0));
|
||||
$dischargeW = max(0.0, (float)($d["dischargeW"] ?? 0.0));
|
||||
|
||||
// nie gleichzeitig
|
||||
if ($chargeW > 0.0 && $dischargeW > 0.0) {
|
||||
$this->SendDebug("WriteBatteryPowerSetpoints", "WARN: both >0 for $typ (idx=$idx) -> set 0", 0);
|
||||
$chargeW = 0.0;
|
||||
$dischargeW = 0.0;
|
||||
}
|
||||
|
||||
$this->WriteByVendorRegistersSingleMode($typ, $cfg, $chargeW, $dischargeW);
|
||||
|
||||
$this->SendDebug("Setpoints", "$typ (idx=$idx) charge={$chargeW}W discharge={$dischargeW}W", 0);
|
||||
}
|
||||
}
|
||||
|
||||
private function WriteByVendorRegistersSingleMode(string $typ, array $cfg, float $chargeW, float $dischargeW): void
|
||||
{
|
||||
$t = mb_strtolower($typ);
|
||||
|
||||
// Leistungs-Variablen
|
||||
$varPowerCharge = (int)($cfg["powerbat_laden"] ?? 0);
|
||||
$varPowerDisch = (int)($cfg["powerbat_entladen"] ?? 0);
|
||||
|
||||
// ✅ EIN Modus-Register
|
||||
$varMode = (int)($cfg["register_ladenentladen_modus"] ?? 0);
|
||||
|
||||
// sichere Writer
|
||||
$setInt = function(int $varId, int $value): void {
|
||||
if ($varId > 0 && IPS_VariableExists($varId)) {
|
||||
RequestAction($varId, $value);
|
||||
}
|
||||
};
|
||||
$setW = function(int $varId, float $w): void {
|
||||
if ($varId > 0 && IPS_VariableExists($varId)) {
|
||||
RequestAction($varId, (int)round(max(0.0, $w), 0)); // ✅ niemals negativ
|
||||
}
|
||||
};
|
||||
|
||||
// Moduscodes je Typ
|
||||
$modeCharge = 1; $modeDisch = 2; // Default
|
||||
if (strpos($t, "goodwe") !== false) {
|
||||
$modeCharge = 11; $modeDisch = 12;
|
||||
} elseif (strpos($t, "solaredge") !== false) {
|
||||
$modeCharge = 3; $modeDisch = 4;
|
||||
}
|
||||
|
||||
// =========================
|
||||
// Laden
|
||||
// =========================
|
||||
if ($chargeW > 0.0) {
|
||||
|
||||
// Modus setzen (ein Register)
|
||||
$setInt($varMode, $modeCharge);
|
||||
|
||||
// GoodWe: nur powerbat_laden
|
||||
if (strpos($t, "goodwe") !== false) {
|
||||
$setW($varPowerCharge, (int)$chargeW);
|
||||
$setW($varPowerDisch, (int)0);
|
||||
return;
|
||||
}
|
||||
|
||||
// SolarEdge + Default: zwei Leistungsregister
|
||||
$setW($varPowerCharge, $chargeW);
|
||||
$setW($varPowerDisch, 0.0);
|
||||
return;
|
||||
}
|
||||
|
||||
// =========================
|
||||
// Entladen
|
||||
// =========================
|
||||
if ($dischargeW > 0.0) {
|
||||
|
||||
// Modus setzen (ein Register)
|
||||
$setInt($varMode, $modeDisch);
|
||||
|
||||
// GoodWe: Entladen nutzt trotzdem powerbat_laden (immer positiv)
|
||||
if (strpos($t, "goodwe") !== false) {
|
||||
$setW($varPowerCharge, (int)$dischargeW);
|
||||
$setW($varPowerDisch, (int)0);
|
||||
return;
|
||||
}
|
||||
|
||||
// SolarEdge + Default: Entladen in powerbat_entladen
|
||||
$setW($varPowerDisch, $dischargeW);
|
||||
$setW($varPowerCharge, 0.0);
|
||||
return;
|
||||
}
|
||||
|
||||
// =========================
|
||||
// Stop / Neutral
|
||||
// =========================
|
||||
$setW($varPowerCharge, 0.0);
|
||||
$setW($varPowerDisch, 0.0);
|
||||
// optional: Modus nicht anfassen oder auf 0 setzen:
|
||||
// $setInt($varMode, 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -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,117 @@
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"type": "Label",
|
||||
"caption": "Aufgepasst: Bei Goodwe nur Ladenvariabel auswählen und entladen Dummy Variabel.\nGoodwe braucht nur eine Leistungssoll Variabel. Entlade NICHT auf gleiche Variabel setzen wie Laden\nGoodwe: Laden=11, Entladen=12,\nSolaredge: Laden=3, Entladen=4\nDefault: Laden=1, Entladen=2"
|
||||
},
|
||||
{
|
||||
"type":"List",
|
||||
"name":"Batteries",
|
||||
"caption":"Batterien mit Typ, Leistung und kapazität",
|
||||
"add":true,
|
||||
"delete":true,
|
||||
"columns":[
|
||||
{
|
||||
"caption":"Typ",
|
||||
"name":"typ",
|
||||
"width":"100px",
|
||||
"add":"Stufe",
|
||||
"edit":{
|
||||
"type":"ValidationTextBox"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption":"Leistung in W",
|
||||
"name":"powerbat",
|
||||
"width":"150px",
|
||||
"add":5000,
|
||||
"edit":{
|
||||
"type":"NumberSpinner"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption":"Kapazität in kWh",
|
||||
"name":"capazity",
|
||||
"width":"200px",
|
||||
"add":60,
|
||||
"edit":{
|
||||
"type":"NumberSpinner"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption":"SoC",
|
||||
"name":"soc",
|
||||
"width":"200px",
|
||||
"add":0,
|
||||
"edit":{
|
||||
"type":"SelectVariable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption":"Batterieleistung Laden",
|
||||
"name":"powerbat_laden",
|
||||
"width":"200px",
|
||||
"add":0,
|
||||
"edit":{
|
||||
"type":"SelectVariable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption":"Batterieleistung Entladen",
|
||||
"name":"powerbat_entladen",
|
||||
"width":"200px",
|
||||
"add":0,
|
||||
"edit":{
|
||||
"type":"SelectVariable"
|
||||
}
|
||||
}
|
||||
,
|
||||
{
|
||||
"caption": "Register Laden/Entladen Modus",
|
||||
"name": "register_ladenentladen_modus",
|
||||
"width": "260px",
|
||||
"add": 0,
|
||||
"edit": {
|
||||
"type": "SelectVariable"
|
||||
}
|
||||
}
|
||||
,
|
||||
{
|
||||
"caption": "Aktuelle Batterieleistung",
|
||||
"name": "register_bat_power",
|
||||
"width": "260px",
|
||||
"add": 0,
|
||||
"edit": {
|
||||
"type": "SelectVariable"
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "SDL_Leistung_Laden",
|
||||
"caption": "SDL_Leistung_Laden",
|
||||
"suffix": "W"
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "SDL_Leistung_Entladen",
|
||||
"caption": "SDL_Leistung_Entladen",
|
||||
"suffix": "W"
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "UpdateInterval",
|
||||
"caption": "Neuberechnung alle",
|
||||
"suffix": "Sekunden",
|
||||
"minimum": 0,
|
||||
"maximum": 86400
|
||||
},
|
||||
{
|
||||
"type": "CheckBox",
|
||||
"name": "FilterAktiv",
|
||||
"caption": "Aktuelle Leistung filtern"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"id": "{C26E97C8-BA00-0563-6B14-B807C5ACE17F}",
|
||||
"name": "SofarWechselrichter",
|
||||
"id": "{9C3DCC91-FA9E-72E5-7FA6-7B483D1D114D}",
|
||||
"name": "Bat_EV_SDL_V3_Beta",
|
||||
"type": 3,
|
||||
"vendor": "Belevo AG",
|
||||
"aliases": [],
|
||||
@@ -9,4 +9,4 @@
|
||||
"implemented": [],
|
||||
"prefix": "GEF",
|
||||
"url": ""
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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,246 @@
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"type": "Label",
|
||||
"caption": "Aufgepasst: Bei Goodwe nur Ladenvariabel auswählen und entladen Dummy Variabel.\nGoodwe braucht nur eine Leistungssoll Variabel. Entlade NICHT auf gleiche Variabel setzen wie Laden\nGoodwe: Laden=11, Entladen=12,\nSolaredge: Laden=3, Entladen=4\nDefault: Laden=1, Entladen=2"
|
||||
},
|
||||
{
|
||||
"type": "List",
|
||||
"name": "Batteries",
|
||||
"caption": "Batterien",
|
||||
"rowCount": 5,
|
||||
"add": true,
|
||||
"delete": true,
|
||||
"sort": {
|
||||
"column": "typ",
|
||||
"direction": "ascending"
|
||||
},
|
||||
"columns": [
|
||||
{
|
||||
"caption": "Typ",
|
||||
"name": "typ",
|
||||
"width": "160px",
|
||||
"add": "",
|
||||
"edit": {
|
||||
"type": "ValidationTextBox"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "Kapazität",
|
||||
"name": "capazity",
|
||||
"width": "100px",
|
||||
"suffix": " kWh",
|
||||
"add": 0,
|
||||
"edit": {
|
||||
"type": "NumberSpinner",
|
||||
"minimum": 0,
|
||||
"digits": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "Batterieleistung",
|
||||
"name": "powerbat",
|
||||
"width": "120px",
|
||||
"suffix": " W",
|
||||
"add": 0,
|
||||
"edit": {
|
||||
"type": "NumberSpinner",
|
||||
"minimum": 0,
|
||||
"digits": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "SoC Variable",
|
||||
"name": "soc",
|
||||
"width": "120px",
|
||||
"add": 0,
|
||||
"edit": {
|
||||
"type": "SelectVariable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "Ist-Leistung Register",
|
||||
"name": "register_bat_power",
|
||||
"width": "150px",
|
||||
"add": 0,
|
||||
"edit": {
|
||||
"type": "SelectVariable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "Ladeleistung Register",
|
||||
"name": "powerbat_laden",
|
||||
"width": "150px",
|
||||
"add": 0,
|
||||
"edit": {
|
||||
"type": "SelectVariable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "Entladeleistung Register",
|
||||
"name": "powerbat_entladen",
|
||||
"width": "160px",
|
||||
"add": 0,
|
||||
"edit": {
|
||||
"type": "SelectVariable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "Modus Register",
|
||||
"name": "register_ladenentladen_modus",
|
||||
"width": "140px",
|
||||
"add": 0,
|
||||
"edit": {
|
||||
"type": "SelectVariable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "Min. SoC",
|
||||
"name": "minPhysicalSocPct",
|
||||
"width": "100px",
|
||||
"suffix": " %",
|
||||
"add": 5,
|
||||
"edit": {
|
||||
"type": "NumberSpinner",
|
||||
"minimum": 0,
|
||||
"maximum": 30,
|
||||
"digits": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"values": []
|
||||
},
|
||||
{
|
||||
"type": "ExpansionPanel",
|
||||
"caption": "SDL / EV Fenster",
|
||||
"items": [
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "SDL_Leistung_Laden",
|
||||
"caption": "SDL Leistung Laden",
|
||||
"suffix": " W",
|
||||
"minimum": 0,
|
||||
"digits": 0
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "SDL_Leistung_Entladen",
|
||||
"caption": "SDL Leistung Entladen",
|
||||
"suffix": " W",
|
||||
"minimum": 0,
|
||||
"digits": 0
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "ReserveHours",
|
||||
"caption": "SDL Reservezeit",
|
||||
"suffix": " h",
|
||||
"minimum": 0,
|
||||
"maximum": 24,
|
||||
"digits": 2
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "SDL_Start_Pos_Config",
|
||||
"caption": "Virtueller SDL Startwert",
|
||||
"suffix": " %",
|
||||
"minimum": 0,
|
||||
"maximum": 100,
|
||||
"digits": 2
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "EV_Start_Pos_Config",
|
||||
"caption": "Virtueller EV Startwert",
|
||||
"suffix": " %",
|
||||
"minimum": 0,
|
||||
"maximum": 100,
|
||||
"digits": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "ExpansionPanel",
|
||||
"caption": "Regelung",
|
||||
"items": [
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "UpdateInterval",
|
||||
"caption": "Update Intervall",
|
||||
"suffix": " s",
|
||||
"minimum": 1,
|
||||
"digits": 0
|
||||
},
|
||||
{
|
||||
"type": "Label",
|
||||
"caption": "EV-SoC Nachberechnung:\n\nAlle X Stunden wird geprüft, ob der virtuelle SDL-SoC bei 50% liegt.\nWenn ja, wird der EV-SoC anhand der physischen Batterie-SoCs neu berechnet.\nDie EV-Toleranz verhindert kleine unnötige Korrekturen.\n\n0 Stunden = automatische EV-Neuberechnung deaktiviert."
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "EV_Recalc_IntervalHours",
|
||||
"caption": "EV SoC neu berechnen alle",
|
||||
"suffix": " h",
|
||||
"minimum": 0,
|
||||
"maximum": 168,
|
||||
"digits": 2
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "EV_Recalc_TolerancePct",
|
||||
"caption": "EV Recalc Toleranz",
|
||||
"suffix": " %",
|
||||
"minimum": 0,
|
||||
"maximum": 100,
|
||||
"digits": 2
|
||||
},
|
||||
{
|
||||
"type": "CheckBox",
|
||||
"name": "FilterAktiv",
|
||||
"caption": "Filter für aktuelle EV/SDL Leistung aktiv. Dient für die Visualisierung, um Leistungssprünge zu vermeiden."
|
||||
},
|
||||
{
|
||||
"type": "Label",
|
||||
"caption": "Filter für aktuelle Leistung:\n\nToleranz (%): Wie stark der Istwert vom Soll abweichen darf\nRampe (W/s): Wie schnell die Leistung verändert wird (Trägheit)\nTreffer: Wie oft ein Wert passen muss, bevor er übernommen wird\n\n→ Höhere Rampe = schneller, aber sprunghafter\n→ Niedrigere Rampe = ruhiger, aber träger"
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "FilterTolerancePct",
|
||||
"caption": "Filter Toleranz",
|
||||
"suffix": " %",
|
||||
"minimum": 0,
|
||||
"maximum": 100,
|
||||
"digits": 1
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "FilterRampWPerSec",
|
||||
"caption": "Filter Rampe",
|
||||
"suffix": " W/s",
|
||||
"minimum": 100,
|
||||
"maximum": 20000,
|
||||
"digits": 0
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "FilterHits",
|
||||
"caption": "Filter Treffer bis Übernahme",
|
||||
"minimum": 1,
|
||||
"maximum": 10,
|
||||
"digits": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": "Button",
|
||||
"caption": "Virtuelle Konten auf Startwerte zurücksetzen",
|
||||
"onClick": "GEF_ResetVirtualAccounts($id);"
|
||||
},
|
||||
{
|
||||
"type": "Button",
|
||||
"caption": "Jetzt aktualisieren",
|
||||
"onClick": "GEF_Update($id);"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"id": "{A7FEA6E1-EBAA-1567-C14B-9A63B09C9EDC}",
|
||||
"name": "Batterie_test",
|
||||
"id": "{770BB7E3-0F19-0469-D0D4-DD0A0E22BDEA}",
|
||||
"name": "Bat_EV_SDL_V4",
|
||||
"type": 3,
|
||||
"vendor": "Belevo AG",
|
||||
"aliases": [],
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,122 @@
|
||||
# Enelix-Verbrauchermodul Batterie
|
||||
|
||||
Dieses Modul integriert Batteriespeicher als steuerbare Verbraucher/Erzeuger in das Belevo Energiemanagement-System (Enelix). Es berechnet dynamisch Lade- und Entladevorgaben, kommuniziert mit dem übergeordneten Manager und steuert native Wechselrichter-Schnittstellen.
|
||||
|
||||
---
|
||||
|
||||
## Inhaltsverzeichnis
|
||||
|
||||
1. [Funktionsumfang](#1-funktionsumfang)
|
||||
2. [Voraussetzungen](#2-voraussetzungen)
|
||||
3. [Installation](#3-installation)
|
||||
4. [Instanz anlegen & Konfiguration](#4-instanz-anlegen--konfiguration)
|
||||
5. [Statusvariablen & Profile](#5-statusvariablen--profile)
|
||||
6. [WebFront / Bedienung](#6-webfront--bedienung)
|
||||
7. [Mapping auf Code-Komponenten](#7-mapping-auf-code-komponenten)
|
||||
8. [Zukünftige Erweiterungen](#8-zukünftige-erweiterungen)
|
||||
|
||||
---
|
||||
|
||||
## 1. Funktionsumfang
|
||||
|
||||
- **Zyklische Steuerung:** In konfigurierbaren Intervallen (`Interval`) berechnet das Modul die aktuell verfügbaren Leistungsschritte und aktualisiert den Status.
|
||||
- **Hersteller-Integration:** Native Steuerlogik für spezifische Wechselrichter (Goodwe, Solaredge, Sig Energy). Die Modus-Umschaltung (Laden/Entladen/Standby) erfolgt automatisch durch setzen der passenden Hersteller-Codes.
|
||||
- **PowerSteps-Generierung:** Das Modul meldet dem Enelix-Manager ein Array an möglichen Leistungsschritten (`PowerSteps`), berechnet aus der maximalen Lade- (`MaxBatterieleistung`) und Entladeleistung (`MaxNachladen`). Dies geschieht in 250 Watt schritten, wobei zur feineren Regelung um den aktuellen Sollwert noch 50W-Schritte verteilt werden.
|
||||
- **Peak-Shaving vs. PV-Überschuss:** Automatische Anpassung der angebotenen `PowerSteps` basierend auf dem vom Manager vorgegebenen Modus (`Is_Peak_Shaving`). Im Peak-Shaving-Modus arbeitet die Batterie im unteren SoC-Bereich um lastspitzen zu brechen, im Solarmodus im oberen Bereich um den Eigenverbruach zu optimieren.
|
||||
- **Peak-Shaving-Reserve:** Berücksichtigung des Ladezustands (SoC). Eine einstellbare Reserve (`AufdasNachladen`) wird für das Peak-Shaving vorgehalten. Bei Unterschreitung der Minimalkapazität (`MinimumEntladen`) wird die Entladung blockiert.
|
||||
|
||||
---
|
||||
|
||||
## 2. Voraussetzungen
|
||||
|
||||
- IP-Symcon **≥ 8.0**
|
||||
- Modul-URL: `https://git.belevo.ch/dh/enelix.git`
|
||||
- Vorhandener und eingerichteter Enelix Manager.
|
||||
- Anbindung der Wechselrichter-Variablen (Netzbezug, SoC, Batterieleistung) in IP-Symcon.
|
||||
|
||||
---
|
||||
|
||||
## 3. Installation
|
||||
|
||||
1. In IP-Symcon **Module Control** öffnen.
|
||||
2. **Hinzufügen → Git-Repository**.
|
||||
3. URL eingeben und **Installieren**.
|
||||
4. IP-Symcon neu starten.
|
||||
|
||||
---
|
||||
|
||||
## 4. Instanz anlegen & Konfiguration
|
||||
|
||||
### 4.1 Instanz anlegen
|
||||
|
||||
- Rechtsklick **Instanzen** → **Instanz hinzufügen**
|
||||
- Filter: **Belevo**
|
||||
- Auswahl: **Batterie (Verbraucher)**
|
||||
|
||||
### 4.2 Properties
|
||||
|
||||
| Name | Typ | Beschreibung |
|
||||
|---|---|---|
|
||||
| **IdleCounterMax** | NumberSpinner | Anzahl der Intervall-Zyklen zwischen zwei Leistungsänderungen. |
|
||||
| **Interval** | NumberSpinner | Berechnungsintervall in Sekunden. |
|
||||
| **Batterietyp** | Select | Wechselrichter-Typ (0: Unabhängig, 1: Goodwe, 2: Solaredge, 3: Sig Energy). |
|
||||
| **MaxBatterieleistung** | SelectVariable | Maximale Ladeleistung der Batterie (Watt). |
|
||||
| **MaxNachladen** | SelectVariable | Maximalen Entladeleistung der Batterie (Watt). |
|
||||
| **AufdasNachladen** | NumberSpinner | Nachladekapazität (Reserve für Peak-Shaving in %). |
|
||||
| **MinimumEntladen** | NumberSpinner | Minimale Kapazität (Tiefenentladeschutz in %). |
|
||||
| **Batteriemanagement** | Select | Steuerung der Batterie durch (1: Wechselrichter, 2: Manager Enelix). |
|
||||
| **Batterieladezustand**| SelectVariable | Variable mit dem aktuellen Batterieladestand (SoC in %). |
|
||||
| **Netzbezug** | SelectVariable | Variable mit dem zu regelnden Netzbezug (identisch mit Manager). |
|
||||
| **AktuelleBatterieleistung**| SelectVariable| Variable mit der aktuellen Ist-Leistung der Batterie. |
|
||||
|
||||
---
|
||||
|
||||
## 5. Statusvariablen & Profile
|
||||
|
||||
| Ident | Typ | Beschreibung |
|
||||
|---|---|---|
|
||||
| **PowerSteps** | String | JSON-Array der dem Manager angebotenen Leistungsschritte. |
|
||||
| **Aktuelle_Leistung** | Integer | Die aktuell von der Batterie erbrachte Leistung. |
|
||||
| **Power** | Integer | Interner | Die aktuell vom Manager zugewiesene Soll-Leistung. |
|
||||
| **Laden_Entladen** | Integer | Herstellerspezifischer Code zum Einstellen des Lademodi (z.B. Goodwe: 11=Laden, 12=Entladen). |
|
||||
| **Idle** | Boolean | Status der Sperrzeit (`true` = bereit für neue Werte, `false` = gesperrt). |
|
||||
| **Hysterese** | Boolean | Zeigt an, ob die Batterie aktuell in Hystere nachregelt. |
|
||||
| **Bezogene_Energie** | Float | Rechnerisch aufsummierte Energie (Leistung × Zeit). |
|
||||
| **PV_Prio** | Integer | Priorität des Verbrauchers für PV-Optimierung, Tiefe Nummer = Hohe Priorität |
|
||||
| **Sperre_Prio** | Integer | Priorität des Verbrauchers für Peak-Optimierung, Tiefe Nummer = Hohe Priorität |
|
||||
| **Bezogene_Energie** | Float | Rechnerisch aufsummierte Energie (Leistung × Zeit). |
|
||||
| **Is_Peak_Shaving** | Boolean | Vom Manager übermittelter aktueller Betriebsmodus. |
|
||||
| **Goodwe_EntLadeleistung** | Interner | Zusatzvariable für Steuerung der Sollleistung bei Goodwespeichern |
|
||||
| **Ladeleistung** | Interner | Sollladelesistung Speicher |
|
||||
| **Entladeleistung** | Interner | Sollentladeleistung Speicher |
|
||||
|
||||
*(Die Variabeln `Goodwe_EntLadeleistung`, `Ladeleistung` oder `Entladeleistung` werden in abhängigkeit von `Batterietyp` angelegt).*
|
||||
|
||||
---
|
||||
|
||||
## 6. WebFront / Bedienung
|
||||
|
||||
Die Anbindung der Batterie sowie die regelung der Prioritäten wird über folgende Variabeln eingestellt:
|
||||
`Laden_Entladen`- Signalisation ob Speicher laden soll oder entladen (Herstellerunabhängig 0 = Laden, 1 = Entladen, ansonsten Herstellerabhängige Werte)
|
||||
`Ladeleistung` - Soll Ladeleistung Speicher
|
||||
`Entladeleistung` - Soll Entladeleistung Speicher
|
||||
`Goodwe_EntLadeleistung`- Zusatzvariable Entladeleistung für Goodwe-Speicher
|
||||
|
||||
`PV_Prio` - Priorität des Verbrauchers für PV-Optimierung, Tiefe Nummer = Hohe Priorität
|
||||
`Sperre_Prio` - Priorität des Verbrauchers für Peak-Optimierung, Tiefe Nummer = Hohe Priorität
|
||||
|
||||
## 7. Mapping auf Code-Komponenten
|
||||
|
||||
| Komponente | Funktion im Code (`module.php`) |
|
||||
|---|---|
|
||||
| **Timer-Registrierung** | `ApplyChanges()` setzt `Timer_Do_UserCalc_Battery` basierend auf `Interval`. Erstellt die passenden Variabeln auf basis des Batterietyps |
|
||||
| **PowerSteps Generierung**| `GeneratePowerSteps()` baut das Raster aus zulässigen Werten basierend auf MaxLaden/Entladen in 250er/50er Schritten auf. |
|
||||
| **Betriebslogik & Limits**| `GetCurrentData($Peak)` filtert die `PowerSteps` je nach SoC, Hysterese und Peak-Modus. |
|
||||
| **Leistungszuteilung** | `SetAktuelle_Leistung($power)` übersetzt die vom Manager geforderte Leistung in herstellerspezifische Variablen und Steuercodes. |
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 8. Zukünftige Erweiterungen
|
||||
|
||||
- **Wetter- und Prognosedaten:** Dynamische Anpassung des Parameters `AufdasNachladen` basierend auf dem zu erwartenden Solarertrag, Anpassung des Parameters auf Monate umd Peak auf Monatsende zu optimieren.
|
||||
|
||||
+22
-13
@@ -2,12 +2,12 @@
|
||||
"elements": [
|
||||
{
|
||||
"type": "Label",
|
||||
"caption": "Konfiguration der Batterie für Peakshaving"
|
||||
"caption": "Konfiguration Enelix-Verbrauchermodul Batterie"
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "IdleCounterMax",
|
||||
"caption": "Zyklen zwischen zwei Leistungsänderungen (Multipliziert sich mit Interval)",
|
||||
"caption": "Anzahl Interval-Zyklen zwischen zwei Leistungsänderungen",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
@@ -21,6 +21,10 @@
|
||||
"name":"Batterietyp",
|
||||
"caption":"Batterietyp",
|
||||
"options":[
|
||||
{
|
||||
"caption":"Herstellerunabhängig",
|
||||
"value":0
|
||||
},
|
||||
{
|
||||
"caption":"Goodwe",
|
||||
"value":1
|
||||
@@ -36,41 +40,41 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"type": "SelectVariable",
|
||||
"name": "MaxBatterieleistung",
|
||||
"caption": "Maximale Batterieleistung",
|
||||
"caption": "Maximale Ladeleistung Batterie",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"type": "SelectVariable",
|
||||
"name": "MaxNachladen",
|
||||
"caption": "Maximum Nachladen",
|
||||
"caption": "Maximum Nachladeleistung Batterie",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "AufdasNachladen",
|
||||
"caption": "Auf so viel Prozent nachladen",
|
||||
"caption": "Nachladekapazität für Peakshavingreserve",
|
||||
"suffix": ""
|
||||
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "MinimumEntladen",
|
||||
"caption": "Minimum des Batterieladezustand",
|
||||
"caption": "Maximale Entladetiefe",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
"type":"Select",
|
||||
"name":"Batteriemanagement",
|
||||
"caption":"Batteriemanagement",
|
||||
"caption":"Steuerung der Batterie durch -",
|
||||
"options":[
|
||||
{
|
||||
"caption":"Durch Wechselrichter",
|
||||
"caption":"Wechselrichter (Verbraucher deaktiviert sich am Manager)",
|
||||
"value":1
|
||||
},
|
||||
{
|
||||
"caption":"Durch EMS Symcon",
|
||||
"caption":"Manager Enelix",
|
||||
"value":2
|
||||
}
|
||||
]
|
||||
@@ -78,13 +82,18 @@
|
||||
{
|
||||
"type": "SelectVariable",
|
||||
"name": "Batterieladezustand",
|
||||
"caption": "Batterieladezustand",
|
||||
"caption": "Batterieladestand",
|
||||
"test": true
|
||||
},
|
||||
{
|
||||
"type": "SelectVariable",
|
||||
"name": "Netzbezug",
|
||||
"caption": "Variable mit dem zu regelnden Netzbezug"
|
||||
"caption": "Variable mit dem zu regelnden Netzbezug (= Netzbezug im Manager)"
|
||||
},
|
||||
{
|
||||
"type": "SelectVariable",
|
||||
"name": "AktuelleBatterieleistung",
|
||||
"caption": "Variable mit der aktueller Batterieleistung"
|
||||
},
|
||||
{
|
||||
"type": "Label",
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
"childRequirements": [],
|
||||
"implemented": [],
|
||||
"prefix": "GEF",
|
||||
"url": ""
|
||||
"url": "https://git.belevo.ch/dh/Enelix/src/branch/main/Batterie"
|
||||
}
|
||||
+179
-133
@@ -15,27 +15,25 @@ class Batterie extends IPSModule
|
||||
$this->RegisterPropertyInteger("Batteriemanagement", 1);
|
||||
$this->RegisterPropertyInteger("Batterietyp", 1);
|
||||
$this->RegisterPropertyInteger("MaxNachladen",0);
|
||||
$this->RegisterPropertyInteger("Netzbezug", 0); // Initialisierung mit 0
|
||||
$this->RegisterPropertyInteger("Netzbezug", 0);
|
||||
$this->RegisterPropertyInteger("AktuelleBatterieleistung", 0);// Initialisierung mit 0
|
||||
$this->RegisterPropertyInteger("Interval", 2); // Recheninterval
|
||||
|
||||
|
||||
// Variabeln für Kommunkation mit Manager
|
||||
$this->RegisterVariableInteger("Batteriemanagement_Variabel","Batteriemanagement_Variabel", "",0);
|
||||
$this->RegisterVariableInteger("Laden_Entladen","Laden_Entladen", "",3);
|
||||
$this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0);
|
||||
$this->RegisterVariableString("PowerSteps", "PowerSteps");
|
||||
$this->RegisterVariableBoolean("Idle", "Idle", "", 0);
|
||||
$this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio");
|
||||
$this->RegisterVariableInteger("PV_Prio", "PV_Prio");
|
||||
$this->RegisterVariableInteger("Power", "Power");
|
||||
$this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving");
|
||||
$this->RegisterVariableInteger("Leistung_Delta", "Leistung_Delta", "", 0);
|
||||
|
||||
$this->RegisterVariableInteger("Laden_Entladen","Laden_Entladen", "",3);
|
||||
$this->RegisterVariableBoolean("Hysterese", "Hysterese","",false);
|
||||
|
||||
|
||||
|
||||
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0);
|
||||
|
||||
// Variabeln für Kommunkation mit Manager
|
||||
$this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle zugeteilte Leistung", "", 0);
|
||||
$this->RegisterVariableString("PowerSteps", "Leistungsschritte");
|
||||
$this->RegisterVariableBoolean("Idle", "Idle", "", 0);
|
||||
$this->RegisterVariableInteger("Sperre_Prio", "Priorität Peakshaving");
|
||||
$this->RegisterVariableInteger("PV_Prio", "Priorität PV");
|
||||
$this->RegisterVariableInteger("Power", "Leistung Batterie");
|
||||
$this->RegisterVariableBoolean("Is_Peak_Shaving", "Peakshavingmodus");
|
||||
$this->RegisterVariableInteger("Leistung_Delta", "Leistung Delta", "", 0);
|
||||
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene Energie", "", 0);
|
||||
|
||||
// Hilfsvariabeln für Idle zustand
|
||||
$this->RegisterPropertyInteger("IdleCounterMax", 2);
|
||||
@@ -43,8 +41,7 @@ class Batterie extends IPSModule
|
||||
$this->SetValue("IdleCounter", 0);
|
||||
|
||||
// Initialisiere Idle
|
||||
$this->SetValue("Idle", true);
|
||||
|
||||
|
||||
$this->RegisterTimer("Timer_Do_UserCalc_Battery",$this->ReadPropertyInteger("Interval")*1000,"IPS_RequestAction(" .$this->InstanceID .', "Do_UserCalc", "");');
|
||||
|
||||
|
||||
@@ -60,87 +57,56 @@ class Batterie extends IPSModule
|
||||
|
||||
$batterietyp = $this->ReadPropertyInteger("Batterietyp");
|
||||
|
||||
// Batterietypabhängige Variabeln Initialisieren
|
||||
switch ($batterietyp) {
|
||||
case 0: // Herstellerunabhängig
|
||||
|
||||
$this->MaintainVariable("Goodwe_EntLadeleistung", "Goodwe_EntLadeleistung", VARIABLETYPE_FLOAT, "", 10, false);
|
||||
$this->MaintainVariable("Ladeleistung", "Ladeleistung", VARIABLETYPE_FLOAT, "", 11, false);
|
||||
$this->MaintainVariable("Entladeleistung", "Entladeleistung", VARIABLETYPE_FLOAT, "", 13, false);
|
||||
break;
|
||||
|
||||
case 1: // Goodwe
|
||||
$this->MaintainVariable("Goodwe_EntLadeleistung", "Goodwe_EntLadeleistung", VARIABLETYPE_FLOAT, "", 10, true);
|
||||
$this->MaintainVariable("Ladeleistung", "Ladeleistung", VARIABLETYPE_FLOAT, "", 11, false);
|
||||
$this->MaintainVariable("Entladeleistung", "Entladeleistung", VARIABLETYPE_FLOAT, "", 13, false);
|
||||
$this->MaintainVariable("Laden_Entladen", "Laden_Entladen", VARIABLETYPE_INTEGER, "", 12, true);
|
||||
break;
|
||||
|
||||
case 2: // Solaredge
|
||||
$this->MaintainVariable("Goodwe_EntLadeleistung", "Goodwe_EntLadeleistung", VARIABLETYPE_FLOAT, "", 10, false);
|
||||
$this->MaintainVariable("Ladeleistung", "Ladeleistung", VARIABLETYPE_FLOAT, "", 11, true);
|
||||
$this->MaintainVariable("Entladeleistung", "Entladeleistung", VARIABLETYPE_FLOAT, "", 13, true);
|
||||
$this->MaintainVariable("Laden_Entladen", "Laden_Entladen", VARIABLETYPE_INTEGER, "", 12, true);
|
||||
break;
|
||||
|
||||
case 3: // SiG Energy
|
||||
$this->MaintainVariable("Goodwe_EntLadeleistung", "Goodwe_EntLadeleistung", VARIABLETYPE_FLOAT, "", 10, false);
|
||||
$this->MaintainVariable("Ladeleistung", "Ladeleistung", VARIABLETYPE_FLOAT, "", 11, true);
|
||||
$this->MaintainVariable("Entladeleistung", "Entladeleistung", VARIABLETYPE_FLOAT, "", 13, true);
|
||||
$this->MaintainVariable("Laden_Entladen", "Laden_Entladen", VARIABLETYPE_INTEGER, "", 12, true);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Sicherheit: alles weg
|
||||
// Default, werden alle ausgeschaltet
|
||||
$this->MaintainVariable("Goodwe_EntLadeleistung", "Goodwe_EntLadeleistung", VARIABLETYPE_FLOAT, "", 10, false);
|
||||
$this->MaintainVariable("Ladeleistung", "Ladeleistung", VARIABLETYPE_FLOAT, "", 11, false);
|
||||
$this->MaintainVariable("Laden_Entladen", "Laden_Entladen", VARIABLETYPE_INTEGER, "", 12, false);
|
||||
$this->MaintainVariable("Entladeleistung", "Entladeleistung", VARIABLETYPE_FLOAT, "", 13, false);
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
$maxBatVar = $this->ReadPropertyInteger("MaxBatterieleistung");
|
||||
$maxNachVar = $this->ReadPropertyInteger("MaxNachladen");
|
||||
|
||||
if ($maxBatVar > 0) {
|
||||
$this->RegisterMessage($maxBatVar, VM_UPDATE);
|
||||
}
|
||||
if ($maxNachVar > 0) {
|
||||
$this->RegisterMessage($maxNachVar, VM_UPDATE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function GeneratePowerSteps($additionalValue)
|
||||
{
|
||||
$maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung");
|
||||
$stepSize = 250; // Schrittgröße
|
||||
$stepSizeSmall = 50; // Kleine Schrittgröße
|
||||
|
||||
// Array direkt als Range erzeugen (schneller als Schleife)
|
||||
$array_powersteps = range(-$maxleistung, $maxleistung, $stepSize);
|
||||
|
||||
// Nächstgelegenen Wert direkt bestimmen (rundet auf den nächsten Step)
|
||||
$closestValue = round($additionalValue / $stepSize) * $stepSize;
|
||||
|
||||
// Falls der Wert nicht im Bereich liegt, abbrechen
|
||||
if (!in_array($closestValue, $array_powersteps)) {
|
||||
return $array_powersteps;
|
||||
}
|
||||
|
||||
// Index des gefundenen Werts suchen
|
||||
$index = array_search($closestValue, $array_powersteps);
|
||||
|
||||
// Zusätzliche Werte berechnen und auf MaxLeistung begrenzen
|
||||
$newValues = array_filter([
|
||||
$closestValue - 4 * $stepSizeSmall,
|
||||
$closestValue - 3 * $stepSizeSmall,
|
||||
$closestValue - 2 * $stepSizeSmall,
|
||||
$closestValue - $stepSizeSmall,
|
||||
$closestValue,
|
||||
$closestValue + $stepSizeSmall,
|
||||
$closestValue + 2 * $stepSizeSmall,
|
||||
$closestValue + 3 * $stepSizeSmall,
|
||||
$closestValue + 4 * $stepSizeSmall,
|
||||
], function ($value) use ($maxleistung) {
|
||||
return $value >= -$maxleistung && $value <= $maxleistung;
|
||||
});
|
||||
|
||||
// Effizienteres Einfügen der Werte (direkt an der Stelle)
|
||||
array_splice($array_powersteps, $index, 1, $newValues);
|
||||
|
||||
return $array_powersteps;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function RequestAction($Ident, $Value)
|
||||
{
|
||||
switch ($Ident) {
|
||||
@@ -161,74 +127,93 @@ public function RequestAction($Ident, $Value)
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("Invalid Ident");
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Nach aufruf bei anpassung Batteriewerte, sofort Getcurrentdata aufrufen.
|
||||
public function MessageSink($TimeStamp, $SenderID, $Message, $Data)
|
||||
{
|
||||
if ($Message !== VM_UPDATE) {
|
||||
return;
|
||||
}
|
||||
|
||||
$maxBatVar = $this->ReadPropertyInteger("MaxBatterieleistung");
|
||||
$maxNachVar = $this->ReadPropertyInteger("MaxNachladen");
|
||||
|
||||
if ($SenderID === $maxBatVar || $SenderID === $maxNachVar) {
|
||||
// PowerSteps sofort neu berechnen (mit aktuellem Peak-Status)
|
||||
$this->GetCurrentData($this->GetValue("Is_Peak_Shaving"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Aktuelle Leistung setzen lassen, der Manager vorgibt
|
||||
public function SetAktuelle_Leistung(int $power)
|
||||
{
|
||||
|
||||
|
||||
$batterietyp = $this->ReadPropertyInteger("Batterietyp");
|
||||
$batterieManagement = $this->ReadPropertyInteger("Batteriemanagement");
|
||||
|
||||
//Fallunterscheidung, soll Enelix überhaupt steuern?
|
||||
|
||||
// Wechselrichter steuert
|
||||
// Goodwe, Solaredge WR Modus
|
||||
if ($batterieManagement == 1 && ($batterietyp == 1 || $batterietyp == 2)) {
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
$this->SetValue("Batteriemanagement_Variabel", 1);
|
||||
return;
|
||||
//Sig Energy WR Modus
|
||||
} elseif ($batterieManagement == 1 && $batterietyp == 3) {
|
||||
//Sig Energy, Herstellerunabhänig im WR Modus
|
||||
} elseif ($batterieManagement == 1 && ($batterietyp == 0 || $batterietyp == 3)) {
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
$this->SetValue("Batteriemanagement_Variabel", 0);
|
||||
return;
|
||||
|
||||
// Enelix Steuert
|
||||
// Sig Energy Symcon Modus
|
||||
} elseif ($batterieManagement == 2 && $batterietyp == 3) {
|
||||
} elseif ($batterieManagement == 2 && ($batterietyp == 0 || $batterietyp == 3)) {
|
||||
$this->SetValue("Batteriemanagement_Variabel", 1);
|
||||
|
||||
//Solaredge Symcon Modus
|
||||
}elseif ($batterieManagement == 2 && $batterietyp == 2) {
|
||||
$this->SetValue("Batteriemanagement_Variabel", 4);
|
||||
}
|
||||
/*
|
||||
if($this->GetValue("Is_Peak_Shaving")==true){
|
||||
if ($power >= 0) {
|
||||
$this->SetValue("Ladeleistung", $power);
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Laden3_Entladen4", 3);
|
||||
} else {
|
||||
$this->SetValue("Entladeleistung", abs($power));
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
$this->SetValue("Laden3_Entladen4", 4);
|
||||
}
|
||||
|
||||
}else{
|
||||
if ($power >= 0) {
|
||||
$this->SetValue("Ladeleistung", $power);
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Laden3_Entladen4", 3);
|
||||
} else {
|
||||
$this->SetValue("Entladeleistung", abs($power));
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
$this->SetValue("Laden3_Entladen4", 4);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Variabeln entsprechend gewältem Batterietyp setzen
|
||||
$batterietyp = $this->ReadPropertyInteger("Batterietyp");
|
||||
if ($batterietyp == 1) {//Goodwe
|
||||
if ($batterietyp == 0) {//Herstellerunabhängig
|
||||
|
||||
if($this->GetValue("Is_Peak_Shaving")==true){
|
||||
|
||||
if ($power >= 0) {
|
||||
$this->SetValue("Ladeleistung", $power);
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Laden_Entladen", 0);
|
||||
} else {
|
||||
$this->SetValue("Entladeleistung", abs($power));
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
$this->SetValue("Laden_Entladen", 1);
|
||||
}
|
||||
|
||||
}else{
|
||||
if ($power >= 0) {
|
||||
$this->SetValue("Ladeleistung", $power);
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Laden_Entladen", 0);
|
||||
} else {
|
||||
$this->SetValue("Entladeleistung", abs($power));
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
$this->SetValue("Laden_Entladen", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($batterietyp == 1) {//Goodwe
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
//-----------------------Gooodwee-------------------------------------//
|
||||
if($this->GetValue("Is_Peak_Shaving")==true){
|
||||
|
||||
if ($power >= 0) {
|
||||
@@ -253,8 +238,6 @@ public function RequestAction($Ident, $Value)
|
||||
|
||||
}elseif ($batterietyp == 2) {//Solaredge
|
||||
|
||||
//-----------------------Solaredge-------------------------------------//
|
||||
$this->SetValue("Goodwe_EntLadeleistung",0);
|
||||
if($this->GetValue("Is_Peak_Shaving")==true){
|
||||
|
||||
if ($power >= 0) {
|
||||
@@ -280,8 +263,6 @@ public function RequestAction($Ident, $Value)
|
||||
}
|
||||
} elseif ($batterietyp == 3) {//Sig Energy
|
||||
|
||||
//-----------------------Sig Energy-------------------------------------//
|
||||
$this->SetValue("Goodwe_EntLadeleistung",0);
|
||||
if($this->GetValue("Is_Peak_Shaving")==true){
|
||||
|
||||
if ($power >= 0) {
|
||||
@@ -307,16 +288,7 @@ public function RequestAction($Ident, $Value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Prüfe auf Änderung der Leistung im Vergleich zur letzten Einstellung
|
||||
@@ -342,12 +314,12 @@ public function RequestAction($Ident, $Value)
|
||||
|
||||
public function GetCurrentData(bool $Peak)
|
||||
{
|
||||
IPS_LogMessage("Batterie", "Currentdata");
|
||||
|
||||
$array_powersteps = $this->GeneratePowerSteps($this->GetValue("Aktuelle_Leistung"));
|
||||
// Aktuelle Daten ausarbeiten und Berechnen
|
||||
$array_powersteps = $this->GeneratePowerSteps();
|
||||
$aufdasnachladen = $this->ReadPropertyInteger("AufdasNachladen");
|
||||
$minimumentladen = $this->ReadPropertyInteger("MinimumEntladen");
|
||||
$maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung");
|
||||
$maxleistung = GetValue($this->ReadPropertyInteger("MaxBatterieleistung"));//Ladeleistung
|
||||
$maxentladeleistung = GetValue($this->ReadPropertyInteger("MaxNachladen"));//Entladeleistung
|
||||
$dummy_array = [];
|
||||
$batterieladezustand = GetValue($this->ReadPropertyInteger("Batterieladezustand"));
|
||||
$filtered_powersteps_entladen = [];
|
||||
@@ -356,9 +328,13 @@ public function RequestAction($Ident, $Value)
|
||||
return $this->SetValue("PowerSteps", json_encode($dummy_array));
|
||||
}
|
||||
|
||||
|
||||
$netzbezug = GetValue($this->ReadPropertyInteger("Netzbezug"));
|
||||
if (abs($netzbezug) > $maxleistung) {
|
||||
$netzbezug = $maxleistung * (-1);
|
||||
$bat_leistung = GetValue($this->ReadPropertyInteger("AktuelleBatterieleistung"));
|
||||
|
||||
|
||||
if ($Peak && $netzbezug > 0) {
|
||||
$netzbezug = -min($netzbezug, $maxentladeleistung) + $bat_leistung;
|
||||
}
|
||||
|
||||
if($batterieladezustand>(5+$aufdasnachladen)){
|
||||
@@ -372,7 +348,6 @@ public function RequestAction($Ident, $Value)
|
||||
$hyst = $this->GetValue("Hysterese");
|
||||
|
||||
if($Peak){
|
||||
IPS_LogMessage("Batterie", "Im if teil");
|
||||
|
||||
if($batterieladezustand>$aufdasnachladen && $hyst==false){
|
||||
|
||||
@@ -402,11 +377,9 @@ public function RequestAction($Ident, $Value)
|
||||
}
|
||||
|
||||
}else{
|
||||
IPS_LogMessage("Batterie", "Im else teil");
|
||||
|
||||
|
||||
if($batterieladezustand>99){
|
||||
IPS_LogMessage("Batterie", "im 1");
|
||||
|
||||
$filtered_powersteps = array_filter($array_powersteps, function ($value) {
|
||||
return $value <= 0;
|
||||
@@ -417,7 +390,6 @@ public function RequestAction($Ident, $Value)
|
||||
}elseif($batterieladezustand>$aufdasnachladen && $hyst==false){
|
||||
|
||||
$this->SetValue("PowerSteps", json_encode($array_powersteps));
|
||||
IPS_LogMessage("Batterie", "im 2");
|
||||
|
||||
|
||||
}elseif($batterieladezustand>=$aufdasnachladen && $hyst==true){
|
||||
@@ -431,9 +403,9 @@ public function RequestAction($Ident, $Value)
|
||||
|
||||
}elseif($batterieladezustand<$aufdasnachladen){
|
||||
|
||||
$dummy_array[] = $this->ReadPropertyInteger("MaxNachladen");
|
||||
//$dummy_array[] = GetValue($this->ReadPropertyInteger("MaxNachladen"));
|
||||
$dummy_array[] = GetValue($this->ReadPropertyInteger("MaxBatterieleistung"));
|
||||
$this->SetValue("PowerSteps", json_encode($dummy_array));
|
||||
IPS_LogMessage("Batterie", "im 3");
|
||||
|
||||
}
|
||||
|
||||
@@ -442,10 +414,84 @@ public function RequestAction($Ident, $Value)
|
||||
}
|
||||
|
||||
|
||||
// Ab hier Hilfsfunktionen
|
||||
|
||||
private function GeneratePowerSteps()
|
||||
{
|
||||
// Hilfsfunktion um die Möglichen Powersteps zu generieren
|
||||
$maxleistung_raw = GetValue($this->ReadPropertyInteger("MaxBatterieleistung"));
|
||||
$nachladen_raw = GetValue($this->ReadPropertyInteger("MaxNachladen"));
|
||||
|
||||
$stepSize = 250; // Grobe Schrittgröße
|
||||
$stepSizeSmall = 50; // Feine Schrittgröße
|
||||
|
||||
// Grenzen auf 50er abrunden (floor)
|
||||
$maxleistung = (int)(floor($maxleistung_raw / $stepSizeSmall) * $stepSizeSmall);
|
||||
$minleistung = (int)(-floor($nachladen_raw / $stepSizeSmall) * $stepSizeSmall); // negativ!
|
||||
|
||||
// Sicherheitscheck: falls Werte komisch sind
|
||||
if ($maxleistung < 0) $maxleistung = 0;
|
||||
if ($minleistung > 0) $minleistung = 0;
|
||||
|
||||
// Grundarray: von min bis max in 250er Schritten
|
||||
$neg = ($minleistung < 0) ? range($minleistung, 0, $stepSize) : [0];
|
||||
$pos = range(0, $maxleistung, $stepSize);
|
||||
|
||||
$array_powersteps = array_values(array_unique(array_merge($neg, $pos)));
|
||||
sort($array_powersteps, SORT_NUMERIC);
|
||||
|
||||
// Zusätzlichen Wert auf 50er abrunden
|
||||
$closestValue = (int)(floor($additionalValue / $stepSizeSmall) * $stepSizeSmall);
|
||||
|
||||
// Clamp in den Bereich
|
||||
if ($closestValue < $minleistung) $closestValue = $minleistung;
|
||||
if ($closestValue > $maxleistung) $closestValue = $maxleistung;
|
||||
|
||||
// Prüfen ob der Wert im Array existiert (bei 250er Raster oft NICHT)
|
||||
$index = array_search($closestValue, $array_powersteps, true);
|
||||
|
||||
// Wenn nicht vorhanden: an der richtigen Stelle einsortieren
|
||||
if ($index === false) {
|
||||
$index = 0;
|
||||
$count = count($array_powersteps);
|
||||
while ($index < $count && $array_powersteps[$index] < $closestValue) {
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
|
||||
// Feine Werte um closestValue herum (±4 * 50)
|
||||
$newValues = [];
|
||||
for ($i = -4; $i <= 4; $i++) {
|
||||
$v = $closestValue + ($i * $stepSizeSmall);
|
||||
if ($v >= $minleistung && $v <= $maxleistung) {
|
||||
$newValues[] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
// Duplikate vermeiden (falls schon Werte vorhanden sind)
|
||||
$newValues = array_values(array_unique($newValues));
|
||||
|
||||
// Wenn closestValue exakt im Grundarray war: diesen einen ersetzen
|
||||
// sonst: feinwerte einfach an der Einfügestelle einfügen
|
||||
if (array_search($closestValue, $array_powersteps, true) !== false) {
|
||||
$existingIndex = array_search($closestValue, $array_powersteps, true);
|
||||
array_splice($array_powersteps, $existingIndex, 1, $newValues);
|
||||
} else {
|
||||
array_splice($array_powersteps, $index, 0, $newValues);
|
||||
}
|
||||
|
||||
// Am Ende sortieren
|
||||
$array_powersteps = array_values(array_unique($array_powersteps));
|
||||
sort($array_powersteps, SORT_NUMERIC);
|
||||
|
||||
return $array_powersteps;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private function CheckIdle($power)
|
||||
{
|
||||
{ // Hilfsfunktion zum Prüfen ob die Batterie schon wieder Leistung verändern kann
|
||||
$lastpower = GetValue("Aktuelle_Leistung");
|
||||
if ($lastpower != GetValue("Aktuelle_Leistung")) {
|
||||
$this->SetValue("Idle", false);
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"type": "Label",
|
||||
"caption": "Konfiguration der Batterie für Peakshaving"
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "IdleCounterMax",
|
||||
"caption": "Zyklen zwischen zwei Leistungsänderungen (Multipliziert sich mit Interval)",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "Interval",
|
||||
"caption": "Intervall Neuberechnung der Werte",
|
||||
"suffix": "Sekunden"
|
||||
},
|
||||
{
|
||||
"type":"Select",
|
||||
"name":"Batterietyp",
|
||||
"caption":"Batterietyp",
|
||||
"options":[
|
||||
{
|
||||
"caption":"Goodwe",
|
||||
"value":1
|
||||
},
|
||||
{
|
||||
"caption":"Solaredge",
|
||||
"value":2
|
||||
},
|
||||
{
|
||||
"caption":"Sig Energy",
|
||||
"value":3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "MaxBatterieleistung",
|
||||
"caption": "Maximale Batterieleistung",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "MaxNachladen",
|
||||
"caption": "Maximum Nachladen",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "AufdasNachladen",
|
||||
"caption": "Auf so viel Prozent nachladen",
|
||||
"suffix": ""
|
||||
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "MinimumEntladen",
|
||||
"caption": "Minimum des Batterieladezustand",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
"type":"Select",
|
||||
"name":"Batteriemanagement",
|
||||
"caption":"Batteriemanagement",
|
||||
"options":[
|
||||
{
|
||||
"caption":"Durch Wechselrichter",
|
||||
"value":1
|
||||
},
|
||||
{
|
||||
"caption":"Durch EMS Symcon",
|
||||
"value":2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "SelectVariable",
|
||||
"name": "Batterieladezustand",
|
||||
"caption": "Batterieladezustand",
|
||||
"test": true
|
||||
},
|
||||
{
|
||||
"type": "SelectVariable",
|
||||
"name": "Netzbezug",
|
||||
"caption": "Variable mit dem zu regelnden Netzbezug"
|
||||
},
|
||||
{
|
||||
"type": "Label",
|
||||
"caption": "Goodwe: Laden=11, Entladen=12,\nSolaredge: Laden=3, Entladen=4,\nSig Energy: Laden=3, Entladen=6, P in kW"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,483 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Batterie_test extends IPSModule
|
||||
{
|
||||
public function Create()
|
||||
{
|
||||
parent::Create();
|
||||
|
||||
// Batterie spezifische Eigenschaften
|
||||
$this->RegisterPropertyInteger("MaxBatterieleistung", 0);
|
||||
$this->RegisterPropertyInteger("Batteriespannung", 50);
|
||||
$this->RegisterPropertyInteger("AufdasNachladen",0);
|
||||
$this->RegisterPropertyInteger("MinimumEntladen",0);
|
||||
$this->RegisterPropertyInteger("Batterieladezustand",0);
|
||||
$this->RegisterPropertyInteger("Batteriemanagement", 1);
|
||||
$this->RegisterPropertyInteger("Batterietyp", 1);
|
||||
$this->RegisterPropertyInteger("MaxNachladen",0);
|
||||
$this->RegisterPropertyInteger("Netzbezug", 0); // Initialisierung mit 0
|
||||
$this->RegisterPropertyInteger("Interval", 2); // Recheninterval
|
||||
|
||||
|
||||
// Variabeln für Kommunkation mit Manager
|
||||
//$this->RegisterVariableFloat("Entladeleistung","Entladeleistung", "",0);
|
||||
$this->RegisterVariableInteger("Batteriemanagement_Variabel","Batteriemanagement_Variabel", "",0);
|
||||
//$this->RegisterVariableInteger("Laden3_Entladen4","Laden3_Entladen4", "",3);
|
||||
$this->RegisterVariableInteger("Laden_Entladen","Laden_Entladen", "",3);
|
||||
//$this->RegisterVariableFloat("Ladeleistung","Ladeleistung", "",0);
|
||||
//$this->RegisterVariableFloat("Goodwe_EntLadeleistung","Goodwe_EntLadeleistung", "",0);
|
||||
$this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0);
|
||||
$this->RegisterVariableString("PowerSteps", "PowerSteps");
|
||||
$this->RegisterVariableBoolean("Idle", "Idle", "", 0);
|
||||
$this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio");
|
||||
$this->RegisterVariableInteger("PV_Prio", "PV_Prio");
|
||||
$this->RegisterVariableInteger("Power", "Power");
|
||||
$this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving");
|
||||
$this->RegisterVariableInteger("Leistung_Delta", "Leistung_Delta", "", 0);
|
||||
|
||||
$this->RegisterVariableBoolean("Hysterese", "Hysterese","",false);
|
||||
|
||||
|
||||
|
||||
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 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_Battery",$this->ReadPropertyInteger("Interval")*1000,"IPS_RequestAction(" .$this->InstanceID .', "Do_UserCalc", "");');
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function ApplyChanges()
|
||||
{
|
||||
parent::ApplyChanges();
|
||||
|
||||
$batterieManagement = $this->ReadPropertyInteger("Batteriemanagement");
|
||||
$this->SetValue("Batteriemanagement_Variabel", $batterieManagement);
|
||||
$this->SetTimerInterval("Timer_Do_UserCalc_Battery",$this->ReadPropertyInteger("Interval")*1000);
|
||||
|
||||
$batterietyp = $this->ReadPropertyInteger("Batterietyp");
|
||||
|
||||
switch ($batterietyp) {
|
||||
case 1: // Goodwe
|
||||
$this->MaintainVariable("Goodwe_EntLadeleistung", "Goodwe_EntLadeleistung", VARIABLETYPE_FLOAT, "", 10, true);
|
||||
$this->MaintainVariable("Ladeleistung", "Ladeleistung", VARIABLETYPE_FLOAT, "", 11, false);
|
||||
$this->MaintainVariable("Entladeleistung", "Entladeleistung", VARIABLETYPE_FLOAT, "", 13, false);
|
||||
$this->MaintainVariable("Laden_Entladen", "Laden_Entladen", VARIABLETYPE_INTEGER, "", 12, true);
|
||||
break;
|
||||
|
||||
case 2: // Solaredge
|
||||
$this->MaintainVariable("Goodwe_EntLadeleistung", "Goodwe_EntLadeleistung", VARIABLETYPE_FLOAT, "", 10, false);
|
||||
$this->MaintainVariable("Ladeleistung", "Ladeleistung", VARIABLETYPE_FLOAT, "", 11, true);
|
||||
$this->MaintainVariable("Entladeleistung", "Entladeleistung", VARIABLETYPE_FLOAT, "", 13, true);
|
||||
$this->MaintainVariable("Laden_Entladen", "Laden_Entladen", VARIABLETYPE_INTEGER, "", 12, true);
|
||||
break;
|
||||
|
||||
case 3: // SiG Energy
|
||||
$this->MaintainVariable("Goodwe_EntLadeleistung", "Goodwe_EntLadeleistung", VARIABLETYPE_FLOAT, "", 10, false);
|
||||
$this->MaintainVariable("Ladeleistung", "Ladeleistung", VARIABLETYPE_FLOAT, "", 11, true);
|
||||
$this->MaintainVariable("Entladeleistung", "Entladeleistung", VARIABLETYPE_FLOAT, "", 13, true);
|
||||
$this->MaintainVariable("Laden_Entladen", "Laden_Entladen", VARIABLETYPE_INTEGER, "", 12, true);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Sicherheit: alles weg
|
||||
$this->MaintainVariable("Goodwe_EntLadeleistung", "Goodwe_EntLadeleistung", VARIABLETYPE_FLOAT, "", 10, false);
|
||||
$this->MaintainVariable("Ladeleistung", "Ladeleistung", VARIABLETYPE_FLOAT, "", 11, false);
|
||||
$this->MaintainVariable("Laden_Entladen", "Laden_Entladen", VARIABLETYPE_INTEGER, "", 12, false);
|
||||
$this->MaintainVariable("Entladeleistung", "Entladeleistung", VARIABLETYPE_FLOAT, "", 13, false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function GeneratePowerSteps($additionalValue)
|
||||
{
|
||||
$maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung");
|
||||
$stepSize = 250; // Schrittgröße
|
||||
$stepSizeSmall = 50; // Kleine Schrittgröße
|
||||
|
||||
// Array direkt als Range erzeugen (schneller als Schleife)
|
||||
$array_powersteps = range(-$maxleistung, $maxleistung, $stepSize);
|
||||
|
||||
// Nächstgelegenen Wert direkt bestimmen (rundet auf den nächsten Step)
|
||||
$closestValue = round($additionalValue / $stepSize) * $stepSize;
|
||||
|
||||
// Falls der Wert nicht im Bereich liegt, abbrechen
|
||||
if (!in_array($closestValue, $array_powersteps)) {
|
||||
return $array_powersteps;
|
||||
}
|
||||
|
||||
// Index des gefundenen Werts suchen
|
||||
$index = array_search($closestValue, $array_powersteps);
|
||||
|
||||
// Zusätzliche Werte berechnen und auf MaxLeistung begrenzen
|
||||
$newValues = array_filter([
|
||||
$closestValue - 4 * $stepSizeSmall,
|
||||
$closestValue - 3 * $stepSizeSmall,
|
||||
$closestValue - 2 * $stepSizeSmall,
|
||||
$closestValue - $stepSizeSmall,
|
||||
$closestValue,
|
||||
$closestValue + $stepSizeSmall,
|
||||
$closestValue + 2 * $stepSizeSmall,
|
||||
$closestValue + 3 * $stepSizeSmall,
|
||||
$closestValue + 4 * $stepSizeSmall,
|
||||
], function ($value) use ($maxleistung) {
|
||||
return $value >= -$maxleistung && $value <= $maxleistung;
|
||||
});
|
||||
|
||||
// Effizienteres Einfügen der Werte (direkt an der Stelle)
|
||||
array_splice($array_powersteps, $index, 1, $newValues);
|
||||
|
||||
return $array_powersteps;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
public function SetAktuelle_Leistung(int $power)
|
||||
{
|
||||
|
||||
|
||||
$batterietyp = $this->ReadPropertyInteger("Batterietyp");
|
||||
$batterieManagement = $this->ReadPropertyInteger("Batteriemanagement");
|
||||
|
||||
// Goodwe, Solaredge WR Modus
|
||||
if ($batterieManagement == 1 && ($batterietyp == 1 || $batterietyp == 2)) {
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
$this->SetValue("Batteriemanagement_Variabel", 1);
|
||||
return;
|
||||
//Sig Energy WR Modus
|
||||
} elseif ($batterieManagement == 1 && $batterietyp == 3) {
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
$this->SetValue("Batteriemanagement_Variabel", 0);
|
||||
return;
|
||||
|
||||
// Sig Energy Symcon Modus
|
||||
} elseif ($batterieManagement == 2 && $batterietyp == 3) {
|
||||
$this->SetValue("Batteriemanagement_Variabel", 1);
|
||||
|
||||
//Solaredge Symcon Modus
|
||||
}elseif ($batterieManagement == 2 && $batterietyp == 2) {
|
||||
$this->SetValue("Batteriemanagement_Variabel", 4);
|
||||
}
|
||||
/*
|
||||
if($this->GetValue("Is_Peak_Shaving")==true){
|
||||
if ($power >= 0) {
|
||||
$this->SetValue("Ladeleistung", $power);
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Laden3_Entladen4", 3);
|
||||
} else {
|
||||
$this->SetValue("Entladeleistung", abs($power));
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
$this->SetValue("Laden3_Entladen4", 4);
|
||||
}
|
||||
|
||||
}else{
|
||||
if ($power >= 0) {
|
||||
$this->SetValue("Ladeleistung", $power);
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Laden3_Entladen4", 3);
|
||||
} else {
|
||||
$this->SetValue("Entladeleistung", abs($power));
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
$this->SetValue("Laden3_Entladen4", 4);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$batterietyp = $this->ReadPropertyInteger("Batterietyp");
|
||||
if ($batterietyp == 1) {//Goodwe
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
//-----------------------Gooodwee-------------------------------------//
|
||||
if($this->GetValue("Is_Peak_Shaving")==true){
|
||||
|
||||
if ($power >= 0) {
|
||||
$this->SetValue("Goodwe_EntLadeleistung", abs($power));
|
||||
$this->SetValue("Laden_Entladen", 11);
|
||||
} else {
|
||||
$this->SetValue("Goodwe_EntLadeleistung", abs($power));
|
||||
$this->SetValue("Laden_Entladen", 12);
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
if ($power >= 0) {
|
||||
$this->SetValue("Goodwe_EntLadeleistung", abs($power));
|
||||
$this->SetValue("Laden_Entladen", 11);
|
||||
} else {
|
||||
$this->SetValue("Goodwe_EntLadeleistung", abs($power));
|
||||
$this->SetValue("Laden_Entladen", 12);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}elseif ($batterietyp == 2) {//Solaredge
|
||||
|
||||
//-----------------------Solaredge-------------------------------------//
|
||||
$this->SetValue("Goodwe_EntLadeleistung",0);
|
||||
if($this->GetValue("Is_Peak_Shaving")==true){
|
||||
|
||||
if ($power >= 0) {
|
||||
$this->SetValue("Ladeleistung", $power);
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Laden_Entladen", 3);
|
||||
} else {
|
||||
$this->SetValue("Entladeleistung", abs($power));
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
$this->SetValue("Laden_Entladen", 4);
|
||||
}
|
||||
|
||||
}else{
|
||||
if ($power >= 0) {
|
||||
$this->SetValue("Ladeleistung", $power);
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Laden_Entladen", 3);
|
||||
} else {
|
||||
$this->SetValue("Entladeleistung", abs($power));
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
$this->SetValue("Laden_Entladen", 4);
|
||||
}
|
||||
}
|
||||
} elseif ($batterietyp == 3) {//Sig Energy
|
||||
|
||||
//-----------------------Sig Energy-------------------------------------//
|
||||
$this->SetValue("Goodwe_EntLadeleistung",0);
|
||||
if($this->GetValue("Is_Peak_Shaving")==true){
|
||||
|
||||
if ($power >= 0) {
|
||||
$this->SetValue("Ladeleistung", $power/1000);
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Laden_Entladen", 3);
|
||||
} else {
|
||||
$this->SetValue("Entladeleistung", abs($power)/1000);
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
$this->SetValue("Laden_Entladen", 6);
|
||||
}
|
||||
|
||||
}else{
|
||||
if ($power >= 0) {
|
||||
$this->SetValue("Ladeleistung", $power/1000);
|
||||
$this->SetValue("Entladeleistung", 0);
|
||||
$this->SetValue("Laden_Entladen", 3);
|
||||
} else {
|
||||
$this->SetValue("Entladeleistung", abs($power)/1000);
|
||||
$this->SetValue("Ladeleistung", 0);
|
||||
$this->SetValue("Laden_Entladen", 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Prüfe auf Änderung der Leistung im Vergleich zur letzten Einstellung
|
||||
$lastPower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
||||
if ($power != $lastPower) {
|
||||
$this->SetValue("Idle", false);
|
||||
$this->SetValue(
|
||||
"IdleCounter",
|
||||
$this->ReadPropertyInteger("IdleCounterMax")
|
||||
);
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function GetCurrentData(bool $Peak)
|
||||
{
|
||||
IPS_LogMessage("Batterie", "Currentdata");
|
||||
|
||||
$array_powersteps = $this->GeneratePowerSteps($this->GetValue("Aktuelle_Leistung"));
|
||||
$aufdasnachladen = $this->ReadPropertyInteger("AufdasNachladen");
|
||||
$minimumentladen = $this->ReadPropertyInteger("MinimumEntladen");
|
||||
$maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung");
|
||||
$dummy_array = [];
|
||||
$batterieladezustand = GetValue($this->ReadPropertyInteger("Batterieladezustand"));
|
||||
$filtered_powersteps_entladen = [];
|
||||
if ($this->ReadPropertyInteger("Batteriemanagement") == 1) {
|
||||
$dummy_array[] = 0;
|
||||
return $this->SetValue("PowerSteps", json_encode($dummy_array));
|
||||
}
|
||||
|
||||
$netzbezug = GetValue($this->ReadPropertyInteger("Netzbezug"));
|
||||
if (abs($netzbezug) > $maxleistung) {
|
||||
$netzbezug = $maxleistung * (-1);
|
||||
}
|
||||
|
||||
if($batterieladezustand>(5+$aufdasnachladen)){
|
||||
|
||||
$this->SetValue("Hysterese", false);
|
||||
|
||||
}elseif($batterieladezustand<=$aufdasnachladen){
|
||||
$this->SetValue("Hysterese", true);
|
||||
}
|
||||
|
||||
$hyst = $this->GetValue("Hysterese");
|
||||
|
||||
if($Peak){
|
||||
IPS_LogMessage("Batterie", "Im if teil");
|
||||
|
||||
if($batterieladezustand>$aufdasnachladen && $hyst==false){
|
||||
|
||||
$dummy_array[] = $netzbezug;
|
||||
$this->SetValue("PowerSteps", json_encode($dummy_array));
|
||||
|
||||
}elseif($batterieladezustand>$aufdasnachladen && $hyst==true){
|
||||
|
||||
|
||||
$filtered_powersteps = array_filter($array_powersteps, function ($value) {
|
||||
return $value <= 0;
|
||||
});
|
||||
$filtered_powersteps_laden = array_values($filtered_powersteps);
|
||||
$this->SetValue("PowerSteps", json_encode($filtered_powersteps_laden));
|
||||
|
||||
}elseif($batterieladezustand>$minimumentladen){
|
||||
|
||||
$this->SetValue("PowerSteps", json_encode($array_powersteps));
|
||||
}
|
||||
else{
|
||||
|
||||
$filtered_powersteps = array_filter($array_powersteps, function ($value) {
|
||||
return $value >= 0;
|
||||
});
|
||||
$filtered_powersteps_laden = array_values($filtered_powersteps);
|
||||
$this->SetValue("PowerSteps", json_encode($filtered_powersteps_laden));
|
||||
}
|
||||
|
||||
}else{
|
||||
IPS_LogMessage("Batterie", "Im else teil");
|
||||
|
||||
|
||||
if($batterieladezustand>99){
|
||||
IPS_LogMessage("Batterie", "im 1");
|
||||
|
||||
$filtered_powersteps = array_filter($array_powersteps, function ($value) {
|
||||
return $value <= 0;
|
||||
});
|
||||
$filtered_powersteps_laden = array_values($filtered_powersteps);
|
||||
$this->SetValue("PowerSteps", json_encode($filtered_powersteps_laden));
|
||||
|
||||
}elseif($batterieladezustand>$aufdasnachladen && $hyst==false){
|
||||
|
||||
$this->SetValue("PowerSteps", json_encode($array_powersteps));
|
||||
IPS_LogMessage("Batterie", "im 2");
|
||||
|
||||
|
||||
}elseif($batterieladezustand>=$aufdasnachladen && $hyst==true){
|
||||
|
||||
$filtered_powersteps = array_filter($array_powersteps, function ($value) {
|
||||
return $value >= 0;
|
||||
});
|
||||
$filtered_powersteps_laden = array_values($filtered_powersteps);
|
||||
$this->SetValue("PowerSteps", json_encode($filtered_powersteps_laden));
|
||||
|
||||
|
||||
}elseif($batterieladezustand<$aufdasnachladen){
|
||||
|
||||
$dummy_array[] = $this->ReadPropertyInteger("MaxNachladen");
|
||||
$this->SetValue("PowerSteps", json_encode($dummy_array));
|
||||
IPS_LogMessage("Batterie", "im 3");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -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);`
|
||||
@@ -4,6 +4,5 @@
|
||||
{ "type": "SelectVariable", "name": "VarConsumption", "caption": "Verbrauch (kWh)" },
|
||||
{ "type": "SelectVariable", "name": "VarFeedIn", "caption": "Einspeisung (kWh)" },
|
||||
{ "type": "SelectVariable", "name": "VarGrid", "caption": "Bezug Netz (kWh)" }
|
||||
],
|
||||
"actions": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
<div id="wrap" style="padding:12px;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;">
|
||||
|
||||
<!-- Controls -->
|
||||
<div style="display:flex;gap:10px;flex-wrap:wrap;align-items:center;">
|
||||
<label style="display:flex;gap:6px;align-items:center;">
|
||||
<span>Zeitraum</span>
|
||||
<select id="range">
|
||||
<option value="day">Tag</option>
|
||||
<option value="week">Woche</option>
|
||||
<option value="month">Monat</option>
|
||||
<option value="year">Jahr</option>
|
||||
<option value="total">Gesamt</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label style="display:flex;gap:6px;align-items:center;">
|
||||
<span>Datum</span>
|
||||
<input id="date" type="date" />
|
||||
</label>
|
||||
|
||||
<button id="prev" type="button">◀</button>
|
||||
<button id="today" type="button">Heute</button>
|
||||
<button id="next" type="button">▶</button>
|
||||
</div>
|
||||
|
||||
<div id="period" style="margin-top:10px;font-size:15px;font-weight:600;"></div>
|
||||
<div id="hint" style="margin-top:6px;font-size:15px;font-weight:700;"></div>
|
||||
|
||||
<div id="grid"
|
||||
style="margin-top:14px;
|
||||
display:grid;
|
||||
grid-template-columns:repeat(2,minmax(0,1fr));
|
||||
gap:14px;">
|
||||
</div>
|
||||
|
||||
<div id="err" style="margin-top:8px;color:#ffb4b4;font-size:13px;"></div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@media (max-width:720px){
|
||||
#grid{grid-template-columns:1fr}
|
||||
}
|
||||
|
||||
#wrap{
|
||||
position:relative;
|
||||
overflow:hidden;
|
||||
min-height:100vh;
|
||||
background:#121216;
|
||||
}
|
||||
|
||||
#wrap::before{
|
||||
content:"";
|
||||
position:absolute;
|
||||
inset:-35%;
|
||||
background:
|
||||
radial-gradient(520px 420px at 18% 18%, rgba(99,179,255,.42), transparent 60%),
|
||||
radial-gradient(560px 460px at 82% 28%, rgba(168,85,247,.38), transparent 62%),
|
||||
radial-gradient(620px 520px at 55% 85%, rgba(99,179,255,.26), transparent 64%);
|
||||
filter:blur(18px);
|
||||
pointer-events:none;
|
||||
}
|
||||
|
||||
#wrap>*{position:relative;z-index:1}
|
||||
|
||||
#hint .kv{margin-right:14px;white-space:nowrap}
|
||||
#hint .kv b{font-weight:900}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
(function(){
|
||||
|
||||
const elRange = document.getElementById('range');
|
||||
const elDate = document.getElementById('date');
|
||||
const elPrev = document.getElementById('prev');
|
||||
const elToday = document.getElementById('today');
|
||||
const elNext = document.getElementById('next');
|
||||
const elPeriod = document.getElementById('period');
|
||||
const elHint = document.getElementById('hint');
|
||||
const elGrid = document.getElementById('grid');
|
||||
const elErr = document.getElementById('err');
|
||||
|
||||
function showErr(e){
|
||||
elErr.textContent = e?.message || e;
|
||||
}
|
||||
|
||||
function ra(){
|
||||
return window.requestAction || window.parent?.requestAction || null;
|
||||
}
|
||||
|
||||
function send(id,val){
|
||||
const f = ra();
|
||||
if(f) try{f(id,val)}catch(e){showErr(e)}
|
||||
}
|
||||
|
||||
function fmt(d){
|
||||
const p=n=>String(n).padStart(2,'0');
|
||||
return `${p(d.getDate())}.${p(d.getMonth()+1)}.${d.getFullYear()}`;
|
||||
}
|
||||
|
||||
function monthName(m){
|
||||
return ['Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'][m];
|
||||
}
|
||||
|
||||
function isoWeek(d){
|
||||
d=new Date(Date.UTC(d.getFullYear(),d.getMonth(),d.getDate()));
|
||||
d.setUTCDate(d.getUTCDate()+4-(d.getUTCDay()||7));
|
||||
const y=d.getUTCFullYear();
|
||||
const s=new Date(Date.UTC(y,0,1));
|
||||
return Math.ceil((((d-s)/86400000)+1)/7)+" "+y;
|
||||
}
|
||||
|
||||
function render(data){
|
||||
if(!data) return;
|
||||
|
||||
elRange.value = data.range || 'day';
|
||||
elDate.value = data.date || '';
|
||||
|
||||
elDate.disabled = (data.range === 'total');
|
||||
|
||||
// Zeitraum-Anzeige
|
||||
if (data.range === 'total') {
|
||||
// ✅ Wunsch: bei Gesamt nix anzeigen
|
||||
elPeriod.textContent = '';
|
||||
} else if (data.tStart && data.tEnd) {
|
||||
const s = new Date(data.tStart * 1000);
|
||||
const e = new Date(data.tEnd * 1000 - 1000);
|
||||
|
||||
if (data.range === 'day')
|
||||
elPeriod.textContent = `Zeitraum: ${fmt(s)}`;
|
||||
else if (data.range === 'week')
|
||||
elPeriod.textContent = `Zeitraum: Woche ${isoWeek(s)}`;
|
||||
else if (data.range === 'month')
|
||||
elPeriod.textContent = `Zeitraum: ${monthName(s.getMonth())} ${s.getFullYear()}`;
|
||||
else if (data.range === 'year')
|
||||
elPeriod.textContent = `Zeitraum: ${s.getFullYear()}`;
|
||||
else
|
||||
elPeriod.textContent = ''; // fallback: lieber leer als falsch
|
||||
} else {
|
||||
elPeriod.textContent = '';
|
||||
}
|
||||
|
||||
// Keine Daten
|
||||
if(data.hasData === false){
|
||||
elHint.innerHTML = `<b>Letzter Zeitpunkt</b> <span style="opacity:.7">(Keine Werte für diesen Zeitraum)</span>`;
|
||||
elGrid.innerHTML = '';
|
||||
return;
|
||||
}
|
||||
|
||||
// Werte
|
||||
const v = data.values || {};
|
||||
elHint.innerHTML = `
|
||||
<span class="kv"><b>Produktion:</b> ${v.Produktion?.toFixed(2) || 0} kWh</span>
|
||||
<span class="kv"><b>Verbrauch:</b> ${v.Hausverbrauch?.toFixed(2) || 0} kWh</span>
|
||||
<span class="kv"><b>Netzbezug:</b> ${v.Netz?.toFixed(2) || 0} kWh</span>
|
||||
<span class="kv"><b>Einspeisung:</b> ${v.Einspeisung?.toFixed(2) || (0)} kWh</span>
|
||||
`;
|
||||
|
||||
const donut = (t, p, c) => {
|
||||
const r = 56;
|
||||
const C = 2 * Math.PI * r;
|
||||
const dash = (Math.max(0, Math.min(100, p)) / 100) * C;
|
||||
|
||||
return `
|
||||
<div style="text-align:center;display:flex;flex-direction:column;align-items:center;gap:10px;">
|
||||
<div style="font-weight:800;margin-bottom:-6px;font-size:15px;">
|
||||
${t}
|
||||
</div>
|
||||
|
||||
<div style="position:relative;width:160px;height:160px;">
|
||||
<svg width="160" height="160" viewBox="0 0 160 160">
|
||||
<circle cx="80" cy="80" r="${r}"
|
||||
stroke="rgba(255,255,255,0.18)"
|
||||
stroke-width="18"
|
||||
fill="none" />
|
||||
|
||||
<circle cx="80" cy="80" r="${r}"
|
||||
stroke="${c}"
|
||||
stroke-width="18"
|
||||
fill="none"
|
||||
stroke-linecap="butt"
|
||||
stroke-dasharray="${dash} ${C}"
|
||||
transform="rotate(-90 80 80)"
|
||||
style="filter: drop-shadow(0 0 12px ${c});" />
|
||||
</svg>
|
||||
|
||||
<div style="position:absolute;inset:0;
|
||||
display:flex;align-items:center;justify-content:center;
|
||||
font-size:24px;font-weight:900;">
|
||||
${Number(p).toFixed(1)}%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
};
|
||||
|
||||
const prod = v.Produktion || 0;
|
||||
const cons = v.Hausverbrauch || 0;
|
||||
const grid = v.Netz || 0;
|
||||
const feed = v.Einspeisung || 0;
|
||||
const eigen = Math.max(cons - grid, 0);
|
||||
|
||||
elGrid.innerHTML =
|
||||
donut('Eigenverbrauchsquote', prod ? (eigen / prod * 100) : 0, '#63B3FF') +
|
||||
donut('Autarkiegrad', cons ? (eigen / cons * 100) : 0, '#A855F7');
|
||||
}
|
||||
|
||||
window.handleMessage = d=>{
|
||||
try{if(typeof d==='string')d=JSON.parse(d)}catch{}
|
||||
render(d);
|
||||
};
|
||||
|
||||
elRange.onchange = ()=>send('SetRange',elRange.value);
|
||||
elDate.onchange = ()=>send('SetDate',elDate.value);
|
||||
elPrev.onclick = ()=>send('Prev',1);
|
||||
elNext.onclick = ()=>send('Next',1);
|
||||
elToday.onclick = ()=>send('Today',1);
|
||||
|
||||
})();
|
||||
</script>
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"id": "{DDE89CBE-4411-5FF4-4931-14204E05CAD0}",
|
||||
"name": "PV_Visu",
|
||||
"id": "{97BFC43B-9BE5-AB7D-EC5A-E31BB54878E0}",
|
||||
"name": "Energy_Pie",
|
||||
"type": 3,
|
||||
"vendor": "Belevo AG",
|
||||
"aliases": [],
|
||||
@@ -10,3 +10,4 @@
|
||||
"prefix": "",
|
||||
"url": ""
|
||||
}
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
class Energy_Pie extends IPSModule
|
||||
{
|
||||
private const ATTR_RANGE = 'Range';
|
||||
private const ATTR_DATE = 'Date';
|
||||
public function Create(): void
|
||||
{
|
||||
parent::Create();
|
||||
// Source variables (logged counters, kWh)
|
||||
$this->RegisterPropertyInteger('VarProduction', 0);
|
||||
$this->RegisterPropertyInteger('VarConsumption', 0);
|
||||
$this->RegisterPropertyInteger('VarFeedIn', 0);
|
||||
$this->RegisterPropertyInteger('VarGrid', 0);
|
||||
// Persisted UI state
|
||||
$this->RegisterAttributeString(self::ATTR_RANGE, 'day');
|
||||
$this->RegisterAttributeString(self::ATTR_DATE, date('Y-m-d'));
|
||||
// Enable individual visualization (HTML-SDK)
|
||||
$this->SetVisualizationType(1);
|
||||
// IMPORTANT: Timer calls global helper below (must exist!)
|
||||
$this->RegisterTimer('AutoPush', 0, 'IPS_RequestAction($_IPS["TARGET"], "Refresh", 1);');
|
||||
}
|
||||
public function ApplyChanges(): void
|
||||
{
|
||||
parent::ApplyChanges();
|
||||
// ensure range valid
|
||||
$range = $this->ReadAttributeString(self::ATTR_RANGE);
|
||||
if (!in_array($range, ['day', 'week', 'month', 'year', 'total'], true)) {
|
||||
$this->WriteAttributeString(self::ATTR_RANGE, 'day');
|
||||
}
|
||||
// ensure date valid (not empty/invalid/future)
|
||||
$date = $this->ReadAttributeString(self::ATTR_DATE);
|
||||
if ($date === '' || !$this->isValidDate($date) || strtotime($date . ' 00:00:00') > time()) {
|
||||
$this->WriteAttributeString(self::ATTR_DATE, date('Y-m-d'));
|
||||
}
|
||||
// Fullscreen-Fix: push periodically (adjust as you like)
|
||||
// 2000ms = alle 2 Sekunden (stabil, aber nicht ganz so brutal wie 1000ms)
|
||||
$this->SetTimerInterval('AutoPush', 2000);
|
||||
$this->RecalculateAndPush();
|
||||
}
|
||||
public function GetVisualizationTile(): string
|
||||
{
|
||||
$path = __DIR__ . '/module.html';
|
||||
if (!file_exists($path)) {
|
||||
return '<div style="padding:12px;font-family:sans-serif;">module.html fehlt</div>';
|
||||
}
|
||||
return file_get_contents($path);
|
||||
}
|
||||
public function RequestAction($Ident, $Value): void
|
||||
{
|
||||
switch ($Ident) {
|
||||
case 'SetRange':
|
||||
$range = (string)$Value;
|
||||
if (!in_array($range, ['day', 'week', 'month', 'year', 'total'], true)) {
|
||||
return;
|
||||
}
|
||||
$this->WriteAttributeString(self::ATTR_RANGE, $range);
|
||||
$this->RecalculateAndPush();
|
||||
break;
|
||||
case 'SetDate':
|
||||
$date = (string)$Value;
|
||||
if (!$this->isValidDate($date)) {
|
||||
return;
|
||||
}
|
||||
$this->WriteAttributeString(self::ATTR_DATE, $date);
|
||||
$this->RecalculateAndPush();
|
||||
break;
|
||||
case 'Prev':
|
||||
case 'Next':
|
||||
case 'Today':
|
||||
$this->ShiftDate($Ident);
|
||||
$this->RecalculateAndPush();
|
||||
break;
|
||||
case 'Refresh':
|
||||
$this->RecalculateAndPush();
|
||||
break;
|
||||
default:
|
||||
// ignore unknown
|
||||
return;
|
||||
}
|
||||
}
|
||||
private function RecalculateAndPush(): void
|
||||
{
|
||||
$range = $this->ReadAttributeString(self::ATTR_RANGE);
|
||||
$date = $this->ReadAttributeString(self::ATTR_DATE);
|
||||
[$tStart, $tEnd] = $this->getRange($range, $date);
|
||||
$dbgProd = [];
|
||||
$dbgFeed = [];
|
||||
$dbgGrid = [];
|
||||
$prod = $this->readDelta($this->ReadPropertyInteger('VarProduction'), $tStart, $tEnd, $dbgProd);
|
||||
$feed = $this->readDelta($this->ReadPropertyInteger('VarFeedIn'), $tStart, $tEnd, $dbgFeed);
|
||||
$grid = $this->readDelta($this->ReadPropertyInteger('VarGrid'), $tStart, $tEnd, $dbgGrid);
|
||||
$hasData = (($dbgProd['count'] ?? 0) > 0) || (($dbgFeed['count'] ?? 0) > 0) || (($dbgGrid['count'] ?? 0) > 0);
|
||||
$noDataHint = (!$hasData && $range !== 'total') ? 'Letzter Zeitpunkt' : '';
|
||||
|
||||
|
||||
// House = Prod - Feed + Grid
|
||||
$house = $prod - $feed + $grid;
|
||||
if ($house < 0) $house = 0.0;
|
||||
$payload = [
|
||||
'range' => $range,
|
||||
'date' => $date,
|
||||
'tStart' => $tStart,
|
||||
'tEnd' => $tEnd,
|
||||
'hasData' => $hasData,
|
||||
'noDataHint' => $noDataHint,
|
||||
'values' => [
|
||||
'Produktion' => (float)$prod,
|
||||
'Einspeisung' => (float)$feed,
|
||||
'Netz' => (float)$grid,
|
||||
'Hausverbrauch' => (float)$house
|
||||
],
|
||||
// kannst du später entfernen
|
||||
'debug' => [
|
||||
'prod' => $dbgProd,
|
||||
'feed' => $dbgFeed,
|
||||
'grid' => $dbgGrid
|
||||
]
|
||||
];
|
||||
$this->UpdateVisualizationValue(json_encode($payload, JSON_THROW_ON_ERROR));
|
||||
}
|
||||
private function getRange(string $range, string $dateYmd): array
|
||||
{
|
||||
$now = time();
|
||||
if ($range === 'total') {
|
||||
return [0, $now];
|
||||
}
|
||||
$base = strtotime($dateYmd . ' 00:00:00') ?: strtotime(date('Y-m-d') . ' 00:00:00');
|
||||
switch ($range) {
|
||||
case 'day':
|
||||
return [$base, $base + 86400];
|
||||
case 'week':
|
||||
$dow = (int)date('N', $base); // 1=Mon..7=Sun
|
||||
$start = $base - (($dow - 1) * 86400);
|
||||
return [$start, $start + 7 * 86400];
|
||||
case 'month':
|
||||
$start = strtotime(date('Y-m-01 00:00:00', $base));
|
||||
$end = strtotime(date('Y-m-01 00:00:00', strtotime('+1 month', $start)));
|
||||
return [$start, $end];
|
||||
|
||||
case 'year':
|
||||
$start = strtotime(date('Y-01-01 00:00:00', $base));
|
||||
$end = strtotime(date('Y-01-01 00:00:00', strtotime('+1 year', $start)));
|
||||
return [$start, $end];
|
||||
|
||||
default:
|
||||
return [$base, $base + 86400];
|
||||
}
|
||||
}
|
||||
public function GetVisualizationPopup(): string
|
||||
{
|
||||
// Popup (Fullscreen) soll das gleiche HTML wie das Tile anzeigen
|
||||
$this->RecalculateAndPush();
|
||||
return $this->GetVisualizationTile();
|
||||
}
|
||||
private function readDelta(int $varId, int $tStart, int $tEnd, array &$dbg): float
|
||||
{
|
||||
$dbg = [
|
||||
'varId' => $varId,
|
||||
'archiveId' => 0,
|
||||
'count' => 0,
|
||||
'first' => null,
|
||||
'last' => null,
|
||||
'vStart' => null,
|
||||
'vEnd' => null
|
||||
];
|
||||
if ($varId <= 0 || !IPS_VariableExists($varId)) {
|
||||
return 0.0;
|
||||
}
|
||||
$archiveID = IPS_GetInstanceListByModuleID('{43192F0B-135B-4CE7-A0A7-1475603F3060}')[0] ?? 0;
|
||||
$dbg['archiveId'] = $archiveID;
|
||||
if ($archiveID <= 0) {
|
||||
return 0.0;
|
||||
}
|
||||
$values = @AC_GetLoggedValues($archiveID, $varId, $tStart - 86400, $tEnd + 86400, 0);
|
||||
if (empty($values)) {
|
||||
return 0.0;
|
||||
}
|
||||
$firstTs = (int)$values[0]['TimeStamp'];
|
||||
$lastTs = (int)$values[count($values) - 1]['TimeStamp'];
|
||||
if ($firstTs > $lastTs) {
|
||||
$values = array_reverse($values);
|
||||
}
|
||||
$dbg['count'] = count($values);
|
||||
$dbg['first'] = (float)$values[0]['Value'];
|
||||
$dbg['last'] = (float)$values[count($values) - 1]['Value'];
|
||||
$vStart = null;
|
||||
$vEnd = null;
|
||||
foreach ($values as $v) {
|
||||
$ts = (int)$v['TimeStamp'];
|
||||
if ($ts <= $tStart) $vStart = (float)$v['Value'];
|
||||
if ($ts <= $tEnd) $vEnd = (float)$v['Value'];
|
||||
if ($ts > $tEnd) break;
|
||||
}
|
||||
if ($vStart === null) $vStart = $dbg['first'];
|
||||
if ($vEnd === null) $vEnd = $dbg['last'];
|
||||
$dbg['vStart'] = $vStart;
|
||||
$dbg['vEnd'] = $vEnd;
|
||||
$diff = $vEnd - $vStart;
|
||||
return ($diff < 0) ? 0.0 : (float)$diff;
|
||||
}
|
||||
private function getLastLogTimestamp(int $varId): int
|
||||
{
|
||||
if ($varId <= 0 || !IPS_VariableExists($varId)) {
|
||||
return 0;
|
||||
}
|
||||
$archiveID = IPS_GetInstanceListByModuleID('{43192F0B-135B-4CE7-A0A7-1475603F3060}')[0] ?? 0;
|
||||
if ($archiveID <= 0) {
|
||||
return 0;
|
||||
}
|
||||
$values = @AC_GetLoggedValues($archiveID, $varId, 0, time(), 1);
|
||||
if (empty($values)) {
|
||||
return 0;
|
||||
}
|
||||
return (int)$values[0]['TimeStamp'];
|
||||
}
|
||||
private function ShiftDate(string $action): void
|
||||
{
|
||||
$range = $this->ReadAttributeString(self::ATTR_RANGE);
|
||||
if ($range === 'total') {
|
||||
return;
|
||||
}
|
||||
if ($action === 'Today') {
|
||||
$this->WriteAttributeString(self::ATTR_DATE, date('Y-m-d'));
|
||||
return;
|
||||
}
|
||||
$date = $this->ReadAttributeString(self::ATTR_DATE);
|
||||
$base = strtotime($date . ' 00:00:00') ?: strtotime(date('Y-m-d') . ' 00:00:00');
|
||||
$sign = ($action === 'Prev') ? -1 : 1;
|
||||
switch ($range) {
|
||||
case 'day':
|
||||
$base = strtotime(($sign === -1 ? '-1 day' : '+1 day'), $base);
|
||||
break;
|
||||
case 'week':
|
||||
$base = strtotime(($sign === -1 ? '-7 day' : '+7 day'), $base);
|
||||
break;
|
||||
case 'month':
|
||||
$base = strtotime(($sign === -1 ? '-1 month' : '+1 month'), $base);
|
||||
break;
|
||||
case 'year':
|
||||
$base = strtotime(($sign === -1 ? '-1 year' : '+1 year'), $base);
|
||||
break;
|
||||
}
|
||||
$this->WriteAttributeString(self::ATTR_DATE, date('Y-m-d', $base));
|
||||
}
|
||||
private function isValidDate(string $ymd): bool
|
||||
{
|
||||
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $ymd)) {
|
||||
return false;
|
||||
}
|
||||
[$y, $m, $d] = array_map('intval', explode('-', $ymd));
|
||||
return checkdate($m, $d, $y);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -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,92 @@
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"type": "Label",
|
||||
"caption": "Konfiguration der nötigen Schaltkontakte und Nennleistungen"
|
||||
},
|
||||
{
|
||||
"type": "Select",
|
||||
"name": "Heizungstemperatur_glätten",
|
||||
"caption": "Heizungstemperatur glätten",
|
||||
"options": [
|
||||
{
|
||||
"caption": "Ja",
|
||||
"value": true
|
||||
},
|
||||
{
|
||||
"caption": "Nein",
|
||||
"value": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "ZeitKonstante",
|
||||
"caption": "Zeit Konstante",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
"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": ""
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "Hysterese",
|
||||
"caption": "Hysterese",
|
||||
"digits": 1,
|
||||
"suffix": "°C"
|
||||
},
|
||||
{
|
||||
"type": "List",
|
||||
"name": "LeistungsStufen",
|
||||
"caption": "Anzahl Stufen mit den dazugehörigen Leistungen",
|
||||
"add": true,
|
||||
"delete": true,
|
||||
"columns": [
|
||||
{
|
||||
"caption": "Stufe(n)",
|
||||
"name": "Stufe",
|
||||
"width": "200px",
|
||||
"add": "Stufe",
|
||||
"edit": {
|
||||
"type": "NumberSpinner"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "Leistung in W",
|
||||
"name": "Leistung",
|
||||
"width": "300px",
|
||||
"add": 0,
|
||||
"edit": {
|
||||
"type": "NumberSpinner"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "Schaltkontakt",
|
||||
"name": "Schaltkontakt_Stufe",
|
||||
"width": "400px",
|
||||
"add": 0,
|
||||
"edit": {
|
||||
"type": "SelectVariable",
|
||||
"validVariableTypes": [0],
|
||||
"requiredAction": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "SelectVariable",
|
||||
"name": "Heizungsfuehler",
|
||||
"caption": "Variable für Heizungsfühler",
|
||||
"test": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"id": "{3FD5E282-FF4F-D02A-8665-2B40DF65F3BB}",
|
||||
"name": "Heizung_x_Stufig",
|
||||
"type": 3,
|
||||
"vendor": "Belevo AG",
|
||||
"aliases": [],
|
||||
"parentRequirements": [],
|
||||
"childRequirements": [],
|
||||
"implemented": [],
|
||||
"prefix": "GEF",
|
||||
"url": ""
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
<?php
|
||||
|
||||
class Heizung_x_Stufig extends IPSModule
|
||||
{
|
||||
private array $leistungArray = [];
|
||||
|
||||
public function Create()
|
||||
{
|
||||
parent::Create();
|
||||
|
||||
$this->RegisterPropertyString("LeistungsStufen", json_encode([]));
|
||||
$this->RegisterPropertyInteger("ZeitKonstante", 120);
|
||||
$this->RegisterPropertyInteger("Heizungsfuehler", 0);
|
||||
$this->RegisterPropertyBoolean("Heizungstemperatur_glätten", false);
|
||||
$this->RegisterPropertyInteger("Interval", 5);
|
||||
$this->RegisterPropertyFloat("Hysterese", 0.1);
|
||||
|
||||
$this->RegisterVariableInteger("Mindesttemperatur", "Mindesttemperatur", "", 45);
|
||||
$this->RegisterVariableInteger("Maximaltemperatur", "Maximaltemperatur", "", 60);
|
||||
$this->RegisterVariableFloat("Heizungstemperatur", "Heizungstemperatur", "", 0);
|
||||
|
||||
$this->RegisterVariableBoolean("Disable", "Heizung Ein/Aus", "~Switch", 0);
|
||||
$this->EnableAction("Disable");
|
||||
|
||||
$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);
|
||||
|
||||
$this->RegisterPropertyInteger("IdleCounterMax", 2);
|
||||
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
|
||||
$this->SetValue("IdleCounter", 0);
|
||||
|
||||
$this->SetValue("Idle", true);
|
||||
|
||||
$this->RegisterTimer(
|
||||
"Timer_Do_UserCalc_Heizung",
|
||||
$this->ReadPropertyInteger("Interval") * 1000,
|
||||
'IPS_RequestAction(' . $this->InstanceID . ', "Do_UserCalc", "");'
|
||||
);
|
||||
}
|
||||
|
||||
public function ApplyChanges()
|
||||
{
|
||||
parent::ApplyChanges();
|
||||
|
||||
$this->SetTimerInterval(
|
||||
"Timer_Do_UserCalc_Heizung",
|
||||
$this->ReadPropertyInteger("Interval") * 1000
|
||||
);
|
||||
}
|
||||
|
||||
public function RequestAction($Ident, $Value)
|
||||
{
|
||||
switch ($Ident) {
|
||||
case "Disable":
|
||||
$this->SetValue("Disable", (bool)$Value);
|
||||
|
||||
if ((bool)$Value) {
|
||||
$this->SetValue("PowerSteps", json_encode([0]));
|
||||
$this->SetAktuelle_Leistung(0);
|
||||
}
|
||||
break;
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
private function LadeUndSortiereLeistungen()
|
||||
{
|
||||
$this->leistungArray = [0];
|
||||
|
||||
$json = $this->ReadPropertyString("LeistungsStufen");
|
||||
$leistungsStufen = json_decode($json, true);
|
||||
|
||||
if (is_array($leistungsStufen)) {
|
||||
foreach ($leistungsStufen as $stufe) {
|
||||
$this->leistungArray[] = (int)($stufe['Leistung'] ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
sort($this->leistungArray);
|
||||
}
|
||||
|
||||
public function SetAktuelle_Leistung(int $power)
|
||||
{
|
||||
$this->LadeUndSortiereLeistungen();
|
||||
|
||||
foreach ($this->leistungArray as $leistung) {
|
||||
$kontaktID = $this->GetKontaktIDZuLeistung($leistung);
|
||||
|
||||
if ($kontaktID > 0 && IPS_VariableExists($kontaktID)) {
|
||||
RequestAction($kontaktID, ($leistung === $power));
|
||||
} elseif ($kontaktID > 0) {
|
||||
IPS_LogMessage("ERROR", "KontaktID $kontaktID existiert nicht oder ist ungültig!");
|
||||
}
|
||||
}
|
||||
|
||||
$lastPower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
||||
|
||||
if ($power != $lastPower) {
|
||||
$this->SetValue("Idle", false);
|
||||
$this->SetValue("IdleCounter", $this->ReadPropertyInteger("IdleCounterMax"));
|
||||
}
|
||||
|
||||
$this->SetValue("Aktuelle_Leistung", $power);
|
||||
|
||||
$this->SetValue(
|
||||
"Bezogene_Energie",
|
||||
$this->GetValue("Bezogene_Energie") +
|
||||
($this->GetValue("Aktuelle_Leistung") * ($this->ReadPropertyInteger("Interval") / 3600))
|
||||
);
|
||||
|
||||
$this->ProcessIdleCounter();
|
||||
}
|
||||
|
||||
private function GetKontaktIDZuLeistung(int $leistung): int
|
||||
{
|
||||
$json = $this->ReadPropertyString("LeistungsStufen");
|
||||
$leistungsStufen = json_decode($json, true);
|
||||
|
||||
if (is_array($leistungsStufen)) {
|
||||
foreach ($leistungsStufen as $stufe) {
|
||||
if ((int)($stufe['Leistung'] ?? 0) === $leistung) {
|
||||
return (int)($stufe['Schaltkontakt_Stufe'] ?? 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function GetCurrentData(bool $Peak)
|
||||
{
|
||||
$this->LadeUndSortiereLeistungen();
|
||||
|
||||
|
||||
/*
|
||||
if ($this->GetValue("Disable") == false) {
|
||||
$this->SetValue("PowerSteps", json_encode([0]));
|
||||
$this->SetAktuelle_Leistung(0);
|
||||
return;
|
||||
}*/
|
||||
|
||||
|
||||
if ($this->GetValue("Disable") == false){
|
||||
$dummy_array[] = 0;
|
||||
return $this->SetValue("PowerSteps", json_encode($dummy_array));
|
||||
}
|
||||
|
||||
$heizungstemperaturGlaetten = $this->ReadPropertyBoolean("Heizungstemperatur_glätten");
|
||||
$heizungsFuehlerPT1ID = $this->ReadPropertyInteger("Heizungsfuehler");
|
||||
|
||||
if ($heizungsFuehlerPT1ID > 0 && IPS_VariableExists($heizungsFuehlerPT1ID)) {
|
||||
$heizungPT1 = GetValue($heizungsFuehlerPT1ID);
|
||||
} else {
|
||||
$heizungPT1 = 0.0;
|
||||
}
|
||||
|
||||
if ($heizungstemperaturGlaetten) {
|
||||
$heizungTempAlt = $this->GetValue("Heizungstemperatur");
|
||||
|
||||
$timeConstant = $this->ReadPropertyInteger("ZeitKonstante");
|
||||
$deltaT = $this->ReadPropertyInteger("Interval");
|
||||
|
||||
$alpha = $deltaT / ($timeConstant + $deltaT);
|
||||
$newHeizungTemp = $heizungTempAlt + $alpha * ($heizungPT1 - $heizungTempAlt);
|
||||
|
||||
$this->SetValue("Heizungstemperatur", $newHeizungTemp);
|
||||
} else {
|
||||
$this->SetValue("Heizungstemperatur", $heizungPT1);
|
||||
}
|
||||
|
||||
$heizungTemp = $this->GetValue("Heizungstemperatur");
|
||||
$minTemp = $this->GetValue("Mindesttemperatur");
|
||||
$maxTemp = $this->GetValue("Maximaltemperatur");
|
||||
$hysterese = $this->ReadPropertyFloat("Hysterese");
|
||||
|
||||
$vollLeistung = max($this->leistungArray);
|
||||
|
||||
if ($Peak) {
|
||||
if ($heizungTemp < $minTemp) {
|
||||
$this->SetValue("PowerSteps", json_encode($this->leistungArray));
|
||||
} elseif (
|
||||
$heizungTemp < $minTemp + $hysterese &&
|
||||
$this->IstEineStufeAktiv()
|
||||
) {
|
||||
$this->SetValue("PowerSteps", json_encode($this->leistungArray));
|
||||
} else {
|
||||
$this->SetValue("PowerSteps", json_encode([0]));
|
||||
}
|
||||
} else {
|
||||
if ($heizungTemp < $minTemp) {
|
||||
$this->SetValue("PowerSteps", json_encode([$vollLeistung]));
|
||||
} elseif (
|
||||
$heizungTemp < $minTemp + $hysterese &&
|
||||
$this->IstEineStufeAktiv()
|
||||
) {
|
||||
$this->SetValue("PowerSteps", json_encode([$vollLeistung]));
|
||||
} elseif ($heizungTemp < $maxTemp - $hysterese) {
|
||||
$this->SetValue("PowerSteps", json_encode($this->leistungArray));
|
||||
} elseif (
|
||||
$heizungTemp < $maxTemp &&
|
||||
$this->IstEineStufeAktiv()
|
||||
) {
|
||||
$this->SetValue("PowerSteps", json_encode($this->leistungArray));
|
||||
} else {
|
||||
$this->SetValue("PowerSteps", json_encode([0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function IstEineStufeAktiv(): bool
|
||||
{
|
||||
$json = $this->ReadPropertyString("LeistungsStufen");
|
||||
$leistungsStufen = json_decode($json, true);
|
||||
|
||||
if (is_array($leistungsStufen)) {
|
||||
foreach ($leistungsStufen as $stufe) {
|
||||
$kontaktID = (int)($stufe['Schaltkontakt_Stufe'] ?? 0);
|
||||
|
||||
if ($kontaktID > 0 && IPS_VariableExists($kontaktID)) {
|
||||
if (GetValue($kontaktID) === true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function ProcessIdleCounter()
|
||||
{
|
||||
$idleCounter = $this->GetValue("IdleCounter");
|
||||
|
||||
if ($idleCounter > 0) {
|
||||
$this->SetValue("Idle", false);
|
||||
$this->SetValue("IdleCounter", $idleCounter - 1);
|
||||
} else {
|
||||
$this->SetValue("Idle", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,232 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
“This License” refers to version 3 of the GNU General Public License.
|
||||
|
||||
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
|
||||
|
||||
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
|
||||
|
||||
A “covered work” means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
|
||||
|
||||
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
|
||||
|
||||
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
|
||||
|
||||
Enelix
|
||||
Copyright (C) 2026 dh
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
||||
|
||||
Enelix Copyright (C) 2026 dh
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
+50
-73
@@ -1,52 +1,37 @@
|
||||
# Belevo EMS Manager
|
||||
# Enelix Manager
|
||||
|
||||
Dieses Modul ist das Herzstück des Belevo Energiemanagement-Systems. Es steuert in festgelegten Intervallen die Leistungsverteilung auf Ihre Verbraucher-Instanzen, trifft den Solarlade- vs. Peak-Shaving-Entscheid und verteilt entsprechend die Leistungen an die Verbraucher.
|
||||
Dieses Modul steuert in festgelegten Intervallen die Leistungsverteilung auf Verbraucher-Instanzen, wählt zwischen Solarladen und Peak-Shaving und verteilt die Leistung in definierten Schritten an die Verbraucher.
|
||||
|
||||
---
|
||||
|
||||
## Inhaltsverzeichnis
|
||||
|
||||
1. [Funktionsumfang](#1-funktionsumfang)
|
||||
2. [Voraussetzungen](#2-voraussetzungen)
|
||||
3. [Installation](#3-installation)
|
||||
4. [Instanz anlegen & Konfiguration](#4-instanz-anlegen--konfiguration)
|
||||
5. [Statusvariablen & Profile](#5-statusvariablen--profile)
|
||||
6. [WebFront / Bedienung](#6-webfront--bedienung)
|
||||
7. [Mapping auf Code-Komponenten](#7-mapping-auf-code-komponenten)
|
||||
8. [Zukünftige Erweiterungen](#8-zukünftige-erweiterungen)
|
||||
1. [Funktionsumfang](#1-funktionsumfang)
|
||||
2. [Voraussetzungen](#2-voraussetzungen)
|
||||
3. [Installation](#3-installation)
|
||||
4. [Instanz anlegen & Konfiguration](#4-instanz-anlegen--konfiguration)
|
||||
5. [Statusvariablen](#5-statusvariablen)
|
||||
6. [WebFront / Bedienung](#6-webfront--bedienung)
|
||||
7. [Mapping auf Code-Komponenten](#7-mapping-auf-code-komponenten)
|
||||
8. [Zukünftige Erweiterungen](#8-zukünftige-erweiterungen)
|
||||
|
||||
---
|
||||
|
||||
## 1. Funktionsumfang
|
||||
|
||||
- **Zyklische Steuerung**
|
||||
In konfigurierbaren Intervallen (`Interval`) wird die Methode `DistributeEnergy()` ausgelöst.
|
||||
- **Mode-Entscheid**
|
||||
Basierend auf der aktuellen Netz-Sollleistung (`Sollleistung_Max`) und der PV-Überschuss-Grenze (`Ueberschussleistung`) wählt der Manager automatisch zwischen
|
||||
- **Solarlade-Mode** (`Is_Peak_Shaving = false`)
|
||||
- **Peak-Shaving-Mode** (`Is_Peak_Shaving = true`)
|
||||
- **Leistungskonten**
|
||||
Jeder Verbraucher meldet über seine Instanzvariablen (`Power`, `Bezogene_Energie`, `PowerSteps`, `PV_Prio` / `Sperre_Prio`) seinen Bedarf bzw. Reduktions- oder Einspeise-Potential.
|
||||
- **Priorisierung & Fairness**
|
||||
1. Sortierung der Verbraucher nach Priorität (`PV_Prio` im Solarmode, `Sperre_Prio` im Shaving-Mode)
|
||||
2. Bei Gleichpriorität abwechselnde Zuteilung nach bisher bezogener Energie (`Bezogene_Energie`)
|
||||
- **Differenz-Verteilung**
|
||||
Die verbleibende Soll–Ist-Differenz D wird in Stufen (je Verbraucher aus `PowerSteps`) abgearbeitet, bis D ≃ 0.
|
||||
- **Externe Kommunikation**
|
||||
Über die Properties `DatenHoch` und `DatenZuruck` (Variable-IDs) können mehrere Manager zu einem Übergeordneten Hauptmanager zusammengefasst werden (V-ZEV, LEG).
|
||||
- **Zyklische Steuerung:** In konfigurierbaren Intervallen (`Interval`) wird die Energieverteilung über den Timer `Timer_DistributeEnergy` ausgelöst.
|
||||
- **Betriebsmodus:** Automatische oder statische Umschaltung zwischen Solarladen (`Is_Peak_Shaving = false`) und Peak-Shaving (`Is_Peak_Shaving = true`), abhängig vom `Netzbezug` und den parametrierten Schwellwerten.
|
||||
- **Priorisierung:** Sortierung der Verbraucher nach `PV_Prio` (Solarmodus) oder `Sperre_Prio` (Peak-Shaving). Bei gleicher Priorität entscheidet die `Bezogene_Energie`.
|
||||
- **Energieverteilung:** Die verbleibende Leistung wird basierend auf den `PowerSteps` der Verbraucher abgearbeitet und zugeteilt.
|
||||
- **Externe Steuerung (Hauptmanager):** Integration in übergeordnete Managementsysteme (z.B. V-ZEV, LEG) über die Variablen `DatenHoch` und `DatenZuruck`, Funktion ist in der aktuellen Version erst beschränkt verfügbar.
|
||||
|
||||
---
|
||||
|
||||
## 2. Voraussetzungen
|
||||
|
||||
- IP-Symcon **≥ 8.0**
|
||||
- Modul-URL:
|
||||
https://git.belevo.ch/dh/Symcon_Belevo_Energiemanagement_testing.git
|
||||
|
||||
yaml
|
||||
Kopieren
|
||||
Bearbeiten
|
||||
- Einmalige manuelle Anmeldung aller Verbraucher in `Verbraucher_Liste`
|
||||
- IP-Symcon **≥ 8.0**
|
||||
- Modul-URL: `https://git.belevo.ch/dh/enelix.git`
|
||||
- Zuweisung der Verbraucher-Instanzen in der `Verbraucher_Liste`
|
||||
|
||||
---
|
||||
|
||||
@@ -54,8 +39,8 @@ Bearbeiten
|
||||
|
||||
1. In IP-Symcon **Module Control** öffnen
|
||||
2. **Hinzufügen → Git-Repository**
|
||||
3. URL eingeben (oben) und **Installieren**
|
||||
4. IP-Symcon neu starten
|
||||
3. URL eintragen: https://git.belevo.ch/dh/enelix.git
|
||||
4. Modul installieren
|
||||
|
||||
---
|
||||
|
||||
@@ -63,63 +48,55 @@ Bearbeiten
|
||||
|
||||
### 4.1 Instanz anlegen
|
||||
|
||||
- Rechtsklick **Instanzen** → **Instanz hinzufügen**
|
||||
- Filter: **Belevo**
|
||||
- Auswahl: **Manager**
|
||||
- Rechtsklick **Instanzen** → **Instanz hinzufügen**
|
||||
- Filter: **Belevo**
|
||||
- Auswahl: **Manager**
|
||||
|
||||
### 4.2 Properties
|
||||
|
||||
| Name | Typ | Beschreibung |
|
||||
|--------------------------|-----------------|----------------------------------------------------------------------------|
|
||||
| **Peakleistung** | NumberSpinner | Sollwert-Vorgabe für Peak-Shaving (Watt) |
|
||||
| **Ueberschussleistung** | NumberSpinner | Sollwert-Vorgabe für Solarladen (Watt) |
|
||||
| **Netzbezug** | SelectVariable | Variable mit dem aktuellen Netz-Ist-Wert (Watt) |
|
||||
| **HauptmanagerAktiv** | CheckBox | Schaltet die Ünergeordnete Manager-Logik global ein/aus |
|
||||
| **ManagerID** | NumberSpinner | Eindeutige ID für externe Manager‐Kommunikation |
|
||||
| **DatenHoch** | SelectVariable | Variable, in die Manager-Statistiken oder Statusdaten geschrieben werden |
|
||||
| **DatenZuruck** | SelectVariable | Variable, aus der Verbraucherdaten importiert werden |
|
||||
| **Interval** | NumberSpinner | Intervall für Neuberechnung der Werte (Sekunden) |
|
||||
| **Verbraucher_Liste** | List | Auswahl aller Verbraucher-Instanzen, die gesteuert werden sollen |
|
||||
| Name | Typ | Beschreibung |
|
||||
|---|---|---|
|
||||
| **Peakleistung** | Integer | Sollwert-Vorgabe für Peak-Shaving (Watt) |
|
||||
| **Ueberschussleistung** | Integer | Sollwert-Vorgabe für Solarladen (Watt) |
|
||||
| **Netzbezug** | Integer | Objekt-ID der Variable mit dem aktuellen Netzbezug |
|
||||
| **Verbraucher_Liste** | String | JSON-Liste aller zu steuernden Verbraucher-Instanzen |
|
||||
| **UmschaltpunktStatisch** | Boolean | Aktiviert statische Umschaltpunkte (Ignoriert dynamische Mittelwertberechnung) |
|
||||
| **Umschalt_Solarladen** | Integer | Schwellwert für den Wechsel in den Solarladen-Modus (bei statischer Umschaltung) |
|
||||
| **Umschalt_Peakshaving** | Integer | Schwellwert für den Wechsel in den Peak-Shaving-Modus (bei statischer Umschaltung) |
|
||||
| **HauptmanagerAktiv** | Boolean | Aktiviert die externe Steuerung durch einen übergeordneten Manager |
|
||||
| **ManagerID** | Integer | Eindeutige ID für die externe Manager-Kommunikation |
|
||||
| **DatenHoch** | Integer | Objekt-ID der Variable zum Senden von JSON-Daten an den Hauptmanager |
|
||||
| **DatenZuruck** | Integer | Objekt-ID der Variable zum Empfangen von JSON-Daten vom Hauptmanager |
|
||||
| **Interval** | Integer | Berechnungsintervall für den Timer und die neuverteilung der Leistungsdaten in Sekunden |
|
||||
|
||||
---
|
||||
|
||||
## 5. Statusvariablen & Profile
|
||||
## 5. Statusvariablen
|
||||
|
||||
| Ident | Typ | Profil | Beschreibung |
|
||||
|-------------------------|------------|----------------|-------------------------------------------------------------------|
|
||||
| **Is_Peak_Shaving** | Boolean | — | Modusanzeige (false = Solarladen, true = Peak-Shaving) |
|
||||
| **LetzteBerechnung** | DateTime | — | Zeitpunkt der letzten Zyklus-Ausführung |
|
||||
| **Aktuelle_Differenz** | Float | ~Watt~~W~ | Zuletzt berechnete Soll–Ist-Differenz |
|
||||
| Ident | Typ | Beschreibung |
|
||||
|---|---|---|
|
||||
| **Is_Peak_Shaving** | Boolean | Modusanzeige (`false` = Solarladen, `true` = Peak-Shaving) |
|
||||
|
||||
---
|
||||
|
||||
## 6. WebFront / Bedienung
|
||||
|
||||
Im WebFront können Sie
|
||||
- den **aktuellen Modus** (`Is_Peak_Shaving`) beobachten
|
||||
Dem Managermodul müssen bei Erstinbetriebnahme eine Variable mit dem zu regelnden Netzbezug sowie die zu Steuernden Verbraucher konfiguriert werden. Anschliessend läuft das Modul autononom gemäss [Funktionsumfang](#1-funktionsumfang). Einzig wird im WebFront der aktuelle Modus über die Statusvariable `Is_Peak_Shaving` visualisiert.
|
||||
|
||||
---
|
||||
|
||||
## 7. Mapping auf Code-Komponenten
|
||||
|
||||
| Komponente | Modul-Datei | Funktion |
|
||||
|---------------------------|-----------------------------|------------------------------------------------------------|
|
||||
| **Timer-Registrierung** | `Manager/module.php` | `ApplyChanges()` → `SetTimerInterval('Interval', …)` |
|
||||
| **Zyklischer Aufruf** | `Manager/module.php` | `ManageTimer()` ruft `DistributeEnergy()` auf |
|
||||
| **Mode-Entscheidlogik** | `Manager/module.php` | Berechnung:
|
||||
```php
|
||||
$isPeak = $ist > (($peak + $solar) / 2);
|
||||
$this->SetValue('Is_Peak_Shaving', $isPeak);
|
||||
``` |
|
||||
| **Datenzugriff** | `Manager/module.php` | `$this->ReadPropertyInteger('Peakleistung')` usw. |
|
||||
| **Verbraucher-Schleife** | `Manager/module.php` | `$this->ReadPropertyArray('Verbraucher_Liste')` |
|
||||
| **Leistungszuteilung** | `Manager/module.php` | `DistributeEnergy()` → Round-Robin über `PowerSteps` |
|
||||
| **Externe Schnittstelle** | `Manager/module.php` | Verwendung von `DatenHoch` / `DatenZuruck` Variablen-IDs |
|
||||
| Komponente | Funktion im Code (`module.php`) |
|
||||
|---|---|
|
||||
| **Timer-Registrierung** | `ApplyChanges()` setzt das Intervall für `Timer_DistributeEnergy`. |
|
||||
| **Zyklischer Aufruf** | Timer löst `RequestAction()` mit dem Ident `DistributeEnergy` aus. |
|
||||
| **Mode-Entscheidlogik** | Dynamisch: Abgleich von `$Netzbezug` mit Mittelwert aus Peak und Überschuss. <br>Statisch: Schwellwertprüfung über Properties `Umschalt_Solarladen` / `Umschalt_Peakshaving`. |
|
||||
| **Leistungszuteilung** | Funktion `DistributeEnergy()` berechnet die Schritte und steuert Verbraucher via `IPS_RequestAction(..., "SetAktuelle_Leistung", ...)`. |
|
||||
| **Externe Kommunikation** | Funktion `DistributeEnergy_Extern()` liest/schreibt Arrays über die festgelegten Variablen-IDs. |
|
||||
|
||||
---
|
||||
|
||||
## 8. Zukünftige Erweiterungen
|
||||
|
||||
- **Automatische Registrierung** neuer Verbraucher (ohne manuelles Eintragen)
|
||||
|
||||
---
|
||||
- **Automatische Registrierung** neuer Verbraucher (ohne manuelles Eintragen, Eingetragen auf Verbruacherseite)
|
||||
+2
-2
@@ -52,12 +52,12 @@
|
||||
{
|
||||
"type": "SelectVariable",
|
||||
"name": "DatenHoch",
|
||||
"caption": "Daten Hoch"
|
||||
"caption": "Hauptmanager Daten Hoch"
|
||||
},
|
||||
{
|
||||
"type": "SelectVariable",
|
||||
"name": "DatenZuruck",
|
||||
"caption": "Daten Zurück"
|
||||
"caption": "Hauptmanager Daten Zurück"
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
|
||||
+1
-1
@@ -8,5 +8,5 @@
|
||||
"childRequirements": [],
|
||||
"implemented": [],
|
||||
"prefix": "GEF",
|
||||
"url": ""
|
||||
"url": "https://git.belevo.ch/dh/Enelix/src/branch/main/Manager"
|
||||
}
|
||||
+282
-309
@@ -6,7 +6,7 @@ class Manager extends IPSModule
|
||||
{
|
||||
parent::Create();
|
||||
|
||||
// Systemvariablen registrieren
|
||||
// Properies und Systemvariablen registrieren
|
||||
$this->RegisterPropertyInteger("Peakleistung", 0);
|
||||
$this->RegisterPropertyInteger("Ueberschussleistung", 0);
|
||||
$this->RegisterPropertyInteger("Netzbezug", 0); // Initialisierung mit 0
|
||||
@@ -20,77 +20,88 @@ class Manager extends IPSModule
|
||||
$this->RegisterPropertyInteger("DatenZuruck", 0); // Initialisierung mit 0
|
||||
$this->RegisterPropertyInteger("Interval", 2); // Recheninterval
|
||||
|
||||
$this->RegisterVariableBoolean("Is_Peak_Shaving", false);
|
||||
$this->RegisterVariableBoolean("Is_Peak_Shaving", false);
|
||||
|
||||
// Timer registrieren
|
||||
// Timer registrieren
|
||||
|
||||
$this->RegisterTimer("Timer_DistributeEnergy",$this->ReadPropertyInteger("Interval")*1000,"IPS_RequestAction(" .$this->InstanceID .', "DistributeEnergy", "");');
|
||||
$this->RegisterTimer(
|
||||
"Timer_DistributeEnergy",
|
||||
$this->ReadPropertyInteger("Interval") * 1000,
|
||||
"IPS_RequestAction(" .
|
||||
$this->InstanceID .
|
||||
', "DistributeEnergy", "");'
|
||||
);
|
||||
}
|
||||
|
||||
public function ApplyChanges()
|
||||
{
|
||||
parent::ApplyChanges();
|
||||
//Liste aller Verbraucher einlesen
|
||||
$this->SetTimerInterval("Timer_DistributeEnergy",$this->ReadPropertyInteger("Interval")*1000);
|
||||
|
||||
$this->SetTimerInterval(
|
||||
"Timer_DistributeEnergy",
|
||||
$this->ReadPropertyInteger("Interval") * 1000
|
||||
);
|
||||
}
|
||||
|
||||
public function RequestAction($Ident, $Value)
|
||||
{
|
||||
switch ($Ident) {
|
||||
case "DistributeEnergy":
|
||||
if($this->ReadPropertyBoolean("HauptmanagerAktiv")==true ){
|
||||
|
||||
$data = json_decode(GetValue($this->ReadPropertyInteger("DatenZuruck")), true);
|
||||
IPS_LogMessage("Manager", print_r($data));
|
||||
IPS_LogMessage("Manager", $data["Timestamp"]);
|
||||
// Fallunterscheidung, ist der Manager stand-alone oder in einem verbund mit Hauptmanager?
|
||||
if ($this->ReadPropertyBoolean("HauptmanagerAktiv") == true) {
|
||||
// Wenn im Verbund, parse die Verbraucherdaten und sende sie dem Hauptmanager, sofern dieser aktiv ist
|
||||
$data = json_decode(
|
||||
GetValue($this->ReadPropertyInteger("DatenZuruck")),
|
||||
true
|
||||
);
|
||||
|
||||
if (isset($data["Timestamp"])) {
|
||||
$timestamp = $data["Timestamp"];
|
||||
$currentTime = time();
|
||||
IPS_LogMessage("Manager", ($currentTime - $timestamp));
|
||||
IPS_LogMessage("Manager", "im here ist so halb gut");
|
||||
|
||||
if (($currentTime - $timestamp) < 3600) {
|
||||
$this->DistributeEnergy_Extern();
|
||||
IPS_LogMessage("Manager", "im here ist gut");
|
||||
|
||||
if ($currentTime - $timestamp < 3600) {
|
||||
$this->DistributeEnergy_Extern();
|
||||
} else {
|
||||
$sendarray = [
|
||||
"Netzbezug" => GetValue(
|
||||
$this->ReadPropertyInteger("Netzbezug")
|
||||
),
|
||||
"Timestamp" => time(),
|
||||
];
|
||||
|
||||
$sendarray = [
|
||||
"Netzbezug" => GetValue($this->ReadPropertyInteger("Netzbezug")),
|
||||
"Timestamp" => time()
|
||||
];
|
||||
|
||||
SetValue($this->ReadPropertyInteger("DatenHoch"), json_encode($sendarray));
|
||||
|
||||
$this->DistributeEnergy();
|
||||
IPS_LogMessage("Manager", "im here ist schlecht");
|
||||
|
||||
}
|
||||
SetValue(
|
||||
$this->ReadPropertyInteger("DatenHoch"),
|
||||
json_encode($sendarray)
|
||||
);
|
||||
|
||||
$this->DistributeEnergy();
|
||||
}
|
||||
} else {
|
||||
|
||||
$sendarray = [
|
||||
"Netzbezug" => GetValue($this->ReadPropertyInteger("Netzbezug")),
|
||||
"Timestamp" => time()
|
||||
"Netzbezug" => GetValue(
|
||||
$this->ReadPropertyInteger("Netzbezug")
|
||||
),
|
||||
"Timestamp" => time(),
|
||||
];
|
||||
|
||||
SetValue($this->ReadPropertyInteger("DatenHoch"), json_encode($sendarray));
|
||||
SetValue(
|
||||
$this->ReadPropertyInteger("DatenHoch"),
|
||||
json_encode($sendarray)
|
||||
);
|
||||
|
||||
$this->DistributeEnergy();
|
||||
IPS_LogMessage("Manager", "im here ist schlecht");
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
$this->DistributeEnergy();
|
||||
} else {
|
||||
// wenn stand-alone, rufe einfach die Methode zum verteilen auf
|
||||
$this->DistributeEnergy();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "ApplyChanges":
|
||||
$this->ApplyChanges();
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("Invalid Ident");
|
||||
}
|
||||
@@ -98,17 +109,18 @@ class Manager extends IPSModule
|
||||
|
||||
public function DistributeEnergy()
|
||||
{
|
||||
|
||||
// Alle Energieverbraucher auslesen und dekodieren
|
||||
$Verbraucher_Liste = json_decode($this->ReadPropertyString("Verbraucher_Liste"), true);
|
||||
$Verbraucher_Liste = json_decode(
|
||||
$this->ReadPropertyString("Verbraucher_Liste"),
|
||||
true
|
||||
);
|
||||
|
||||
if (empty($Verbraucher_Liste)) {
|
||||
// Liste ist leer, daher nichts zu tun
|
||||
IPS_LogMessage("Manager", "aufgerufen leere liste");
|
||||
|
||||
// Wenn keine Verbruacher angemeldet sind abbrechen
|
||||
return;
|
||||
}
|
||||
|
||||
// Hilfsvariabeln initialiseren
|
||||
|
||||
$filteredVerbraucher = []; // Array das später mit allen Verbrauchsdaten der Energieverbraucher gefüllt wird
|
||||
$allIdle = true; // Variable zur Überprüfung, ob alle Benutzer Idle = true sind
|
||||
@@ -117,20 +129,29 @@ class Manager extends IPSModule
|
||||
|
||||
// Fülle das Array mit allen entsprechenden Werten der Verbraucher ab
|
||||
foreach ($Verbraucher_Liste as $user) {
|
||||
if (!IPS_InstanceExists($user["Verbraucher"])) {
|
||||
IPS_LogMessage("Manager", "aufgerufen komisch");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Werte direkt von der Verbraucher-Instanz abrufen
|
||||
$Aktuelle_Leistung = GetValue(IPS_GetObjectIDByIdent("Power", $user["Verbraucher"])); // Aktuelle Leistung durch Power ersetzt
|
||||
$Bezogene_Energie = GetValue(IPS_GetObjectIDByIdent("Bezogene_Energie", $user["Verbraucher"]));
|
||||
$PV_Prio = GetValue(IPS_GetObjectIDByIdent("PV_Prio", $user["Verbraucher"]));
|
||||
$Sperre_Prio = GetValue(IPS_GetObjectIDByIdent("Sperre_Prio", $user["Verbraucher"]));
|
||||
$idle = GetValue(IPS_GetObjectIDByIdent("Idle", $user["Verbraucher"]));
|
||||
$powerStepsJson = GetValue(IPS_GetObjectIDByIdent("PowerSteps", $user["Verbraucher"]));
|
||||
$Aktuelle_Leistung = GetValue(
|
||||
IPS_GetObjectIDByIdent("Power", $user["Verbraucher"])
|
||||
); // Aktuelle Leistung durch Power ersetzt
|
||||
$Bezogene_Energie = GetValue(
|
||||
IPS_GetObjectIDByIdent("Bezogene_Energie", $user["Verbraucher"])
|
||||
);
|
||||
$PV_Prio = GetValue(
|
||||
IPS_GetObjectIDByIdent("PV_Prio", $user["Verbraucher"])
|
||||
);
|
||||
$Sperre_Prio = GetValue(
|
||||
IPS_GetObjectIDByIdent("Sperre_Prio", $user["Verbraucher"])
|
||||
);
|
||||
$idle = GetValue(
|
||||
IPS_GetObjectIDByIdent("Idle", $user["Verbraucher"])
|
||||
);
|
||||
$powerStepsJson = GetValue(
|
||||
IPS_GetObjectIDByIdent("PowerSteps", $user["Verbraucher"])
|
||||
);
|
||||
$powerSteps = json_decode($powerStepsJson, true);
|
||||
$delta = GetValue(IPS_GetObjectIDByIdent("Leistung_Delta", $user["Verbraucher"]));
|
||||
$delta = GetValue(
|
||||
IPS_GetObjectIDByIdent("Leistung_Delta", $user["Verbraucher"])
|
||||
);
|
||||
|
||||
// Verbraucher-Daten zum gefilterten Array hinzufügen
|
||||
$filteredVerbraucher[] = [
|
||||
@@ -142,130 +163,109 @@ class Manager extends IPSModule
|
||||
"Sperre_Prio" => $Sperre_Prio,
|
||||
"Idle" => $idle,
|
||||
"PowerSteps" => $powerSteps,
|
||||
"Leistung_Delta" => $delta
|
||||
"Leistung_Delta" => $delta,
|
||||
];
|
||||
|
||||
// Überprüfen, ob alle Benutzer Idle = true sind, wenn einer nicht ist, wird später verworfen...
|
||||
// Überprüfen, ob alle Benutzer Idle = true sind (bereit für eine Leistungsänderung), wenn einer nicht ist, wird später verworfen...
|
||||
if (!$idle) {
|
||||
$allIdle = false;
|
||||
IPS_LogMessage("Manager", "nciht idle");
|
||||
|
||||
}
|
||||
//if(in_array(0, $powerSteps, true)){
|
||||
//if(in_array(0, $powerSteps, true)){
|
||||
|
||||
//}
|
||||
// Addiere die aktuell bereits verwendete Leistung auf, um sie bei der verteilung zu berücksichtigen
|
||||
$totalAktuelle_Leistung += ($Aktuelle_Leistung-$delta);
|
||||
|
||||
// }
|
||||
|
||||
$totalAktuelle_Leistung += $Aktuelle_Leistung - $delta;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Berücksichtigung der bereits verteilten Leistungen (nachher kann dafür wieder bei 0 begonnen werden zu verteilen)
|
||||
// Systemvariablen abrufen
|
||||
// Variante der Leistungsregelung (Überschuss, Peak) ermitteln und aktuellen Netzbezug bereitstellen
|
||||
$Netzbezug = GetValue($this->ReadPropertyInteger("Netzbezug"));
|
||||
|
||||
IPS_LogMessage("Leistung Am Anfang", "P" . $totalAktuelle_Leistung);
|
||||
|
||||
|
||||
$Peakleistung = $this->ReadPropertyInteger("Peakleistung");
|
||||
$Ueberschussleistung = $this->ReadPropertyInteger("Ueberschussleistung");
|
||||
|
||||
|
||||
|
||||
if(($this->ReadPropertyBoolean("UmschaltpunktStatisch"))==false){
|
||||
|
||||
// Fallunterscheidung ob auf Solarladen oder Peakshaving gerregelt wird.
|
||||
if ($Netzbezug < ($Peakleistung + $Ueberschussleistung) / 2) {
|
||||
$remainingPower = -1 * (-1 * $Ueberschussleistung + $Netzbezug);
|
||||
$Is_Peak_Shaving = false;
|
||||
} else {
|
||||
$remainingPower = $Peakleistung - $Netzbezug;
|
||||
$Is_Peak_Shaving = true;
|
||||
}
|
||||
|
||||
}else{ // Statische ermittlung der Betriebsart
|
||||
|
||||
if($Netzbezug<($this->ReadPropertyInteger("Umschalt_Solarladen"))){
|
||||
|
||||
$remainingPower = -1 * (-1 * $Ueberschussleistung + $Netzbezug);
|
||||
$Is_Peak_Shaving = false;
|
||||
$Ueberschussleistung = $this->ReadPropertyInteger(
|
||||
"Ueberschussleistung"
|
||||
);
|
||||
|
||||
// Dynamische ermittlung der Betriebsart
|
||||
if ($this->ReadPropertyBoolean("UmschaltpunktStatisch") == false) {
|
||||
// Fallunterscheidung ob auf Solarladen oder Peakshaving gerregelt wird.
|
||||
if ($Netzbezug < ($Peakleistung + $Ueberschussleistung) / 2) {
|
||||
$remainingPower = -1 * (-1 * $Ueberschussleistung + $Netzbezug);
|
||||
$Is_Peak_Shaving = false;
|
||||
} else {
|
||||
$remainingPower = $Peakleistung - $Netzbezug;
|
||||
$Is_Peak_Shaving = true;
|
||||
}
|
||||
elseif($Netzbezug>($this->ReadPropertyInteger("Umschalt_Peakshaving"))){
|
||||
|
||||
$remainingPower = $Peakleistung - $Netzbezug;
|
||||
$Is_Peak_Shaving = true;
|
||||
|
||||
}
|
||||
// Statische ermittlung der Betriebsart
|
||||
else {
|
||||
if (
|
||||
$Netzbezug < $this->ReadPropertyInteger("Umschalt_Solarladen")
|
||||
) {
|
||||
$remainingPower = -1 * (-1 * $Ueberschussleistung + $Netzbezug);
|
||||
$Is_Peak_Shaving = false;
|
||||
} elseif (
|
||||
$Netzbezug > $this->ReadPropertyInteger("Umschalt_Peakshaving")
|
||||
) {
|
||||
$remainingPower = $Peakleistung - $Netzbezug;
|
||||
$Is_Peak_Shaving = true;
|
||||
} elseif ($this->GetValue("Is_Peak_Shaving") == false) {
|
||||
$remainingPower = -1 * (-1 * $Ueberschussleistung + $Netzbezug);
|
||||
$Is_Peak_Shaving = false;
|
||||
} elseif ($this->GetValue("Is_Peak_Shaving") == true) {
|
||||
$remainingPower = $Peakleistung - $Netzbezug;
|
||||
$Is_Peak_Shaving = true;
|
||||
}
|
||||
elseif( $this->GetValue("Is_Peak_Shaving")==false){
|
||||
|
||||
$remainingPower = -1 * (-1 * $Ueberschussleistung + $Netzbezug);
|
||||
$Is_Peak_Shaving = false;
|
||||
|
||||
}
|
||||
elseif( $this->GetValue("Is_Peak_Shaving")==true){
|
||||
|
||||
$remainingPower = $Peakleistung - $Netzbezug;
|
||||
$Is_Peak_Shaving = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Aktuelle bereits verwendete Leistung auf die verbleibende Leistung als Offset summieren.
|
||||
$remainingPower += $totalAktuelle_Leistung;
|
||||
|
||||
IPS_LogMessage("Manag anfang", $remainingPower);
|
||||
|
||||
// Frage alle Energieverbraucher ab, was sie für Leistungen benötigen könnten
|
||||
foreach ($Verbraucher_Liste as $user) {
|
||||
if (IPS_InstanceExists($user["Verbraucher"])) {
|
||||
IPS_RequestAction($user["Verbraucher"],"GetCurrentData", $Is_Peak_Shaving);
|
||||
IPS_LogMessage("Manager", "aufgerufen getcurrentdata");
|
||||
|
||||
IPS_RequestAction(
|
||||
$user["Verbraucher"],
|
||||
"GetCurrentData",
|
||||
$Is_Peak_Shaving
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Abbrechen wenn es keine gefilterten User gibt
|
||||
|
||||
// Abbrechen wenn es keine Verbruacher gibt, die verfügbar sind
|
||||
if (empty($filteredVerbraucher)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Wenn nicht alle Benutzer Idle = true sind, oder sich der zustand von Is_Peak_shaving gerade verändert hat rufe SetAktuelle_Leistung mit Aktuelle_Leistung Werten auf, (alle Verbraucher behalten die aktuelle Leistung)
|
||||
if (!$allIdle || ($Is_Peak_Shaving != $this->GetValue("Is_Peak_Shaving"))) {
|
||||
if (
|
||||
!$allIdle ||
|
||||
$Is_Peak_Shaving != $this->GetValue("Is_Peak_Shaving")
|
||||
) {
|
||||
foreach ($filteredVerbraucher as $user) {
|
||||
IPS_RequestAction($user["InstanceID"],"SetAktuelle_Leistung",$user["Aktuelle_Leistung"]);
|
||||
IPS_LogMessage("Manager", "aufgerufen nicht alle idle");
|
||||
|
||||
IPS_RequestAction(
|
||||
$user["InstanceID"],
|
||||
"SetAktuelle_Leistung",
|
||||
$user["Aktuelle_Leistung"]
|
||||
);
|
||||
}
|
||||
$this->SetValue("Is_Peak_Shaving", $Is_Peak_Shaving);
|
||||
$this->SetValue("Is_Peak_Shaving", $Is_Peak_Shaving);
|
||||
|
||||
return;
|
||||
}
|
||||
$this->SetValue("Is_Peak_Shaving", $Is_Peak_Shaving);
|
||||
|
||||
$this->SetValue("Is_Peak_Shaving", $Is_Peak_Shaving);
|
||||
|
||||
// Sortiere die Verbruacher nach Priorität entweder der PV_Prio oder der Peak Prio
|
||||
usort($filteredVerbraucher, function ($a, $b) use (
|
||||
$Is_Peak_Shaving
|
||||
) {
|
||||
usort($filteredVerbraucher, function ($a, $b) use ($Is_Peak_Shaving) {
|
||||
$primaryKey = $Is_Peak_Shaving ? "Sperre_Prio" : "PV_Prio";
|
||||
// Wenn die Prio geleich ist, sortiere danach welcher verbraucher bisher am wenigsten Energie bekommen hat.
|
||||
// Wenn die Prio geleich ist, sortiere danach welcher verbraucher bisher am wenigsten Energie bekommen hat.
|
||||
if ($a[$primaryKey] == $b[$primaryKey]) {
|
||||
return round($a["Bezogene_Energie"]/2000) <=> round($b["Bezogene_Energie"]/2000);
|
||||
return round($a["Bezogene_Energie"] / 2000) <=>
|
||||
round($b["Bezogene_Energie"] / 2000);
|
||||
}
|
||||
return $a[$primaryKey] <=> $b[$primaryKey];
|
||||
});
|
||||
|
||||
// Primärschlüssel für die Priorität basierend auf dem Parameter auswählen (für sortierung in gruppen anschliessend)
|
||||
$priorityKey = $Is_Peak_Shaving ? "Sperre_Prio" : "PV_Prio";
|
||||
|
||||
// Schleife durch alle Prioritäten
|
||||
$priorities = array_unique(
|
||||
array_column($filteredVerbraucher, $priorityKey)
|
||||
@@ -280,6 +280,7 @@ class Manager extends IPSModule
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Jetzt werden die energien pro gruppe verteilt (Immer alle pro prio in einer gruppe miteinander)
|
||||
foreach ($groupedUsers as $priority => $users) {
|
||||
// Verbraucher mit gleicher Priorität sammeln
|
||||
@@ -295,124 +296,84 @@ class Manager extends IPSModule
|
||||
$withoutZeroHigh = [];
|
||||
$withoutZeroLow = [];
|
||||
|
||||
// Verbraucher die nicht 0 Annhemen können, bekommen einfach den tiefsten wert
|
||||
|
||||
|
||||
|
||||
|
||||
/* Alter Verteilalgor. zu testzwecken auskommentiert, wird dann gelöscht wenns funktioniert.
|
||||
foreach ($samePriorityUsers as $entry) {
|
||||
if (min($entry["PowerSteps"]) <= 0) {
|
||||
$withZero[] = $entry;
|
||||
} else {
|
||||
$withoutZero[] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
// Verbraucher die nicht 0 annhemen können erhalten nun den minimalwert
|
||||
if (!empty($withoutZero)) {
|
||||
foreach ($withoutZero as $entry) {
|
||||
$instanceID = $entry["InstanceID"];
|
||||
$minPowerStep = min($entry["PowerSteps"]);
|
||||
|
||||
IPS_RequestAction($instanceID,"SetAktuelle_Leistung",$minPowerStep);
|
||||
//$remainingPower -= $entry["Aktuelle_Leistung"];
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/* Neuer Block */
|
||||
// Sammle alle Verbraucher die nicht null als Verbruach annehmen können. (inkl. sortierung in positive und Negative)
|
||||
foreach ($samePriorityUsers as $entry) {
|
||||
$withZero[] = $entry;
|
||||
|
||||
if (min($entry["PowerSteps"]) > 0) {
|
||||
|
||||
$withoutZeroHigh[] = $entry;
|
||||
}
|
||||
if (max($entry["PowerSteps"]) < 0) {
|
||||
|
||||
$withoutZeroLow[] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
// Verbraucher die nicht 0 annhemen können erhalten nun den minimalwert
|
||||
|
||||
// positiven Verbrauchern die nicht 0 annhemen können bereits den minimalwert zuteilen
|
||||
if (!empty($withoutZeroHigh)) {
|
||||
foreach ($withoutZeroHigh as $entry) {
|
||||
$instanceID = $entry["InstanceID"];
|
||||
$minPowerStep = min($entry["PowerSteps"]);
|
||||
|
||||
//$remainingPower -= $minPowerStep;
|
||||
}
|
||||
}
|
||||
// Verbraucher die nicht 0 annhemen können erhalten nun den minimalwert
|
||||
// negativen Verbrauchern die nicht 0 annhemen können bereits den minimalwert zuteilen
|
||||
if (!empty($withoutZeroLow)) {
|
||||
foreach ($withoutZeroLow as $entry) {
|
||||
$instanceID = $entry["InstanceID"];
|
||||
$minPowerStep = max($entry["PowerSteps"]);
|
||||
|
||||
//$remainingPower += $minPowerStep;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Neuer Block Ende */
|
||||
|
||||
|
||||
|
||||
|
||||
// Nun die verteilen, die 0 erhalten können.
|
||||
// Nun die Verbrucher verteilen, die auch 0 erhalten können.
|
||||
$samePriorityUsers = $withZero;
|
||||
|
||||
// $userEnergyProv = [];
|
||||
// $userEnergyProv = array_fill_keys(array_column($samePriorityUsers, "InstanceID"), 0); // Initialisierung für jeden Benutzer auf 0 setzen
|
||||
|
||||
|
||||
$userEnergyProv = [];
|
||||
|
||||
foreach ($samePriorityUsers as $entry) {
|
||||
$instanceID = $entry["InstanceID"];
|
||||
// Schutz: falls PowerSteps nicht gesetzt oder kein Array ist
|
||||
$steps = (isset($entry["PowerSteps"]) && is_array($entry["PowerSteps"])) ? $entry["PowerSteps"] : [0];
|
||||
foreach ($samePriorityUsers as $entry) {
|
||||
$instanceID = $entry["InstanceID"];
|
||||
// Schutz: falls PowerSteps nicht gesetzt oder kein Array ist
|
||||
$steps =
|
||||
isset($entry["PowerSteps"]) &&
|
||||
is_array($entry["PowerSteps"])
|
||||
? $entry["PowerSteps"]
|
||||
: [0];
|
||||
|
||||
// Wenn 0 als möglicher Step vorhanden ist -> 0 setzen
|
||||
|
||||
$minStep = min($steps);
|
||||
$maxStep = max($steps);
|
||||
// Wenn 0 als möglicher Step vorhanden ist -> 0 setzen
|
||||
|
||||
if (in_array(0, $steps, true)) {
|
||||
$userEnergyProv[$instanceID] = 0;
|
||||
continue;
|
||||
} elseif ($minStep > 0) {
|
||||
// nur positive Schritte -> minimalen positiven Wert einsetzen
|
||||
$userEnergyProv[$instanceID] = $minStep;
|
||||
// entspricht deinem vorherigen Verhalten: remainingPower reduzieren
|
||||
$remainingPower -= $minStep;
|
||||
} elseif ($maxStep < 0) {
|
||||
// nur negative Schritte -> maximalen (am wenigsten negativen) Wert einsetzen
|
||||
$userEnergyProv[$instanceID] = $maxStep;
|
||||
// entspricht deinem vorherigen Verhalten: remainingPower erhöhen (maxStep ist negativ)
|
||||
$remainingPower += $maxStep;
|
||||
} else {
|
||||
// Mixed (positive & negative) aber kein 0 -> Fallback 0 (ändere wenn nötig)
|
||||
$userEnergyProv[$instanceID] = 0;
|
||||
}
|
||||
}
|
||||
$minStep = min($steps);
|
||||
$maxStep = max($steps);
|
||||
|
||||
if (in_array(0, $steps, true)) {
|
||||
$userEnergyProv[$instanceID] = 0;
|
||||
continue;
|
||||
} elseif ($minStep > 0) {
|
||||
// nur positive Schritte -> minimalen positiven Wert einsetzen
|
||||
$userEnergyProv[$instanceID] = $minStep;
|
||||
// entspricht deinem vorherigen Verhalten: remainingPower reduzieren
|
||||
$remainingPower -= $minStep;
|
||||
} elseif ($maxStep < 0) {
|
||||
// nur negative Schritte -> maximalen (am wenigsten negativen) Wert einsetzen
|
||||
$userEnergyProv[$instanceID] = $maxStep;
|
||||
// entspricht deinem vorherigen Verhalten: remainingPower erhöhen (maxStep ist negativ)
|
||||
$remainingPower += $maxStep;
|
||||
} else {
|
||||
// Mixed (positive & negative) aber kein 0 -> Fallback 0 (ändere wenn nötig)
|
||||
$userEnergyProv[$instanceID] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IPS_LogMessage("Manag", $remainingPower);
|
||||
|
||||
if($remainingPower>=0){
|
||||
// Beginne mit aktiver Verteilung
|
||||
if ($remainingPower >= 0) {
|
||||
// Alle Schritte der Benutzer in einem Array sammeln
|
||||
$allSteps = [];
|
||||
foreach ($samePriorityUsers as $user) {
|
||||
foreach ($user["PowerSteps"] as $step) {
|
||||
if($step>=0){
|
||||
$allSteps[] = [
|
||||
"user" => $user["InstanceID"],
|
||||
//"Leistung_Delta" => $user["Leistung_Delta"],
|
||||
"step" => $step,
|
||||
];}
|
||||
if ($step >= 0) {
|
||||
$allSteps[] = [
|
||||
"user" => $user["InstanceID"],
|
||||
//"Leistung_Delta" => $user["Leistung_Delta"],
|
||||
"step" => $step,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,41 +389,45 @@ foreach ($samePriorityUsers as $entry) {
|
||||
$powerstep = $entry["step"];
|
||||
|
||||
// Überprüfe, ob noch genügend verbleibende Energie für den nächsten Schritt vorhanden ist
|
||||
if ($remainingPower >= $powerstep - $userEnergyProv[$user]) { // oder bedingung testen
|
||||
if (
|
||||
$remainingPower >=
|
||||
$powerstep - $userEnergyProv[$user]
|
||||
) {
|
||||
// oder bedingung testen
|
||||
// Aktualisiere die verbleibende Energie und die bereitgestellte Energie für den Benutzer
|
||||
$remainingPower -= $powerstep - $userEnergyProv[$user];
|
||||
$userEnergyProv[$user] = $powerstep;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Prüfen, dass jeder User mindestens seinen minimalwert an Leistung bekommt
|
||||
foreach ($userEnergyProv as $userInstanceID => $leistung) {
|
||||
// 1. Innerhalb der Schleife: alle nicht-negativen Leistungen sammeln
|
||||
// Innerhalb der Schleife: alle nicht-negativen Leistungen sammeln
|
||||
$positiveValues = array_filter(
|
||||
array_column(
|
||||
$samePriorityUsers,
|
||||
'PowerSteps',
|
||||
'InstanceID'
|
||||
"PowerSteps",
|
||||
"InstanceID"
|
||||
)[$userInstanceID],
|
||||
function ($l) {
|
||||
return $l >= 0;
|
||||
}
|
||||
);
|
||||
// 2. Falls keine Werte ≥ 0 vorhanden sind, auf 0 zurückfallen
|
||||
// Falls keine Werte ≥ 0 vorhanden sind, auf 0 zurückfallen
|
||||
$fallbackMinimum = empty($positiveValues)
|
||||
? max( array_column(
|
||||
$samePriorityUsers,
|
||||
'PowerSteps',
|
||||
'InstanceID'
|
||||
)[$userInstanceID])
|
||||
? max(
|
||||
array_column(
|
||||
$samePriorityUsers,
|
||||
"PowerSteps",
|
||||
"InstanceID"
|
||||
)[$userInstanceID]
|
||||
)
|
||||
: min($positiveValues);
|
||||
|
||||
// 3. minimalleistung = dieser Fallback
|
||||
// minimalleistung = dieser Fallback
|
||||
$minimalleistung = $fallbackMinimum;
|
||||
|
||||
// 4. den höheren Wert wählen und für IPS negativieren
|
||||
//$schreibleistung = max($leistung, $minimalleistung);
|
||||
//den höheren Wert wählen und für IPS negativieren
|
||||
|
||||
if (abs($leistung) > abs($minimalleistung)) {
|
||||
$schreibleistung = $leistung;
|
||||
@@ -470,31 +435,26 @@ foreach ($samePriorityUsers as $entry) {
|
||||
$schreibleistung = $minimalleistung;
|
||||
}
|
||||
|
||||
// 5. Aktion ausführen
|
||||
// Die Veteilten Leistungen auf die Verbruacher schreiben
|
||||
if (IPS_InstanceExists($userInstanceID)) {
|
||||
IPS_RequestAction(
|
||||
$userInstanceID,
|
||||
"SetAktuelle_Leistung",
|
||||
$schreibleistung
|
||||
);
|
||||
IPS_LogMessage(
|
||||
"Manager",
|
||||
"aufgerufen setleistung (Berechnung in foreach): " . $schreibleistung
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
// Alle Schritte der Benutzer in einem Array sammeln
|
||||
} else {
|
||||
// Alle Schritte der Benutzer in einem Array sammeln
|
||||
$allSteps = [];
|
||||
foreach ($samePriorityUsers as $user) {
|
||||
foreach ($user["PowerSteps"] as $step) {
|
||||
if($step<=0){
|
||||
$allSteps[] = [
|
||||
"user" => $user["InstanceID"],
|
||||
//"Leistung_Delta" => $user["Leistung_Delta"],
|
||||
"step" => -1*$step,
|
||||
];}
|
||||
if ($step <= 0) {
|
||||
$allSteps[] = [
|
||||
"user" => $user["InstanceID"],
|
||||
"step" => -1 * $step,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,78 +463,71 @@ foreach ($samePriorityUsers as $entry) {
|
||||
return $a["step"] <=> $b["step"];
|
||||
});
|
||||
|
||||
$remainingPower = $remainingPower *-1;
|
||||
$remainingPower = $remainingPower * -1;
|
||||
// Iteriere durch alle Schritte
|
||||
foreach ($allSteps as $entry) {
|
||||
$user = $entry["user"];
|
||||
$powerstep = $entry["step"];
|
||||
|
||||
// Überprüfe, ob noch genügend verbleibende Energie für den nächsten Schritt vorhanden ist
|
||||
if ($remainingPower >= $powerstep - $userEnergyProv[$user]) { // oder bedingung testen
|
||||
if (
|
||||
$remainingPower >=
|
||||
$powerstep - $userEnergyProv[$user]
|
||||
) {
|
||||
// oder bedingung testen
|
||||
// Aktualisiere die verbleibende Energie und die bereitgestellte Energie für den Benutzer
|
||||
$remainingPower -= $powerstep - $userEnergyProv[$user];
|
||||
$userEnergyProv[$user] = $powerstep;
|
||||
}
|
||||
|
||||
}
|
||||
$remainingPower = $remainingPower *-1;
|
||||
|
||||
$remainingPower = $remainingPower * -1;
|
||||
|
||||
// Prüfen, dass jeder User mindestens seinen minimalwert an Leistung bekommt
|
||||
foreach ($userEnergyProv as $userInstanceID => $leistung) {
|
||||
// 1. Innerhalb der Schleife: alle nicht-negativen Leistungen sammeln
|
||||
foreach ($userEnergyProv as $userInstanceID => $leistung) {
|
||||
// Innerhalb der Schleife: alle nicht-negativen Leistungen sammeln
|
||||
$positiveValues = array_filter(
|
||||
array_column(
|
||||
$samePriorityUsers,
|
||||
'PowerSteps',
|
||||
'InstanceID'
|
||||
"PowerSteps",
|
||||
"InstanceID"
|
||||
)[$userInstanceID],
|
||||
function ($l) {
|
||||
return $l <= 0;
|
||||
}
|
||||
);
|
||||
// 2. Falls keine Werte ≥ 0 vorhanden sind, auf 0 zurückfallen
|
||||
// Falls keine Werte ≥ 0 vorhanden sind, auf 0 zurückfallen
|
||||
$fallbackMinimum = empty($positiveValues)
|
||||
? min( array_column(
|
||||
$samePriorityUsers,
|
||||
'PowerSteps',
|
||||
'InstanceID'
|
||||
)[$userInstanceID])
|
||||
? min(
|
||||
array_column(
|
||||
$samePriorityUsers,
|
||||
"PowerSteps",
|
||||
"InstanceID"
|
||||
)[$userInstanceID]
|
||||
)
|
||||
: max($positiveValues);
|
||||
|
||||
// 3. minimalleistung = dieser Fallback
|
||||
// minimalleistung = dieser Fallback
|
||||
$minimalleistung = $fallbackMinimum;
|
||||
|
||||
// 4. den höheren Wert wählen und für IPS negativieren
|
||||
//$schreibleistung = max($leistung, $minimalleistung);
|
||||
// den höheren Wert wählen und negieren
|
||||
|
||||
if (abs($leistung) > abs($minimalleistung)) {
|
||||
$schreibleistung = $leistung*-1;
|
||||
$schreibleistung = $leistung * -1;
|
||||
} else {
|
||||
$schreibleistung = $minimalleistung;
|
||||
}
|
||||
|
||||
// 5. Aktion ausführen
|
||||
// Die Veteilten Leistungen auf die Verbruacher schreiben
|
||||
if (IPS_InstanceExists($userInstanceID)) {
|
||||
IPS_RequestAction(
|
||||
$userInstanceID,
|
||||
"SetAktuelle_Leistung",
|
||||
$schreibleistung
|
||||
);
|
||||
IPS_LogMessage(
|
||||
"Manager",
|
||||
"aufgerufen setleistung (Berechnung in foreach): " . $schreibleistung
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function DistributeEnergy_Extern()
|
||||
@@ -582,21 +535,38 @@ foreach ($samePriorityUsers as $entry) {
|
||||
// Systemvariablen abrufen
|
||||
$Netzbezug = GetValue($this->ReadPropertyInteger("Netzbezug"));
|
||||
|
||||
|
||||
$Verbraucher_Liste = json_decode($this->ReadPropertyString("Verbraucher_Liste"), true);
|
||||
$filteredVerbraucher = [];
|
||||
$Verbraucher_Liste = json_decode(
|
||||
$this->ReadPropertyString("Verbraucher_Liste"),
|
||||
true
|
||||
);
|
||||
$filteredVerbraucher = [];
|
||||
// Fülle das Array mit allen entsprechenden Werten der Verbraucher ab
|
||||
foreach ($Verbraucher_Liste as $user) {
|
||||
|
||||
|
||||
// Werte direkt von der Verbraucher-Instanz abrufen
|
||||
$Aktuelle_Leistung = GetValue(IPS_GetObjectIDByIdent("Aktuelle_Leistung", $user["Verbraucher"]));
|
||||
$Bezogene_Energie = GetValue(IPS_GetObjectIDByIdent("Bezogene_Energie", $user["Verbraucher"]));
|
||||
$PV_Prio = GetValue(IPS_GetObjectIDByIdent("PV_Prio", $user["Verbraucher"]));
|
||||
$Sperre_Prio = GetValue(IPS_GetObjectIDByIdent("Sperre_Prio", $user["Verbraucher"]));
|
||||
$idle = GetValue(IPS_GetObjectIDByIdent("Idle", $user["Verbraucher"]));
|
||||
$powerStepsJson = GetValue(IPS_GetObjectIDByIdent("PowerSteps", $user["Verbraucher"]));
|
||||
$delta = GetValue(IPS_GetObjectIDByIdent("Leistung_Delta", $user["Verbraucher"]));
|
||||
$Aktuelle_Leistung = GetValue(
|
||||
IPS_GetObjectIDByIdent(
|
||||
"Aktuelle_Leistung",
|
||||
$user["Verbraucher"]
|
||||
)
|
||||
);
|
||||
$Bezogene_Energie = GetValue(
|
||||
IPS_GetObjectIDByIdent("Bezogene_Energie", $user["Verbraucher"])
|
||||
);
|
||||
$PV_Prio = GetValue(
|
||||
IPS_GetObjectIDByIdent("PV_Prio", $user["Verbraucher"])
|
||||
);
|
||||
$Sperre_Prio = GetValue(
|
||||
IPS_GetObjectIDByIdent("Sperre_Prio", $user["Verbraucher"])
|
||||
);
|
||||
$idle = GetValue(
|
||||
IPS_GetObjectIDByIdent("Idle", $user["Verbraucher"])
|
||||
);
|
||||
$powerStepsJson = GetValue(
|
||||
IPS_GetObjectIDByIdent("PowerSteps", $user["Verbraucher"])
|
||||
);
|
||||
$delta = GetValue(
|
||||
IPS_GetObjectIDByIdent("Leistung_Delta", $user["Verbraucher"])
|
||||
);
|
||||
$powerSteps = json_decode($powerStepsJson, true);
|
||||
|
||||
// Verbraucher-Daten zum gefilterten Array hinzufügen
|
||||
@@ -610,38 +580,41 @@ foreach ($samePriorityUsers as $entry) {
|
||||
"Idle" => $idle,
|
||||
"PowerSteps" => $powerSteps,
|
||||
"Leistung_Delta" => $delta,
|
||||
"ParentManager" => $this->ReadPropertyInteger("ManagerID")
|
||||
|
||||
"ParentManager" => $this->ReadPropertyInteger("ManagerID"),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
$sendarray = [];
|
||||
|
||||
$sendarray = [
|
||||
"User" => $filteredVerbraucher,
|
||||
"User" => $filteredVerbraucher,
|
||||
"Netzbezug" => $Netzbezug,
|
||||
"Timestamp" => time()
|
||||
|
||||
"Timestamp" => time(),
|
||||
];
|
||||
|
||||
SetValue($this->ReadPropertyInteger("DatenHoch"), json_encode($sendarray));
|
||||
SetValue(
|
||||
$this->ReadPropertyInteger("DatenHoch"),
|
||||
json_encode($sendarray)
|
||||
);
|
||||
|
||||
$answerArray = json_decode(GetValue($this->ReadPropertyInteger("DatenZuruck")), true);
|
||||
|
||||
foreach($answerArray["User"] as $user){
|
||||
IPS_RequestAction($user["InstanceID"],"GetCurrentData", $answerArray["Is_Peak_Shaving"]);
|
||||
|
||||
IPS_RequestAction($user["InstanceID"],"SetAktuelle_Leistung",$user["Set_Leistung"]);
|
||||
$answerArray = json_decode(
|
||||
GetValue($this->ReadPropertyInteger("DatenZuruck")),
|
||||
true
|
||||
);
|
||||
|
||||
foreach ($answerArray["User"] as $user) {
|
||||
IPS_RequestAction(
|
||||
$user["InstanceID"],
|
||||
"GetCurrentData",
|
||||
$answerArray["Is_Peak_Shaving"]
|
||||
);
|
||||
|
||||
IPS_RequestAction(
|
||||
$user["InstanceID"],
|
||||
"SetAktuelle_Leistung",
|
||||
$user["Set_Leistung"]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
html, body { margin: 0; padding: 8px; background: transparent; font-family: sans-serif; color: #ffffff; }
|
||||
.bar-block { margin-bottom: 20px; }
|
||||
.bar-title { font-size: 1.2em; font-weight: bold; margin-bottom: 6px; }
|
||||
.bar-container { width: 100%; background: #ddd; border-radius: 4px; overflow: hidden; height: 24px; position: relative; }
|
||||
.bar { height: 100%; float: left; position: relative; }
|
||||
.bar span { position: absolute; width: 100%; text-align: center; line-height: 24px; font-size: 0.8em; color: #fff; }
|
||||
.bar-cons { background: #4CAF50; }
|
||||
.bar-feed { background: #8BC34A; }
|
||||
.bar-pv { background: #FF9800; }
|
||||
.bar-grid { background: #FF5722; }
|
||||
.value-text { font-size: 0.95em; margin-top: 4px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="pv_visu">
|
||||
<div class="bar-block">
|
||||
<div class="bar-title">Produktion (Eigenverbrauch / Einspeisung)</div>
|
||||
<div class="bar-container">
|
||||
<div class="bar bar-cons" id="barCons"><span id="barConsText"></span></div>
|
||||
<div class="bar bar-feed" id="barFeed"><span id="barFeedText"></span></div>
|
||||
</div>
|
||||
<div class="value-text" id="prodValues"></div>
|
||||
</div>
|
||||
<div class="bar-block">
|
||||
<div class="bar-title">Verbrauch (PV / Netz)</div>
|
||||
<div class="bar-container">
|
||||
<div class="bar bar-pv" id="barPV"><span id="barPVText"></span></div>
|
||||
<div class="bar bar-grid" id="barGrid"><span id="barGridText"></span></div>
|
||||
</div>
|
||||
<div class="value-text" id="consValues"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function Apply(data) {
|
||||
document.getElementById('barCons').style.width = data.prodCons + '%';
|
||||
document.getElementById('barFeed').style.width = data.prodFeed + '%';
|
||||
document.getElementById('barPV').style.width = data.consPV + '%';
|
||||
document.getElementById('barGrid').style.width = data.consGrid + '%';
|
||||
|
||||
document.getElementById('barConsText').innerText = data.prodCons + '%';
|
||||
document.getElementById('barFeedText').innerText = data.prodFeed + '%';
|
||||
document.getElementById('barPVText').innerText = data.consPV + '%';
|
||||
document.getElementById('barGridText').innerText = data.consGrid + '%';
|
||||
|
||||
document.getElementById('prodValues').innerText =
|
||||
'Gesamt: ' + data.value.prod + ' kWh, Eigenverbrauch: ' + (data.consPV/100*data.value.cons).toFixed(2) + ' kWh, Einspeisung: ' + data.value.feed + ' kWh';
|
||||
document.getElementById('consValues').innerText =
|
||||
'Gesamt: ' + data.value.cons + ' kWh, PV-Anteil: ' + (data.consPV/100*data.value.cons).toFixed(2) + ' kWh, Netz: ' + data.value.grid + ' kWh';
|
||||
}
|
||||
|
||||
function handleMessage(msg) {
|
||||
try {
|
||||
const data = typeof msg === 'string' ? JSON.parse(msg) : msg;
|
||||
Apply(data);
|
||||
} catch (e) {
|
||||
console.error('Fehler beim Verarbeiten der Daten:', e, msg);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof registerMessageHandler === 'function') {
|
||||
registerMessageHandler(handleMessage);
|
||||
}
|
||||
|
||||
// Live-Aktualisierung alle 30 Sekunden
|
||||
function pollData() {
|
||||
if (typeof IPS !== 'undefined') {
|
||||
IPS.RequestAction('update', '');
|
||||
}
|
||||
}
|
||||
setInterval(pollData, 30000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,99 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PV_Visu extends IPSModule
|
||||
{
|
||||
public function Create()
|
||||
{
|
||||
parent::Create();
|
||||
|
||||
$this->RegisterPropertyInteger('VarProduction', 0);
|
||||
$this->RegisterPropertyInteger('VarConsumption', 0);
|
||||
$this->RegisterPropertyInteger('VarFeedIn', 0);
|
||||
$this->RegisterPropertyInteger('VarGrid', 0);
|
||||
|
||||
$this->RegisterVariableString('JSONData', 'Visualisierungsdaten', '', 0);
|
||||
IPS_SetHidden($this->GetIDForIdent('JSONData'), true);
|
||||
|
||||
$this->SetVisualizationType(1); // HTML SDK Tile
|
||||
}
|
||||
|
||||
public function ApplyChanges()
|
||||
{
|
||||
parent::ApplyChanges();
|
||||
|
||||
foreach (['VarProduction', 'VarConsumption', 'VarFeedIn', 'VarGrid'] as $prop) {
|
||||
$vid = $this->ReadPropertyInteger($prop);
|
||||
if ($vid > 0) {
|
||||
$this->RegisterMessage($vid, VM_UPDATE);
|
||||
}
|
||||
}
|
||||
|
||||
$this->UpdateData(); // Initial
|
||||
}
|
||||
|
||||
public function MessageSink($TimeStamp, $SenderID, $Message, $Data)
|
||||
{
|
||||
if ($Message === VM_UPDATE) {
|
||||
$this->UpdateData();
|
||||
}
|
||||
}
|
||||
|
||||
public function GetVisualizationTile()
|
||||
{
|
||||
$initialData = '<script>handleMessage(' . json_encode($this->UpdateData()) . ');</script>';
|
||||
$html = file_get_contents(__DIR__ . '/module.html');
|
||||
return $html . $initialData;
|
||||
}
|
||||
|
||||
public function RequestAction($Ident, $Value)
|
||||
{
|
||||
if ($Ident === 'update') {
|
||||
return $this->UpdateData(); // Rückgabe für Visualisierung
|
||||
}
|
||||
throw new \Exception("Unknown Ident: $Ident");
|
||||
}
|
||||
|
||||
public function UpdateData()
|
||||
{
|
||||
$start = strtotime('today 00:00');
|
||||
$end = time();
|
||||
|
||||
$prod = $this->GetDailyTotal($this->ReadPropertyInteger('VarProduction'), $start, $end);
|
||||
$cons = $this->GetDailyTotal($this->ReadPropertyInteger('VarConsumption'), $start, $end);
|
||||
$feed = $this->GetDailyTotal($this->ReadPropertyInteger('VarFeedIn'), $start, $end);
|
||||
$grid = $this->GetDailyTotal($this->ReadPropertyInteger('VarGrid'), $start, $end);
|
||||
|
||||
$prodCons = $prod > 0 ? (($cons - $grid) / $prod) * 100 : 0;
|
||||
$prodFeed = $prod > 0 ? 100 - $prodCons : 0;
|
||||
$consPV = $cons > 0 ? min($prod, ($cons - $grid)) / $cons * 100 : 0;
|
||||
$consGrid = $cons > 0 ? 100 - $consPV : 0;
|
||||
|
||||
$data = [
|
||||
'prodCons' => round($prodCons, 1),
|
||||
'prodFeed' => round($prodFeed, 1),
|
||||
'consPV' => round($consPV, 1),
|
||||
'consGrid' => round($consGrid, 1),
|
||||
'value' => [
|
||||
'prod' => round($prod, 2),
|
||||
'cons' => round($cons, 2),
|
||||
'feed' => round($feed, 2),
|
||||
'grid' => round($grid, 2),
|
||||
],
|
||||
];
|
||||
|
||||
$json = json_encode($data);
|
||||
SetValueString($this->GetIDForIdent('JSONData'), $json);
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function GetDailyTotal(int $varID, int $start, int $end)
|
||||
{
|
||||
if ($varID <= 0) return 0.0;
|
||||
|
||||
$archiveID = @IPS_GetInstanceListByModuleID('{43192F0B-135B-4CE7-A0A7-1475603F3060}')[0];
|
||||
if (!$archiveID) return 0.0;
|
||||
|
||||
$values = @AC_GetAggregatedValues($archiveID, $varID, 1, $start, $end, 1);
|
||||
return isset($values[0]['Avg']) ? (float)$values[0]['Avg'] : 0.0;
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
# PV_Visu
|
||||
|
||||
Visualisierung des Eigenverbrauchs: Tages-Quoten für PV-Produktion vs. Einspeisung und Verbrauch vs. Netz-Bezug.
|
||||
|
||||
## Inhaltsverzeichnis
|
||||
|
||||
1. [Funktionsumfang](#funktionsumfang)
|
||||
2. [Voraussetzungen](#voraussetzungen)
|
||||
3. [Installation](#installation)
|
||||
4. [Instanz einrichten](#instanz-einrichten)
|
||||
5. [WebFront](#webfront)
|
||||
6. [PHP-Befehlsreferenz](#php-befehlsreferenz)
|
||||
|
||||
## Funktionsumfang
|
||||
|
||||
- Anzeige von Tages-Quoten (%)
|
||||
- Produktion: Eigenverbrauch vs. Einspeisung
|
||||
- Verbrauch: PV-Anteil vs. Netz-Anteil
|
||||
- Zwei Balkendiagramme
|
||||
- Absolute Tages-Summen (kWh)
|
||||
|
||||
## Voraussetzungen
|
||||
|
||||
- IP-Symcon ≥ 7.1
|
||||
- Archiv-Modul aktiviert
|
||||
- Vier kWh-Zähler-Variablen
|
||||
|
||||
## Installation
|
||||
|
||||
1. **Module Store** → Suche nach „PV_Visu“ und installieren
|
||||
2. **Alternativ**: Unter Module → Repositories folgende URL hinzufügen:
|
||||
```
|
||||
https://github.com/DeinRepo/PV_Visu.git
|
||||
```
|
||||
und Modul neu einlesen.
|
||||
|
||||
## Instanz einrichten
|
||||
|
||||
- **Instanz hinzufügen** → Filter: „PV_Visu“
|
||||
- Variablen zuweisen:
|
||||
|
||||
| Property | Beschreibung |
|
||||
| -------------- | -------------------------- |
|
||||
| VarProduction | PV-Produktionszähler (kWh) |
|
||||
| VarConsumption | Gesamtverbrauch (kWh) |
|
||||
| VarFeedIn | Einspeisung (kWh) |
|
||||
| VarGrid | Netz-Bezug (kWh) |
|
||||
|
||||
## WebFront
|
||||
|
||||
- **Tile-Typ:** PV_Visu
|
||||
- Balken 1 (Grün): Produktion
|
||||
- Balken 2 (Orange/Rot): Verbrauch
|
||||
|
||||
## PHP-Befehlsreferenz
|
||||
|
||||
```php
|
||||
IPS_RequestAction($InstanceID, 'update', true);
|
||||
```
|
||||
@@ -1,6 +1,6 @@
|
||||
# Symcon Belevo Energiemanagement Modul
|
||||
# Enelix
|
||||
|
||||
Dieses Modul implementiert das neuartige Energiemanagementsystem der Belevo AG in IP-Symcon.
|
||||
Diese Modulbibliothek implementiert das Energiemanagementsystem der Belevo AG (Enelix) in IP-Symcon.
|
||||
Es verteilt elektrische Leistung auf mehrere Verbraucher (z. B. Elektroauto-Ladestationen, Boiler, Speicher) dynamisch nach Priorität und Fairness. Unterstützt werden:
|
||||
|
||||
- **Einzelhaus-Anschlüsse**
|
||||
@@ -32,69 +32,15 @@ Es verteilt elektrische Leistung auf mehrere Verbraucher (z. B. Elektroauto-Lade
|
||||
|
||||
1. In IP-Symcon **Module Control** öffnen
|
||||
2. **Hinzufügen → Git-Repository**
|
||||
3. URL eintragen: https://git.belevo.ch/dh/Symcon_Belevo_Energiemanagement_testing.git
|
||||
4. Modul installieren und IP-Symcon neu starten
|
||||
3. URL eintragen: https://git.belevo.ch/dh/Enelix.git
|
||||
4. Modul installieren
|
||||
5. Ein Managermodul sowie die gewünschen Verbrauchermodule erstellen und konfigurieren.
|
||||
|
||||
---
|
||||
|
||||
## 1. Manager-Instanz anlegen
|
||||
## 1 Funktionsweise
|
||||
|
||||
1. Rechtsklick auf **Instanzen** → **Instanz hinzufügen**
|
||||
2. Filter: **Belevo**
|
||||
3. **„Manager“** auswählen und Instanz erstellen
|
||||
|
||||
### Manager-Eigenschaften
|
||||
|
||||
| Property | Typ | Beschreibung |
|
||||
|------------------------------------|-----------------|------------------------------------------------------------------------------|
|
||||
| **Zeit_Zwischen_Zustandswechseln** | Integer (Sek.) | Dauer zwischen zwei Zyklen (Default: 5 s) |
|
||||
| **Interval** | Integer (Sek.) | Haupt-Timerintervall zur Neuberechnung |
|
||||
| **Sollleistung_Max** | Float (Watt) | Maximale erlaubte Gesamtleistung am Netzanschluss |
|
||||
| **Ueberschussleistung** | Float (Watt) | Untergrenze für Solarlade-Mode (z. B. 0 W) |
|
||||
| **HauptmanagerAktiv** | Boolean | Schaltet die gesamte Manager-Logik ein/aus |
|
||||
| **Verbraucher_Liste** | InstanceList | Liste aller Verbraucher-Instanzen, die der Manager steuern soll |
|
||||
|
||||
### Manager-Statusvariablen
|
||||
|
||||
| Ident | Typ | Beschreibung |
|
||||
|-------------------------|-----------|------------------------------------------------------------------------------|
|
||||
| **Is_Peak_Shaving** | Boolean | `true` = Peak-Shaving-Mode; `false` = Solarlade-Mode |
|
||||
| **LetzteBerechnung** | DateTime | Zeitstempel der letzten Ausführung |
|
||||
| **Aktuelle_Differenz** | Float (W) | Zuletzt berechnete Soll–Ist-Differenz |
|
||||
|
||||
---
|
||||
|
||||
## 2. Verbraucher-Instanzen anlegen
|
||||
|
||||
Für jedes zu steuernde Gerät:
|
||||
|
||||
1. Rechtsklick auf **Instanzen** → **Instanz hinzufügen**
|
||||
2. Filter: **Belevo**
|
||||
3. **„Belevo EMS Verbraucher“** auswählen und Instanz erstellen
|
||||
|
||||
### Verbraucher-Eigenschaften
|
||||
|
||||
| Property | Typ | Beschreibung |
|
||||
|-----------------|------------|----------------------------------------------------------------------------|
|
||||
| **PV_Prio** | Integer | Priorität im Solarlade-Mode (niedriger = höhere Priorität) |
|
||||
| **Sperre_Prio** | Integer | Priorität im Peak-Shaving-Mode (niedriger = höhere Priorität) |
|
||||
| **PowerSteps** | String | JSON-Array möglicher Leistungsstufen in Watt, z. B. `[0,1000,2000]` |
|
||||
|
||||
### Automatisch angelegte Variablen
|
||||
|
||||
| Ident | Typ | Profil | Beschreibung |
|
||||
|----------------------|----------|--------------|-----------------------------------------------------------------------|
|
||||
| **Power** | Float | ~Watt~~W~ | Aktuell angeforderte Leistung (W) |
|
||||
| **Aktuelle_Leistung**| Float | ~Watt~~W~ | Vom Manager zugewiesene Leistung im aktuellen Zyklus (W) |
|
||||
| **Bezogene_Energie** | Float | Wh | Kumulierte Energieabnahme seit Zyklusstart (Wh) |
|
||||
| **Leistung_Delta** | Float | ~Watt~~W~ | Differenz zwischen `Power` und `Aktuelle_Leistung` (W) |
|
||||
| **Idle** | Boolean | — | `true`, wenn Verbraucher gerade keine Änderung benötigt |
|
||||
|
||||
---
|
||||
|
||||
## 3. Funktionsweise
|
||||
|
||||
### 3.1 Mode-Entscheid
|
||||
### 1.1 Mode-Entscheid
|
||||
|
||||
- In jedem Zyklus liest der Manager den **aktuellen Ist-Netzanschlusswert** (Summe aller `Aktuelle_Leistung`).
|
||||
- Er berechnet den **Schwellwert** als
|
||||
@@ -106,13 +52,13 @@ Bearbeiten
|
||||
- Ist der Ist-Wert **> Threshold**, setzt er **Peak-Shaving** (`Is_Peak_Shaving = true`), sonst **Solarladen** (`false`).
|
||||
- Diese Boolean teilt er allen Verbrauchern mit, damit sie ihre `PowerSteps`-Arrays entsprechend vorbereiten.
|
||||
|
||||
### 3.2 Soll–Ist-Berechnung
|
||||
### 1.2 Soll–Ist-Berechnung
|
||||
|
||||
- Differenz **D** = `Sollleistung_Max` − Ist-Wert
|
||||
- **D > 0**: Bedarf → Solarlade-Zuteilung
|
||||
- **D < 0**: Überschuss → Peak-Shaving-Reduktion
|
||||
|
||||
### 3.3 Leistungszuweisung
|
||||
### 1.3 Leistungszuweisung
|
||||
|
||||
- Für jeden Verbraucher wählt der Manager die **höchste** Stufe aus `PowerSteps`, die die verbleibende Differenz \|D\| **nicht überschreitet**.
|
||||
- Er durchläuft die Verbraucher nacheinander (Round-Robin), bis \|D\| annähernd erschöpft ist.
|
||||
@@ -192,18 +138,6 @@ Bearbeiten
|
||||
Durch dieses Verfahren – Aufaddierung der bereits verteilten Leistungen, Sortierung nach Priorität und Fairness sowie sukzessive Abarbeitung der Stufen-Arrays – wird die **Gesamtleistung optimal und gerecht** auf alle Verbraucher verteilt.
|
||||
|
||||
|
||||
## Für das oben beschriebene Verteilverfahren ist ein Patentanmeldeverfahren für den Europäischen Raum im Gange (25207583.3 - 1002)
|
||||
## Anmelder/Patentinhaber ist die Belevo AG
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 4. Registrierung der Verbraucher
|
||||
|
||||
- **Aktuell müssen alle Verbraucher manuell** in `Verbraucher_Liste` eingetragen werden.
|
||||
- **Zukünftige Versionen** werden eine automatische Geräteerkennung unterstützen, so dass neue Verbraucher ohne Konfigurationsaufwand hinzukommen können.
|
||||
|
||||
---
|
||||
|
||||
## 5. Support & Entwicklung
|
||||
|
||||
- **Issues & Feature-Requests** bitte im Git-Repository eröffnen.
|
||||
- **Entwickler**: Belevo AG
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
2. Starte IP-Symcon neu bzw. klicke in der Konsole auf „Module aktualisieren“.
|
||||
|
||||
Anschließend erscheint in der Instanzliste der neue Gerätetyp **Sofar Wechselrichter**.
|
||||
|
||||
---
|
||||
|
||||
## Konfiguration
|
||||
|
||||
1. **Instanz anlegen**
|
||||
- Gehe in der IPS-Konsole auf „Instanzen hinzufügen“ → Hersteller: (falls sichtbar) → Modul: **Sofar Wechselrichter**.
|
||||
- Vergib einen sinnvollen Namen und eine Beschreibung.
|
||||
|
||||
2. **Einstellungen in den Eigenschaften**
|
||||
- **Logger-Seriennummer**:
|
||||
Gib hier die „Logger-Nummer“ deines Sofar-Wechselrichters ein (Dezimal).
|
||||
- **Abfragezyklus (Sekunden)**:
|
||||
Intervall in Sekunden, in dem zyklisch alle eingetragenen Register abgefragt werden.
|
||||
Ein Wert von `0` deaktiviert den Timer (keine zyklischen Abfragen).
|
||||
- **Register-Tabelle**:
|
||||
Hier definierst du beliebig viele Zeilen, jeweils mit:
|
||||
1. **Register-Nummer** (dezimal)
|
||||
2. **Bezeichnung** (z. B. „Gesamtproduktion“ oder „Spannung Phase L1“)
|
||||
3. **Skalierungs-faktor** (z. B. `0.1`, `1`, `10` usw.)
|
||||
|
||||
Wird beispielsweise für Register `1476` als Bezeichnung „Gesamtproduktion“ mit Skalierungsfaktor `1` eingetragen,
|
||||
so liest das Modul alle 60 Sekunden (oder den von dir gewählten Zyklus) Register 1476,
|
||||
multipliziert das rohe UINT16-Ergebnis mit `1` und legt den Wert in einer IPS-Variable an.
|
||||
|
||||
3. **Speichern/Übernehmen**
|
||||
Klicke auf „Übernehmen“, um die Änderungen zu übernehmen.
|
||||
Das Modul legt automatisch untergeordnete IPS-Variablen an:
|
||||
|
||||
- **Vorheriger Wert (Register 1160)**
|
||||
→ INT16BE, unverändert (analog zur alten Node-RED-Logik).
|
||||
Diese Variable heißt intern `Vorheriger Wert` und wird automatisch gepflegt.
|
||||
- **Alle weiteren Einträge aus der Register-Tabelle**
|
||||
→ Für jede Zeile wird eine Float-Variable mit der von dir angegebenen „Bezeichnung“ angelegt.
|
||||
Der Variablen-Identifier lautet automatisch `Reg<Registernummer>` (z. B. `Reg1476`).
|
||||
|
||||
---
|
||||
|
||||
## Funktionsweise
|
||||
|
||||
1. **Initialisierung (ApplyChanges)**
|
||||
- Liest den Abfragezyklus aus den Moduleigenschaften und initialisiert den Timer.
|
||||
- Legt eine Integer-Variable `Vorheriger Wert` (Reg 1160) an.
|
||||
- Legt für jede Zeile in der Register-Tabelle eine Float-Variable an (Ident `Reg<Nummer>`).
|
||||
|
||||
2. **Zyklische Abfrage (Timer-Callback)**
|
||||
- **Register 1160 (INT16BE)**
|
||||
→ Wird als „Vorheriger Wert“ in die Variable geschrieben (signed interpretiert).
|
||||
- **Alle weiteren Register aus der Tabelle**
|
||||
→ Jedes Register wird per Modbus-ähnlichem TCP-Paketaustausch abgefragt, als UINT16 ausgelesen,
|
||||
mit dem angegebenen Skalierungsfaktor multipliziert und in der zugehörigen Float-Variable gespeichert.
|
||||
|
||||
3. **Kommunikation**
|
||||
- TCP-Verbindung zu `192.168.0.0:8899` (feste IP im Code).
|
||||
- Der Aufruf von `readRegister()` baut ein „Out_Frame“ wie in Node-RED,
|
||||
rechnet CRC16-Modbus über die letzten 6 Bytes, hängt eine Summen-Checksum + 0x15 an,
|
||||
sendet das Paket, liest die Antwort, schneidet exakt 2 Daten-Bytes heraus und liefert sie zurück.
|
||||
|
||||
---
|
||||
|
||||
## Beispiel: Register 1476 („Gesamtproduktion“)
|
||||
|
||||
- **Register-Tabelle**
|
||||
| Register‐Nummer | Bezeichnung | Skalierungsfaktor |
|
||||
| --------------: | :------------------ | ----------------: |
|
||||
| 1476 | Gesamtproduktion | 1 |
|
||||
|
||||
- **Ergebnis**
|
||||
- Eine Float-Variable mit der Bezeichnung „Gesamtproduktion“ wird angelegt.
|
||||
- Wenn der PollInterval auf `60` Sekunden steht, liest das Modul alle 60 Sekunden das Register 1476,
|
||||
skaliert mit 1 und schreibt den numerischen Wert in `Reg1476`.
|
||||
|
||||
---
|
||||
|
||||
## Fehlersuche
|
||||
|
||||
- Falls die Variable „Vorheriger Wert“ immer denselben Wert liefert oder ein Lesefehler auftritt, prüfe bitte:
|
||||
1. **Logger-Nummer**: Ist sie korrekt (Dezimal)?
|
||||
2. **Netzwerk/Firewall**: Kann Symcon die Adresse `192.168.0.100:8899` erreichen?
|
||||
3. **Debug-Ausgaben**:
|
||||
– Öffne in der Konsole „Kernel-Log“ → Filter „SofarWechselrichter“.
|
||||
– Dort werden WARNs und ERRs protokolliert, falls z. B. keine Antwort kommt oder das Datenpaket inkorrekt ist.
|
||||
|
||||
- Falls du andere Datentypen brauchst (z. B. INT16 für Register außerhalb 1160), definiere sie analog als separate Zeile:
|
||||
– Trage die `Register‐Nummer` ein, gib als Skalierungsfaktor `1` (oder `0.1` etc.) an.
|
||||
– Der absolute Rohwert wird stets als UINT16 interpretiert (0–65535).
|
||||
– Solltest du negative INT16 benötigen, kannst du nachträglich einfach die Variable „Vorheriger Wert“ (Reg 1160)
|
||||
als Beispiel nehmen und in einem Script umrechnen (Werte über 32767 → –32768 + Rest).
|
||||
|
||||
---
|
||||
|
||||
## Versionshistorie
|
||||
|
||||
- **1.0**
|
||||
- Erstveröffentlichung:
|
||||
• Zyklische Abfrage beliebiger Register in einer Matrix konfigurieren
|
||||
• Automatische Anlage von Variablen für jeden Eintrag
|
||||
• Spezieller „Vorheriger Wert“ (Register 1160 als INT16)
|
||||
|
||||
---
|
||||
|
||||
*Ende der Dokumentation.*
|
||||
@@ -1,106 +0,0 @@
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"type": "Label",
|
||||
"caption": "Sofar Wechselrichter Konfiguration"
|
||||
},
|
||||
{
|
||||
"type": "ValidationTextBox",
|
||||
"name": "IPAddress",
|
||||
"caption": "Inverter IP-Adresse"
|
||||
},
|
||||
{
|
||||
"type": "ValidationTextBox",
|
||||
"name": "LoggerNumber",
|
||||
"caption": "Logger-Seriennummer"
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "PollInterval",
|
||||
"caption": "Abfragezyklus (Sekunden)",
|
||||
"minimum": 1,
|
||||
"suffix": "s"
|
||||
},
|
||||
{
|
||||
"type": "List",
|
||||
"name": "Registers",
|
||||
"caption": "Register-Tabelle",
|
||||
"add": "Neues Register hinzufügen",
|
||||
"delete": "Lösche Eintrag",
|
||||
"columns": [
|
||||
{
|
||||
"caption": "Register-Nummer",
|
||||
"name": "RegisterNumber",
|
||||
"width": "200px",
|
||||
"add": 0,
|
||||
"edit": {
|
||||
"type": "NumberSpinner",
|
||||
"minimum": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "Bezeichnung",
|
||||
"name": "Label",
|
||||
"width": "300px",
|
||||
"add": "",
|
||||
"edit": {
|
||||
"type": "ValidationTextBox"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "Skalierungs-faktor",
|
||||
"name": "ScalingFactor",
|
||||
"width": "200px",
|
||||
"add": 1,
|
||||
"edit": {
|
||||
"type": "NumberSpinner",
|
||||
"digits": 4,
|
||||
"minimum": -999999,
|
||||
"maximum": 999999
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "Endian",
|
||||
"name": "Endian",
|
||||
"width": "80px",
|
||||
"add": "BE",
|
||||
"edit": {
|
||||
"type": "Select",
|
||||
"options": [
|
||||
{ "caption": "BE", "value": "BE" },
|
||||
{ "caption": "LE", "value": "LE" }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "Bit-Länge",
|
||||
"name": "BitLength",
|
||||
"width": "80px",
|
||||
"add": "16",
|
||||
"edit": {
|
||||
"type": "Select",
|
||||
"options": [
|
||||
{ "caption": "16 Bit", "value": "16" },
|
||||
{ "caption": "32 Bit", "value": "32" },
|
||||
{ "caption": "64 Bit", "value": "64" }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "Signed/Unsigned",
|
||||
"name": "Signedness",
|
||||
"width": "100px",
|
||||
"add": "Unsigned",
|
||||
"edit": {
|
||||
"type": "Select",
|
||||
"options": [
|
||||
{ "caption": "Unsigned", "value": "Unsigned" },
|
||||
{ "caption": "Signed", "value": "Signed" }
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": []
|
||||
}
|
||||
@@ -1,379 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Sofar Wechselrichter Modul (IP-Symcon)
|
||||
*
|
||||
* - LoggerNumber als String (kein Integer-Overflow).
|
||||
* - Negative Skalierungen erlaubt.
|
||||
* - Bit-Länge pro Register (16, 32, 64) auswählbar.
|
||||
* - Signed/Unsigned pro Register wählbar.
|
||||
* - Liest 32/64-Bit-Werte registerweise einzeln und setzt anschließend zusammen.
|
||||
* - Gelöschte Register-Variablen werden entfernt.
|
||||
* - Debug-Logs zeigen Raw-Response, um Slice-Position zu prüfen.
|
||||
*/
|
||||
class SofarWechselrichter extends IPSModule
|
||||
{
|
||||
public function Create()
|
||||
{
|
||||
parent::Create();
|
||||
// Moduleigenschaften
|
||||
$this->RegisterPropertyString('IPAddress', '');
|
||||
$this->RegisterPropertyString('LoggerNumber', '0'); // als String
|
||||
$this->RegisterPropertyInteger('PollInterval', 60);
|
||||
$this->RegisterPropertyString('Registers', '[]'); // JSON-String
|
||||
|
||||
// Timer für zyklische Abfragen (per RequestAction("Query"))
|
||||
$script = 'IPS_RequestAction(' . $this->InstanceID . ', "Query", "");';
|
||||
$this->RegisterTimer('QueryTimer', 0, $script);
|
||||
}
|
||||
|
||||
public function ApplyChanges()
|
||||
{
|
||||
parent::ApplyChanges();
|
||||
// Timer-Intervall (ms)
|
||||
$intervalSec = $this->ReadPropertyInteger('PollInterval');
|
||||
$intervalMs = ($intervalSec > 0) ? $intervalSec * 1000 : 0;
|
||||
$this->SetTimerInterval('QueryTimer', $intervalMs);
|
||||
|
||||
// Aktuelle Registerliste
|
||||
$registers = json_decode($this->ReadPropertyString('Registers'), true);
|
||||
if (!is_array($registers)) {
|
||||
$registers = [];
|
||||
}
|
||||
|
||||
// 1) Variablen anlegen (neu hinzugekommene Register)
|
||||
$position = 10;
|
||||
foreach ($registers as $entry) {
|
||||
$regNo = (int) $entry['RegisterNumber'];
|
||||
$label = trim($entry['Label']);
|
||||
if ($regNo < 0 || $label === '') {
|
||||
continue;
|
||||
}
|
||||
$ident = 'Reg' . $regNo;
|
||||
if (!$this->VariableExists($ident)) {
|
||||
$this->RegisterVariableFloat($ident, $label, '', $position);
|
||||
}
|
||||
$position += 10;
|
||||
}
|
||||
|
||||
// 2) Variablen löschen (falls Register entfernt wurden)
|
||||
$validIdents = [];
|
||||
foreach ($registers as $entry) {
|
||||
$validIdents[] = 'Reg' . ((int)$entry['RegisterNumber']);
|
||||
}
|
||||
$children = IPS_GetChildrenIDs($this->InstanceID);
|
||||
foreach ($children as $childID) {
|
||||
$obj = IPS_GetObject($childID);
|
||||
if ($obj['ObjectType'] !== 2) {
|
||||
continue;
|
||||
}
|
||||
$ident = $obj['ObjectIdent'];
|
||||
if (substr($ident, 0, 3) === 'Reg') {
|
||||
if (!in_array($ident, $validIdents)) {
|
||||
IPS_DeleteVariable($childID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function Destroy()
|
||||
{
|
||||
parent::Destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Wird aufgerufen durch IPS_RequestAction über den Timer
|
||||
*/
|
||||
public function RequestAction($Ident, $Value)
|
||||
{
|
||||
switch ($Ident) {
|
||||
case 'Query':
|
||||
$this->Query();
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Ungültiger Ident: ' . $Ident);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Zyklische Abfrage aller definierten Register
|
||||
*/
|
||||
private function Query(): void
|
||||
{
|
||||
$this->LogMessage('Query invoked', KL_MESSAGE);
|
||||
|
||||
$ip = trim($this->ReadPropertyString('IPAddress'));
|
||||
$loggerNumberStr = trim($this->ReadPropertyString('LoggerNumber'));
|
||||
|
||||
// 1) Validierung IP
|
||||
if (!filter_var($ip, FILTER_VALIDATE_IP)) {
|
||||
$this->LogMessage('Abbruch: Ungültige IP = "' . $ip . '"', KL_WARNING);
|
||||
return;
|
||||
}
|
||||
// 2) Validierung LoggerNumber (Dezimal-String, > 0)
|
||||
if ($loggerNumberStr === '' || !ctype_digit($loggerNumberStr) || bccomp($loggerNumberStr, '1') < 0) {
|
||||
$this->LogMessage('Abbruch: Ungültige LoggerNumber = "' . $loggerNumberStr . '"', KL_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
// 3) Register-Liste einlesen
|
||||
$registers = json_decode($this->ReadPropertyString('Registers'), true);
|
||||
if (!is_array($registers) || count($registers) === 0) {
|
||||
// Keine Register definiert
|
||||
return;
|
||||
}
|
||||
|
||||
// 4) Für jedes Register: einzeln auslesen, zusammensetzen, skalieren, speichern
|
||||
foreach ($registers as $entry) {
|
||||
$regNo = (int) $entry['RegisterNumber'];
|
||||
$label = trim((string)$entry['Label']);
|
||||
$scale = (string) $entry['ScalingFactor']; // kann negativ sein
|
||||
$endian = strtoupper(trim((string)$entry['Endian']));
|
||||
$bitLength = (int) $entry['BitLength']; // 16, 32 oder 64
|
||||
$signedness = trim((string)$entry['Signedness']); // "Signed" oder "Unsigned"
|
||||
$ident = 'Reg' . $regNo;
|
||||
|
||||
if ($regNo < 0 || $label === '' || !in_array($bitLength, [16, 32, 64])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$numRegs = $bitLength / 16; // 1, 2 oder 4
|
||||
// Bytes registerweise einzeln abfragen und zusammenfügen:
|
||||
$dataBytes = '';
|
||||
for ($i = 0; $i < $numRegs; $i++) {
|
||||
$chunk = $this->readSingleRegister($ip, $loggerNumberStr, $regNo + $i);
|
||||
$dataBytes .= $chunk;
|
||||
}
|
||||
// Debug: raw combined response hex
|
||||
$combinedHex = strtoupper(bin2hex($dataBytes));
|
||||
$this->LogMessage("Raw data for Reg {$regNo} ({$bitLength}bit): {$combinedHex}", KL_MESSAGE);
|
||||
|
||||
// Endian-Handling: falls LE, kehre gesamte Byte-Reihenfolge um
|
||||
if ($endian === 'LE') {
|
||||
$combinedHex = $this->reverseByteOrder($combinedHex);
|
||||
$this->LogMessage("After LE reverse: {$combinedHex}", KL_MESSAGE);
|
||||
}
|
||||
|
||||
// Konvertiere Hex in Dezimal-String
|
||||
$rawDec = $this->hexToDecimal($combinedHex);
|
||||
|
||||
// Bei "Signed" → Zwei-Komplement-Umrechnung
|
||||
if ($signedness === 'Signed') {
|
||||
$half = bcpow('2', (string)($bitLength - 1), 0); // 2^(bitLength-1)
|
||||
$fullRange = bcpow('2', (string)$bitLength, 0); // 2^bitLength
|
||||
if (bccomp($rawDec, $half) >= 0) {
|
||||
$rawDec = bcsub($rawDec, $fullRange, 0);
|
||||
}
|
||||
$this->LogMessage("Signed rawDec for Reg {$regNo}: {$rawDec}", KL_MESSAGE);
|
||||
}
|
||||
|
||||
// Skaliere (bc*-Multiplikation, 4 Nachkommastellen)
|
||||
$valueStr = bcmul($rawDec, $scale, 4);
|
||||
SetValueFloat($this->GetIDForIdent($ident), (float)$valueStr);
|
||||
$this->LogMessage("Final value for Reg {$regNo}: {$valueStr}", KL_MESSAGE);
|
||||
} catch (Exception $e) {
|
||||
$this->LogMessage(
|
||||
"Fehler Lesen Reg {$regNo} ({$bitLength}bit, {$signedness}): " . $e->getMessage(),
|
||||
KL_WARNING
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liest genau ein Register (16 Bit) per Modbus-ähnlichem TCP (2 Bytes zurück).
|
||||
*
|
||||
* @param string $ip Inverter-IP
|
||||
* @param string $serial_nr_str Logger-Seriennummer als Dezimal-String
|
||||
* @param int $reg Register-Adresse
|
||||
* @return string 2-Byte-Binär-String
|
||||
* @throws Exception Bei Kommunikationsfehlern
|
||||
*/
|
||||
private function readSingleRegister(string $ip, string $serial_nr_str, int $reg): string
|
||||
{
|
||||
// 1) Out_Frame ohne CRC aufbauen
|
||||
$oFrame = 'a5170010450000';
|
||||
|
||||
// Dezimal-String → 8-stellige Hex
|
||||
$hexSN8 = $this->decStringToHex8($serial_nr_str);
|
||||
$hexSNbytes = [
|
||||
substr($hexSN8, 6, 2),
|
||||
substr($hexSN8, 4, 2),
|
||||
substr($hexSN8, 2, 2),
|
||||
substr($hexSN8, 0, 2),
|
||||
];
|
||||
$oFrame .= implode('', $hexSNbytes);
|
||||
|
||||
// Data-Field (16 Hex-Zeichen konstant)
|
||||
$oFrame .= '020000000000000000000000000000';
|
||||
|
||||
// Business-Field: 01 03 + Start-Register + Anzahl Register (1)
|
||||
$startHex = str_pad(dechex($reg), 4, '0', STR_PAD_LEFT);
|
||||
$numHex = str_pad(dechex(1), 4, '0', STR_PAD_LEFT);
|
||||
$oFrame .= '0103' . $startHex . $numHex;
|
||||
|
||||
// 2) CRC16-Modbus (letzte 6 Bytes)
|
||||
$crcInputHex = substr($oFrame, -12);
|
||||
$crcInputBin = hex2bin($crcInputHex);
|
||||
if ($crcInputBin === false) {
|
||||
throw new Exception("Ungültiges Hex in CRC-Input: {$crcInputHex}");
|
||||
}
|
||||
$crcValue = $this->calculateCRC16Modbus($crcInputBin);
|
||||
$crcHex = strtoupper(str_pad(dechex($crcValue), 4, '0', STR_PAD_LEFT));
|
||||
$crcSwapped = substr($crcHex, 2, 2) . substr($crcHex, 0, 2);
|
||||
$oFrameWithCRC = $oFrame . strtolower($crcSwapped);
|
||||
|
||||
// 3) Summen-Checksum (alle Bytes ab Index 1) + 0x15
|
||||
$l = strlen($oFrameWithCRC) / 2;
|
||||
$bArr = [];
|
||||
for ($i = 0; $i < $l; $i++) {
|
||||
$byteHex = substr($oFrameWithCRC, 2 * $i, 2);
|
||||
$bArr[$i] = hexdec($byteHex);
|
||||
}
|
||||
$crcSum = 0;
|
||||
for ($i = 1; $i < $l; $i++) {
|
||||
$crcSum += $bArr[$i];
|
||||
$crcSum &= 0xFF;
|
||||
}
|
||||
$bArr[$l] = $crcSum;
|
||||
$bArr[$l+1] = 0x15;
|
||||
|
||||
$frameBin = '';
|
||||
foreach ($bArr as $b) {
|
||||
$frameBin .= chr($b);
|
||||
}
|
||||
|
||||
// 4) TCP-Verbindung öffnen & Paket senden (Port fest 8899)
|
||||
$port = 8899;
|
||||
$fp = @stream_socket_client("tcp://{$ip}:{$port}", $errno, $errstr, 5);
|
||||
if (!$fp) {
|
||||
throw new Exception("Verbindung zu {$ip}:{$port} fehlgeschlagen ({$errno}: {$errstr})");
|
||||
}
|
||||
fwrite($fp, $frameBin);
|
||||
stream_set_timeout($fp, 2);
|
||||
|
||||
// 5) Antwort einlesen
|
||||
$response = '';
|
||||
while (!feof($fp)) {
|
||||
$chunk = fread($fp, 1024);
|
||||
if ($chunk === false || $chunk === '') {
|
||||
break;
|
||||
}
|
||||
$response .= $chunk;
|
||||
}
|
||||
fclose($fp);
|
||||
if ($response === '') {
|
||||
throw new Exception("Keine Antwort vom Inverter erhalten.");
|
||||
}
|
||||
|
||||
// Debug: log raw response hex
|
||||
$respHex = strtoupper(bin2hex($response));
|
||||
$this->LogMessage("Raw response for single reg {$reg}: {$respHex}", KL_MESSAGE);
|
||||
|
||||
// 6) Slice-Logik: l = 2*1 + 4 = 6, slice(-6, 2) → 2 Bytes
|
||||
$lModbus = 2 * 1 + 4; // = 6
|
||||
$numBytes = 2;
|
||||
if (strlen($response) < $lModbus) {
|
||||
throw new Exception("Unerwartet kurze Antwort (< {$lModbus} Bytes).");
|
||||
}
|
||||
$dataBytes = substr($response, -$lModbus, $numBytes);
|
||||
if (strlen($dataBytes) < $numBytes) {
|
||||
throw new Exception("Data-Segment enthält weniger als {$numBytes} Bytes.");
|
||||
}
|
||||
$dataHex = strtoupper(bin2hex($dataBytes));
|
||||
$this->LogMessage("Sliced data for single reg {$reg}: {$dataHex}", KL_MESSAGE);
|
||||
|
||||
return $dataBytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wandelt einen Dezimal-String in einen 8-stelligen Hex-String um.
|
||||
*
|
||||
* @param string $decString
|
||||
* @return string 8-stellige Hex (uppercase)
|
||||
*/
|
||||
private function decStringToHex8(string $decString): string
|
||||
{
|
||||
$num = ltrim($decString, '0');
|
||||
if ($num === '') {
|
||||
return '00000000';
|
||||
}
|
||||
$hex = '';
|
||||
while (bccomp($num, '0') > 0) {
|
||||
$mod = bcmod($num, '16');
|
||||
$digit = dechex((int)$mod);
|
||||
$hex = strtoupper($digit) . $hex;
|
||||
$num = bcdiv($num, '16', 0);
|
||||
}
|
||||
return str_pad($hex, 8, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Kehrt die Byte-Reihenfolge eines Hex-Strings um (2 Hex-Zeichen = 1 Byte).
|
||||
*
|
||||
* @param string $hex Hex-Repr. (z.B. "A1B2C3D4")
|
||||
* @return string Umgekehrte Byte-Reihenfolge (z.B. "D4C3B2A1")
|
||||
*/
|
||||
private function reverseByteOrder(string $hex): string
|
||||
{
|
||||
$bytes = str_split($hex, 2);
|
||||
$bytes = array_reverse($bytes);
|
||||
return implode('', $bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Konvertiert einen Hex-String in einen Dezimal-String (BCMath).
|
||||
*
|
||||
* @param string $hex Uppercase-Hex ohne Präfix (z.B. "00FF10A3")
|
||||
* @return string Dezimal-String (z.B. "16737763")
|
||||
*/
|
||||
private function hexToDecimal(string $hex): string
|
||||
{
|
||||
$hex = ltrim($hex, '0');
|
||||
if ($hex === '') {
|
||||
return '0';
|
||||
}
|
||||
$len = strlen($hex);
|
||||
$dec = '0';
|
||||
$power16 = '1';
|
||||
for ($i = $len - 1; $i >= 0; $i--) {
|
||||
$digit = hexdec($hex[$i]);
|
||||
$term = bcmul((string)$digit, $power16, 0);
|
||||
$dec = bcadd($dec, $term, 0);
|
||||
$power16 = bcmul($power16, '16', 0);
|
||||
}
|
||||
return $dec;
|
||||
}
|
||||
|
||||
/**
|
||||
* Berechnet CRC16-Modbus (Init=0xFFFF, Poly=0xA001) über Binärdaten.
|
||||
*/
|
||||
private function calculateCRC16Modbus(string $binaryData): int
|
||||
{
|
||||
$crc = 0xFFFF;
|
||||
$len = strlen($binaryData);
|
||||
for ($pos = 0; $pos < $len; $pos++) {
|
||||
$crc ^= ord($binaryData[$pos]);
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
if (($crc & 0x0001) !== 0) {
|
||||
$crc >>= 1;
|
||||
$crc ^= 0xA001;
|
||||
} else {
|
||||
$crc >>= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $crc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft, ob eine Variable mit Ident existiert.
|
||||
*/
|
||||
private function VariableExists(string $ident): bool
|
||||
{
|
||||
$vid = @IPS_GetObjectIDByIdent($ident, $this->InstanceID);
|
||||
return ($vid !== false && IPS_VariableExists($vid));
|
||||
}
|
||||
}
|
||||
+2
-6
@@ -1,9 +1,5 @@
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"type": "ValidationTextBox",
|
||||
"name": "DeviceID",
|
||||
"caption": "Device ID"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
+11
-5
@@ -3,10 +3,16 @@
|
||||
"name": "VGT_Sub",
|
||||
"type": 3,
|
||||
"vendor": "Belevo",
|
||||
"aliases": ["VGT MQTT Device"],
|
||||
"prefix": "VGT",
|
||||
"parentRequirements": [],
|
||||
"aliases": [
|
||||
"VGT MQTT Device"
|
||||
],
|
||||
"parentRequirements": [
|
||||
"{F7A0DD2E-7684-4520-B61B-9613D6163722}"
|
||||
],
|
||||
"childRequirements": [],
|
||||
"implemented": [],
|
||||
"implemented": [
|
||||
"{018EF6B5-AB94-40C6-AA53-46943E824ACF}"
|
||||
],
|
||||
"prefix": "VGT",
|
||||
"version": "1.0"
|
||||
}
|
||||
}
|
||||
+74
-106
@@ -4,130 +4,98 @@ declare(strict_types=1);
|
||||
|
||||
class VGT_Sub extends IPSModule
|
||||
{
|
||||
// Die GUID des IP-Symcon MQTT Clients (Splitter)
|
||||
private const PARENT_GUID = '{C6D2AEB3-6E1F-4B2E-8E69-3A1A00246850}';
|
||||
|
||||
public function Create()
|
||||
{
|
||||
parent::Create();
|
||||
|
||||
// DeviceID
|
||||
$this->RegisterPropertyString('DeviceID', '');
|
||||
|
||||
// Eingehende MQTT-Nachrichten
|
||||
$this->RegisterVariableString("InputJSON", "MQTT Input", "", 1);
|
||||
$this->EnableAction("InputJSON");
|
||||
|
||||
// Ausgehende MQTT-Nachrichten
|
||||
$this->RegisterVariableString("OutputJSON", "MQTT Output", "", 2);
|
||||
|
||||
// Statusvariablen
|
||||
$this->RegisterVariableFloat('PowerProduction', 'Power Production', '', 10);
|
||||
$this->EnableAction('PowerProduction');
|
||||
|
||||
$this->RegisterVariableFloat('StateOfCharge', 'State of Charge', '', 11);
|
||||
$this->EnableAction('StateOfCharge');
|
||||
|
||||
$this->RegisterVariableBoolean('IsRunning', 'Is Running', '', 12);
|
||||
$this->EnableAction('IsRunning');
|
||||
|
||||
$this->RegisterVariableBoolean('IsReady', 'Is Ready', '', 13);
|
||||
$this->EnableAction('IsReady');
|
||||
|
||||
$this->RegisterVariableFloat('MinSoc', 'Min SoC', '', 14);
|
||||
$this->EnableAction('MinSoc');
|
||||
|
||||
$this->RegisterVariableFloat('MaxSoc', 'Max SoC', '', 15);
|
||||
$this->EnableAction('MaxSoc');
|
||||
|
||||
// Remote-Control
|
||||
$this->RegisterVariableInteger('PowerSetpoint', 'Power Setpoint', '', 20);
|
||||
IPS_SetVariableCustomAction($this->GetIDForIdent('PowerSetpoint'), 0);
|
||||
|
||||
$this->RegisterVariableString('Strategy', 'Strategy', '', 21);
|
||||
IPS_SetVariableCustomAction($this->GetIDForIdent('Strategy'), 0);
|
||||
// Verbindet sich automatisch mit einem MQTT Client
|
||||
$this->ConnectParent('{C6D2AEB3-6E1F-4B2E-8E69-3A1A00246850}');
|
||||
}
|
||||
|
||||
public function RequestAction($Ident, $Value)
|
||||
public function ApplyChanges()
|
||||
{
|
||||
if ($Ident === "InputJSON") {
|
||||
SetValueString($this->GetIDForIdent("InputJSON"), $Value);
|
||||
$this->ProcessIncoming($Value);
|
||||
return;
|
||||
}
|
||||
parent::ApplyChanges();
|
||||
$this->ConnectParent('{C6D2AEB3-6E1F-4B2E-8E69-3A1A00246850}');
|
||||
|
||||
SetValue($this->GetIDForIdent($Ident), $Value);
|
||||
}
|
||||
// Topic Definitionen
|
||||
$requestTopic = 'feedback-request/deviceOne';
|
||||
|
||||
private function ProcessIncoming($jsonString)
|
||||
{
|
||||
$data = @json_decode($jsonString, true);
|
||||
if (!is_array($data)) {
|
||||
return;
|
||||
}
|
||||
// 1. Filter setzen: Wir wollen nur Nachrichten für unser Request-Topic sehen.
|
||||
// Das "Topic" im Filter bezieht sich auf das JSON-Paket vom MQTT Client.
|
||||
$this->SetReceiveDataFilter('.*"Topic":"' . preg_quote($requestTopic, '/') . '".*');
|
||||
|
||||
if (!isset($data['topic']) || !isset($data['payload'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$topic = $data['topic'];
|
||||
$payload = $data['payload'];
|
||||
|
||||
$device = $this->ReadPropertyString('DeviceID');
|
||||
|
||||
// Feedback Request
|
||||
if ($topic === "feedback-request/$device") {
|
||||
$this->SendFeedback($device);
|
||||
return;
|
||||
}
|
||||
|
||||
// Remote Control Request
|
||||
if ($topic === "remote-control-request/$device") {
|
||||
$this->ProcessRemoteControl($device, $payload);
|
||||
return;
|
||||
// 2. Beim MQTT Broker abonnieren (Subscribe senden)
|
||||
// Wir prüfen erst, ob wir einen Parent haben, um Fehler zu vermeiden
|
||||
if ($this->HasActiveParent()) {
|
||||
$this->Subscribe($requestTopic);
|
||||
}
|
||||
}
|
||||
|
||||
private function SendFeedback($device)
|
||||
/**
|
||||
* Wird aufgerufen, wenn der Parent (MQTT Client) Daten empfängt
|
||||
*/
|
||||
public function ReceiveData($JSONString)
|
||||
{
|
||||
$response = [
|
||||
"power_production" => GetValue($this->GetIDForIdent('PowerProduction')),
|
||||
"state_of_charge" => GetValue($this->GetIDForIdent('StateOfCharge')),
|
||||
"is_running" => GetValue($this->GetIDForIdent('IsRunning')),
|
||||
"is_ready" => GetValue($this->GetIDForIdent('IsReady')),
|
||||
"min_soc" => GetValue($this->GetIDForIdent('MinSoc')),
|
||||
"max_soc" => GetValue($this->GetIDForIdent('MaxSoc'))
|
||||
$data = json_decode($JSONString, true);
|
||||
|
||||
$this->SendDebug('ReceiveData', $JSONString, 0);
|
||||
|
||||
if (!isset($data['Topic']) || !isset($data['Payload'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sicherheitscheck: Ist es wirklich das gewünschte Topic?
|
||||
if ($data['Topic'] === 'feedback-request/deviceOne') {
|
||||
|
||||
$this->SendDebug('VGT_Logic', 'Request received. Sending "Hello"...', 0);
|
||||
|
||||
// Antwort senden
|
||||
$this->Publish('feedback-response', 'Hello');
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------
|
||||
* MQTT HILFSFUNKTIONEN
|
||||
* ---------------------------------------------------------*/
|
||||
|
||||
private function Subscribe(string $topic)
|
||||
{
|
||||
$payload = [
|
||||
'DataID' => self::PARENT_GUID,
|
||||
'PacketType' => 3, // Achtung: Symcon intern ist Subscribe oft mapped,
|
||||
// aber für den MQTT Client ist es Type 3 (Publish) oder spezial.
|
||||
// Standard Symcon MQTT Client nutzt jedoch oft Type 8 für Subscribe.
|
||||
// Hier nutzen wir den Standard Weg für JSON DataID:
|
||||
];
|
||||
|
||||
SetValueString(
|
||||
$this->GetIDForIdent("OutputJSON"),
|
||||
json_encode([
|
||||
"topic" => "feedback-response/$device",
|
||||
"payload" => json_encode($response)
|
||||
])
|
||||
);
|
||||
|
||||
// Sende Subscribe Paket (Type 8 = Subscribe beim Client Splitter)
|
||||
$this->SendDataToParent(json_encode([
|
||||
'DataID' => self::PARENT_GUID,
|
||||
'PacketType' => 8,
|
||||
'QualityOfService' => 0,
|
||||
'Retain' => false,
|
||||
'Topic' => $topic,
|
||||
'Payload' => ''
|
||||
]));
|
||||
|
||||
$this->SendDebug('MQTT', "Subscribed to $topic", 0);
|
||||
}
|
||||
|
||||
private function ProcessRemoteControl($device, $payload)
|
||||
private function Publish(string $topic, string $payload)
|
||||
{
|
||||
$json = @json_decode($payload, true);
|
||||
if (!is_array($json)) {
|
||||
return;
|
||||
}
|
||||
// Sende Publish Paket (Type 3 = Publish)
|
||||
$this->SendDataToParent(json_encode([
|
||||
'DataID' => self::PARENT_GUID,
|
||||
'PacketType' => 3,
|
||||
'QualityOfService' => 0,
|
||||
'Retain' => false,
|
||||
'Topic' => $topic,
|
||||
'Payload' => $payload
|
||||
]));
|
||||
|
||||
if (isset($json['power_setpoint'])) {
|
||||
SetValue($this->GetIDForIdent('PowerSetpoint'), (int)$json['power_setpoint']);
|
||||
}
|
||||
|
||||
if (isset($json['strategy'])) {
|
||||
SetValueString($this->GetIDForIdent('Strategy'), (string)$json['strategy']);
|
||||
}
|
||||
|
||||
SetValueString(
|
||||
$this->GetIDForIdent("OutputJSON"),
|
||||
json_encode([
|
||||
"topic" => "remote-control-response/$device",
|
||||
"payload" => json_encode($json)
|
||||
])
|
||||
);
|
||||
$this->SendDebug('MQTT', "Published to $topic: $payload", 0);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
From a314141093f7e16493a47009948d71e7095858e2 Mon Sep 17 00:00:00 2001
|
||||
From: "belevo\\mh" <mh@belevo.ch>
|
||||
Date: Mon, 26 Jan 2026 12:55:13 +0100
|
||||
Subject: [PATCH] no message
|
||||
|
||||
---
|
||||
Bat_EV_SDL/form.json | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/Bat_EV_SDL/form.json b/Bat_EV_SDL/form.json
|
||||
index bd29490..191ac69 100644
|
||||
--- a/Bat_EV_SDL/form.json
|
||||
+++ b/Bat_EV_SDL/form.json
|
||||
@@ -10,7 +10,7 @@
|
||||
{
|
||||
"caption":"Typ",
|
||||
"name":"typ",
|
||||
- "width":"200px",
|
||||
+ "width":"100px",
|
||||
"add":"Stufe",
|
||||
"edit":{
|
||||
"type":"ValidationTextBox"
|
||||
@@ -53,7 +53,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
- "caption":"Batterieleistung Laden SDL",
|
||||
+ "caption":"Laden SDL",
|
||||
"name":"powerbat_laden_sdl",
|
||||
"width":"200px",
|
||||
"add":0,
|
||||
@@ -62,7 +62,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
- "caption":"Batterieleistung Entladen SDL",
|
||||
+ "caption":"Entladen SDL",
|
||||
"name":"powerbat_entladen_sdl",
|
||||
"width":"200px",
|
||||
"add":0,
|
||||
@@ -71,7 +71,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
- "caption":"Batterie SOC-EV",
|
||||
+ "caption":"SOC-EV",
|
||||
"name":"ev_soc",
|
||||
"width":"200px",
|
||||
"add":0,
|
||||
@@ -80,7 +80,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
- "caption":"Batterieleistung Laden EV",
|
||||
+ "caption":"Laden EV",
|
||||
"name":"powerbat_laden_EV",
|
||||
"width":"200px",
|
||||
"add":0,
|
||||
@@ -89,7 +89,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
- "caption":"Batterieleistung Entladen EV",
|
||||
+ "caption":"Entladen EV",
|
||||
"name":"powerbat_entladen_ev",
|
||||
"width":"200px",
|
||||
"add":0,
|
||||
--
|
||||
2.43.0.windows.1
|
||||
|
||||
Reference in New Issue
Block a user