Skip to content

Commit 0fb7fe0

Browse files
authored
Energy management class (#262)
* initial setup energy management class * setters and getters to energyManagement * cleanup and removal of (very) old code. + initialization of default EMS * Update Class.J_EnergyManagementDefault.java * energy management is becoming owner of subManagements. A variable amount. * sub management interface + improvements to default interface * improvements and finalizing port from p_managagements on gc canvas to ems * updates to the EMS classes * EMS updates, in progress * refactor and modularisation of f_connectToJ_EA (and remove) + adding c_flex/fixedAssets to GC + adding checks to EMS. * cleanup of canvas, and added remove method to I_EnergyManagement interface. * added p_chargepoint creation if not present when adding charging management. * storage heat toegeovegd aan de check * to string added to default EMS + cleanup of canvas + avgc additions * additional checks added * added cap to maximal extractable energy from heatStorage. Losses can still make temp go below minTemperature!
1 parent 7b63def commit 0fb7fe0

65 files changed

Lines changed: 1675 additions & 3964 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Zero_engine.alpx

Lines changed: 109 additions & 64 deletions
Large diffs are not rendered by default.

_alp/Agents/EnergyModel/Code/Functions.java

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,6 @@
240240
for (J_EA EA : c_energyAssets) {
241241
EA.storeStatesAndReset();
242242
}
243-
for (I_AssetManagement AM : c_assetManagement) {
244-
AM.storeStatesAndReset();
245-
}
246243

247244

248245
for (GridConnection GC : c_gridConnections) {
@@ -261,13 +258,13 @@
261258
GC.f_resetStates();
262259

263260
GC.c_tripTrackers.forEach(tt->{
264-
tt.storeAndResetState();
261+
tt.storeStatesAndReset();
265262
tt.setStartIndex(p_timeVariables, GC.f_getChargePoint());
266263
//tt.prepareNextActivity(p_runStartTime_h*60, GC.f_getChargePoint());
267264
});
268265
if (GC instanceof GCHouse) {
269266
if (((GCHouse)GC).p_cookingTracker != null) {
270-
((GCHouse)GC).p_cookingTracker.storeAndResetState();
267+
((GCHouse)GC).p_cookingTracker.storeStatesAndReset();
271268
}
272269
}
273270
}
@@ -386,9 +383,6 @@
386383
for (J_EA EA : c_energyAssets) {
387384
EA.restoreStates();
388385
}
389-
for (I_AssetManagement AM : c_assetManagement) {
390-
AM.restoreStates();
391-
}
392386

393387
/*for (GridNode GN : pop_gridNodes) {
394388
//Has no reset states
@@ -397,13 +391,13 @@
397391
for (GridConnection GC : c_gridConnections) {
398392
GC.f_resetStatesAfterRapidRun();
399393
GC.c_tripTrackers.forEach(tt->{
400-
tt.restoreState();
394+
tt.restoreStates();
401395
//tt.prepareNextActivity((t_h-p_runStartTime_h)*60, GC.f_getChargePoint());
402396
});
403397
//GC.c_tripTrackers.forEach(tt->tt.prepareNextActivity((t_h-p_runStartTime_h)*60));
404398
if (GC instanceof GCHouse) {
405399
if (((GCHouse)GC).p_cookingTracker != null) {
406-
((GCHouse)GC).p_cookingTracker.restoreState();
400+
((GCHouse)GC).p_cookingTracker.restoreStates();
407401
}
408402
}
409403
}
@@ -1324,18 +1318,6 @@ ArrayList<GridConnection> f_getAllGridConnections()
13241318

13251319
/*ALCODEEND*/}
13261320

1327-
double f_registerAssetManagement(I_AssetManagement newAssetManagement)
1328-
{/*ALCODESTART::1762791721564*/
1329-
//Should only be called by GC
1330-
c_assetManagement.add(newAssetManagement);
1331-
/*ALCODEEND*/}
1332-
1333-
double f_removeAssetManagement(I_AssetManagement assetManagement)
1334-
{/*ALCODESTART::1762791721568*/
1335-
//Should only be called by GC
1336-
c_assetManagement.remove(assetManagement);
1337-
/*ALCODEEND*/}
1338-
13391321
double f_initializeTimeDates()
13401322
{/*ALCODESTART::1767178014622*/
13411323
// Initialize time and date
@@ -1371,3 +1353,9 @@ ArrayList<GridConnection> f_getAllGridConnections()
13711353

13721354
/*ALCODEEND*/}
13731355

1356+
double f_checkConfiguration()
1357+
{/*ALCODESTART::1772104199229*/
1358+
c_gridConnections.forEach(gc -> gc.f_checkConfiguration());
1359+
1360+
/*ALCODEEND*/}
1361+

_alp/Agents/EnergyModel/Code/Functions.xml

Lines changed: 27 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222
<Id>1716890117265</Id>
223223
<Name><![CDATA[f_getActiveGridConnections]]></Name>
224224
<X>1660</X>
225-
<Y>520</Y>
225+
<Y>600</Y>
226226
<Label>
227227
<X>10</X>
228228
<Y>0</Y>
@@ -254,7 +254,7 @@
254254
<Id>1716897568717</Id>
255255
<Name><![CDATA[f_getConnectionOwners]]></Name>
256256
<X>1640</X>
257-
<Y>560</Y>
257+
<Y>640</Y>
258258
<Label>
259259
<X>10</X>
260260
<Y>0</Y>
@@ -270,7 +270,7 @@
270270
<Id>1716899946694</Id>
271271
<Name><![CDATA[f_getTopLevelGridCapacity_kW]]></Name>
272272
<X>1640</X>
273-
<Y>580</Y>
273+
<Y>660</Y>
274274
<Label>
275275
<X>10</X>
276276
<Y>0</Y>
@@ -286,7 +286,7 @@
286286
<Id>1717058801652</Id>
287287
<Name><![CDATA[f_getEnergyAssets]]></Name>
288288
<X>1640</X>
289-
<Y>600</Y>
289+
<Y>680</Y>
290290
<Label>
291291
<X>10</X>
292292
<Y>0</Y>
@@ -302,7 +302,7 @@
302302
<Id>1718289616227</Id>
303303
<Name><![CDATA[f_getGridNodesTopLevel]]></Name>
304304
<X>1640</X>
305-
<Y>640</Y>
305+
<Y>720</Y>
306306
<Label>
307307
<X>10</X>
308308
<Y>0</Y>
@@ -318,7 +318,7 @@
318318
<Id>1718289761647</Id>
319319
<Name><![CDATA[f_getGridNodesNotTopLevel]]></Name>
320320
<X>1640</X>
321-
<Y>660</Y>
321+
<Y>740</Y>
322322
<Label>
323323
<X>10</X>
324324
<Y>0</Y>
@@ -371,7 +371,7 @@
371371
<Id>1727167397666</Id>
372372
<Name><![CDATA[f_getPausedGridConnections]]></Name>
373373
<X>1660</X>
374-
<Y>540</Y>
374+
<Y>620</Y>
375375
<Label>
376376
<X>10</X>
377377
<Y>0</Y>
@@ -439,7 +439,7 @@
439439
<Id>1739958854535</Id>
440440
<Name><![CDATA[f_addEnergyCoop]]></Name>
441441
<X>1640</X>
442-
<Y>280</Y>
442+
<Y>360</Y>
443443
<Label>
444444
<X>10</X>
445445
<Y>0</Y>
@@ -463,7 +463,7 @@
463463
<Id>1739972940581</Id>
464464
<Name><![CDATA[f_removeEnergyCoop]]></Name>
465465
<X>1640</X>
466-
<Y>300</Y>
466+
<Y>380</Y>
467467
<Label>
468468
<X>10</X>
469469
<Y>0</Y>
@@ -487,7 +487,7 @@
487487
<Id>1740056275008</Id>
488488
<Name><![CDATA[f_addConsumptionEnergyCarrier]]></Name>
489489
<X>1640</X>
490-
<Y>340</Y>
490+
<Y>420</Y>
491491
<Label>
492492
<X>10</X>
493493
<Y>0</Y>
@@ -507,7 +507,7 @@
507507
<Id>1741710906926</Id>
508508
<Name><![CDATA[f_updateActiveAssetsMetaData]]></Name>
509509
<X>1640</X>
510-
<Y>180</Y>
510+
<Y>260</Y>
511511
<Label>
512512
<X>10</X>
513513
<Y>0</Y>
@@ -523,7 +523,7 @@
523523
<Id>1746021439807</Id>
524524
<Name><![CDATA[f_addProductionEnergyCarrier]]></Name>
525525
<X>1640</X>
526-
<Y>360</Y>
526+
<Y>440</Y>
527527
<Label>
528528
<X>10</X>
529529
<Y>0</Y>
@@ -607,7 +607,7 @@
607607
<Id>1754379679149</Id>
608608
<Name><![CDATA[f_addAssetFlow]]></Name>
609609
<X>1640</X>
610-
<Y>380</Y>
610+
<Y>460</Y>
611611
<Label>
612612
<X>10</X>
613613
<Y>0</Y>
@@ -627,7 +627,7 @@
627627
<Id>1754908171225</Id>
628628
<Name><![CDATA[f_getGridConnectionsCollectionPointer]]></Name>
629629
<X>1640</X>
630-
<Y>700</Y>
630+
<Y>780</Y>
631631
<Label>
632632
<X>10</X>
633633
<Y>0</Y>
@@ -643,7 +643,7 @@
643643
<Id>1755014169405</Id>
644644
<Name><![CDATA[f_getPausedGridConnectionsCollectionPointer]]></Name>
645645
<X>1640</X>
646-
<Y>720</Y>
646+
<Y>800</Y>
647647
<Label>
648648
<X>10</X>
649649
<Y>0</Y>
@@ -675,7 +675,7 @@
675675
<Id>1758012535712</Id>
676676
<Name><![CDATA[f_getDate]]></Name>
677677
<X>1640</X>
678-
<Y>470</Y>
678+
<Y>550</Y>
679679
<Label>
680680
<X>10</X>
681681
<Y>0</Y>
@@ -740,64 +740,40 @@
740740
<Id>1761140687507</Id>
741741
<Name><![CDATA[f_getAllGridConnections]]></Name>
742742
<X>1640</X>
743-
<Y>500</Y>
744-
<Label>
745-
<X>10</X>
746-
<Y>0</Y>
747-
</Label>
748-
<PublicFlag>false</PublicFlag>
749-
<PresentationFlag>true</PresentationFlag>
750-
<ShowLabel>true</ShowLabel>
751-
<Body xmlns:al="http://anylogic.com"/>
752-
</Function>
753-
<Function AccessType="default" StaticFunction="false">
754-
<ReturnModificator>VOID</ReturnModificator>
755-
<ReturnType>double</ReturnType>
756-
<Id>1762791721564</Id>
757-
<Name><![CDATA[f_registerAssetManagement]]></Name>
758-
<X>1650</X>
759-
<Y>860</Y>
743+
<Y>580</Y>
760744
<Label>
761745
<X>10</X>
762746
<Y>0</Y>
763747
</Label>
764748
<PublicFlag>false</PublicFlag>
765749
<PresentationFlag>true</PresentationFlag>
766750
<ShowLabel>true</ShowLabel>
767-
<Parameter>
768-
<Name><![CDATA[newAssetManagement]]></Name>
769-
<Type><![CDATA[I_AssetManagement]]></Type>
770-
</Parameter>
771751
<Body xmlns:al="http://anylogic.com"/>
772752
</Function>
773-
<Function AccessType="default" StaticFunction="false">
753+
<Function AccessType="public" StaticFunction="false">
774754
<ReturnModificator>VOID</ReturnModificator>
775755
<ReturnType>double</ReturnType>
776-
<Id>1762791721568</Id>
777-
<Name><![CDATA[f_removeAssetManagement]]></Name>
778-
<X>1650</X>
779-
<Y>880</Y>
756+
<Id>1767178014622</Id>
757+
<Name><![CDATA[f_initializeTimeDates]]></Name>
758+
<ExcludeFromBuild>true</ExcludeFromBuild>
759+
<X>700</X>
760+
<Y>50</Y>
780761
<Label>
781762
<X>10</X>
782763
<Y>0</Y>
783764
</Label>
784765
<PublicFlag>false</PublicFlag>
785766
<PresentationFlag>true</PresentationFlag>
786767
<ShowLabel>true</ShowLabel>
787-
<Parameter>
788-
<Name><![CDATA[assetManagement]]></Name>
789-
<Type><![CDATA[I_AssetManagement]]></Type>
790-
</Parameter>
791768
<Body xmlns:al="http://anylogic.com"/>
792769
</Function>
793770
<Function AccessType="public" StaticFunction="false">
794771
<ReturnModificator>VOID</ReturnModificator>
795772
<ReturnType>double</ReturnType>
796-
<Id>1767178014622</Id>
797-
<Name><![CDATA[f_initializeTimeDates]]></Name>
798-
<ExcludeFromBuild>true</ExcludeFromBuild>
799-
<X>700</X>
800-
<Y>50</Y>
773+
<Id>1772104199229</Id>
774+
<Name><![CDATA[f_checkConfiguration]]></Name>
775+
<X>1640</X>
776+
<Y>170</Y>
801777
<Label>
802778
<X>10</X>
803779
<Y>0</Y>

0 commit comments

Comments
 (0)