Opened 5 years ago

Last modified 3 years ago

#5853 assigned defect

-d=-disableDirectionalDerivatives Fails

Reported by: bode-h@… Owned by: Andreas Heuermann
Priority: high Milestone:
Component: FMI Version: v1.16.0-dev
Keywords: Simulation Flags Cc: Lennart Ochel

Description

Hello,

i want to enable the directional derivates in generated FMU.

To do so, I set under tools -> options -> Simulation the flag

-d=-disableDirectionalDerivatives

Saving and generating the FMU via Data - Export - FMU gives me an FMU file.

Opening it in Python (PyFMI) returns the Error:

FMUException: This FMU does not provide directional derivatives

Watching the flags shows following result:

model = load_fmu('simuflag.fmu')

model.get_capability_flags()
Out[44]:
{'needsExecutionTool': False,

'completedIntegratorStepNotNeeded': False,
'canBeInstantiatedOnlyOncePerProcess': False,
'canNotUseMemoryManagementFunctions': False,
'canGetAndSetFMUstate': False,
'canSerializeFMUstate': False,
'providesDirectionalDerivatives': False,
'completedEventIterationIsProvided': True}

Why is this flag still set as false?
Any bug, or mishandling by myself?

Best regards

Henrik

Attachments (1)

grid.mo (107.9 KB ) - added by bode-h@… 5 years ago.
The Model "network" should be exported as an FMU with enabled directional derivates

Download all attachments as: .zip

Change History (15)

by bode-h@…, 5 years ago

Attachment: grid.mo added

The Model "network" should be exported as an FMU with enabled directional derivates

comment:1 by Francesco Casella, 5 years ago

Component: OMEditFMI
Milestone: Future1.16.0
Owner: changed from Adeel Asghar to Lennart Ochel
Status: newassigned

comment:2 by bode-h@…, 5 years ago

Running the file vial terminal with:

C:\Programme\OpenModelica1.16.0-dev-64bit\bin>omc -d=-disableDirectionalDerivatives fmu.mos

gave me the same result, directional derivatives still not provided.

The fmu.mos looks the following:

loadModel(Modelica);
loadFile("C:\Users\user\folder\grid.mo");
translateModelFMU(grid.network);
getErrorString();

comment:3 by Andreas Heuermann, 5 years ago

Cc: Andreas Heuermann added

comment:4 by Lennart Ochel, 5 years ago

Status: assignedaccepted

I think this feature is right now available only with the cpp runtime.

comment:5 by Andreas Heuermann, 5 years ago

Minimal working example:

loadModel(Modelica); getErrorString();
setCommandLineOptions("-d=newInst,-disableDirectionalDerivatives "); getErrorString();
translateModelFMU(Modelica.Electrical.Analog.Examples.CauerLowPassAnalog); getErrorString();

I get a modelDescription.xml with

...
  <ModelExchange
    modelIdentifier="Modelica_Electrical_Analog_Examples_CauerLowPassAnalog"
    providesDirectionalDerivative="true">
    <SourceFiles>
...

comment:6 by Andreas Heuermann, 5 years ago

I don't have PyFMI installed, so I can't check what it's saying to this fmu.

comment:7 by bode-h@…, 5 years ago

I wrote those lines in the fmu.mos and called it with the following command in the terminal

C:\Programme\OpenModelica1.16.0-dev-64bit\bin>omc fmu.mos
true
""
true
""
"C:/Programme/OpenModelica1.16.0-dev-64bit/bin/grid.network.fmu"
"Notification: Automatically loaded package grid default due to uses annotation.

My modelDescriptions looks the following:

  ...
  numberOfEventIndicators="0">
  <ModelExchange
    modelIdentifier="grid_network">
    <SourceFiles>
      <File name="grid_network.c" />
      ...

No Information about any flags regarding the directional derivatives.

comment:8 by bode-h@…, 5 years ago

With your model, it works. But i can´t set this flag in my grid model.

Could you please take a look, why it is not working with my file? I´ll attach it here.

Would be awesome if it works :-)

Best regards

Henrik

comment:9 by bode-h@…, 5 years ago

grid.mo was already attached at the first post

comment:10 by Andreas Heuermann, 5 years ago

Seems to be an error with your model. You are initializing the parameters wrong.
Try parameter Integer myParameter = 42;

But in any case we should produce an error when providesDirectionalDerivatives can't be generated but was requested by the user (like for C).

I will look into it tomorrow and see if I can use the Cpp solution for C as well.

comment:11 by Andreas Heuermann, 5 years ago

Cc: Lennart Ochel added; Andreas Heuermann removed
Owner: changed from Lennart Ochel to Andreas Heuermann
Status: acceptedassigned

comment:12 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:13 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:14 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.