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

Added functions for getting FMU metadata #17

Merged
merged 6 commits into from
May 25, 2022

Conversation

sathvikbhagavan
Copy link
Contributor

Added functions for getting input, output, state, parameter and derivative names from FMU modelDescription.

Copy link
Contributor

@sharanry sharanry left a comment

Choose a reason for hiding this comment

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

Can the tests check not just length of the result but the actually values of the results?

@ThummeTo
Copy link
Owner

ThummeTo commented May 23, 2022

Can the tests check not just length of the result but the actually values of the results?

In general, we want to accomplish that by implementing the FMI-CrossChecks from ModelicaAssoctation. This repo is currently archived and will be replaced by a successor soon, so it will still take some time.

As workaround, we are checking for simulation results/states at t=0 (everything initialized correctly?) and t=end (last simulation time step). This is not perfect, but chances are high that the simulation between worked correctly if t=end is not a stable equilibrium or similar of the system. And as said, it's only a workaround until we have the new cross-checks. So I would suggest to check at least results at simulation start and stop?

@ThummeTo
Copy link
Owner

ThummeTo commented May 23, 2022

BTW: @sathvikbhagavan much appreciated! Let me know when you are ready to review/test :-)

@sathvikbhagavan
Copy link
Contributor Author

This PR involves the implementation of utility functions involving extracting things from modelDescription. I don't think there is any need to check the simulation. I think we are ready to review/test.

@sathvikbhagavan sathvikbhagavan marked this pull request as ready for review May 23, 2022 10:14
@ThummeTo
Copy link
Owner

ThummeTo commented May 24, 2022

Can the tests check not just length of the result but the actually values of the results?

Ah now I see what you meant, in fact you are right. The tests are only checking for the length of the name-arrays instead of checking their actual content. This is not good... I will fix this. And if it is ok @sathvikbhagavan I would rename the functions to better fit the tone of the FMI-command-set?

@sathvikbhagavan
Copy link
Contributor Author

I added some tests for checking the values of the arrays yesterday. But if you think more tests are required, please feel free to add them. I am fine with renaming functions according to the FMI convention.

@ThummeTo ThummeTo changed the base branch from main to merge_prs May 25, 2022 05:39
@ThummeTo ThummeTo merged commit 94d8184 into ThummeTo:merge_prs May 25, 2022
@ThummeTo
Copy link
Owner

@sathvikbhagavan I am on merging that, do you know fmi2ValueReferenceToString and fmi2StringToValueReference?

@sathvikbhagavan
Copy link
Contributor Author

I saw the code for fmi2ValueReferenceToString and fmi2StringToValueReference. The functions fmi2GetNamesToValueReference and fmi2GetValueRefenceToName are similar but gives out a dictionary for all modelVariables.

ThummeTo added a commit that referenced this pull request May 25, 2022
* minor changed

* Bug fixes (#18)

* Fix fmi2SampleDirectionalDerivative()

* Fix fmi2DependenciesSupported

* Adapt the old calculation for the steps

* Added functions for getting FMU metadata (#17)

* Added functions for getting inp, out, state names

* added tests for checking values

* changed fmi2GetVariableUnits to default nothing

* updated fmi2GetVariableDescriptions

* returns dict instead of list of dict

* added tests for checking units and start values

Co-authored-by: sathvikbhagavan <sathvikbhagavan@@gmail.com>

* inc version

* typo

* typo

* merged PRs

* typo

* sampling fix

Co-authored-by: Johannes Stoljar <93336654+stoljarjo@users.noreply.github.com>
Co-authored-by: sathvikbhagavan <35105271+sathvikbhagavan@users.noreply.github.com>
Co-authored-by: sathvikbhagavan <sathvikbhagavan@@gmail.com>
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.

None yet

3 participants