-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chpmodelspec and cylindricalthermalstoragespec without storagevolumelvlmin #1046
base: dev
Are you sure you want to change the base?
Changes from all commits
ceaefb2
cd258ef
d1d2a63
9339ffc
fbf8c4b
75b1ac7
f8adf3a
40a3c93
bd287d8
19e32ef
e3aae40
bfcd012
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -50,7 +50,7 @@ class ChpModelSpec | |||
val chpStateNotRunning: ChpState = | ||||
ChpState(isRunning = false, 0, Kilowatts(0), KilowattHours(0)) | ||||
val chpStateRunning: ChpState = | ||||
ChpState(isRunning = true, 0, Kilowatts(0), KilowattHours(0)) | ||||
ChpState(isRunning = true, 0, Kilowatts(42), KilowattHours(42)) | ||||
|
||||
val (storageInput, chpInput) = setupSpec() | ||||
|
||||
|
@@ -62,7 +62,7 @@ class ChpModelSpec | |||
"ThermalStorage", | ||||
thermalBus, | ||||
getQuantity(100, StandardUnits.VOLUME), | ||||
getQuantity(20, StandardUnits.VOLUME), | ||||
getQuantity(0, StandardUnits.VOLUME), | ||||
getQuantity(30, StandardUnits.TEMPERATURE), | ||||
getQuantity(40, StandardUnits.TEMPERATURE), | ||||
getQuantity(1.15, StandardUnits.SPECIFIC_HEAT_CAPACITY), | ||||
|
@@ -145,26 +145,26 @@ class ChpModelSpec | |||
"Check active power after calculating next state with #chpState and heat demand #heatDemand kWh:" in { | ||||
val testCases = Table( | ||||
("chpState", "storageLvl", "heatDemand", "expectedActivePower"), | ||||
(chpStateNotRunning, 90, 0, 0), // tests case (false, false, true) | ||||
(chpStateNotRunning, 70, 0, 0), // tests case (false, false, true) | ||||
( | ||||
chpStateNotRunning, | ||||
90, | ||||
70, | ||||
8 * 115, | ||||
95, | ||||
), // tests case (false, true, false) | ||||
(chpStateNotRunning, 90, 10, 0), // tests case (false, true, true) | ||||
(chpStateRunning, 90, 0, 95), // tests case (true, false, true) | ||||
(chpStateRunning, 90, 8 * 115, 95), // tests case (true, true, false) | ||||
(chpStateRunning, 90, 10, 95), // tests case (true, true, true) | ||||
(chpStateNotRunning, 70, 10, 0), // tests case (false, true, true) | ||||
(chpStateRunning, 70, 0, 95), // tests case (true, false, true) | ||||
(chpStateRunning, 70, 8 * 115, 95), // tests case (true, true, false) | ||||
(chpStateRunning, 70, 10, 95), // tests case (true, true, true) | ||||
( | ||||
chpStateRunning, | ||||
90, | ||||
70, | ||||
7 * 115 + 1, | ||||
95, | ||||
), // test case (_, true, false) and demand covered together with chp | ||||
( | ||||
chpStateRunning, | ||||
90, | ||||
70, | ||||
9 * 115, | ||||
95, | ||||
), // test case (_, true, false) and demand not covered together with chp | ||||
|
@@ -190,26 +190,28 @@ class ChpModelSpec | |||
"Check total energy after calculating next state with #chpState and heat demand #heatDemand kWh:" in { | ||||
val testCases = Table( | ||||
("chpState", "storageLvl", "heatDemand", "expectedTotalEnergy"), | ||||
(chpStateNotRunning, 90, 0, 0), // tests case (false, false, true) | ||||
(chpStateNotRunning, 70, 0, 0), // tests case (false, false, true) | ||||
// Fixme Check this, why 100? | ||||
( | ||||
chpStateNotRunning, | ||||
90, | ||||
70, | ||||
8 * 115, | ||||
100, | ||||
), // tests case (false, true, false) | ||||
(chpStateNotRunning, 90, 10, 0), // tests case (false, true, true) | ||||
(chpStateRunning, 90, 0, 100), // tests case (true, false, true) | ||||
(chpStateRunning, 90, 8 * 115, 100), // tests case (true, true, false) | ||||
(chpStateRunning, 90, 10, 100), // tests case (true, true, true) | ||||
(chpStateNotRunning, 70, 10, 0), // tests case (false, true, true) | ||||
// Fixme Check this, why 100? | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
see above |
||||
(chpStateRunning, 70, 0, 100), // tests case (true, false, true) | ||||
(chpStateRunning, 70, 8 * 115, 100), // tests case (true, true, false) | ||||
(chpStateRunning, 70, 10, 100), // tests case (true, true, true) | ||||
( | ||||
chpStateRunning, | ||||
90, | ||||
70, | ||||
7 * 115 + 1, | ||||
100, | ||||
), // test case (_, true, false) and demand covered together with chp | ||||
( | ||||
chpStateRunning, | ||||
90, | ||||
70, | ||||
9 * 115, | ||||
100, | ||||
), // test case (_, true, false) and demand not covered together with chp | ||||
|
@@ -236,29 +238,33 @@ class ChpModelSpec | |||
"Check storage level after calculating next state with #chpState and heat demand #heatDemand kWh:" in { | ||||
val testCases = Table( | ||||
("chpState", "storageLvl", "heatDemand", "expectedStoredEnergy"), | ||||
(chpStateNotRunning, 90, 0, 1035), // tests case (false, false, true) | ||||
(chpStateNotRunning, 70, 0, 805), // tests case (false, false, true) | ||||
( | ||||
chpStateNotRunning, | ||||
90, | ||||
70, | ||||
// todo check this | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
outdated imho |
||||
8 * 115, | ||||
230, | ||||
0, | ||||
), // tests case (false, true, false) | ||||
(chpStateNotRunning, 90, 10, 1025), // tests case (false, true, true) | ||||
(chpStateRunning, 90, 0, 1135), // tests case (true, false, true) | ||||
(chpStateRunning, 90, 8 * 115, 230), // tests case (true, true, false) | ||||
(chpStateRunning, 90, 10, 1125), // tests case (true, true, true) | ||||
(chpStateNotRunning, 70, 10, 795), // tests case (false, true, true) | ||||
// todo check this, why 1135? | ||||
(chpStateRunning, 70, 0, 905), // tests case (true, false, true) | ||||
(chpStateRunning, 70, 8 * 115, 0), // tests case (true, true, false) | ||||
(chpStateRunning, 70, 10, 895), // tests case (true, true, true) | ||||
// todo, why not +100? | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
demand is 806 kWh, chp will do 100 kWh, remaining demand is 706 kWh, storage contains 805 kWh so 99 will be in the end within the the storage. Or do I made any failure here? |
||||
( | ||||
chpStateRunning, | ||||
90, | ||||
70, | ||||
806, | ||||
329, | ||||
99, | ||||
), // test case (_, true, false) and demand covered together with chp | ||||
( | ||||
chpStateRunning, | ||||
90, | ||||
70, | ||||
9 * 115, | ||||
230, | ||||
0, | ||||
), // test case (_, true, false) and demand not covered together with chp | ||||
// todo check this, why 92? | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. imho: If the storage contains 92 m³ this represents 1058 kWh. + 100 kWh from Chp => 1158 which is more than 1150 of the storage volume. Thus explains in my opinion the comment below, (chp) test case AND storage volume exceeds maximum. Also I'm still not fully happy with the comment since it's hard to understand. If you agree or have a better formulation, please go ahead. |
||||
( | ||||
chpStateRunning, | ||||
92, | ||||
|
@@ -281,48 +287,54 @@ class ChpModelSpec | |||
} | ||||
|
||||
"Check time tick and running status after calculating next state with #chpState and heat demand #heatDemand kWh:" in { | ||||
val testCases = Seq( | ||||
// (ChpState, Storage Level, Heat Demand, Expected Time Tick, Expected Running Status) | ||||
val testCases = Table( | ||||
( | ||||
"chpState", | ||||
"storageLvl", | ||||
"heatDemand", | ||||
"expectedTick", | ||||
"expectedRunningStatus", | ||||
), | ||||
( | ||||
chpStateNotRunning, | ||||
90, | ||||
70, | ||||
0, | ||||
7200, | ||||
false, | ||||
), // Test case (false, false, true) | ||||
( | ||||
chpStateNotRunning, | ||||
90, | ||||
70, | ||||
8 * 115, | ||||
7200, | ||||
true, | ||||
), // Test case (false, true, false) | ||||
( | ||||
chpStateNotRunning, | ||||
90, | ||||
70, | ||||
10, | ||||
7200, | ||||
false, | ||||
), // Test case (false, true, true) | ||||
(chpStateRunning, 90, 0, 7200, true), // Test case (true, false, true) | ||||
(chpStateRunning, 70, 0, 7200, true), // Test case (true, false, true) | ||||
( | ||||
chpStateRunning, | ||||
90, | ||||
70, | ||||
8 * 115, | ||||
7200, | ||||
true, | ||||
), // Test case (true, true, false) | ||||
(chpStateRunning, 90, 10, 7200, true), // Test case (true, true, true) | ||||
(chpStateRunning, 70, 10, 7200, true), // Test case (true, true, true) | ||||
( | ||||
chpStateRunning, | ||||
90, | ||||
70, | ||||
806, | ||||
7200, | ||||
true, | ||||
), // Test case (_, true, false) and demand covered together with chp | ||||
( | ||||
chpStateRunning, | ||||
90, | ||||
70, | ||||
9 * 115, | ||||
7200, | ||||
true, | ||||
|
@@ -336,23 +348,22 @@ class ChpModelSpec | |||
), // Test case (true, true, true) and storage volume exceeds maximum | ||||
) | ||||
|
||||
for ( | ||||
forAll(testCases) { | ||||
( | ||||
chpState, | ||||
storageLvl, | ||||
heatDemand, | ||||
expectedTimeTick, | ||||
expectedRunningStatus, | ||||
) <- testCases | ||||
) { | ||||
val chpData = buildChpRelevantData(chpState, heatDemand) | ||||
val thermalStorage = buildThermalStorage(storageInput, storageLvl) | ||||
val chpModel = buildChpModel(thermalStorage) | ||||
chpState, | ||||
storageLvl, | ||||
heatDemand, | ||||
expectedTick, | ||||
expectedRunningStatus, | ||||
) => | ||||
val chpData = buildChpRelevantData(chpState, heatDemand) | ||||
val thermalStorage = buildThermalStorage(storageInput, storageLvl) | ||||
val chpModel = buildChpModel(thermalStorage) | ||||
|
||||
val nextState = chpModel.calculateNextState(chpData) | ||||
val nextState = chpModel.calculateNextState(chpData) | ||||
|
||||
nextState.lastTimeTick shouldEqual expectedTimeTick | ||||
nextState.isRunning shouldEqual expectedRunningStatus | ||||
nextState.lastTimeTick shouldEqual expectedTick | ||||
nextState.isRunning shouldEqual expectedRunningStatus | ||||
} | ||||
} | ||||
|
||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like I said, a fresh view the next day make things easier: 50 kW for TWO hours = 100 kWh :)