From cbe1cf80ee1332a63242bd0d9e6ed60cdd137a0b Mon Sep 17 00:00:00 2001 From: someone Date: Tue, 5 Jun 2012 00:57:32 +0200 Subject: [PATCH] psh updates --- psh.dl | 19 +++++++++++++++---- psh.test8.dl | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 psh.test8.dl diff --git a/psh.dl b/psh.dl index 2dd239a..3dcc43e 100644 --- a/psh.dl +++ b/psh.dl @@ -1,14 +1,25 @@ % pumpspeicherkraftwerk definition. % if i1 > 0 and not empty produce / reditect i2. -p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,I1), c(C,i2,I2), not c(C,is,empty), 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), c(C,i2,I2), not c(C,is,empty) ,c_max(C,MAX), I1 > MAX, OP = MAX + I2, #int(OP). +% 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). + +% 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). -% not charge but powered charger input -p(C,op,OP) :- not ab(C), storage_plant(C), not c(C,i1,I1), c(C,i2,I2), not c(C,i1,charge), I2 > 0, I1 > 0, OP = I1 + I2, #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). diff --git a/psh.test8.dl b/psh.test8.dl new file mode 100644 index 0000000..fbbe336 --- /dev/null +++ b/psh.test8.dl @@ -0,0 +1,35 @@ +% testing a pumpspeicherkraftwerk +% normal discharge but empty +% In case c_max > i1 > 0 and is not empty, it produces energy, so op = i1. +% The storage plant can only generate power if it is not empty (is not empty). + +storage_plant(psh). + +% define max capacity +c_max(psh,20). + +% define max charging power +charge_max(psh,30). + +% define control i1 to 5KW (we request 5KW) +c(psh,i1,5). + +% define control i2 to 0KW (we are not charging) +c(psh,i2,0). + +% define control is to empty +c(psh,is,empty). + +% test definition. +% expecting i1 to be 5 +expect_c(psh,i1,5). + +% expecting i2 to be 0 +expect_c(psh,i2,0). + +% expecting is to be empty +expect_c(psh,is,empty). + +% and therefore we shall produce 0KW +expect_p(psh,op,0). + -- 2.43.0