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

Make FMU parameters tunable when importing #85

Closed
fajansen opened this issue Oct 17, 2019 · 12 comments
Closed

Make FMU parameters tunable when importing #85

fajansen opened this issue Oct 17, 2019 · 12 comments
Labels
enhancement New feature or request import This issue is related to FMI import

Comments

@fajansen
Copy link

With the FMIKit FMU importer, parameters of the FMU can only be changed at the beginning of the simulation. With the Mathworks FMU importer (tested with 2019b), the FMU parameters are tunable and can be changed during runtime.

@t-sommer t-sommer added enhancement New feature or request import This issue is related to FMI import labels Oct 17, 2019
@fajansen
Copy link
Author

Documentation about tunable parameters:
https://www.mathworks.com/help/simulink/ug/using-tunable-parameters.html
Documentation for dashboard (uses tunable parameters):
https://www.mathworks.com/help/simulink/ug/tune-and-visualize-your-model-with-dashboard-blocks.html
Support by Matlab FMU Import: https://www.mathworks.com/help/simulink/ug/work-with-fmi-in-simulink.html
Example with FMU import and GUI by mail, as I can't attach files.

@t-sommer
Copy link
Contributor

Example with FMU import and GUI by mail, as I can't attach files.

You have to ZIP them or append .zip to the filename of an FMU.

@t-sommer
Copy link
Contributor

It should be possible to expose tunable parameters as S-Function Run-Time Parameters.

@fajansen
Copy link
Author

fajansen commented Mar 2, 2020

Any news on this topic? We really need this.

@fajansen
Copy link
Author

Any update?

@t-sommer
Copy link
Contributor

I've created a prototype (443d57f) based on fmikit_demo_BouncingBall that makes parameter e a tunable dialog parameter.

Pros:

  • allows changing the parameters at runtime

Cons:

  • would replace workspace variables as start values for tunable parameters

@t-sommer
Copy link
Contributor

Another (and probably more robust) approach would be to simply add the tunable parameters as discrete inputs, leveraging the existing infrastructure.

@fajansen
Copy link
Author

Would you expose all tunable parameters as discrete inputs or just a few selected by the user? The downside of this approach is that you have to create lots of "constant" blocks and connect them to the right inputs. This might also have a performance impact. Parameters are only written when changed, inputs every timestep.

@t-sommer
Copy link
Contributor

Would you expose all tunable parameters as discrete inputs or just a few selected by the user?

No. These inputs would have to be added individually, like the output ports.

The downside of this approach is that you have to create lots of "constant" blocks and connect them to the right inputs. This might also have a performance impact.

We could keep track of the previous value and only set it, when it has changed.

@fajansen
Copy link
Author

This would work nicely for my use case.
If it's only for a handful of variables, the performance impact should also be negligible, keeping track of the previous value is just an additional error source.

@sloghavi68
Copy link

@t-sommer I want to test the new tunable parameters with the 3.0 alpha. What do I need to do to make a parameter tunable? Do I have to select it as an input? I noticed that not all parameters have the input option available. Would you mind commenting on what is required for a parameter for it to be available to be defined as a tunable parameter?

@t-sommer
Copy link
Contributor

t-sommer commented Jun 8, 2021

I noticed that not all parameters have the input option available.

Only tunable parameters can be exposed as block inputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request import This issue is related to FMI import
Projects
None yet
Development

No branches or pull requests

3 participants