From 368b7b5d24b66b4c71847b2a6531d038c982c923 Mon Sep 17 00:00:00 2001 From: someone Date: Tue, 5 Jun 2012 02:22:42 +0200 Subject: [PATCH] switching tests updatet --- s.dl | 26 ++++++++++++++++++++++++++ s.test1.dl | 30 +++++++++++++++--------------- s.test2.dl | 30 +++++++++++++++--------------- s.test3.dl | 30 +++++++++++++++--------------- s.test4.dl | 30 +++++++++++++++--------------- 5 files changed, 86 insertions(+), 60 deletions(-) diff --git a/s.dl b/s.dl index e69de29..ed9965d 100644 --- a/s.dl +++ b/s.dl @@ -0,0 +1,26 @@ +% switching definition. + +% system inactive +p(C,o1,O1) :- not ab(C), switching(C), c(C,i4,0), c(C,i6,I6), O1 = 0, O2 = I6, #int(O1), #int(O2). +p(C,o2,O2) :- not ab(C), switching(C), c(C,i4,0), c(C,i6,I6), O1 = 0, O2 = I6, #int(O1), #int(O2). + +% 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). + +% noop +%p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,0), c(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). + +% over MAX charge +%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). + +% charge +%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). + +% 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). + diff --git a/s.test1.dl b/s.test1.dl index b195e3f..76259ee 100644 --- a/s.test1.dl +++ b/s.test1.dl @@ -1,49 +1,49 @@ -% testing a switching centerk +% testing a switching center % system inactive % In case i4 = 0, the system is inactive and the incoming energy i6 is redirected to o2. Furthermore, o1 = 0 as the pumped-storage hydropower plant psh should not receive energy. switching(s). % define control i1 to 1KW -c(psh,i1,1). +c(s,i1,1). % define control i2 to 2KW -c(psh,i2,2). +c(s,i2,2). % define control i3 to 3KW -c(psh,i3,3). +c(s,i3,3). % define control i4 to 0 -c(psh,i4,0). +c(s,i4,0). % define control i5 to 0KW -c(psh,i5,0). +c(s,i5,0). % define control i6 to 10KW -c(psh,i6,10). +c(s,i6,10). % test definition. % expecting i1 to be 1 -expect_c(psh,i1,1). +expect_c(s,i1,1). % expecting i2 to be 2 -expect_c(psh,i2,2). +expect_c(s,i2,2). % expecting i3 to be 3 -expect_c(psh,i3,3). +expect_c(s,i3,3). % expecting i4 to be 0 -expect_c(psh,i4,0). +expect_c(s,i4,0). % expecting i5 to be 0 -expect_c(psh,i5,0). +expect_c(s,i5,0). % expecting i6 to be 10 -expect_c(psh,i6,10). +expect_c(s,i6,10). % and therefore we shall charge with 0KW -expect_p(psh,o1,0). +expect_p(s,o1,0). % and return 10KW -expect_p(psh,o2,10). +expect_p(s,o2,10). diff --git a/s.test2.dl b/s.test2.dl index dc3bd6b..bebc97a 100644 --- a/s.test2.dl +++ b/s.test2.dl @@ -1,49 +1,49 @@ -% testing a switching centerk +% testing a switching center % system accumilation mode % In case i4 = 0, the system is inactive and the incoming energy i6 is redirected to o2. Furthermore, o1 = 0 as the pumped-storage hydropower plant psh should not receive energy. switching(s). % define control i1 to 10KW -c(psh,i1,10). +c(s,i1,10). % define control i2 to 20KW -c(psh,i2,20). +c(s,i2,20). % define control i3 to 30KW -c(psh,i3,30). +c(s,i3,30). % define control i4 to 1 -c(psh,i4,1). +c(s,i4,1). % define control i5 to 0KW -c(psh,i5,0). +c(s,i5,0). % define control i6 to 10KW -c(psh,i6,10). +c(s,i6,10). % test definition. % expecting i1 to be 10 -expect_c(psh,i1,10). +expect_c(s,i1,10). % expecting i2 to be 20 -expect_c(psh,i2,20). +expect_c(s,i2,20). % expecting i3 to be 30 -expect_c(psh,i3,30). +expect_c(s,i3,30). % expecting i4 to be 1 -expect_c(psh,i4,1). +expect_c(s,i4,1). % expecting i5 to be 0 -expect_c(psh,i5,0). +expect_c(s,i5,0). % expecting i6 to be 10 -expect_c(psh,i6,10). +expect_c(s,i6,10). % and therefore we shall charge with 0KW -expect_p(psh,o1,0). +expect_p(s,o1,0). % and return 70KW -expect_p(psh,o2,70). +expect_p(s,o2,70). diff --git a/s.test3.dl b/s.test3.dl index 0137681..f9dae23 100644 --- a/s.test3.dl +++ b/s.test3.dl @@ -1,49 +1,49 @@ -% testing a switching centerk +% testing a switching center % system charge mode % In case i4 = 0, the system is inactive and the incoming energy i6 is redirected to o2. Furthermore, o1 = 0 as the pumped-storage hydropower plant psh should not receive energy. switching(s). % define control i1 to 1KW -c(psh,i1,1). +c(s,i1,1). % define control i2 to 2KW -c(psh,i2,2). +c(s,i2,2). % define control i3 to 3KW -c(psh,i3,3). +c(s,i3,3). % define control i4 to 2 -c(psh,i4,2). +c(s,i4,2). % define control i5 to 5KW -c(psh,i5,5). +c(s,i5,5). % define control i6 to 10KW -c(psh,i6,10). +c(s,i6,10). % test definition. % expecting i1 to be 1 -expect_c(psh,i1,1). +expect_c(s,i1,1). % expecting i2 to be 2 -expect_c(psh,i2,2). +expect_c(s,i2,2). % expecting i3 to be 3 -expect_c(psh,i3,3). +expect_c(s,i3,3). % expecting i4 to be 2 -expect_c(psh,i4,2). +expect_c(s,i4,2). % expecting i5 to be 5 -expect_c(psh,i5,5). +expect_c(s,i5,5). % expecting i6 to be 10 -expect_c(psh,i6,10). +expect_c(s,i6,10). % and therefore we shall charge with 5KW -expect_p(psh,o1,5). +expect_p(s,o1,5). % and return 5KW -expect_p(psh,o2,5). +expect_p(s,o2,5). diff --git a/s.test4.dl b/s.test4.dl index 69822f0..a1e1783 100644 --- a/s.test4.dl +++ b/s.test4.dl @@ -1,49 +1,49 @@ -% testing a switching centerk +% testing a switching center % system charge mode over MAX % In case i4 = 0, the system is inactive and the incoming energy i6 is redirected to o2. Furthermore, o1 = 0 as the pumped-storage hydropower plant psh should not receive energy. switching(s). % define control i1 to 1KW -c(psh,i1,1). +c(s,i1,1). % define control i2 to 2KW -c(psh,i2,2). +c(s,i2,2). % define control i3 to 3KW -c(psh,i3,3). +c(s,i3,3). % define control i4 to 2 -c(psh,i4,2). +c(s,i4,2). % define control i5 to 15KW -c(psh,i5,15). +c(s,i5,15). % define control i6 to 10KW -c(psh,i6,10). +c(s,i6,10). % test definition. % expecting i1 to be 1 -expect_c(psh,i1,1). +expect_c(s,i1,1). % expecting i2 to be 2 -expect_c(psh,i2,2). +expect_c(s,i2,2). % expecting i3 to be 3 -expect_c(psh,i3,3). +expect_c(s,i3,3). % expecting i4 to be 2 -expect_c(psh,i4,2). +expect_c(s,i4,2). % expecting i5 to be 15 -expect_c(psh,i5,15). +expect_c(s,i5,15). % expecting i6 to be 10 -expect_c(psh,i6,10). +expect_c(s,i6,10). % and therefore we shall charge with 10KW -expect_p(psh,o1,10). +expect_p(s,o1,10). % and return 5KW -expect_p(psh,o2,0). +expect_p(s,o2,0). -- 2.43.0