diff --git a/README.md b/README.md index 829a5b63..6adf5d85 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![MPL-2.0 License](https://img.shields.io/badge/license-MPL_2.0-blue.svg)](https://www.mozilla.org/en-US/MPL/2.0/) + # dynamic-mapping-server To automatically generate the sql schema file you can use the following command: @@ -7,4 +8,69 @@ To automatically generate the sql schema file you can use the following command: Parameters are not yet generated by the app. For now the app will not work as intended without any data. -After creating the database and its tables, load **src/main/resources/IEEE14Models.sql** to instantiate some. \ No newline at end of file +After creating the database and its tables, load **src/main/resources/IEEE14Models.sql** to instantiate some. + +--- + +# How to add a new model + +- Call the POST /models/ endpoint with a Model JSON Object + - (Example: _test/resources/LoadAlphaBeta.json_) + +--- + +# How to add a new equipment type + +## Griddyna-app + +### For rules: + +1) Add [Type] to EquipmentType enum +2) Add properties in EquipmentProperties.[Type] + +### For automata: + +1) Add [Family] to AutomatonFamily +2) Add properties in AutomatonProperties.[Family] + +## Dynamic-mapping-server + +1) Add [Type/Family] to utils/EquipmentType + +### For rules: + +2) Add [Type] to `equipmentTypeToCollectionName` method in Templater +3) Add [Type] to `equipmentTypeToClass` method in Templater +4) Add `get[Type]EquipmentValueMethod` in NetworkServiceImpl +5) Add previous method to `getNetworkValuesFromExistingNetwork` in NetworkServiceImpl +6) Add `getPropertyValuesBy[Type]` in NetworkServiceImpl +7) Add previous method to `matchNetworkToRule` in NetworkServiceImpl + +### For automata: + +2) Add [Family] to `familyModel` switch in Templater +3) Update `AUTOMATON_IMPORT` if new imports are needed (or create an import constant for each family) + +--- + +# Roadmap + +- Create an interface to Delete sets + - Front-End only, probably via `SetEditor` +- Prefill Sets in `SetEditor` + - Either put a default set in `parameterDefinitions` (FE & BE) or use first set to prefill all the others (FE only) +- Fetch EquipmentTypes from BE instead of defining them in the Front End + - Update Data Model and add an `EquipmentController` +- Manage Equipment properties and creates an interface to update/add a type. + - New endpoints to `EquipmentController` +- Create an interface to import models + - FE only, add a page with a form to create new model and its parameters +- Directly create the .dyd without using the script. + - It will need to use `matchNetworkToRule` results and **remove duplicates** from the results. + - Replicate PowSyBl calls to relevant classes to simulate what does the script processing do and fetch missing + values +- Optimise Redux store to speed up FE when the attached network become massive + - Reduce data stored and optimise selectors (memoization) +- Polish Parameters Management appearance (FE) +- Sends only relevant sets to the FE (pertaining to the attached network only), avoid unnecessary forms. +- Rename Script class as Results since the script is no longer the only result \ No newline at end of file diff --git a/src/main/java/org/gridsuite/mapping/server/controller/ModelController.java b/src/main/java/org/gridsuite/mapping/server/controller/ModelController.java index 9616e585..4ac835e6 100644 --- a/src/main/java/org/gridsuite/mapping/server/controller/ModelController.java +++ b/src/main/java/org/gridsuite/mapping/server/controller/ModelController.java @@ -48,7 +48,7 @@ public ResponseEntity> getSetsGroupsFromModelName(@PathVaria } @PostMapping(value = "/{modelName}/parameters/sets/strict") - @Operation(summary = "Save a new parameter sets group without checking sets") + @Operation(summary = "Save a new parameter sets group with checking sets") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Parameter Set Group Saved")}) public ResponseEntity saveParametersSet(@PathVariable("modelName") String modelName, @RequestBody ParametersSetsGroup setsGroup) { @@ -72,9 +72,9 @@ public ResponseEntity> getParametersDefinitionsFr } @GetMapping(value = "/") - @Operation(summary = "get models names") + @Operation(summary = "get models") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "names of all models")}) + @ApiResponse(responseCode = "200", description = "simplified versions of all models")}) public ResponseEntity> getModels() { return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(modelService.getModels()); } diff --git a/src/main/resources/Diagrams/DynamicMapping.png b/src/main/resources/Diagrams/DynamicMapping.png new file mode 100644 index 00000000..208943a4 Binary files /dev/null and b/src/main/resources/Diagrams/DynamicMapping.png differ diff --git a/src/main/resources/Diagrams/DynamicMapping.puml b/src/main/resources/Diagrams/DynamicMapping.puml new file mode 100644 index 00000000..df2641cb --- /dev/null +++ b/src/main/resources/Diagrams/DynamicMapping.puml @@ -0,0 +1,199 @@ +@startuml + +'EQUIPMENT' +enum ET as "EquipmentType" { + GENERATOR + LINE + LOAD +} + +enum PT as "ParameterType" { + STRING + INT + DOUBLE + BOOLEAN +} + +class EP as "EquipmentProperty" { + String name + String value + ParameterType type +} + +class E as "Equipment" { + EquipmentType type + EquipmentProperty[] properties +} + +E "1" *-right- "1" ET +E "1" *-left- "*" EP +EP "1" *-left- "1" PT + +'MODEL' + +enum ST as "SetGroupType" { +FIXED +PREFIX +SUFFIX +} + +enum PO as "ParameterOrigin" { + NETWORK + FIXED + USER +} + +class MPD as "ModelParameterDefinition" { + String name + ParameterType type + ParameterOrigin origin + String originName + String fixedValue +} + +MPD "1" *-up- "1" PT +MPD "1" *-down- "1" PO + +class MP as "ModelParameter" { + String name + String value +} + + +class PS as "ParametersSet" { + String name + ModelParameter[] parameters + Date lastModifiedDate +} + +PS "1" *-left- "*" MP + + + +class PSG as "ParametersSetsGroup" { + # String modelName + # String name + # SetGroupType type + ParametersSet[] sets +} + +PSG "1" *-down- "1" ST +PSG "1" *-down- "*" PS + +'housekeeping' +PS -right[hidden]- ST + +class M as "Model" { + String modelName + EquipmentType equipmentType + ModelParameterDefinition[] parameterDefinitions + ParametersSetsGroup[] setsGroups + Boolean isParameterSetGroupValid() +} + +M "1" *-left- "*" MPD +M "1" *-up- "*" PSG + + +'FILTER' +enum O as "Operand" { + EQUALS + NOT_EQUALS + LOWER + LOWER_OR_EQUALS + HIGHER_OR_EQUALS + HIGHER + INCLUDES + STARTS_WITH + ENDS_WITH + IN + NOT_IN +} + +abstract F as "AbstractFilter" { + EquipmentProperty property + String filterId + Operand operand + String convertFilterToString() + boolean matchValueToFilter(String valueToTest) +} +F "1" *-up- "1" EP +F "1" *-left- "1" O + +class NF as "NumberFilter" extends F { + Float[] value +} + +class SF as "StringFilter" extends F { + String[] value +} + +class BF as "BooleanFilter" extends F { + Boolean value +} + +'housekeeping:' +NF-up[hidden]-F +SF-up[hidden]-F +BF-up[hidden]-F + + +'RULE' +class R as "Rule" { +EquipmentType type +String mappedModel +String setGroup +SetGroupType groupType +AbstractFilter[] filters +String composition +} + +R "1" *-left- "*" F +R "1" *-up- "1" ET +R "1" *-down- "1" PSG + +note right of R +composition is the expression +organizing the different filters +Example: (Filter1 && Filter3) || Filter2 +end note + +'AUTOMATON' +enum AF as "AutomatonFamily" { +CURRENT_LIMIT_AUTOMATON +} + +abstract AA as "AbstractAutomaton" { +AutomatonFamily family +String model +String setGroup +String watchedElement +} + +AA "1" *- "1" AF +AA "1" *-down- "1" PSG + + +class CLA as "CurrentLimitAutomaton" extends AA { + String side +} + +'housekeeping:' +'CLA-left[hidden]-AA + +'MAPPING' + +class DynamicMapping { +# String name +Rule[] rules +Automaton[] automata +Boolean controlledParameters +Script convertToScript() +} + +DynamicMapping "1" o-down- "*" R +DynamicMapping "1" o-down- "*" AA + +'housekeeping' +R -right[hidden]- AA +@enduml \ No newline at end of file