1 % switching definition.
4 p(C,o1,OP) :- not ab(C), switching(C), c(C,i4,0), c(C,i6,I6), OP = 0, #int(OP).
5 p(C,o2,OP) :- not ab(C), switching(C), c(C,i4,0), c(C,i6,I6), OP = I6, #int(OP).
7 % system accumilation mode
8 p(C,o1,OP) :- not ab(C), switching(C), c(C,i4,1), c(C,i1,I1), c(C,i2,I2), c(C,i3,I3), c(C,i6,I6), OP = 0, #int(OP).
9 p(C,o2,OP) :- not ab(C), switching(C), c(C,i4,1), c(C,i1,I1), c(C,i2,I2), c(C,i3,I3), c(C,i6,I6), T1 = I1 + I2, T2 = I3 + I6, OP = T1 + T2, #int(OP).
12 %p(C,o1,O1) :- not ab(C), switching(C), c(C,i4,2), c(C,i1,I1), c(C,i2,I2), c(C,i3,I3), c(C,i5,I5), c(C,i6,I6), O1 = 0, #int(O1).
17 % not charge but powered charger input
18 %p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,I1), c(C,i2,I2), not c(C,is,empty), not c(C,i1,charge), c_max(C,MAX), I1 > MAX, OP = MAX + I2, #int(OP).
21 %p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,0), c(C,i2,0), OP = 0, #int(OP).
24 %p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,charge), c(C,i2,I2), c(C,is,full), OP = I2, #int(OP).
27 %p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,charge), c(C,i2,I2), charge_max(C,CMAX), not c(C,is,full), I2 > CMAX, OP = I2 - CMAX, #int(OP).
30 %p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,charge), c(C,i2,I2), charge_max(C,CMAX), not c(C,is,full), I2 <= CMAX, OP = 0, #int(OP).
32 % normal discharge but empty
33 % not charge but powered charger input
34 %p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i2,I2), c(C,is,empty), not c(C,i1,charge), OP = I2, #int(OP).