({{, (RefLink[CreateSystemModel, paclet:ref/CreateSystemModel])[sys]
creates a Modelica (RefLink[SystemModel, paclet:ref/SystemModel]) from the systems model sys. }, {, (RefLink[CreateSystemModel, paclet:ref/CreateSystemModel])[eqns,t]
creates a model for the system equations eqns with independent variable t.}, {, (RefLink[CreateSystemModel, paclet:ref/CreateSystemModel])[…,tspec]
creates a model with type specification tspec for variables and parameters.}, {, (RefLink[CreateSystemModel, paclet:ref/CreateSystemModel])[…,spec]
creates a model with spec for parameter values, initial values and model relations.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[CreateSystemModel, paclet:ref/CreateSystemModel]) returns (RefLink[SystemModel, paclet:ref/SystemModel])[…].

(RefLink[CreateSystemModel, paclet:ref/CreateSystemModel])["NewModel",…] gives the created model the name "NewModel".

(RefLink[CreateSystemModel, paclet:ref/CreateSystemModel])["PackageA.NewModel"] inserts "NewModel" into "PackageA".

Possible systems models sys include (RefLink[TransferFunctionModel, paclet:ref/TransferFunctionModel]) and (RefLink[StateSpaceModel, paclet:ref/StateSpaceModel]). »

Possible equations eqns include ordinary differential equations (ODE), differential algebraic equations (DAE), initial value equations and event specifications given by (RefLink[WhenEvent, paclet:ref/WhenEvent]). »

Parameters in eqns and sys are taken to be variables that do not explicitly depend on t.

Type specifications tspecs for variables and parameters {(Subscript[tspec, 1]),…}, where each (Subscript[tspec, i]) has the form:

The types (Subscript[type, i]) can be basic (RefLink[Reals, paclet:ref/Reals]), (RefLink[Integers, paclet:ref/Integers]) and (RefLink[Booleans, paclet:ref/Booleans]), or any Modelica type including units. »

(RefLink[SystemModels, paclet:ref/SystemModels])["Modelica.SIunits.*","type"] can be used to find built-in standard units.

Modelica models are typically built by combining many models into a larger system. The interaction between these models is described by the Modelica concept connector. »

A connector consists of effort and flow variables. When connecting multiple connectors, flow variables are summed to 0, while effort variables are set equal.

As an example, an electrical circuit connector, commonly called a pin, consists of a voltage variable v and a current variable i.

Connecting pins n and p sums the flow variables, in this case currents i, to 0 and sets the efforts, in this case voltages v, equal:

All flow variables are positive in the direction flowing into a component.

Effort and flow variables for different domains include:

Possible connectors (Subscript[conn, i]) for a domain are usually defined in an "\"Interfaces\"" package. For example, (RefLink[SystemModels, paclet:ref/SystemModels])["Modelica.Electrical.Analog.Interfaces.*","connector"] can be used to find connectors for the built-in electrical library.

The specification (Subscript[var, i])∈(Subscript[conn, i]) can be used to specify that a variable (Subscript[var, i]) refers to a connector of type (Subscript[conn, i]).

Variables (Subscript[v, i]) in a connector c can be referred to in eqns with (Subscript[c▴v, i]), where the "▴" character is input as \[UpPointer].

The variables defined by a connector conn can be listed with (RefLink[SystemModel, paclet:ref/SystemModel])[conn,"SystemVariables"].

In (RefLink[CreateSystemModel, paclet:ref/CreateSystemModel])[…,spec], spec is an (RefLink[Association, paclet:ref/Association]) with the following keys:

Libraries often contain partial models called interfaces for building new component models. These interfaces usually consist of connectors and equations describing the basic relationships between them.

With (RefLink[CreateSystemModel, paclet:ref/CreateSystemModel])[…,\[LeftAssociation]"Extends"->partial\[RightAssociation]], the new model is combined with the existing partial (RefLink[SystemModel, paclet:ref/SystemModel]) defined in Modelica. »

A model can extend multiple models using "Extends"->{"(Subscript[partial, 1])",…}.

Partial models to build on are usually defined in an "Interfaces" package. For example, (RefLink[SystemModels, paclet:ref/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.

OpenersPrimaryExamplesSection(Spacer1)Examples  (45)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Create a model based on a (RefLink[StateSpaceModel, paclet:ref/StateSpaceModel]):

CreateSystemModel[(StateSpaceModel[0, 1, 1, 0, ])]

Create a model based on a (RefLink[TransferFunctionModel, paclet:ref/TransferFunctionModel]):

CreateSystemModel[(TransferFunctionModel[((1+2 s)/(1+s)), ])]

Build a model around an existing interface using equations:

model=CreateSystemModel[{v[t]==r i[t]},t,<|"Extends"->"Modelica.Electrical.Analog.Interfaces.OnePort"|>];

model["ModelicaDisplay"]

({{model Wdf9b0781ffaf4b189e06dec1996dcac6}, {  extends Modelica.Electrical.Analog.Interfaces.OnePort;}, {  parameter Real r;}, {equation}, {  v = r * i;}, {end Wdf9b0781ffaf4b189e06dec1996dcac6;}})

OpenersExampleSection1(Spacer1)Scope  (31)

OpenersExampleSubsection0(Spacer1)Systems Models  (9)

Create a model of a single-input, single-output (RefLink[TransferFunctionModel, paclet:ref/TransferFunctionModel]):

CreateSystemModel[(TransferFunctionModel[((1+2 s)/(1+s)), ])]

Create a model of a single-input, single-output (RefLink[StateSpaceModel, paclet:ref/StateSpaceModel]):

CreateSystemModel[(StateSpaceModel[0, 1, 1, 0, ])]

Multiple input, multiple output:

CreateSystemModel[(TransferFunctionModel[(1/(2+s)), (1/(3+s)), (1/(4+s)), (1/(3+s)), (1/(4+s)), (1/(5+s)), ])]

Create a model with parameters in a transfer-function model:

CreateSystemModel[(TransferFunctionModel[((p1+2 s)/(p2+s)), ])]

Specify parameters in a state-space model:

CreateSystemModel[(StateSpaceModel[a, 0, 1, 0, 0, b, 0, 1, 1, 1, 0, 0, ])]

Define parameter values in a transfer-function model:

CreateSystemModel[(TransferFunctionModel[((p1+2 s)/(p2+s)), ]),<|"ParameterValues"->{p1->1,p2->2}|>]

Give parameter values in a state-space model:

CreateSystemModel[(StateSpaceModel[a, 0, 1, 0, 0, b, 0, 1, 1, 1, 0, 0, ]),<|"ParameterValues"->{a->1,b->2}|>]

Give the types and values of parameters:

CreateSystemModel[(StateSpaceModel[a, 0, 1, 0, 0, b, 0, 1, 1, 1, 0, 0, ]),{a∈Reals,b∈"Modelica.SIunits.Current"},<|"ParameterValues"->{a->1,b->2}|>]

Create a model from a discrete transfer-function model:

CreateSystemModel[(TransferFunctionModelFull[(1/((-1+z) (-0.605`+z))), 1, , ])]

Create a model from a discrete state-space model:

CreateSystemModel[(StateSpaceModelFull[1, 0, 0, 1, 0, 2, 0, 1, 0, 0, 3, 1, 1, 1, 1, 0, 2, , ])]

Use a descriptor system:

CreateSystemModel[(StateSpaceModel[1, 0, 3, 0, 5, 0, 2, 0, 4, 6, 7, 8, 9, ])]

A function is converted into an input-output block:

model=CreateSystemModel[Function[x,x+Sin[x]]];

model["ModelicaDisplay"]

({{block Wfab8d193eb2b49f8ab733f8c5b256503}, {  extends Modelica.Blocks.Interfaces.SISO;}, {equation}, {  y = u + sin(u);}, {end Wfab8d193eb2b49f8ab733f8c5b256503;}})

OpenersExampleSubsection1(Spacer1)Differential Equations  (11)

Create a single-equation ODE system:

model=CreateSystemModel[{u[t]==u'[t]},t];

model["ModelicaDisplay"]

({{model W8e4618edc47e4d61869c4036187f0c74}, {  Real u;}, {equation}, {  u = der(u);}, {end W8e4618edc47e4d61869c4036187f0c74;}})

Specify any order equation. Reduction of higher-order derivatives is done automatically:

model=CreateSystemModel[{x''[t]+1/10x'[t]+Sin[x[t]]==1/2 Cos[t],x[0]==0,x'[0]==0},t];

model["ModelicaDisplay"]

({{model W2b1a04516d074ce1a93b850dc99afe53}, {  Real x;}, {  Real derx111;}, {initial equation}, {  x = 0;}, {  der(x) = 0;}, {equation}, {  sin(x) + 1 / 10 * der(x) + der(derx111) = 1 / 2 * cos(time);}, {  derx111 = der(x);}, {end W2b1a04516d074ce1a93b850dc99afe53;}})

Define a system of multiple equations:

model=CreateSystemModel[{(Subscript[y, 1])'[t]==(Subscript[y, 1])[t]+(Subscript[y, 2])[t],(Subscript[y, 2])'[t]==(Subscript[y, 1])[t]+Sin[t]},t];

model["ModelicaDisplay"]

({{model Wafae2199d57746768aa52846aa190666}, {  Real y_1;}, {  Real y_2;}, {equation}, {  der(y_1) = y_1 + y_2;}, {  der(y_2) = sin(time) + y_1;}, {end Wafae2199d57746768aa52846aa190666;}})

Define a system with an algebraic constraint, resulting in a high-index problem:

model=CreateSystemModel[{x'[t]==y[t]^2+x[t]y[t],2x[t]^2+y[t]^2==1,x[0]==0,y[0]==1},t];

model["ModelicaDisplay"]

({{model Wcb6e09f02e9e4085af5a6beffbe3f96a}, {  Real x;}, {  Real y;}, {initial equation}, {  x = 0;}, {  y = 1;}, {equation}, {  der(x) = x * y + y ^ 2;}, {  2 * x ^ 2 + y ^ 2 = 1;}, {end Wcb6e09f02e9e4085af5a6beffbe3f96a;}})

Hybrid equations can be specified using (RefLink[WhenEvent, paclet:ref/WhenEvent]):

model=CreateSystemModel[{y'[x]==-y[x],WhenEvent[y[x]<0.1,y[x]->y[x]+0.1*x],y[0]==1},x];

model["ModelicaDisplay"]

({{model W8738327647554205b149924a26514e72}, {  Real y;}, {initial equation}, {  y = 1;}, {equation}, {  der(y) = (-1) * y;}, {  when y < 0.1 then}, {    reinit(y, 0.1 * time + pre(y));}, {  end when;}, {end W8738327647554205b149924a26514e72;}})

sim=SystemModelSimulate[model,10];
SystemModelPlot[sim,{"y"}]

Wolfram Language functions are automatically translated to their Modelica equivalent:

model=CreateSystemModel[{y'[x]==Floor[x],y[0]==1},x];

model["ModelicaDisplay"]

({{model Wa366799229264470b49f7762fbe56285}, {  Real y;}, {initial equation}, {  y = 1;}, {equation}, {  der(y) = floor(time);}, {end Wa366799229264470b49f7762fbe56285;}})

Specify a default parameter value:

model=CreateSystemModel[{x'[t]==par x[t],x'[0]==2},t,
<|"ParameterValues"->{par->10}|>];

model["ModelicaDisplay"]

({{model W1161938afe65417eab398eb3be69b0cc}, {  parameter Real par = 10;}, {  Real x;}, {initial equation}, {  der(x) = 2;}, {equation}, {  der(x) = par * x;}, {end W1161938afe65417eab398eb3be69b0cc;}})

Specify a start value:

model=CreateSystemModel[{x'[t]==par x[t]},t,<|"InitialValues"->{x->10}|>];

model["ModelicaDisplay"]

({{model W316d0a32d7df42ef8e0c4f2a5d4f46a0}, {  parameter Real par;}, {  Real x(start = 10);}, {equation}, {  der(x) = par * x;}, {end W316d0a32d7df42ef8e0c4f2a5d4f46a0;}})

Specify types for variables and parameters:

model=CreateSystemModel[{x'[t]==par x[t],x'[0]==0},t,{par∈Reals,x∈"Modelica.SIunits.Position"}];

model["ModelicaDisplay"]

({{model We9c5cb3d2c214dce9f490c7c1adfd638}, {  parameter Real par;}, {  Modelica.SIunits.Position x;}, {initial equation}, {  der(x) = 0;}, {equation}, {  der(x) = par * x;}, {end We9c5cb3d2c214dce9f490c7c1adfd638;}})

Arrays are expressed using (RefLink[Indexed, paclet:ref/Indexed]):

model=CreateSystemModel[{Indexed[u,1]'[t]==1,Indexed[u,2]'[t]==2},t];

model["ModelicaDisplay"]

({{model Wee472e44225c46c0a7cd5ad402cf036c}, {  Real u[2];}, {equation}, {  der(u[1]) = 1;}, {  der(u[2]) = 2;}, {end Wee472e44225c46c0a7cd5ad402cf036c;}})

Functions used in equations are translated into functions in Modelica:

model=CreateSystemModel[{Unevaluated[Function[#1+Sin[#2]]][1,u[t]]==u'[t]},t];

model["ModelicaDisplay"]

({{model W33e87a2d7a254d9cb2e264d92f9a976a}, {  Real u;}, {}, {  function Mfunction0}, {    input Real u1;}, {    input Real u2;}, {    output Real y;}, {  algorithm}, {    y := u1 + sin(u2);}, {  end Mfunction0;}, {equation}, {  Mfunction0(1, u) = der(u);}, {end W33e87a2d7a254d9cb2e264d92f9a976a;}})

OpenersExampleSubsection2(Spacer1)Connectors  (3)

Create a derivative block:

eqs={y[t]==u'[t]};

Define input and output connectors:

conns={u∈"Modelica.Blocks.Interfaces.RealInput",y∈"Modelica.Blocks.Interfaces.RealOutput"};

Create the model:

model=CreateSystemModel[eqs,t,conns];

model["ModelicaDisplay"]

({{model Wcc627fe98be54ee8b91431618e8386ac}, {  Modelica.Blocks.Interfaces.RealInput u;}, {  Modelica.Blocks.Interfaces.RealOutput y;}, {equation}, {  y = der(u);}, {end Wcc627fe98be54ee8b91431618e8386ac;}})

Create a resistor using connectors from the Electrical library:

eqs={v[t]==r i[t],i[t]==QuantityVariable["p.i","ElectricCurrent"][t],QuantityVariable["n.i","ElectricCurrent"][t]==-QuantityVariable["p.i","ElectricCurrent"][t],v[t]==QuantityVariable["p.v","ElectricPotential"][t]-QuantityVariable["n.v","ElectricPotential"][t]};

model=CreateSystemModel[eqs,t,{p∈"Modelica.Electrical.Analog.Interfaces.PositivePin",n∈"Modelica.Electrical.Analog.Interfaces.NegativePin"}];

model["ModelicaDisplay"]

({{model W8d6f26f5d89c49e38d515a3dab475202}, {  parameter Real r;}, {  Real i;}, {  Real v;}, {  Modelica.Electrical.Analog.Interfaces.PositivePin p;}, {  Modelica.Electrical.Analog.Interfaces.NegativePin n;}, {equation}, {  v = r * i;}, {  i = p.i;}, {  n.i = (-1) * p.i;}, {  v = (-1) * n.v + p.v;}, {end W8d6f26f5d89c49e38d515a3dab475202;}})

Use the short form to refer to connectors:

conns={u∈"RealInput",y∈"RealOutput"};

model=CreateSystemModel[{y[t]==u'[t]},t,conns];

model["ModelicaDisplay"]

({{model W00712a2fec86460785e0b0ba26de4c1a}, {  Modelica.Blocks.Interfaces.RealInput u;}, {  Modelica.Blocks.Interfaces.RealOutput y;}, {equation}, {  y = der(u);}, {end W00712a2fec86460785e0b0ba26de4c1a;}})

OpenersExampleSubsection3(Spacer1)Build on Partial Models  (2)

Create a block that adds 1 to the input:

eqs={y[t]==u[t]+1};

Create the block, extending a SISO block interface:

model=CreateSystemModel[eqs,t,<|"Extends"->"Blocks.Interfaces.SISO"|>];

model["ModelicaDisplay"]

({{block W810b8d168da54371ac74a4f6e12767a8}, {  extends Modelica.Blocks.Interfaces.SISO;}, {equation}, {  y = 1 + u;}, {end W810b8d168da54371ac74a4f6e12767a8;}})

Use the short form to refer to an existing interface:

model=CreateSystemModel[{v[t]==r i[t]},t,<|"Extends"->"Analog.Interfaces.OnePort"|>];

model["ModelicaDisplay"]

({{model W8053a9b3369d4458b5e09e346bb48e0c}, {  extends Modelica.Electrical.Analog.Interfaces.OnePort;}, {  parameter Real r;}, {equation}, {  v = r * i;}, {end W8053a9b3369d4458b5e09e346bb48e0c;}})

({{model W4a22d1f7f84449deae983f7bc4aa0c0a}, {  extends DocumentationExamples.Basic.ParSel(a = 2, y.start = 4);}, { »;}, {end W4a22d1f7f84449deae983f7bc4aa0c0a;}})

OpenersExampleSubsection4(Spacer1)Initial and Parameter Values  (6)

Give a start value for a variable:

model=CreateSystemModel[{x'[t]==par x[t]},t,<|"InitialValues"->{x->10}|>];

model["ModelicaDisplay"]

({{model W1905f9d2cbb7422ea14e1a626243c9dc}, {  parameter Real par;}, {  Real x(start = 10);}, {equation}, {  der(x) = par * x;}, {end W1905f9d2cbb7422ea14e1a626243c9dc;}})

Give a start value for a parameter:

model=CreateSystemModel[{x'[t]==par x[t]},t,<|"InitialValues"->{par->10}|>];

model["ModelicaDisplay"]

({{model Wdf7acea0cce8441ba74d64ae204a8183}, {  parameter Real par(start = 10);}, {  Real x;}, {equation}, {  der(x) = par * x;}, {end Wdf7acea0cce8441ba74d64ae204a8183;}})

With both a start value and an initial equation, the initial equation has higher priority:

model=CreateSystemModel[{x'[t]==-x[t],x[0]==2},t,<|"InitialValues"->{x->10}|>];

model["ModelicaDisplay"]

({{model W4f5bb3fe9281408b8e4e2e126a5ef485}, {  Real x(start = 10);}, {initial equation}, {  x = 2;}, {equation}, {  der(x) = (-1) * x;}, {end W4f5bb3fe9281408b8e4e2e126a5ef485;}})

SystemModelPlot[{model,5},{"x"}]

Use a parameter as an initial value:

model=CreateSystemModel[{x'[t]==-x[t]},t,<|"ParameterValues"->{par->5},"InitialValues"->{x->par}|>];

model["ModelicaDisplay"]

({{model W4bccc85188344128818b50a61b10c662}, {  parameter Real par = 5;}, {  Real x(start = par);}, {equation}, {  der(x) = (-1) * x;}, {end W4bccc85188344128818b50a61b10c662;}})

Give a parameter value:

model=CreateSystemModel[{x'[t]==par x[t]},t,<|"ParameterValues"->{par->10}|>];

model["ModelicaDisplay"]

({{model Wf0e0d7dc76524721ae4ab67773188288}, {  parameter Real par = 10;}, {  Real x;}, {equation}, {  der(x) = par * x;}, {end Wf0e0d7dc76524721ae4ab67773188288;}})

Give a parameter depending on another parameter:

model=CreateSystemModel[{x'[t]==p1 x[t],x[0]==p2},t,<|"ParameterValues"->{p1->-2,p2->-p1}|>];

model["ModelicaDisplay"]

({{model W9499a8b5515f4740aefa5c2eab7ef2d3}, {  parameter Real p1 = -2;}, {  parameter Real p2 = (-1) * p1;}, {  Real x;}, {initial equation}, {  x = p2;}, {equation}, {  der(x) = p1 * x;}, { »;}, {end W9499a8b5515f4740aefa5c2eab7ef2d3;}})

OpenersExampleSection2(Spacer1)Applications  (5)

Define the equations for a bouncing ball:

eqs={v[t]==h'[t],v'[t]==-9.81,WhenEvent[h[t]≤0,v[t]->-k v[t]],h[0]==1};

Create the model:

model=CreateSystemModel[eqs,t];

Simulate with a restitution of 95%:

sim=SystemModelSimulate[model,10,<|"ParameterValues"->{"k"->0.95}|>];

Plot the height over time:

SystemModelPlot[sim,"h"]

Create a model of the Lotka–Volterra equations, modeling a predator-prey relationship:

eqs={pred'[t]==pred[t](δ prey[t]-γ),prey'[t]==prey[t](α-β pred[t])};

Define initial values for the two states:

ieqs={prey[0]==10,pred[0]==10};

Define parameter values:

pars={α->0.1,β->0.02,γ->0.4,δ->0.02};

Create the model:

model=CreateSystemModel[Join[eqs,ieqs],t,<|"ParameterValues"->pars|>];

Show the levels of predators and prey over time:

sim=SystemModelSimulate[model,100];

SystemModelPlot[sim,{"pred","prey"}]

A higher prey growth parameter speeds up the cycles in the system:

sims=SystemModelSimulate[model,100,<|"ParameterValues"->{"alpha"->{0.1,0.2,0.3,0.4}}|>];

Partition[Map[SystemModelPlot[#,{"prey","pred"},PlotLabel->α==#["alpha"]]&,sims],2]//Grid

Model two connected tanks with a leak in the second tank:

Set up the equations, which include initial equations and parameters:

pressureEqns={p1[t]==ρ g h1[t],p2[t]==ρ g h2[t]};
flowRate=(p1[t]-p2[t])(π pipeDia^4)/(128 μ pipeLen);
massConservation={a1 h1'[t]==-flowRate,a2 h2'[t]==flowRate-a2 h2[t]/10};
eqns=Join[pressureEqns,massConservation,{h1[0]==1,h2[0]==0}];

Create the model, using a given set of parameter values as the default:

pars={pipeLen->0.1,pipeDia->0.2,ρ->0.2,μ->2 10^-3,g->9.81,a1->1,a2->1};

model=CreateSystemModel[eqns,t,<|"ParameterValues"->pars|>];

Simulate:

sim=SystemModelSimulate[model,80];

Both tanks drain over time, because the second tank is leaking:

SystemModelPlot[sim,{"h1","h2"}]

Create a mechanical translational damper with damping in only one direction:

eqs={f[t]==If[vrel[t]>0,d*vrel[t],0],vrel[t]==s⎵rel'[t]};

Define the damping constant:

pvals={d->1};

Create the damper using a partial interface from the Translational Mechanics library:

partial="Translational.Interfaces.PartialCompliant";

CreateSystemModel["UniDamper",eqs,t,<|"ParameterValues"->pvals,"Extends"->partial|>];

Compare with a bidirectional damper:

model=SystemModel["DocumentationExamples.Modeling.DamperCompare"]

sim=SystemModelSimulate[model,8]

SystemModelPlot[sim,{"massUniDir.s","massBiDir.s"},PlotRange->All]

Create a digital lowpass filter:

a=LeastSquaresFilterKernel[{"Lowpass",0.1},20];

Convert the filter into a transfer function:

h=ListZTransform[a,z];

tf=TransferFunctionModel[h,z,SamplingPeriod->0.01]//TransferFunctionCancel

Create a model of the filter:

lowpass=CreateSystemModel[tf];

Create a signal generating source:

signal=CreateSystemModel["Signal",{y[t]==Abs[Sin[t Cos[2t]]]t},t,<|"Extends"->"Modelica.Blocks.Interfaces.SignalSource"|>];

Connect the signal source to the filter:

model=ConnectSystemModelComponents["FilteredSignal",{"signal"∈signal,"filter"∈lowpass},{"signal.y"\[UndirectedEdge]"filter.u"}]

Simulate and plot the signal output and the filtered signal:

sim=SystemModelSimulate[model,10];
SystemModelPlot[sim,{"signal.y","filter.y"}]

OpenersExampleSection3(Spacer1)Properties & Relations  (3)

(RefLink[SystemModel, paclet:ref/SystemModel]) properties can be used to extract information from a model:

origModel=SystemModel["DocumentationExamples.Basic.DiffEq"];

Create a new model with equations from an existing model, changing a parameter:

eqs=origModel["SystemEquations",t];
ivals=origModel["InitialValues"];

newModel=CreateSystemModel[eqs,t,<|"ParameterValues"->{"a"->2},"InitialValues"->ivals|>];

newModel["ModelicaDisplay"]

({{model Wc076ad956fdf47bd80a99e0dc0d18880}, {  parameter Real a(start = 1.) = 2;}, {  Real y(start = 1.);}, {  Real z(start = 0.);}, {equation}, {  der(y) = z;}, {  a * y + der(z) = 0;}, {end Wc076ad956fdf47bd80a99e0dc0d18880;}})

Simulate and compare the two models:

origSim=SystemModelSimulate[origModel,5];
newSim=SystemModelSimulate[newModel,5];

SystemModelPlot[{origSim,newSim},{"y","z"}]

Special characters are translated into their long form:

model=CreateSystemModel[{α'[t]==β[t],β'[t]==0,α[0]==0,β[0]==0},t];

model["ModelicaDisplay"]

({{model W1580bdc636ab4cfca2d3b369b1236b9a}, {  Real alpha;}, {  Real beta;}, {initial equation}, {  alpha = 0;}, {  beta = 0;}, {equation}, {  der(alpha) = beta;}, {  der(beta) = 0;}, {end W1580bdc636ab4cfca2d3b369b1236b9a;}})

(RefLink[Subscript, paclet:ref/Subscript]) is translated into _:

model=CreateSystemModel[{(Subscript[x, 1])'[t]==-(Subscript[x, 1])[t],(Subscript[x, 2])[t]==2(Subscript[x, 1])[t]},t];

model["ModelicaDisplay"]

({{model W9215c5bb528b46fc8a2c5e9eee219cc8}, {  Real x_1;}, {  Real x_2;}, {equation}, {  der(x_1) = (-1) * x_1;}, {  x_2 = 2 * x_1;}, {end W9215c5bb528b46fc8a2c5e9eee219cc8;}})

OpenersExampleSection4(Spacer1)Possible Issues  (3)

Models are not saved unless explicitly saved:

model=CreateSystemModel["NoSave",{x'[t]==par x[t]},t];

After quitting the Wolfram Language kernel, the model is gone:

Quit[]

SystemModel["NoSave","Summary"]

Some systems models are not supported:

CreateSystemModel[(TransferFunctionModel[((-1+(SystemsModelDelay[3]))/(3+s)), ])]

(RefLink[CreateSystemModel, paclet:ref/CreateSystemModel]) supports a subset of Wolfram Language functions:

CreateSystemModel[{(Subscript[x, 1])'[t]==Gamma[(Subscript[x, 1])[t]]},t]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ConnectSystemModelComponents, paclet:ref/ConnectSystemModelComponents])  ▪  (RefLink[CreateDataSystemModel, paclet:ref/CreateDataSystemModel])  ▪  (RefLink[SystemModel, paclet:ref/SystemModel])  ▪  (RefLink[StateSpaceModel, paclet:ref/StateSpaceModel])  ▪  (RefLink[TransferFunctionModel, paclet:ref/TransferFunctionModel])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[System Model Creation, paclet:guide/SystemModelCreation])}, {▪(RefLinkPlain[System Modeling Overview, paclet:guide/SystemModelingOverview])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(Spacer1)▪(WebLink[(Spacer1)Wolfram SystemModeler Documentation, http://reference.wolfram.com/system-modeler/])}})}})