From b6a31651d7779c6d297d8cc51ee5a30576f67bbb Mon Sep 17 00:00:00 2001 From: someone Date: Tue, 5 Jun 2012 18:50:30 +0200 Subject: [PATCH] major c/p fuckup --- c.dl | 44 ++++++++++++++++++++++---------------------- c.test1.dl | 10 +++++----- c.test2.dl | 10 +++++----- c.test3.dl | 10 +++++----- c.test4.dl | 10 +++++----- c.test5.dl | 10 +++++----- c.test6.dl | 10 +++++----- c.test7.dl | 10 +++++----- c.test8.dl | 10 +++++----- c.test9.dl | 10 +++++----- connect.dl | 28 +++++++++++++++++++++++++++- connect.test1.dl | 10 ++++++++++ psh.dl | 14 +++++++------- psh.test1.dl | 4 ++-- psh.test2.dl | 4 ++-- psh.test3.dl | 4 ++-- psh.test4.dl | 4 ++-- psh.test5.dl | 4 ++-- psh.test6.dl | 4 ++-- psh.test7.dl | 4 ++-- psh.test8.dl | 4 ++-- s.dl | 16 ++++++++-------- s.test1.dl | 16 ++++++++-------- s.test2.dl | 16 ++++++++-------- s.test3.dl | 16 ++++++++-------- s.test4.dl | 16 ++++++++-------- s.test5.dl | 16 ++++++++-------- 27 files changed, 175 insertions(+), 139 deletions(-) diff --git a/c.dl b/c.dl index 346087a..d111541 100644 --- a/c.dl +++ b/c.dl @@ -13,47 +13,47 @@ c_max_p(State,PM) :- c_max(psh,PMAX), State = half_full, PM = PMAX, #int(PM), #i c_max_p(State,PM) :- State = empty, PM = 0, #int(PM). % noop -p(C,o1,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i3,full), Idem <= Icur, OP = 0, #int(OP). -p(C,o2,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i3,full), Idem <= Icur, OP = 0, #int(OP). -p(C,o3,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i3,full), Idem <= Icur, OP = 0, #int(OP). -p(C,o4,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i3,full), Idem <= Icur, OP = 0, #int(OP). -p(C,o5,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i3,full), Idem <= Icur, OP = 0, #int(OP). +c(C,o1,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i3,full), Idem <= Icur, OP = 0, #int(OP). +c(C,o2,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i3,full), Idem <= Icur, OP = 0, #int(OP). +c(C,o3,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i3,full), Idem <= Icur, OP = 0, #int(OP). +c(C,o4,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i3,full), Idem <= Icur, OP = 0, #int(OP). +c(C,o5,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i3,full), Idem <= Icur, OP = 0, #int(OP). % charge psh (over max) -p(C,o1,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), not c(C,i3,full), w_charge(psh,IMAXpc), Idem <= Icur, OP = 0, #int(OP). -p(C,o2,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), not c(C,i3,full), w_charge(psh,IMAXpc), Idem <= Icur, OP = 0, #int(OP). -p(C,o3,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), not c(C,i3,full), w_charge(psh,IMAXpc), Idem <= Icur, OP = 0, #int(OP). -p(C,o4,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), not c(C,i3,full), w_charge(psh,IMAXpc), Idem <= Icur, OP = 2, #int(OP). -p(C,o5,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), not c(C,i3,full), w_charge(psh,IMAXpc), Idem <= Icur, Tava = Icur - Idem, Tava <= IMAXpc, OP = Tava, #int(OP). -p(C,o5,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), not c(C,i3,full), w_charge(psh,IMAXpc), Idem <= Icur, Tava = Icur - Idem, Tava > IMAXpc, OP = IMAXpc, #int(OP). +c(C,o1,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), not c(C,i3,full), w_charge(psh,IMAXpc), Idem <= Icur, OP = 0, #int(OP). +c(C,o2,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), not c(C,i3,full), w_charge(psh,IMAXpc), Idem <= Icur, OP = 0, #int(OP). +c(C,o3,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), not c(C,i3,full), w_charge(psh,IMAXpc), Idem <= Icur, OP = 0, #int(OP). +c(C,o4,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), not c(C,i3,full), w_charge(psh,IMAXpc), Idem <= Icur, OP = 2, #int(OP). +c(C,o5,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), not c(C,i3,full), w_charge(psh,IMAXpc), Idem <= Icur, Tava = Icur - Idem, Tava <= IMAXpc, OP = Tava, #int(OP). +c(C,o5,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), not c(C,i3,full), w_charge(psh,IMAXpc), Idem <= Icur, Tava = Icur - Idem, Tava > IMAXpc, OP = IMAXpc, #int(OP). % Produce energy. -p(C,o4,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), Idem > Icur, OP = 1, #int(OP). -p(C,o5,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), Idem > Icur, OP = 0, #int(OP). +c(C,o4,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), Idem > Icur, OP = 1, #int(OP). +c(C,o5,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), Idem > Icur, OP = 0, #int(OP). % Treq = to request is <= c_max(w). request o2 = Treq. -p(C,o2,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq <= WMAX, OP = Treq, #int(OP). -p(C,o1,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq <= WMAX, OP = 0, #int(OP). -p(C,o3,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq <= WMAX, OP = 0, #int(OP). +c(C,o2,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq <= WMAX, OP = Treq, #int(OP). +c(C,o1,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq <= WMAX, OP = 0, #int(OP). +c(C,o3,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq <= WMAX, OP = 0, #int(OP). % Treq > c_max(w). request o2 = c_max(w) + other -p(C,o2,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq > WMAX, OP = WMAX, #int(OP). +c(C,o2,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq > WMAX, OP = WMAX, #int(OP). -p(C,o1,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq > WMAX, Treqw = Treq - WMAX, +c(C,o1,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq > WMAX, Treqw = Treq - WMAX, c(C,i3,IS), c_max_p(IS,PMAX), Treqw <= PMAX, OP = Treqw, #int(OP). -p(C,o3,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq > WMAX, Treqw = Treq - WMAX, +c(C,o3,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq > WMAX, Treqw = Treq - WMAX, c(C,i3,IS), c_max_p(IS,PMAX), Treqw <= PMAX, OP = 0, #int(OP). % Treq > c_max(w) + c_max(psh). -p(C,o1,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq > WMAX, Treqw = Treq - WMAX, +c(C,o1,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq > WMAX, Treqw = Treq - WMAX, c(C,i3,IS), c_max_p(IS,PMAX), Treqw > PMAX, OP = PMAX, #int(OP). -p(C,o3,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq > WMAX, Treqw = Treq - WMAX, +c(C,o3,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq > WMAX, Treqw = Treq - WMAX, c(C,i3,IS), c_max_p(IS,PMAX), Treqw > PMAX, Treqwp = Treqw - PMAX, c_max(f,FMAX), Treqwp <= FMAX, OP = Treqwp, #int(OP). % Treq hopelessly over our capacity -p(C,o3,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq > WMAX, Treqw = Treq - WMAX, +c(C,o3,OP) :- not ab(C), control(C), c(C,i1,Icur), c(C,i2,Idem), c(C,i4,Iw), Idem > Icur, Treq = Idem - Icur, c_max_w(Iw,WMAX), Treq > WMAX, Treqw = Treq - WMAX, c(C,i3,IS), c_max_p(IS,PMAX), Treqw > PMAX, Treqwp = Treqw - PMAX, c_max(f,FMAX), Treqwp > FMAX, OP = FMAX, #int(OP). diff --git a/c.test1.dl b/c.test1.dl index 3875fc6..5dd6dde 100644 --- a/c.test1.dl +++ b/c.test1.dl @@ -39,17 +39,17 @@ expect_c(c,i3,half_full). expect_c(c,i4,10). % and request 0KW -expect_p(c,o1,0). +expect_c(c,o1,0). % and request 10KW -expect_p(c,o2,10). +expect_c(c,o2,10). % and request 0KW -expect_p(c,o3,0). +expect_c(c,o3,0). % do we enable the switching station? -expect_p(c,o4,1). +expect_c(c,o4,1). % and we charge out pumpspeicherkraftwerk with 0KW -expect_p(c,o5,0). +expect_c(c,o5,0). diff --git a/c.test2.dl b/c.test2.dl index 811796e..79ca5b9 100644 --- a/c.test2.dl +++ b/c.test2.dl @@ -39,17 +39,17 @@ expect_c(c,i3,half_full). expect_c(c,i4,10). % and request 15KW -expect_p(c,o1,15). +expect_c(c,o1,15). % and request 15KW -expect_p(c,o2,15). +expect_c(c,o2,15). % and request 0KW -expect_p(c,o3,0). +expect_c(c,o3,0). % do we enable the switching station? -expect_p(c,o4,1). +expect_c(c,o4,1). % and we charge out pumpspeicherkraftwerk with 0KW -expect_p(c,o5,0). +expect_c(c,o5,0). diff --git a/c.test3.dl b/c.test3.dl index 4c0364f..bd34f2e 100644 --- a/c.test3.dl +++ b/c.test3.dl @@ -39,17 +39,17 @@ expect_c(c,i3,half_full). expect_c(c,i4,10). % and request 20KW -expect_p(c,o1,20). +expect_c(c,o1,20). % and request 15KW -expect_p(c,o2,15). +expect_c(c,o2,15). % and request 15KW -expect_p(c,o3,15). +expect_c(c,o3,15). % do we enable the switching station? -expect_p(c,o4,1). +expect_c(c,o4,1). % and we charge out pumpspeicherkraftwerk with 0KW -expect_p(c,o5,0). +expect_c(c,o5,0). diff --git a/c.test4.dl b/c.test4.dl index b426c50..4dc027e 100644 --- a/c.test4.dl +++ b/c.test4.dl @@ -39,17 +39,17 @@ expect_c(c,i3,half_full). expect_c(c,i4,50). % and request 20KW -expect_p(c,o1,20). +expect_c(c,o1,20). % and request 0KW -expect_p(c,o2,0). +expect_c(c,o2,0). % and request 30KW -expect_p(c,o3,30). +expect_c(c,o3,30). % do we enable the switching station? -expect_p(c,o4,1). +expect_c(c,o4,1). % and we charge out pumpspeicherkraftwerk with 0KW -expect_p(c,o5,0). +expect_c(c,o5,0). diff --git a/c.test5.dl b/c.test5.dl index fc5847c..2f80588 100644 --- a/c.test5.dl +++ b/c.test5.dl @@ -39,17 +39,17 @@ expect_c(c,i3,empty). expect_c(c,i4,50). % and request 0KW -expect_p(c,o1,0). +expect_c(c,o1,0). % and request 0KW -expect_p(c,o2,0). +expect_c(c,o2,0). % and request 50KW -expect_p(c,o3,50). +expect_c(c,o3,50). % do we enable the switching station? -expect_p(c,o4,1). +expect_c(c,o4,1). % and we charge out pumpspeicherkraftwerk with 0KW -expect_p(c,o5,0). +expect_c(c,o5,0). diff --git a/c.test6.dl b/c.test6.dl index 1fa758b..3333785 100644 --- a/c.test6.dl +++ b/c.test6.dl @@ -39,17 +39,17 @@ expect_c(c,i3,half_full). expect_c(c,i4,0). % and request 0KW -expect_p(c,o1,0). +expect_c(c,o1,0). % and request 0KW -expect_p(c,o2,0). +expect_c(c,o2,0). % and request 0KW -expect_p(c,o3,0). +expect_c(c,o3,0). % do we enable the switching station? -expect_p(c,o4,2). +expect_c(c,o4,2). % and we charge out pumpspeicherkraftwerk with 10KW -expect_p(c,o5,10). +expect_c(c,o5,10). diff --git a/c.test7.dl b/c.test7.dl index 4d63090..480e1a5 100644 --- a/c.test7.dl +++ b/c.test7.dl @@ -39,17 +39,17 @@ expect_c(c,i3,full). expect_c(c,i4,0). % and request 0KW -expect_p(c,o1,0). +expect_c(c,o1,0). % and request 0KW -expect_p(c,o2,0). +expect_c(c,o2,0). % and request 0KW -expect_p(c,o3,0). +expect_c(c,o3,0). % do we enable the switching station? -expect_p(c,o4,0). +expect_c(c,o4,0). % and we charge out pumpspeicherkraftwerk with 0KW -expect_p(c,o5,0). +expect_c(c,o5,0). diff --git a/c.test8.dl b/c.test8.dl index 437bc54..c872e37 100644 --- a/c.test8.dl +++ b/c.test8.dl @@ -39,17 +39,17 @@ expect_c(c,i3,half_full). expect_c(c,i4,0). % and request 0KW -expect_p(c,o1,0). +expect_c(c,o1,0). % and request 0KW -expect_p(c,o2,0). +expect_c(c,o2,0). % and request 0KW -expect_p(c,o3,0). +expect_c(c,o3,0). % do we enable the switching station? -expect_p(c,o4,2). +expect_c(c,o4,2). % and we charge out pumpspeicherkraftwerk with 30KW -expect_p(c,o5,30). +expect_c(c,o5,30). diff --git a/c.test9.dl b/c.test9.dl index 19035c3..550bf5d 100644 --- a/c.test9.dl +++ b/c.test9.dl @@ -39,17 +39,17 @@ expect_c(c,i3,half_full). expect_c(c,i4,10). % and request 20KW -expect_p(c,o1,20). +expect_c(c,o1,20). % and request 15KW -expect_p(c,o2,15). +expect_c(c,o2,15). % and request 15KW -expect_p(c,o3,60). +expect_c(c,o3,60). % do we enable the switching station? -expect_p(c,o4,1). +expect_c(c,o4,1). % and we charge out pumpspeicherkraftwerk with 0KW -expect_p(c,o5,0). +expect_c(c,o5,0). diff --git a/connect.dl b/connect.dl index 0319b7a..71f3eb3 100644 --- a/connect.dl +++ b/connect.dl @@ -10,6 +10,32 @@ storage_plant(psh). c_max(f,60). c_max(w,15). c_max(psh,20). -w_charge(psh,30). +% control +c(c,i1,V) :- in_c(l_current,V). +c(c,i2,V) :- in_c(l_demand,V). +c(c,i3,V) :- in_c(s_storage,V). +c(c,i4,V) :- in_c(s_wind,V). + +% switching +p(s,i6,V) :- in_p(p_in,V). +out_p(p_out,V) :- p(s,o2,V). +p(s,i1,V) :- p(psh,op,V). +p(s,i2,V) :- p(w,op,V). +p(s,i3,V) :- p(f,op,V). +c(s,i4,V) :- c(c,o4,V). +c(s,i5,V) :- c(c,o5,V). + +% psh +c(psh,is,V) :- in_c(s_storage,V). +c(psh,i1,V) :- c(c,o1,V). +p(psh,i2,V) :- p(s,o1,V). + +% windmill +c(w,iw,V) :- in_c(s_wind,V). +c(w,i1,V) :- c(c,o2,V). + +%fuel +c(f,i1,V) :- c(c,o3,V). + diff --git a/connect.test1.dl b/connect.test1.dl index e69de29..5cd29ff 100644 --- a/connect.test1.dl +++ b/connect.test1.dl @@ -0,0 +1,10 @@ +% testing the whole system. +% predefined test + +in_c(s_storage,full). +in_c(s_wind,10). +in_c(l_demand,45). +in_c(l_current,20). +in_p(p_in,20). + +expect_out_p(p_out,45). diff --git a/psh.dl b/psh.dl index 03160d2..f04aad0 100644 --- a/psh.dl +++ b/psh.dl @@ -3,25 +3,25 @@ % if i1 > 0 and not empty produce / reditect i2. % normal discharge % not charge but powered charger input -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 > 0, MAX >= I1, OP = I1 + I2, #int(OP). +p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,I1), p(C,i2,I2), not c(C,is,empty), not c(C,i1,charge), c_max(C,MAX), I1 > 0, MAX >= I1, OP = I1 + I2, #int(OP). % over MAX discharge % not charge but powered charger input -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). +p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,I1), p(C,i2,I2), not c(C,is,empty), not c(C,i1,charge), c_max(C,MAX), I1 > MAX, OP = MAX + I2, #int(OP). % noop -p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,0), c(C,i2,0), OP = 0, #int(OP). +p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,0), p(C,i2,0), OP = 0, #int(OP). % charge but full -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). +p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,charge), p(C,i2,I2), c(C,is,full), OP = I2, #int(OP). % over MAX charge -p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,charge), c(C,i2,I2), w_charge(C,CMAX), not c(C,is,full), I2 > CMAX, OP = I2 - CMAX, #int(OP). +p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,charge), p(C,i2,I2), w_charge(C,CMAX), not c(C,is,full), I2 > CMAX, OP = I2 - CMAX, #int(OP). % charge -p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,charge), c(C,i2,I2), w_charge(C,CMAX), not c(C,is,full), I2 <= CMAX, OP = 0, #int(OP). +p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,charge), p(C,i2,I2), w_charge(C,CMAX), not c(C,is,full), I2 <= CMAX, OP = 0, #int(OP). % normal discharge but empty % not charge but powered charger input -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). +p(C,op,OP) :- not ab(C), storage_plant(C), p(C,i2,I2), c(C,is,empty), not c(C,i1,charge), OP = I2, #int(OP). diff --git a/psh.test1.dl b/psh.test1.dl index 267a4f9..2442120 100644 --- a/psh.test1.dl +++ b/psh.test1.dl @@ -15,7 +15,7 @@ w_charge(psh,30). c(psh,i1,5). % define control i2 to 0KW (we are not charging) -c(psh,i2,0). +p(psh,i2,0). % define control is to full c(psh,is,full). @@ -25,7 +25,7 @@ c(psh,is,full). expect_c(psh,i1,5). % expecting i2 to be 0 -expect_c(psh,i2,0). +expect_p(psh,i2,0). % expecting is to be full expect_c(psh,is,full). diff --git a/psh.test2.dl b/psh.test2.dl index 5df56fe..f54b8bf 100644 --- a/psh.test2.dl +++ b/psh.test2.dl @@ -15,7 +15,7 @@ w_charge(psh,30). c(psh,i1,25). % define control i2 to 0KW (we are not charging) -c(psh,i2,0). +p(psh,i2,0). % define control is to full c(psh,is,full). @@ -25,7 +25,7 @@ c(psh,is,full). expect_c(psh,i1,25). % expecting i2 to be 0 -expect_c(psh,i2,0). +expect_p(psh,i2,0). % expecting is to be full expect_c(psh,is,full). diff --git a/psh.test3.dl b/psh.test3.dl index 8f15cad..8de7521 100644 --- a/psh.test3.dl +++ b/psh.test3.dl @@ -14,7 +14,7 @@ w_charge(psh,30). c(psh,i1,0). % define control i2 to 0KW (we are not charging) -c(psh,i2,0). +p(psh,i2,0). % define control is to full c(psh,is,full). @@ -24,7 +24,7 @@ c(psh,is,full). expect_c(psh,i1,0). % expecting i2 to be 0 -expect_c(psh,i2,0). +expect_p(psh,i2,0). % expecting is to be full expect_c(psh,is,full). diff --git a/psh.test4.dl b/psh.test4.dl index b56d6f8..01385fb 100644 --- a/psh.test4.dl +++ b/psh.test4.dl @@ -14,7 +14,7 @@ w_charge(psh,30). c(psh,i1,5). % define control i2 to 5KW -c(psh,i2,5). +p(psh,i2,5). % define control is to half_full c(psh,is,half_full). @@ -24,7 +24,7 @@ c(psh,is,half_full). expect_c(psh,i1,5). % expecting i2 to be 5 -expect_c(psh,i2,5). +expect_p(psh,i2,5). % expecting is to be half_full expect_c(psh,is,half_full). diff --git a/psh.test5.dl b/psh.test5.dl index 0020c54..46a2a52 100644 --- a/psh.test5.dl +++ b/psh.test5.dl @@ -14,7 +14,7 @@ w_charge(psh,30). c(psh,i1,charge). % define control i2 to 5KW -c(psh,i2,5). +p(psh,i2,5). % define control is to full c(psh,is,full). @@ -24,7 +24,7 @@ c(psh,is,full). expect_c(psh,i1,charge). % expecting i2 to be 5 -expect_c(psh,i2,5). +expect_p(psh,i2,5). % expecting is to be full expect_c(psh,is,full). diff --git a/psh.test6.dl b/psh.test6.dl index ce884f5..0aa0896 100644 --- a/psh.test6.dl +++ b/psh.test6.dl @@ -14,7 +14,7 @@ w_charge(psh,30). c(psh,i1,charge). % define control i2 to 35KW -c(psh,i2,35). +p(psh,i2,35). % define control is to empty c(psh,is,empty). @@ -24,7 +24,7 @@ c(psh,is,empty). expect_c(psh,i1,charge). % expecting i2 to be 35 -expect_c(psh,i2,35). +expect_p(psh,i2,35). % expecting is to be empty expect_c(psh,is,empty). diff --git a/psh.test7.dl b/psh.test7.dl index 71278b1..03885c2 100644 --- a/psh.test7.dl +++ b/psh.test7.dl @@ -14,7 +14,7 @@ w_charge(psh,30). c(psh,i1,charge). % define control i2 to 5KW -c(psh,i2,5). +p(psh,i2,5). % define control is to empty c(psh,is,empty). @@ -24,7 +24,7 @@ c(psh,is,empty). expect_c(psh,i1,charge). % expecting i2 to be 5 -expect_c(psh,i2,5). +expect_p(psh,i2,5). % expecting is to be empty expect_c(psh,is,empty). diff --git a/psh.test8.dl b/psh.test8.dl index 8733161..49285b1 100644 --- a/psh.test8.dl +++ b/psh.test8.dl @@ -15,7 +15,7 @@ w_charge(psh,30). c(psh,i1,5). % define control i2 to 0KW (we are not charging) -c(psh,i2,0). +p(psh,i2,0). % define control is to empty c(psh,is,empty). @@ -25,7 +25,7 @@ c(psh,is,empty). expect_c(psh,i1,5). % expecting i2 to be 0 -expect_c(psh,i2,0). +expect_p(psh,i2,0). % expecting is to be empty expect_c(psh,is,empty). diff --git a/s.dl b/s.dl index 2c97771..0c5a8eb 100644 --- a/s.dl +++ b/s.dl @@ -1,18 +1,18 @@ % switching definition. % system inactive -p(C,o1,OP) :- not ab(C), switching(C), c(C,i4,0), c(C,i6,I6), OP = 0, #int(OP). -p(C,o2,OP) :- not ab(C), switching(C), c(C,i4,0), c(C,i6,I6), OP = I6, #int(OP). +p(C,o1,OP) :- not ab(C), switching(C), c(C,i4,0), p(C,i6,I6), OP = 0, #int(OP). +p(C,o2,OP) :- not ab(C), switching(C), c(C,i4,0), p(C,i6,I6), OP = I6, #int(OP). % system accumilation mode -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). -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). +p(C,o1,OP) :- not ab(C), switching(C), c(C,i4,1), p(C,i1,I1), p(C,i2,I2), p(C,i3,I3), p(C,i6,I6), OP = 0, #int(OP). +p(C,o2,OP) :- not ab(C), switching(C), c(C,i4,1), p(C,i1,I1), p(C,i2,I2), p(C,i3,I3), p(C,i6,I6), T1 = I1 + I2, T2 = I3 + I6, OP = T1 + T2, #int(OP). % system charge mode -p(C,o1,OP) :- not ab(C), switching(C), c(C,i4,2), c(C,i5,I5), c(C,i6,I6), I6 >= I5, OP = I5, #int(OP). -p(C,o2,OP) :- not ab(C), switching(C), c(C,i4,2), c(C,i5,I5), c(C,i6,I6), I6 >= I5, OP = I6 - I5, #int(OP). +p(C,o1,OP) :- not ab(C), switching(C), c(C,i4,2), c(C,i5,I5), p(C,i6,I6), I6 >= I5, OP = I5, #int(OP). +p(C,o2,OP) :- not ab(C), switching(C), c(C,i4,2), c(C,i5,I5), p(C,i6,I6), I6 >= I5, OP = I6 - I5, #int(OP). % system charge mode over MAX -p(C,o1,OP) :- not ab(C), switching(C), c(C,i4,2), c(C,i5,I5), c(C,i6,I6), I6 < I5, OP = I6, #int(OP). -p(C,o2,OP) :- not ab(C), switching(C), c(C,i4,2), c(C,i5,I5), c(C,i6,I6), I6 < I5, OP = 0, #int(OP). +p(C,o1,OP) :- not ab(C), switching(C), c(C,i4,2), c(C,i5,I5), p(C,i6,I6), I6 < I5, OP = I6, #int(OP). +p(C,o2,OP) :- not ab(C), switching(C), c(C,i4,2), c(C,i5,I5), p(C,i6,I6), I6 < I5, OP = 0, #int(OP). diff --git a/s.test1.dl b/s.test1.dl index 76259ee..f8593f8 100644 --- a/s.test1.dl +++ b/s.test1.dl @@ -5,13 +5,13 @@ switching(s). % define control i1 to 1KW -c(s,i1,1). +p(s,i1,1). % define control i2 to 2KW -c(s,i2,2). +p(s,i2,2). % define control i3 to 3KW -c(s,i3,3). +p(s,i3,3). % define control i4 to 0 c(s,i4,0). @@ -20,17 +20,17 @@ c(s,i4,0). c(s,i5,0). % define control i6 to 10KW -c(s,i6,10). +p(s,i6,10). % test definition. % expecting i1 to be 1 -expect_c(s,i1,1). +expect_p(s,i1,1). % expecting i2 to be 2 -expect_c(s,i2,2). +expect_p(s,i2,2). % expecting i3 to be 3 -expect_c(s,i3,3). +expect_p(s,i3,3). % expecting i4 to be 0 expect_c(s,i4,0). @@ -39,7 +39,7 @@ expect_c(s,i4,0). expect_c(s,i5,0). % expecting i6 to be 10 -expect_c(s,i6,10). +expect_p(s,i6,10). % and therefore we shall charge with 0KW expect_p(s,o1,0). diff --git a/s.test2.dl b/s.test2.dl index bab5e89..990fd59 100644 --- a/s.test2.dl +++ b/s.test2.dl @@ -5,13 +5,13 @@ switching(s). % define control i1 to 10KW -c(s,i1,10). +p(s,i1,10). % define control i2 to 20KW -c(s,i2,20). +p(s,i2,20). % define control i3 to 30KW -c(s,i3,30). +p(s,i3,30). % define control i4 to 1 c(s,i4,1). @@ -20,17 +20,17 @@ c(s,i4,1). c(s,i5,0). % define control i6 to 10KW -c(s,i6,10). +p(s,i6,10). % test definition. % expecting i1 to be 10 -expect_c(s,i1,10). +expect_p(s,i1,10). % expecting i2 to be 20 -expect_c(s,i2,20). +expect_p(s,i2,20). % expecting i3 to be 30 -expect_c(s,i3,30). +expect_p(s,i3,30). % expecting i4 to be 1 expect_c(s,i4,1). @@ -39,7 +39,7 @@ expect_c(s,i4,1). expect_c(s,i5,0). % expecting i6 to be 10 -expect_c(s,i6,10). +expect_p(s,i6,10). % and therefore we shall charge with 0KW expect_p(s,o1,0). diff --git a/s.test3.dl b/s.test3.dl index e161c94..5d13d4f 100644 --- a/s.test3.dl +++ b/s.test3.dl @@ -5,13 +5,13 @@ switching(s). % define control i1 to 1KW -c(s,i1,1). +p(s,i1,1). % define control i2 to 2KW -c(s,i2,2). +p(s,i2,2). % define control i3 to 3KW -c(s,i3,3). +p(s,i3,3). % define control i4 to 2 c(s,i4,2). @@ -20,17 +20,17 @@ c(s,i4,2). c(s,i5,5). % define control i6 to 10KW -c(s,i6,10). +p(s,i6,10). % test definition. % expecting i1 to be 1 -expect_c(s,i1,1). +expect_p(s,i1,1). % expecting i2 to be 2 -expect_c(s,i2,2). +expect_p(s,i2,2). % expecting i3 to be 3 -expect_c(s,i3,3). +expect_p(s,i3,3). % expecting i4 to be 2 expect_c(s,i4,2). @@ -39,7 +39,7 @@ expect_c(s,i4,2). expect_c(s,i5,5). % expecting i6 to be 10 -expect_c(s,i6,10). +expect_p(s,i6,10). % and therefore we shall charge with 5KW expect_p(s,o1,5). diff --git a/s.test4.dl b/s.test4.dl index 84d33de..44aac25 100644 --- a/s.test4.dl +++ b/s.test4.dl @@ -5,13 +5,13 @@ switching(s). % define control i1 to 1KW -c(s,i1,1). +p(s,i1,1). % define control i2 to 2KW -c(s,i2,2). +p(s,i2,2). % define control i3 to 3KW -c(s,i3,3). +p(s,i3,3). % define control i4 to 2 c(s,i4,2). @@ -20,17 +20,17 @@ c(s,i4,2). c(s,i5,15). % define control i6 to 10KW -c(s,i6,10). +p(s,i6,10). % test definition. % expecting i1 to be 1 -expect_c(s,i1,1). +expect_p(s,i1,1). % expecting i2 to be 2 -expect_c(s,i2,2). +expect_p(s,i2,2). % expecting i3 to be 3 -expect_c(s,i3,3). +expect_p(s,i3,3). % expecting i4 to be 2 expect_c(s,i4,2). @@ -39,7 +39,7 @@ expect_c(s,i4,2). expect_c(s,i5,15). % expecting i6 to be 10 -expect_c(s,i6,10). +expect_p(s,i6,10). % and therefore we shall charge with 10KW expect_p(s,o1,10). diff --git a/s.test5.dl b/s.test5.dl index 77b4cef..32a739f 100644 --- a/s.test5.dl +++ b/s.test5.dl @@ -5,13 +5,13 @@ switching(s). % define control i1 to 10KW -c(s,i1,10). +p(s,i1,10). % define control i2 to 10KW -c(s,i2,10). +p(s,i2,10). % define control i3 to 10KW -c(s,i3,10). +p(s,i3,10). % define control i4 to 1 c(s,i4,1). @@ -20,17 +20,17 @@ c(s,i4,1). c(s,i5,0). % define control i6 to 10KW -c(s,i6,10). +p(s,i6,10). % test definition. % expecting i1 to be 10 -expect_c(s,i1,10). +expect_p(s,i1,10). % expecting i2 to be 10 -expect_c(s,i2,10). +expect_p(s,i2,10). % expecting i3 to be 10 -expect_c(s,i3,10). +expect_p(s,i3,10). % expecting i4 to be 1 expect_c(s,i4,1). @@ -39,7 +39,7 @@ expect_c(s,i4,1). expect_c(s,i5,0). % expecting i6 to be 10 -expect_c(s,i6,10). +expect_p(s,i6,10). % and therefore we shall charge with 0KW expect_p(s,o1,0). -- 2.43.0