ConnectSystemModelComponents

ConnectSystemModelComponents[{"c1"comp1,},{"c1.a""c2.b",}]

creates a system model by connecting connector "a" of component "c1" with connector "b" of component "c2" etc.

Details and Options

  • ConnectSystemModelComponents assembles components to create a new system model. These connections communicate values and set conservation laws in the system.
  • ConnectSystemModelComponents returns SystemModel[].
  • ConnectSystemModelComponents["NewModel",] gives the created model the name "NewModel".
  • ConnectSystemModelComponents["PackageA.NewModel",] inserts "NewModel" into "PackageA".
  • The compi can be a SystemModel object, a full model name string or a shortened model name accepted by SystemModel.
  • In ConnectSystemModelComponents[,spec], spec is an Association with the following keys:
  • "ParameterValues"{p1val1,}parameter values
    "InitialValues"{v1val1,}initial values
    "ExtendsModels"{partial1,}partial models to build on
    "DiscreteVariables"{v1,v2,}variables changing only at events
    "SimulationSettings"{opt1val1,}model simulation options
  • With ConnectSystemModelComponents[,"ExtendsModels"partial], the new model is combined with the existing partial SystemModel defined in Modelica. »
  • A model can extend multiple models using "ExtendsModels"{"partial1",}.
  • Partial models to build on are usually defined in an Interfaces package. For example, SystemModels["Modelica.Electrical.Analog.Interfaces.*","model"|"block"] can be used to find partial models for the built-in electrical library.
  • "InitialValues" correspond to the start property in the Modelica model.
  • Allowed options in "SimulationsSettings"->{opt1val1,} include
  • "Method"simulation method
    "StartTime"simulation start time
    "StopTime"simulation stop time
  • Available adaptive-step "Method" values include:
  • "DASSL"DASSL DAE solver
    "CVODES"CVODES ODE solver
  • Options for adaptive-step methods include:
  • "InterpolationPoints"number of interpolation points
    "Tolerance"tolerance for adaptive step size
  • Available fixed-step "Method" values include:
  • "Euler"explicit Euler's method of order 1
    "Heun"Heun's method of order 2
    "RungeKutta"explicit RungeKutta method of order 4
  • Options for fixed-step methods include:
  • "StepSize"fixed step size
  • The layout for the created model diagram can be controlled with the option GraphLayout.

Examples

open allclose all

Basic Examples  (2)

Create a simple electrical circuit:

Show the current and voltage in the inductor:

Use short naming to refer to the Abs and Sine components in Modelica.Blocks:

Scope  (5)

Create a block example, sampling a sine wave at regular intervals:

Simulate and plot the sampled signal:

Give a value to a parameter in a component:

Set the amplitude of the sine to 3:

Simulate and plot the output:

Connect two masses with heat capacity with a thermal conductor:

Set heat capacities, masses and initial temperatures:

Show that a temperature equilibrium is reached:

Create a mass connected to a spring:

Move the initial position of the mass, stretching the spring:

Show how the mass position oscillates:

Build a damped 3D pendulum:

Set parameter values:

Simulate and animate the path of the pendulum:

Generalizations & Extensions  (1)

Rule, DirectedEdge and UndirectedEdge can be used for connections:

Use Rule to specify a connection:

Use DirectedEdge and UndirectedEdge to specify connections:

Simulate and plot the signals:

Options  (3)

GraphLayout  (3)

GraphLayout can be used to specify the layout of the model diagram:

An edge-weighted "SpringElectricalEmbedding" is used by default:

Turn off automatic layout:

Applications  (3)

A DC Motor  (1)

Create a model of a DC motor by connecting electrical and mechanical components:

Show the angular velocity of the DC motor:

A Lowpass Filter  (1)

Create a digital lowpass filter:

Convert the filter into a transfer function:

Create a model of the filter:

Create a signal generating source:

Connect the signal source to the filter:

Simulate and plot the signal output and the filtered signal:

An Inerter  (1)

Create an inerter, with forces at the terminals proportional to relative acceleration:

Compare how adding an inerter to a damping system influences vibrations:

Set parameter values and simulate the system with a sine vibration force:

Damping effects are of similar magnitude:

Forces acting on the damper component are significantly reduced with an inerter:

Properties & Relations  (3)

Use CreateSystemModel to create models based on differential equations:

CreateSystemModel can be used similarly to ConnectSystemModelComponents:

Hierarchical models based on existing components enable quick creation of larger systems:

Build a 3D inverted pendulum model with a controller:

A complex multidomain system can be built using few components:

Neat Examples  (1)

Show thermal conductance between vertices in a graph:

Define components:

Define connections:

Create a model and set initial and parameter values:

Simulate and animate the model, indicating temperature by color:

Wolfram Research (2018), ConnectSystemModelComponents, Wolfram Language function, https://reference.wolfram.com/language/ref/ConnectSystemModelComponents.html (updated 2020).

Text

Wolfram Research (2018), ConnectSystemModelComponents, Wolfram Language function, https://reference.wolfram.com/language/ref/ConnectSystemModelComponents.html (updated 2020).

CMS

Wolfram Language. 2018. "ConnectSystemModelComponents." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/ConnectSystemModelComponents.html.

APA

Wolfram Language. (2018). ConnectSystemModelComponents. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ConnectSystemModelComponents.html

BibTeX

@misc{reference.wolfram_2024_connectsystemmodelcomponents, author="Wolfram Research", title="{ConnectSystemModelComponents}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/ConnectSystemModelComponents.html}", note=[Accessed: 18-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_connectsystemmodelcomponents, organization={Wolfram Research}, title={ConnectSystemModelComponents}, year={2020}, url={https://reference.wolfram.com/language/ref/ConnectSystemModelComponents.html}, note=[Accessed: 18-November-2024 ]}