modelicafmi

Modelica MSL CombiTimeTable - how to only set size of table at time of compilation?


I have stated to use MSL CombiTimeTable and replace my own code for a similar function. Is there a way to specify only the size of the table at time of compilation and later give the table values?

The following declaration code works

    CombiTimeTable pump(
        smoothness=Modelica.Blocks.Types.Smoothness.ConstantSegments,
        extrapolation = Modelica.Blocks.Types.Extrapolation.HoldLastPoint,
        table=[0,0; 1001,1; 1002,2; 1003,3; 1004,4; 1005,5]);

But I want to avoid giving table dummy values. The documentation of MSL for this block does not indicate that it is possible, but here is perhaps some way to do it?

https://doc.modelica.org/Modelica%203.2.3/Resources/helpMapleSim/Blocks/Sources/index.html#CombiTimeTable

I usually compile the Modelica code to FMUs and set parameters in a Python script. There is a possibility to read the CombiTimeTable information from a file, but I want to have all parameters for the FMU in the Python script, for simplicity.


Solution

  • It depends. You could try:

      CombiTimeTable pump(
            nout=1,
            smoothness=Modelica.Blocks.Types.Smoothness.ConstantSegments,
            extrapolation = Modelica.Blocks.Types.Extrapolation.HoldLastPoint,
            table=table);
      parameter Real table[6,2];
    

    which uses an unspecified table of the right-size.

    However, tools may require special settings (Dymola seems to require Advanced.IssueErrorForUnassignedParameter=false)- and/or generate default values like 0 regardless.