Skip to content

Commit

Permalink
Merge pull request #31 from dnv-innersource/feature/complete-cli-pipe…
Browse files Browse the repository at this point in the history
…line

Complete cli pipeline and create builder class
  • Loading branch information
KristofferSkare authored Mar 19, 2024
2 parents eb01702 + 16c432b commit dbc34b8
Show file tree
Hide file tree
Showing 31 changed files with 500 additions and 165 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ The changelog format is based on [Keep a Changelog](https://keepachangelog.com/e
## [Unreleased]

### Changed
* Moved CMake + conan + c++ package files and folders with cpp code inside src folder to be included in package
* Replace pkg_resources with importlib.metadata for getting packages version to work in python 3.12
* Replace deprecated root_validator with model_validator in pydanitc class
* Remove unnecessary hard coded values in utils/builder.py
* Add MlFmuBuilder class to generate code and compile FMU
* Find default paths to files and directories if not given in cli
* Run functions in utils/builder.py according to which command is being run
* Clean up temporary/build files after the process is done
* Complete cli interface
* Add subparsers to cli argparser to handle several different commands
* Create MlFmuBuilder from args and run code according to command
* Change cli test to match the new cli interface/parser

### Changed

* Default agent_(input/output)_indexes is [] by default instead of None
* Updated doc by running publish-interface-docs
* Added feature to be able to initialize states using previously defined parameters or inputs
Expand Down
2 changes: 1 addition & 1 deletion docs/interface/schema.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
</pre></div> </div> </div> </div> </div> </div> <div class=accordion id=accordionstates_items_description> <div class=card> <div class=card-header id=headingstates_items_description> <h2 class=mb-0> <button class="btn btn-link property-name-button" type=button data-toggle=collapse data-target=#states_items_description aria-expanded aria-controls=states_items_description onclick="setAnchor('#states_items_description')"><span class=property-name>description</span></button> </h2> </div> <div id=states_items_description class="collapse property-definition-div" aria-labelledby=headingstates_items_description data-parent=#accordionstates_items_description> <div class="card-body pl-5"> <h4>Description</h4> <span class="badge badge-success default-value">Default: null</span><br> <span class=description><p>Short FMU variable description.</p> </span><div class=any-of-value id=states_items_description_anyOf><h2 class=handle> <label>Any of</label> </h2><ul class="nav nav-tabs" id=tabsstates_items_description_anyOf_anyOf role=tablist><li class=nav-item> <a class="nav-link active anyOf-option" id=states_items_description_anyOf_i0 data-toggle=tab href=#tab-pane_states_items_description_anyOf_i0 role=tab onclick="setAnchor('#states_items_description_anyOf_i0')">Option 1</a> </li><li class=nav-item> <a class="nav-link anyOf-option" id=states_items_description_anyOf_i1 data-toggle=tab href=#tab-pane_states_items_description_anyOf_i1 role=tab onclick="setAnchor('#states_items_description_anyOf_i1')">Option 2</a> </li></ul> <div class="tab-content card"><div class="tab-pane fade card-body active show" id=tab-pane_states_items_description_anyOf_i0 role=tabpanel> <span class="badge badge-dark value-type">Type: string</span><br> </div><div class="tab-pane fade card-body " id=tab-pane_states_items_description_anyOf_i1 role=tabpanel> <span class="badge badge-dark value-type">Type: null</span><br> </div></div></div> </div> </div> </div> </div> <div class=accordion id=accordionstates_items_startValue> <div class=card> <div class=card-header id=headingstates_items_startValue> <h2 class=mb-0> <button class="btn btn-link property-name-button" type=button data-toggle=collapse data-target=#states_items_startValue aria-expanded aria-controls=states_items_startValue onclick="setAnchor('#states_items_startValue')"><span class=property-name>startValue</span></button> </h2> </div> <div id=states_items_startValue class="collapse property-definition-div" aria-labelledby=headingstates_items_startValue data-parent=#accordionstates_items_startValue> <div class="card-body pl-5"> <h4>Startvalue</h4> <span class="badge badge-success default-value">Default: null</span><br> <span class=description><p>The default value of the parameter used for initialization. If this field is set parameters for initialization will be automatically generated for these states.</p> </span><div class=any-of-value id=states_items_startValue_anyOf><h2 class=handle> <label>Any of</label> </h2><ul class="nav nav-tabs" id=tabsstates_items_startValue_anyOf_anyOf role=tablist><li class=nav-item> <a class="nav-link active anyOf-option" id=states_items_startValue_anyOf_i0 data-toggle=tab href=#tab-pane_states_items_startValue_anyOf_i0 role=tab onclick="setAnchor('#states_items_startValue_anyOf_i0')">Option 1</a> </li><li class=nav-item> <a class="nav-link anyOf-option" id=states_items_startValue_anyOf_i1 data-toggle=tab href=#tab-pane_states_items_startValue_anyOf_i1 role=tab onclick="setAnchor('#states_items_startValue_anyOf_i1')">Option 2</a> </li></ul> <div class="tab-content card"><div class="tab-pane fade card-body active show" id=tab-pane_states_items_startValue_anyOf_i0 role=tabpanel> <span class="badge badge-dark value-type">Type: number</span><br> </div><div class="tab-pane fade card-body " id=tab-pane_states_items_startValue_anyOf_i1 role=tabpanel> <span class="badge badge-dark value-type">Type: null</span><br> </div></div></div> </div> </div> </div> </div> <div class=accordion id=accordionstates_items_initializationVariable> <div class=card> <div class=card-header id=headingstates_items_initializationVariable> <h2 class=mb-0> <button class="btn btn-link property-name-button" type=button data-toggle=collapse data-target=#states_items_initializationVariable aria-expanded aria-controls=states_items_initializationVariable onclick="setAnchor('#states_items_initializationVariable')"><span class=property-name>initializationVariable</span></button> </h2> </div> <div id=states_items_initializationVariable class="collapse property-definition-div" aria-labelledby=headingstates_items_initializationVariable data-parent=#accordionstates_items_initializationVariable> <div class="card-body pl-5"> <h4>Initializationvariable</h4> <span class="badge badge-success default-value">Default: null</span><br> <span class=description><p>The name of a an input or parameter in the same model interface that should be used to initialize this state.</p> </span><div class=any-of-value id=states_items_initializationVariable_anyOf><h2 class=handle> <label>Any of</label> </h2><ul class="nav nav-tabs" id=tabsstates_items_initializationVariable_anyOf_anyOf role=tablist><li class=nav-item> <a class="nav-link active anyOf-option" id=states_items_initializationVariable_anyOf_i0 data-toggle=tab href=#tab-pane_states_items_initializationVariable_anyOf_i0 role=tab onclick="setAnchor('#states_items_initializationVariable_anyOf_i0')">Option 1</a> </li><li class=nav-item> <a class="nav-link anyOf-option" id=states_items_initializationVariable_anyOf_i1 data-toggle=tab href=#tab-pane_states_items_initializationVariable_anyOf_i1 role=tab onclick="setAnchor('#states_items_initializationVariable_anyOf_i1')">Option 2</a> </li></ul> <div class="tab-content card"><div class="tab-pane fade card-body active show" id=tab-pane_states_items_initializationVariable_anyOf_i0 role=tabpanel> <span class="badge badge-dark value-type">Type: string</span><br> </div><div class="tab-pane fade card-body " id=tab-pane_states_items_initializationVariable_anyOf_i1 role=tabpanel> <span class="badge badge-dark value-type">Type: null</span><br> </div></div></div> </div> </div> </div> </div> <div class=accordion id=accordionstates_items_agentOutputIndexes> <div class=card> <div class=card-header id=headingstates_items_agentOutputIndexes> <h2 class=mb-0> <button class="btn btn-link property-name-button" type=button data-toggle=collapse data-target=#states_items_agentOutputIndexes aria-expanded aria-controls=states_items_agentOutputIndexes onclick="setAnchor('#states_items_agentOutputIndexes')"><span class=property-name>agentOutputIndexes</span></button> </h2> </div> <div id=states_items_agentOutputIndexes class="collapse property-definition-div" aria-labelledby=headingstates_items_agentOutputIndexes data-parent=#accordionstates_items_agentOutputIndexes> <div class="card-body pl-5"> <h4>Agentoutputindexes</h4><span class="badge badge-dark value-type">Type: array of string</span> <span class="badge badge-success default-value">Default: []</span><br> <span class=description><p>Index or range of indices of agent outputs that will be stored as internal states and will be fed as inputs in the next time step. Note: the FMU signal and the agent outputs need to have the same length.</p> </span> <span class="badge badge-info no-additional">No Additional Items</span><h4>Each item of this array must be:</h4> <div class=card> <div class="card-body items-definition" id=states_items_agentOutputIndexes_items> <span class="badge badge-dark value-type">Type: string</span><br> <span class=pattern-value id=states_items_agentOutputIndexes_items_pattern>Must match regular expression: <code>^(\d+|\d+:\d+)$</code></span> </div> </div><br> <div class="badge badge-secondary">Examples:</div> <br><div id=states_items_agentOutputIndexes_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;10&quot;</span>
</pre></div> </div><div id=states_items_agentOutputIndexes_ex2 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;10:20&quot;</span>
</pre></div> </div><div id=states_items_agentOutputIndexes_ex3 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;30&quot;</span>
</pre></div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> <div class=accordion id=accordionusesTime> <div class=card> <div class=card-header id=headingusesTime> <h2 class=mb-0> <button class="btn btn-link property-name-button" type=button data-toggle=collapse data-target=#usesTime aria-expanded aria-controls=usesTime onclick="setAnchor('#usesTime')"><span class=property-name>usesTime</span></button> </h2> </div> <div id=usesTime class="collapse property-definition-div" aria-labelledby=headingusesTime data-parent=#accordionusesTime> <div class="card-body pl-5"> <h4>Usestime</h4> <span class="badge badge-success default-value">Default: false</span><br> <span class=description><p>Whether the agent consumes time data from co-simulation algorithm.</p> </span><div class=any-of-value id=usesTime_anyOf><h2 class=handle> <label>Any of</label> </h2><ul class="nav nav-tabs" id=tabsusesTime_anyOf_anyOf role=tablist><li class=nav-item> <a class="nav-link active anyOf-option" id=usesTime_anyOf_i0 data-toggle=tab href=#tab-pane_usesTime_anyOf_i0 role=tab onclick="setAnchor('#usesTime_anyOf_i0')">Option 1</a> </li><li class=nav-item> <a class="nav-link anyOf-option" id=usesTime_anyOf_i1 data-toggle=tab href=#tab-pane_usesTime_anyOf_i1 role=tab onclick="setAnchor('#usesTime_anyOf_i1')">Option 2</a> </li></ul> <div class="tab-content card"><div class="tab-pane fade card-body active show" id=tab-pane_usesTime_anyOf_i0 role=tabpanel> <span class="badge badge-dark value-type">Type: boolean</span><br> </div><div class="tab-pane fade card-body " id=tab-pane_usesTime_anyOf_i1 role=tabpanel> <span class="badge badge-dark value-type">Type: null</span><br> </div></div></div> </div> </div> </div> </div> <div class=accordion id=accordionstateInitializationReuse> <div class=card> <div class=card-header id=headingstateInitializationReuse> <h2 class=mb-0> <button class="btn btn-link property-name-button" type=button data-toggle=collapse data-target=#stateInitializationReuse aria-expanded aria-controls=stateInitializationReuse onclick="setAnchor('#stateInitializationReuse')"><span class=property-name>stateInitializationReuse</span></button> </h2> </div> <div id=stateInitializationReuse class="collapse property-definition-div" aria-labelledby=headingstateInitializationReuse data-parent=#accordionstateInitializationReuse> <div class="card-body pl-5"> <h4>Stateinitializationreuse</h4><span class="badge badge-dark value-type">Type: boolean</span> <span class="badge badge-success default-value">Default: false</span><br> <span class=description><p>Whether variables are allowed to be reused for state initialization when initialization<em>variable is used for state initialization. If set to true the variable referred to in initialization</em>variable will be repeated for the state initialization until the entire state is initialized.</p> </span> </div> </div> </div> </div> <footer> <p class=generated-by-footer>Generated using <a href=https://github.com/coveooss/json-schema-for-humans>json-schema-for-humans</a> on 2024-03-13 at 14:21:57 +0100</p> </footer></body> </html>
</pre></div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> <div class=accordion id=accordionusesTime> <div class=card> <div class=card-header id=headingusesTime> <h2 class=mb-0> <button class="btn btn-link property-name-button" type=button data-toggle=collapse data-target=#usesTime aria-expanded aria-controls=usesTime onclick="setAnchor('#usesTime')"><span class=property-name>usesTime</span></button> </h2> </div> <div id=usesTime class="collapse property-definition-div" aria-labelledby=headingusesTime data-parent=#accordionusesTime> <div class="card-body pl-5"> <h4>Usestime</h4> <span class="badge badge-success default-value">Default: false</span><br> <span class=description><p>Whether the agent consumes time data from co-simulation algorithm.</p> </span><div class=any-of-value id=usesTime_anyOf><h2 class=handle> <label>Any of</label> </h2><ul class="nav nav-tabs" id=tabsusesTime_anyOf_anyOf role=tablist><li class=nav-item> <a class="nav-link active anyOf-option" id=usesTime_anyOf_i0 data-toggle=tab href=#tab-pane_usesTime_anyOf_i0 role=tab onclick="setAnchor('#usesTime_anyOf_i0')">Option 1</a> </li><li class=nav-item> <a class="nav-link anyOf-option" id=usesTime_anyOf_i1 data-toggle=tab href=#tab-pane_usesTime_anyOf_i1 role=tab onclick="setAnchor('#usesTime_anyOf_i1')">Option 2</a> </li></ul> <div class="tab-content card"><div class="tab-pane fade card-body active show" id=tab-pane_usesTime_anyOf_i0 role=tabpanel> <span class="badge badge-dark value-type">Type: boolean</span><br> </div><div class="tab-pane fade card-body " id=tab-pane_usesTime_anyOf_i1 role=tabpanel> <span class="badge badge-dark value-type">Type: null</span><br> </div></div></div> </div> </div> </div> </div> <div class=accordion id=accordionstateInitializationReuse> <div class=card> <div class=card-header id=headingstateInitializationReuse> <h2 class=mb-0> <button class="btn btn-link property-name-button" type=button data-toggle=collapse data-target=#stateInitializationReuse aria-expanded aria-controls=stateInitializationReuse onclick="setAnchor('#stateInitializationReuse')"><span class=property-name>stateInitializationReuse</span></button> </h2> </div> <div id=stateInitializationReuse class="collapse property-definition-div" aria-labelledby=headingstateInitializationReuse data-parent=#accordionstateInitializationReuse> <div class="card-body pl-5"> <h4>Stateinitializationreuse</h4><span class="badge badge-dark value-type">Type: boolean</span> <span class="badge badge-success default-value">Default: false</span><br> <span class=description><p>Whether variables are allowed to be reused for state initialization when initialization<em>variable is used for state initialization. If set to true the variable referred to in initialization</em>variable will be repeated for the state initialization until the entire state is initialized.</p> </span> </div> </div> </div> </div> <footer> <p class=generated-by-footer>Generated using <a href=https://github.com/coveooss/json-schema-for-humans>json-schema-for-humans</a> on 2024-03-18 at 11:02:10 +0100</p> </footer></body> </html>
Loading

0 comments on commit dbc34b8

Please sign in to comment.