improve the approach we use for parsing and storing component data#169
improve the approach we use for parsing and storing component data#169
Conversation
pelesh
left a comment
There was a problem hiding this comment.
Class BusFault.cpp includes (indirectly) both, nlohmann/json.hpp and magic_enum/magic_enum.hpp headers. This makes the component dependent on I/O file parser implementation. We need to find a way to abstract away component models from the parser specifics. All component models should build independently of the parser (where it is okay if the parser depends on components).
|
i'm not sure it's really possible to decouple it any further unless we added even more intermediary structures or something. both of those headers could be removed and with some conditional compilation, since all of the actual json parsing code resides in the one file, it'd be easy to remove the json parser and magic_enum. i don't think attempting to completely remove an indirect dependency is particularly worthwhile here. |
|
well, actually now that i recall there's one field in the Footnotes
|
|
Also parser tests should not be in phasor dynamics but in a separate subdirectory. They are helper utility, not the part of phasor dynamics core. |
Then I guess we should add intermediary data structures, i.e. meta models. Also, we should consider using factories to instantiate and parametrize components. |
we already have an intermediary (the we can already remove the json parser from the adding even more structures would be detrimental to your original goal, i think. it would require consumers of the library to interact with more structures to get things done (unless i'm interpreting the proposal wrong) and again, duplicate places in which data can be and incur a greater maintenance burden upon us. without more justification and a clearer path to implementation i'm against making this change, personally. |
838c09d to
f2df29b
Compare
|
this should be ready to go now |
…e floating point literals again. no implicit conversions
…o use `ComponentData` note that this doesn't build due to code relying upon the presence of fields. this will be finished in a subsequent commit
84fe668 to
4a4d72c
Compare
|
rebased on latest develop and made changes to fix the new |
pelesh
left a comment
There was a problem hiding this comment.
Just a couple of nitpicking comments.
) * move the case format tests and require floating point parameters to be floating point literals again. no implicit conversions * add some documentation to the modified bus fault data structure * break out the component data json parser into a separate file * finish reworking the remainder of the applicable `*Data` structures to use `ComponentData` * fix documentation comment in `LoadImpl.hpp` * remove extraneous parens in `SystemModelData.hpp` * fix the `ThreeBusClassical` example
this pull request replaces the data structures for components introduced in #133, save for those related to buses. this is done to simplify the way json parsing is handled for them
checklist
-Wall -Wpedantic -Wconversion -Wextra.