Skip to content

Clarify/Allow use of ExternalObjects in records #2399

@beutlich

Description

@beutlich

It would be very convenient if external objects are considered as legal components of records. Currently, this is not yet clarified by the specification.

As an example, the below model runs in Dymola or SimulationX, but fails in Wolfram SystemModeler, for instance.

model M
  import Modelica.Utilities.Files;
  record R "Record with external object"
    import Modelica.Blocks.Types;
    parameter String tableName "Table name";
    parameter String fileName "File name";
    constant Boolean verbose = true "Print message during creation of external table object";
    // Create and assign the external object once
    final parameter Types.ExternalCombiTimeTable table = Types.ExternalCombiTimeTable(tableName, fileName, fill(0, 0, 2), 0, {2}, Types.Smoothness.LinearSegments, Types.Extrapolation.LastTwoPoints, 0, Types.TimeEvents.Always, verbose) "External table object";
  end R;
  parameter R r = R("tab0", Files.loadResource("modelica://Modelica/Resources/Data/Tables/test.txt"));
  annotation(uses(Modelica(version="3.2.3")));
end M;

This goes along wih #1669 to make libraries like ExternData or Modelica_DeviceDrivers Modelica-compliant. The topic was already presented to the MAP-Lang in the article Towards a Standard-Conform, Platform-Generic and Feature-Rich Modelica Device Drivers Library, section 3.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions