I would like to create a rule which regulating the charging of my electrical vehicle based on the available photovoltaics power.
In the german forum @Udo_Hartmann supported to create the basic rule:
rule "Ladestrom einstellen" when Item PVLeistung changed or Item StromBedarf changed then val Number nPV = if(PVLeistung.state instanceof Number) (PVLeistung.state as Number).floatValue else 0 val Number nHaus = if(StromBedarf.state instanceof Number) (StromBedarf.state as Number).floatValue else 2000 // zu erwartender Spitzenbedarf als Default Wert val Number nDiff = nPV - nHaus var Number nStufe = 0 if(nDiff < 0) nStufe = 0 else if(nDiff < 1000) nStufe = 1 else if(nDiff < 2000) nStufe = 2 else if(nDiff < 3000) nStufe = 3 else if(nDiff < 4000) nStufe = 4 else if(nDiff < 5000) nStufe = 5 else nStufe = 6 Ladeleistung.sendCommand(nStufe) end
In general this is fine, but since the power can vary a lot I would like to implement a “smoothed” regulation. It means for short term I would also consume power directly from grid.
To give you some hints you can see some shapes of the produced power. In some cases its more or less regular in some its fluctuation a lot:
I would like to charge the car with the power seen in the “green area” as much as possible.
Does somebody has experience in such feedback control?
Thanks for your support in advance