-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsma.rules
21 lines (20 loc) · 835 Bytes
/
sma.rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
rule "Total Power Consumption"
when
Item inverter1PowerDrawn received update
then
val Number TotalPower = (inverter1ActivePower.state as QuantityType<Number>
+ inverter2PreBatDischarge.state as QuantityType<Number>
+ inverter1PowerDrawn.state as QuantityType<Number>
- inverter2PreBatCharge.state as QuantityType<Number>
- inverter1PowerGridFeedIn.state as QuantityType<Number>)
if ( TotalPower >= 0|"W" ) {
TotalPowerConsumption.postUpdate(TotalPower)
}
val Number PowerBatIncl = (inverter1ActivePower.state as QuantityType<Number>
+ inverter2PreBatDischarge.state as QuantityType<Number>
+ inverter1PowerDrawn.state as QuantityType<Number>
- inverter1PowerGridFeedIn.state as QuantityType<Number>)
if ( TotalPower >= 0|"W" ) {
PowerConsumptionBatIncl.postUpdate(PowerBatIncl)
}
end