fyziktom / VirtualEconomyFramework

Framework for economy applications
https://veframework.com/
MIT License
24 stars 7 forks source link

151 entities blocks storage UI #158

Closed fyziktom closed 1 year ago

fyziktom commented 1 year ago

This merge brings ISimulator interface to provide simulator of consumption or production of blocks inside of IEntity.

Each IEntity has dictionary of the simulators. Simulator can be loaded through handler or directly through IEntity object.

There are two simulators available now. The PVESimulator and TDD Consumption simulator (battery is WIP). Both are used in the demo.

The simulators are called when the Summedvalue of entity is requested. It is here. This function creates empty result blocks and combines them with simulated blocks if any simulator is available. The call of simulators is here. It can load some parameters/options for simulator or some input DataProfiles or IBlocks lists. This function can be called for draw graph of day simulation of production or consumption also.

GetConsumptionOfEntity function has new parameter now. It allow the simulators during calculation. For example here it is off. It is last bool parameter of this function. In this phase of calculation the blocks are already created, recalculated (based on cover of consumption by PVE) and added to entities. Oposite, at start of calculation there was no blocks in entities so simulators flag was on to create new blocks by simulators during calculating summedvalues of entity.

The simulation of entity blocks are used in the demo calculation in energy demo app.

sonarcloud[bot] commented 1 year ago

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 53 Code Smells

0.0% 0.0% Coverage
4.6% 4.6% Duplication