Opened 8 years ago

Last modified 8 years ago

#4069 accepted defect

Unify init.xml files of C and Cpp runtime

Reported by: rfranke Owned by: wbraun
Priority: high Milestone: 2.0.0
Component: Run-time Version:
Keywords: Cc: wbraun, niklwors

Description

The Variables Browser of OMEdit does not show entry fields for models that were translated with the Cpp runtime. It appears that the XML attribute isValueChangeable is missing in the init file.

The question arises, why the C runtime and the Cpp runtime generate different _init.xml files.

Change History (14)

comment:1 Changed 8 years ago by rfranke

cba2c4a/OMCompiler adds isValueChangeable and isDiscrete to the _init.xml file of the Cpp runtime. The question remains, why this separate generator exists at all -- risking problems like the one reported here if the xml generator of the C runtime and OMEdit get further developed.

comment:2 Changed 8 years ago by wbraun

I'm not sure why we use different code for the same task, maybe niklwors knows more. As far as I see the c-runtime init file has much more information, so probably the cpp runtime could switch to that file.

comment:3 Changed 8 years ago by niklwors

In the cpp- runtime we are using a different index for the valueReference attribute than the c-runtime. The cpp- runtime uses an optimized memory organization for the model variables. The rest should be the same.

comment:4 Changed 8 years ago by rfranke

  • Milestone changed from 1.10.0 to 2.0.0

The C runtime starts with valueReference 1000; the Cpp runtime with valueReference 0. The C runtime calls the root node fmiModelDescription; the Cpp runtime ModelDescription. There might be more differences.

Wouldn't it be a good idea to not further diverge, but gradually converge the runtimes, i.e. use one and the same _init.xml for both?

Note that FMI2 export uses the same modelDescription.xml already today.

comment:5 Changed 8 years ago by rfranke

Another difference: the Cpp runtime uses the original variableReference for an aliase, whereas the C runtime introduces a new variableReference for each alias.

comment:6 Changed 8 years ago by niklwors

We can use the same init xml file. We can merge it together with the adaptions for the c and cpp runtime interfaces.

comment:7 follow-up: Changed 8 years ago by rfranke

@wbraun: do you have a reason for the offset 1000, for separate variableReferences for aliases and for the root element fmiModelDescription?

comment:8 in reply to: ↑ 7 Changed 8 years ago by wbraun

  • Owner changed from somebody to wbraun
  • Status changed from new to accepted

Replying to rfranke:

@wbraun: do you have a reason for the offset 1000, for separate variableReferences for aliases and for the root element fmiModelDescription?

No, I think there is no strong reason. I'll take a look.

comment:9 Changed 8 years ago by rfranke

The generator might call SimCodeUtil.getValueReference. It distinguishes runtimes and use cases with neg aliases in the XML file (FMI1) and without (FMI2) and is already used for the generation of the XML file with a common FMI2 exporter.

Since 8b1f74ec9868827a59de7fd5b07a9ba7e8b01597/OMCompiler also Cpp init.xml and FMI1 export calls this SimCodeUtil.getValueReference.

comment:10 Changed 8 years ago by rfranke

  • Summary changed from Parameters are not changeable in OMEdit with Cpp runtime to Unify init.xml files of C and Cpp runtime

comment:11 Changed 8 years ago by sjoelund.se

Is the value references even used in the (non-FMU) C runtime? I can only see it used for the profiling html-report.

comment:12 Changed 8 years ago by wbraun

Replying to sjoelund.se:

Is the value references even used in the (non-FMU) C runtime? I can only see it used for the profiling html-report.

No, we don't need it at all in the c runtime.

Last edited 8 years ago by wbraun (previous) (diff)

comment:13 Changed 8 years ago by rfranke

Hmm... with the Cpp runtime we saw transposed matrices in OMEdit if the value references were wrong (#4072). This is because the Cpp runtime uses the value references when reading parameter values from the init.xml file.

How does the C runtime assign values from init.xml to model parameters, e.g. upon re-simulate from OMEdit?

comment:14 Changed 8 years ago by sjoelund.se

It reads them in sequential order (it assumes states come first, then derivatives, etc).

Note: See TracTickets for help on using tickets.