I develop simulation scripts in Python using FMPy (and also PyFMI). For some Modelica models you have parameters that are defined as a function of other parameters. If you include these parameters in the list "output" of the simulate_fmu() function you get information about that "variable" stored.
Information stored is: name, variability, causality etc. The variability and causality are here correctly: 'fixed' and 'calculatedParameter'. But where is the actual value stored?
Since this is a calculated parameter it is not natural to also include it in the start_values list to the simulate_fmu() function. This means here is not any start value stored.
I currently use FMPy ver 0.3.20 in a Python 3.12.3 environment on Windows. Using PyFMI for the same FMU I have no problem to extract the values of these derived parameters.
--
Just for comparison with PyFMI where we by the command
model.get_variable_causality()
get (information taken from the built-in information)
0 corresponds to 'parameter'
1 corresponds to 'calculatedParameter'
2 corresponds to 'input'
3 corresponds to 'output'
4 corresponds to 'local'
5 corresponds to 'independent'
6 corresponds to 'unknown'
but in PyFMI all are stored as time series, i.e. category 0 and 1 just brings un-necessary storage, by default.
From input from the team behind FMPy I now understand "my issue" much better. The problem is entirely due to my own misunderstanding of how FMPy works. Let me explain. The input information to the model in terms of initial state values and parameter all come from
model_description.modelVariables
where
model_description = read_model_description(fmu_model)
values given found in the field "start" for the variable in question.
The calculated parameters are results from simulation, although done "before" time=0, sort of, and stored in the result-file from a simulation. Here the calculated parameters are stored as time series, although here is only a calculation "before" time = 0. Thus FMPy also store fixed calculated parameters as time series, in the same way as PyFMI, although I would prefer just a single value.
For details around a small example, see the github site for FMPy issues given above by Christian Bertsch. I thank Torsten Sommer for working through the basic example.