Fuel
if ($.Gas < 0) { problem("GasEmpty") }

Gas: 34033.75 [kWs]
HeatConsumer
var delta = $.Demand * dt if (#HeatStorage.$.Energy > delta) { #HeatStorage.$.Energy -= delta $.Consumed += delta // TODO consume Extra } else { $.Extra += delta problem("RoomToCold") }

Consumed: 300 [kWs] Extra: 9.9 [kWs] Demand: 3 [kW] Stopped: false
ThermalPowerStation
var full = $.Max * $.Factor if ($.Heat < full && #Fuel.$.Gas > $.Max * dt && (#Battery.$.Energy < 0.9 * #Battery.$.Max )) { var gas = $.Max * dt #Fuel.$.Gas -= gas $.Heat += 1.0 * gas } var delta = $.Heat / $.Factor * dt if ($.Heat > 2) { $.Heat -= delta if(#HeatStorage.$.Energy < #HeatStorage.$.Max) { #HeatStorage.$.Energy += 0.5 * delta } if (#Battery.$.Energy < #Battery.$.Max ) { #Battery.$.Energy += 0.4 * delta } }

Heat: 22.9094 Factor: 10 Max: 7.5 Stopped: false
HeatStorage


Energy: 303.4647 [kWs] Max: 360 [kWs]
Battery


Energy: 326.9534 Max: 360
ResetSimulation
#MeasureData.$.Time = Date.now() / 1000 #MeasureData.$.Start = #MeasureData.$.Time #Fuel.$.Gas = 5 * 2 * 3600 // two hours gas #HeatStorage.$.Energy = 0 #Battery.$.Energy = 0 #ElectricConsumer.$.Consumed = 0 #ElectricConsumer.$.Demand = 1.5 #ElectricConsumer.$.Extra = 0 #HeatConsumer.$.Consumed = 0 #HeatConsumer.$.Demand = 3 #HeatConsumer.$.Extra = 0 #ThermalPowerStation.$.Heat = 0 #HeatingSystem.$.Heat = 0 #MeasureData.$.Counter = 10000 #SimulationResults.resetData() #SimulationResults.showData() #Battery.$.Max = 0.1 * 3600 // 1h 2kw #HeatStorage.$.Max = 0.1 * 3600 // 1h 3kw

Stopped: true
show
0 Gas Heat Battery ConsumedPower ConsumedHeat TWP HS Total Time 1 359.9875 0 0 0 0 0.75 0.4995 359.999995 1390987598.1079998 2 359.35 0.258739 0.051683 0.03454 0.063 30.235809 23.174858 359.984751 1390987603.207995 3 358.7125 2.484045 0.927045 0.10818 0.21 47.887436 40.392208 359.947587 1390987608.30799 4 358.075 10.75599 4.338756 0.184773 0.363 58.459984 53.725685 359.895577 1390987613.4079852 5 357.4375 23.554165 9.446827 0.261362 0.516 64.792475 64.051409 359.833311 1390987618.5079803 6 356.8 39.485557 15.561017 0.338048 0.669 68.585359 72.047867 359.763846 1390987623.6079755 7 356.1625 57.620572 22.277026 0.414801 0.822 70.857129 78.240492 359.689253 1390987628.7079706 8 355.525 77.328667 29.361529 0.491513 0.975 72.21782 83.036191 359.610955 1390987633.8079658 9 354.8875 98.175059 36.678808 0.568081 1.128 73.032813 86.75008 359.529948 1390987638.907961 10 354.385 119.130855 44.127135 0.644645 1.281 73.520959 77.031494 359.448749 1390987644.007956 11 354.0025 136.711016 51.636354 0.721383 1.434 73.813336 59.654806 359.376038 1390987649.1079512 12 353.62 151.213953 59.19383 0.798108 1.587 73.988458 46.197934 359.31105 1390987654.2079463 13 353.2375 163.323536 66.78171 0.87481 1.74 74.093348 35.77665 359.252062 1390987659.3079414 14 352.855 173.573492 74.388639 0.951489 1.893 74.156172 27.706189 359.197734 1390987664.4079366 15 352.4725 182.379625 82.008867 1.028136 2.046 74.193801 21.456255 359.147022 1390987669.5079317 16 352.09 190.065421 89.63795 1.104755 2.199 74.216339 16.616174 359.099114 1390987674.6079268 17 351.7075 196.882279 97.261987 1.181461 2.352 74.229839 12.867914 359.053381 1390987679.707922 18 351.325 203.025421 104.882223 1.258226 2.505 74.237924 9.965183 359.009334 1390987684.807917 19 350.9425 206.848 112.503528 1.334994 2.658 74.242767 9.469459 358.966131 1390987689.9079123 20 350.56 210.67155 120.133907 1.411678 2.811 74.245668 8.998395 358.923173 1390987695.0079074 21 350.1775 214.495681 127.77052 1.488305 2.964 74.247405 8.550765 358.880449 1390987700.1079025 22 349.795 218.320161 135.393334 1.565073 3.117 74.248446 8.125402 358.837946 1390987705.2078977 23 349.4125 222.144849 143.014222 1.641862 3.27 74.249069 7.721199 358.795655 1390987710.3078928 24 349.03 225.969662 150.637536 1.718627 3.423 74.249442 7.337104 358.753564 1390987715.407888 25 348.6475 229.79455 158.262222 1.795379 3.576 74.249666 6.972115 358.711665 1390987720.507883 26 348.265 233.619483 165.9024 1.871977 3.729 74.2498 6.625283 358.669946 1390987725.6078782 27 347.8825 237.444443 173.533448 1.948666 3.882 74.24988 6.295705 358.628401 1390987730.7078733 28 347.5 241.269419 181.153468 2.025466 4.035 74.249928 5.982521 358.587019 1390987735.8078685 29 347.1175 245.094405 188.787982 2.10212 4.188 74.249957 5.684917 358.545793 1390987740.9078636 30 346.735 248.919396 196.426756 2.178733 4.341 74.249974 5.402118 358.504715 1390987746.0078588 31 346.3525 252.744391 204.060803 2.255392 4.494 74.249985 5.133386 358.463778 1390987751.107854 32 345.97 256.569388 211.692464 2.332075 4.647 74.249991 4.878023 358.422974 1390987756.207849 33 345.5875 260.394386 219.315189 2.408848 4.8 74.249994 4.635363 358.382297 1390987761.3078442 34 345.205 264.219385 226.933779 2.485662 4.953 74.249997 4.404774 358.341742 1390987766.4078393 35 344.8225 268.044384 234.568464 2.562315 5.106 74.249998 4.185656 358.3013 1390987771.5078344 36 344.44 271.869384 242.208638 2.638914 5.259 74.249999 3.977438 358.260968 1390987776.6078296 37 344.0575 275.694384 249.84785 2.715521 5.412 74.249999 3.779578 358.22074 1390987781.7078247 38 343.675 279.519384 257.472981 2.79227 5.565 74.25 3.591561 358.180609 1390987786.8078198 39 343.2925 283.344384 265.088634 2.869114 5.718 74.25 3.412897 358.140573 1390987791.907815 40 342.91 287.169384 272.700553 2.945994 5.871 74.25 3.24312 358.100625 1390987797.00781 41 342.5275 290.994383 280.32417 3.022758 6.024 74.25 3.081789 358.060762 1390987802.1078053 42 342.145 294.819383 287.956393 3.099436 6.177 74.25 2.928484 358.020979 1390987807.2078004 43 341.7625 298.644383 295.60236 3.175976 6.33 74.25 2.782805 357.981272 1390987812.3077955 44 341.38 302.469383 303.241438 3.252586 6.483 74.25 2.644373 357.941638 1390987817.4077907 45 340.9975 306.294383 310.873961 3.32926 6.636 74.25 2.512827 357.902072 1390987822.5077858 46 340.615 310.119383 318.503559 3.405964 6.789 74.25 2.387825 357.862572 1390987827.607781 47 340.3375 313.567195 325.820095 3.482782 6.942 64.504377 2.269041 357.823889 1390987832.707776 48 340.3375 311.201742 328.48252 3.559634 7.095 38.635284 2.156166 357.796891 1390987837.8077712 49 340.3375 303.648966 327.011233 3.636324 7.248 23.140835 2.048907 357.780324 1390987842.9077663
10:27:3010:28:3010:29:3010:30:30050100150200250300350GasHeatBatteryConsumedPowerConsumedHeatTWPHSTotal
Step
Reset
start
stopped
Steps:
50
Time:
0.1
ElectricConsumer
$.Demand += (Math.random() - 0.5) * 0.01 * dt var delta = $.Demand * dt if (#Battery.$.Energy > delta) { #Battery.$.Energy -= delta $.Consumed += delta } else { $.Extra += delta problem("EngeryToLow") }

Consumed: 363.7829 Demand: 1.5043 Extra: 4.6536
HeatingSystem
var full = $.Max * $.Factor if ($.Heat < full && #Fuel.$.Gas > $.Max * dt && #HeatStorage.$.Energy < 0.3 * #HeatStorage.$.Max) { var gas = $.Max * dt #Fuel.$.Gas -= gas $.Heat += gas } var delta = ($.Heat / $.Factor) * dt if ($.Heat > 2 * $.Max && #HeatStorage.$.Energy < #HeatStorage.$.Max ) { $.Heat -= delta #HeatStorage.$.Energy += 0.8 * delta } else { $.Heat -= 0.2 * delta }

Heat: 2.0469 [kW/s] Stopped: false Factor: 20 Max: 5 [kW]
MeasureData
$.Time += dt $.Counter += dt if ($.Counter < 5) return $.Counter = 0 var data = { Gas: #Fuel.$.Gas, Heat: #HeatStorage.$.Energy, Battery: #Battery.$.Energy, ConsumedPower: #ElectricConsumer.$.Consumed, ConsumedHeat: #HeatConsumer.$.Consumed, TWP: #ThermalPowerStation.$.Heat, HS: #HeatingSystem.$.Heat, } data.Total = Properties.values(data).sum() var factor = 0.01 // scale, so that it fits into vis data.Gas *= factor data.ConsumedPower *= factor data.ConsumedHeat *= factor data.Total *= factor Properties.own(data).each(function(ea) { data[ea] = data[ea].roundTo(0.000001) }) data.Time = $.Time, #SimulationResults.addData(data)

Counter: 0.1 Time: 1390987843.0078 Start: 1390987598.008