AmesimKnowledge

Advanced Modelica language topics > Coupling Modelica and native Simcenter Amesim submodels

Signal-based connections

connections signal ports

ports external

Making Modelica models connect with traditional Simcenter Amesim ones involves mainly using a predefined set of Modelica definitions of special input and output variables (in the sense of "inputs from" and "outputs to" the Simcenter Amesim world). The figure below shows the Modelica source code of two model classes used to communicate with Simcenter Amesim: SignalToAMESim and SignalFromAMESim. The use of these two classes to build more complex models will typically yield an under-constrained system when compiled with an ordinary Modelica compiler, because if we want to supply values from outside, we have to keep input variables of a model instance unconstrained. The models SignalToAMESim and SignalFromAMESim make use of a special kind of connectors called "external connectors" (see the declaration of AMERealInput and AMERealOutput in the figure below).

Figure 35: Definitions that enable connection of Modelica-based submodels with Simcenter Amesim traditional submodels

The external connector in Simcenter Amesim's Modelica compiler is a Simcenter Amesim-specific extension to the Modelica standard so the compiler knows that a constraint will be provided from outside at runtime. Thus, the compiler does not complain and generates the code of a Simcenter Amesim submodel with inputs and outputs. One important thing to note is that in this case inputs and outputs have no physical units (they are signals), so only Simcenter Amesim submodels with signal ports can be connected to these Modelica-based submodels.

In a subsequent example, we will introduce the use of units and external connectors that will allow direct connections between a Modelica-based submodel with electrical ports and a Simcenter Amesim submodel with electrical ports (see the Physical port connections section).

For now, let us consider the case of connections using signals. We rewrite our model class of RLC so that input voltage will be computed using external Simcenter Amesim submodels. Replace the sinusvoltage component by instances of SimcenterAmesim.Electrical.Sources.SignalVoltage and SimcenterAmesim.AMESim.Blocks.AMERealInput as in the figures below.

Figure 36: Externally supplied RLC circuit (SimcenterAmesim.Examples.ElectricalExamples.ExternallySuppliedRLC modified for this example)

Our new model class of RLC circuit can be imported into Simcenter Amesim like any ordinary Modelica code: the compiler generates the appropriate signal port in the resulting Simcenter Amesim submodel. If we build a new sketch under Simcenter Amesim, it is now possible to pick the icon with one input (it may be necessary to update categories). The voltage source has to be described using a Simcenter Amesim submodel: we choose to model it using a sine wave generator, as shown in the figure Figure 38.

Figure 37: The code of a model class of RLC circuit that depends on Simcenter Amesim submodels (SimcenterAmesim.Examples.ElectricalExamples.ExternallySuppliedRLC)

Figure 38: Connections between traditional Simcenter Amesim submodels and a Modelica-based submodel

When the Modelica-based submodels have more than one input or output, we need to know which variable corresponds to each input or output. This is done using the contextual menu External variables in Submodel mode (see figure Figure 39).

You can use the Display variable titles and Display variable names checkboxes to display or hide the following elements:

  • Display variable titles: the Modelica variable name and its description as defined in the Modelica component code.

  • Display variable names: the component instance name combined with the Modelica variable name.

We now have to set the parameter values of the sine wave generator.

Warning

Unlike Modelica, phase shifts in Simcenter Amesim submodels are in degrees, not radians!

The frequency should be set to 1 Hz, the mean level to zero, the amplitude to 15, and the phase shift should be set to 0 degrees. Running the simulation with appropriate run parameters gives the same result as those obtained with pure Modelica-based submodels.

Figure 39: External variables window showing the name of the variable associated to the pointed port

Figure 40: External connector definitions required for using physical ports

Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.Modelica_Platform/Signalbased_connections · retrieved 2026-07-17