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

how to enable the getdirectionalderivative function? #28

Open
mayongjie2 opened this issue Feb 3, 2023 · 1 comment
Open

how to enable the getdirectionalderivative function? #28

mayongjie2 opened this issue Feb 3, 2023 · 1 comment

Comments

@mayongjie2
Copy link

Hi everyone,

My issue is I am willing to calculate the partial derivatives of outputs to the inputs, and to the internal states, of a fmu model exported from Openmodelica.
According to the documentation of fmi 2.0, the attribute 'providesDirectionalDerivatives' in fmu model, should be true, I think this should be set up during the fmu model exporting from the Openmodelica.
In model exchange mode, this attribute could be set as true when being exported from Openmodelica, however after I imported it into c program, I couldn't invoke the getdirectionalderivative function (or the cover function fmi2_import_get_directional_derivative) in fmi-library.
In co-simulation mode, this attribute couldn't even be changed, I tried adding '--providesDirectionalDerivatie=true' in the options-simulation tab, and in the commandline, both failed.

So how could I do, does fmi-library support this function getdirectionalderivative ?
Or is this because fmu from Openmodelica doesn't have this function ?

thanks a lot in advance !
My email: [email protected]

@filip-stenstrom
Copy link
Collaborator

FMI-Library does support it.

I don't know how OpenModelica works, but you can read the modelDescription.xml to find the value of providesDirectionalDerivatives for the specific FMU.

It's not clear what is failing for you (crash/incorrect outputs/...), but I would recommend that you make sure that the FMU instance is in a state where a call to fmi2GetDirectionalDerivative is allowed before calling.

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

No branches or pull requests

2 participants