From d6ec1f83eb9fc5b5a4ba1146a668505896794115 Mon Sep 17 00:00:00 2001 From: someone Date: Tue, 5 Jun 2012 00:43:44 +0200 Subject: [PATCH] psh updates --- psh.dl | 19 +++++++++++++++---- psh.test4.dl | 8 ++++---- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/psh.dl b/psh.dl index b3b6fd8..2dd239a 100644 --- a/psh.dl +++ b/psh.dl @@ -1,8 +1,19 @@ % pumpspeicherkraftwerk definition. -% if i1 > 0 produce -p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,0), c(C,i2,I2),OP = I2, #int(OP). -p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,I1), c(C,i2,I2),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),c_max(C,MAX), I1 > MAX, OP = MAX + I2, #int(OP). + +% 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). + +% 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). + + + +%p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,0), c(C,i2,I2),OP = I2, #int(OP). +%p(C,op,OP) :- not ab(C), storage_plant(C), c(C,i1,I1), c(C,i2,I2),c_max(C,MAX), I1 > 0, MAX >= I1, OP = I1 + I2, #int(OP). %psh_empty(C) :- storage_plant(C), -c(C,is,full), -c(C,is,half_full). %psh_not_full(C) :- storage_plant(C), c(C,is,empty) | c(C,is,half_full). diff --git a/psh.test4.dl b/psh.test4.dl index 175219a..087f807 100644 --- a/psh.test4.dl +++ b/psh.test4.dl @@ -16,8 +16,8 @@ c(psh,i1,5). % define control i2 to 5KW c(psh,i2,5). -% define control is to empty -c(psh,is,empty). +% define control is to half_full +c(psh,is,half_full). % test definition. % expecting i1 to be 5 @@ -26,8 +26,8 @@ expect_c(psh,i1,5). % expecting i2 to be 5 expect_c(psh,i2,5). -% expecting is to be empty -expect_c(psh,is,empty). +% expecting is to be half_full +expect_c(psh,is,half_full). % and therefore we shall produce 10KW expect_p(psh,op,10). -- 2.43.0