Closed fyziktom closed 1 year ago
SonarCloud Quality Gate failed.
0 Bugs
0 Vulnerabilities
0 Security Hotspots
236 Code Smells
SonarCloud Quality Gate failed.
0 Bugs
0 Vulnerabilities
0 Security Hotspots
257 Code Smells
SonarCloud Quality Gate failed.
0 Bugs
0 Vulnerabilities
0 Security Hotspots
311 Code Smells
First version of the EntitiesBlocks driver matches first expectations. It consists of two basic libraries: driver and UI components. There is the simple WASM demo.
The driver basic imporant interfaces are:
The IEntity has extension in form of interface ISource and IConsumer. These interfaces contains just type now to allow way how to create some additional properties/functions for specific cases of Entities. Example is class BatteryStorage which stores the properties such as Capacity or Maximum Charge and Discharge current.
Handler keeps the dictionary of all IEntities. Their relations are implemented by list of Ids of children entities in each Entity.
Each entity has dicitonary of IBlocks.
The block has StartTime and Timeframe which defines time when block is active. The EndTime is calculated automatically. The block can be repetitive. It means like "each day from 8-18 and run from some date until another date" or "run from some date until another date for X hours with Y off time period". Blocks can carry this informations. In the case of the repetitive blocks the first block does not contains RepetitiveSourceBlockId, but is set as repetitive source it means there is line of blocks which refers to this block through RepetitiveSourceBlockId property. This allow to sort them in one line in graph, or edit/remove whole line. This is also used for optimization of calculation of the Summed Value data of the repetitive blocks (more about Summed Value below). There is known issue with the repetitive block where you need some different values during months/days, etc. example is PVE profile per year, where you have average value per month. This must be added like separated blocks for now. I will solve this in commings refactoring/updates.
The basic functions are used in the unit tests.
The important function of this library is possibility to select some StartTime and EndTime and recalculate amounts in this time area. It means it will identify all blocks which play role in this time area and add them to the result list which is split based on settings of BlockTimeframe. If you set for example BlockTimeframe.Day and StartTime 1.1.2022 and EndTime 1.1.2023, the result list will have 365 blocks, one per each day. If some original block overlay more days it is split and based on average amount it is added to specific days. The extended version of this function can take some window in the day (for example 8-18) and cut just amount which fits to this time window in the day. Example is here.
The IEntitiesHandler has functions for export state to JSON and load it back.
It is still raw and in WIP.