Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] 55 restructure simulation api for do step #65

Draft
wants to merge 62 commits into
base: master
Choose a base branch
from

Conversation

KBeeser
Copy link

@KBeeser KBeeser commented Sep 18, 2022

  • Code sections that require deeper rewiev are labeled "todo: review"

Konrad Beeser and others added 30 commits July 11, 2022 12:24
do_step reads FMU values, applies inputs and performs a single simulation step. the initialiszation function allows to set parameters and initial values and must be called before performing simulation steps
in order to find index in df instead of bisection implemenation the pandas get_indexer() method is used. Instead of holding the last available value, linear interpolation can be used
results attribut is directly filled by do_step_read_write function; tsd is replaced by pandas df; a get_results_function is added returning the results (and converting them to tsd if needed)
…ts by default

Because this is the typical case in a do_step_simulation
function to find variables starting with a certain str; helpful for example to filter for bus variables
get rid of read_write_step function, because usually there is communication between read and write; Introduce read_variables wrapper function that appends the results to the sim_res frame by default; Introduce set_variables wrapper function, that uses a table and/or a dict as input. After writing the variables, optionally it calls the do_step function; the status indicator finished from the do_step function is an attribute now; the do_step function closes the fmu, if finished; the get_results function checks for duplicates in the sim_res frame
demonstration of step wise fmu simulation. Apllication is a control task. First the system fmu interacts with a python controller, second the system fmu interacts with a second controller fmu
can be set in the initialize() func. But can also be adjusted during stepwise simulation using setter
different philosophy: User-friendly do_step wrapper function makes explicti call of read/set_vars functions unecessary. The do_step wrapper sets the vars given as arguments to the fmu, performs a simulation step and after the step reads the results and appends them to the results dataframe
…ithub.com/RWTH-EBC/ebcpy into 55-restructure-simulation-api-for-do_step

start restructuring from 38 do_step branch
…n-class

use of pydantic to integrate config file
path fmu_discrete_simulation(Model,FMU) is running
…ound truth

added log messages related to discrete FMU simulation
adjsut examples to include experiment configuration
…ds; class method that prints available experiment configuration fields
@KBeeser KBeeser linked an issue Sep 18, 2022 that may be closed by this pull request
@KBeeser KBeeser requested a review from FelixStege September 18, 2022 16:53
Konrad Beeser and others added 7 commits September 19, 2022 12:55
…nticipate merge conflict for merging master into branch
…api-for-do_step

# Conflicts:
#	ebcpy/simulationapi/__init__.py
#	ebcpy/simulationapi/dymola.py
#	ebcpy/simulationapi/fmu.py
#	examples/e2a_fmu_continuous_example.py
#	examples/e3_dymola_example.py
#	tests/test_simulationapi.py

resolve merge conflict by selecting the according files in 55-restructure-simulation-api-for-do_step
@KBeeser KBeeser requested a review from FWuellhorst October 9, 2022 16:19
Copy link
Contributor

@FelixStege FelixStege left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the great work @konrad234!

I added some comments. Mainly:

  • There are a lot of result/simulation files which are not needed and can be deleted
  • The unittests are currently not running properly
  • There are quite a few TODO markers in the code

ebcpy/simulationapi/__init__.py Outdated Show resolved Hide resolved
ebcpy/simulationapi/__init__.py Outdated Show resolved Hide resolved
ebcpy/simulationapi/__init__.py Outdated Show resolved Hide resolved
ebcpy/simulationapi/__init__.py Outdated Show resolved Hide resolved
ebcpy/simulationapi/__init__.py Outdated Show resolved Hide resolved
tests/data/dsin.txt Outdated Show resolved Hide resolved
tests/data/dsin.txt Outdated Show resolved Hide resolved
tests/data/testzone/FMU_Discrete.log Outdated Show resolved Hide resolved
tests/test_simulationapi.py Outdated Show resolved Hide resolved
tests/test_simulationapi.py Show resolved Hide resolved
Konrad Beeser and others added 12 commits October 21, 2022 13:20
also consider kwargs (#64) and use default log message within the examples to avoid user interaction to avoid proplems in dynamic testing.
…e to the results

in order to get rid of current_time attribute in FMU class
…right after modifying input_table or sim_setup attributes.

this improves efficiency, as this check can make interpolation obsolete. Befere this check was performed every simulation step, which is less efficient
given a key, the initialization arguments of the simulation apis also run with the outdated arguments insted of the configuration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Restructure Simulation API for do_step
3 participants