WSMLink`
WSMLink`

WSMConnectComponents

WSMConnectComponentsString is being phased out in favor of ConnectSystemModelComponents, which was introduced experimentally in Version 11.3.

WSMConnectComponents["newmodel",{"c1""comp1",},{"c1.a"->"c2.b",}]

creates the Modelica model "newmodel" by connecting connector a of component c1 with connector b of component c2 etc.

Details and Options

  • WSMConnectComponents[newmodel,] returns WSMModelData[newmodel].
  • WSMConnectComponents["PackageA.NewModel",] inserts "NewModel" into "PackageA".
  • The shortest unique component name comp can be used where WSMNames["*.comp"] gives a unique match.

Examples

open allclose all

Basic Examples  (3)

Load Wolfram System Modeler Link:

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  (4)

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

Simulate and plot the sampled signal:

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  (2)

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:

Turn off automatic layout:

Applications  (3)

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:

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

Show the angular velocity of the DC motor:

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:

Properties & Relations  (4)

Use WSMCreateModel to create models based on differential equations:

WSMCreateModel can be used similarly to WSMConnectComponents:

WSMConnectComponentsString creates an inert Modelica String of the model:

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

Build a 3D inverted pendulum model with a controller:

A complex multi-domain 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: