SystemModel["model"]

gives a representation of the model "model", usable as input to other functions.

SystemModel["model"]["property"]

gives the specified "property" for the model "model".

Details and Options

  • SystemModel[]["property"] is equivalent to SystemModel[, "property"].
  • SystemModel["model"]["Properties"] gives a list of possible properties.
  • A shortened name "model" can be used if SystemModels["*.model"] gives a unique match.
  • Import["file.mo","MO"] imports the specified model and makes it available as a SystemModel.
  • Use Export to save a SystemModel to disk.
  • SystemModel[model,<|"property"->|>] creates a new SystemModel by modifying property of model.
  • Properties related to the whole model:
  • "Description"top-level description of model
    "Summary"model summary data
    "ModelName"fully qualified path of model
    "Diagram"diagram view of model
    "ModelicaIcon"icon view of model
    "ModelicaDisplay"show Modelica model code
    "ModelicaString"Modelica model code as a string
    "SourceFile"file where the model is saved
    "Documentation"open model documentation
    "DocumentationURL"link to model documentation
    "Domain"association describing modeling domain
    "DomainChart"chart describing modeling domain
    "Balanced"if the model is balanced in equations and variables
    "SimulationModel"if the model is a simulation model
    "Specialization"specialization "model", "package", "function",
    "Version"version information of model
    "SimulationSettings"model simulation options
  • "ModelicaDisplay" creates a cell with style "Program" containing the textual form of "model".
  • "ModelicaString" returns the textual form of "model" as a string.
  • SystemModel["model"]["Diagram","c1","c2",] shows the diagram for component "c1.c2...ci" in "model".
  • SystemModel["model",{property,options}] accepts the following options for property "Diagram" and "ModelicaIcon":
  • FrameTrueshow frame
    FrameTicksFalseshow frame ticks
    GridLinesNonewhat grid lines to show
    PlotRangeAutomaticplot range in mm
    PlotRangePaddingAutomaticpadding in mm
  • GridLines->Inherited inherits the grid defined in the model diagram. »
  • PlotRange->Automatic specifies a plot range that encloses the primitives drawn in the diagram.
  • PlotRange->Inherited inherits the page size specified in the model diagram.
  • Properties related to model plots:
  • "PlotNames"names of plots in model
    "LocalPlotNames"names of plots defined locally in model
    "InheritedPlotNames"names of plots inherited from "ExtendsModels"
    "Plots"model plot specifications
    "LocalPlots"plot specifications defined locally in model
    "InheritedPlots"plot specifications defined in "ExtendsModels"
  • Model plots from "Plots" and "LocalPlots" are a list of plotspec.
  • Each plotspec is an Association that includes the following keys:
  • "Subplots"{sp1,sp2,}list of subplots specifications (required)
    "Identifier"Automaticplot identifier
    "Name"Automaticname of the plot
    "Group"Nonegroup name
    "Default"Falsewhether the plot is a default one
    "Caption"Nonecaption of the plot
  • Each subplot specification spi is an Association that includes the following keys:
  • "Variables"{v1,v2,}list of variables (required)
    "Identifier"Nonesubplot identifier
    "Title"Automatictitle of the subplot
    "Interval"Automatictime interval
    "AxesLabel"Automaticaxes label
    "PlotLegends"Automaticlegends for curves
    "PlotRange"Automaticrange of values to include
  • Model plot "Variables" can take the following forms:
  • {"v1","v2",}variables vi
    {{"v1,x","v1,y"},}parametric plot of vi,x vs vi,y
    {{"v1","p1",d1},}sensitivity bounds around vi for pi varying 100 di%
  • Model plot "Interval" can be given as {tmin,tmax} or tmax.
  • Model plot "AxesLabel" can be Automatic, None, a string label for the y axis or {"xlabel","ylabel"}.
  • Possible "PlotLegends" are Automatic, None or a list of one string per variable in the plot.
  • "PlotRange" is Automatic, {ymin,ymax} or y, which is interpreted as {-y,y}.
  • If "Default" is True, the plot will be included in SystemModelPlot[model].
  • Properties related to equations and variables:
  • "SystemEquations"differential and algebraic equations
    "InitialEquations"initial value equations
    "InitialSeedings"guess values for initialization
    "StateVariables"differentiated variables
    "AlgebraicVariables"non-differentiated variables
    "SystemVariables"state and algebraic variables
    "TopSystemVariables"system variables excluding component variables
    "InputVariables"variables specified as inputs
    "OutputVariables"variables specified as outputs
    "ParameterNames"parameters
    "TopParameterNames"parameters excluding component parameters
    "DiscreteVariables"variables changing only at events
  • "SystemEquations" gives equations depending on t.
  • SystemModel["model"]["SystemEquations",t] gives equations depending on t.
  • SystemModel[] contains Missing[type,content] for any parts of equations that cannot be represented.
  • "InputVariables" are distinct from "SystemVariables", and "OutputVariables" are a subset of "SystemVariables".
  • "DiscreteVariables" are a subset of "SystemVariables" and are given in a form suitable as a setting for the DiscreteVariables option to NDSolve.
  • Properties related to values:
  • "ParameterValues"parameter rules {p1->val1,}
    "InitialValues"initial value rules {v1->val1,}
    "GroupedInitialValues"initial values grouped by state, input and output
  • For variable and parameter lists, SystemModel["model"][{prop,patt}] returns the elements of prop whose Modelica form matches the string pattern patt.
  • Properties related to the structure of the model:
  • "ExtendsModels"models this model extends
    "Components"model components
    "Connections"model connections
    "Connectors"model connector components
    "LocalComponents"components defined locally in model
    "LocalConnections"connections defined locally in model
    "LocalConnectors"connectors defined locally in model
    "InheritedComponents"components defined in "ExtendsModels"
    "InheritedConnections"connections defined in "ExtendsModels"
    "InheritedConnectors"connectors defined in "ExtendsModels"
  • Properties related to relations with other models:
  • "ModelsExtending"models that extend this model
    "ModelsContaining"models that use this model as a component
    "Parent"the parent model in a package hierarchy
    "Children"child models in a package hierarchy
    "Siblings"sibling models in a package hierarchy
  • The following options can be given:
  • MethodAutomaticmethods for equation processing
    ProgressReporting$ProgressReportingcontrol display of progress
  • Possible settings for "opti" in Method->{"opt1"->val1} include:
  • "Elimination"Noneeliminate simple equations
    "ReduceIndex"Automaticreduced index of DAEs in balanced models
    "StartTime"0simulation start time
  • The properties "PropertyAssociation" and "PropertyDataset" return computable forms of all properties.

Examples

open allclose all

Basic Examples  (5)

Get the representation of a model:

Retrieve a property using the model representation:

Show a summary of a model:

Import loads a model from disk using the "MO" format:

Get the differential equations for the model:

Get the differential equations for a model:

Pick a random included example model using SystemModelExamples:

Show the full model name and description for the model:

Scope  (59)

Basic Uses  (5)

Show a list of possible properties:

Get the description of a model:

Change the description of the model:

Get the diagram of a model as a Graphics:

Get the system equations of a model:

Get the components and connections in a DC motor model:

Model Representations  (7)

Get the diagram of a model as a Graphics:

Show the grid:

Show frame ticks:

Get the diagram of a component in a model:

Increase the PlotRangePadding for a diagram:

Show the diagram of a model without a frame, using the page size from the model:

Show the icon of a model:

Show the text view of a model:

Retrieve the Modelica code of a model as a String:

Model Information  (5)

Get the path of the file containing a model:

Retrieve the model name of a SystemModel:

Make a copy with a new name:

Get a link to the documentation for a model:

Open model documentation:

Retrieve the simulation settings of a model:

From this model, create one with new simulation settings:

Retrieve the simulation settings of the new model:

Get the domain usage in a model:

Get a chart of the domains used in a model:

Variables and Equations  (9)

Get the system equations of a model:

Get the initial equations of a model:

Get all state variables of a model:

Get a list of all algebraic variables in the model:

Get a list of all system variables in the model:

Get a list of all input variables in the model:

Get a list of all output variables in the model:

Get the discrete variables of a model:

Get all parameter names of a model:

Retrieving Initial and Parameter Values  (3)

Get all parameter values of a model:

Get all initial values of a model:

Get initial values grouped by state, input and output:

Modifying Initial and Parameter Values  (5)

Change the value of the parameter a from 3 to 10:

Set the start value of the variable x to 3:

Use a model with a multidimensional variable:

Set the initial values for the variable:

The start value of the variable x is updated:

Set string values in a model:

Give the string parameter a new value:

The value of x is updated:

In many cases, parameters and initial values can be set without being explicit:

Set the parameter a and the initial value for variable y without specifying which is a parameter:

The start value for variable y was modified:

The value for the parameter a was modified:

Time Variable and Filtering  (2)

By default, equations use t as the time variable:

Get the differential equations depending on a chosen variable:

Get parameter values matching a pattern:

Structural Properties  (5)

Get the models a model builds on:

Show the model names:

From a model, create a new one that extends another class:

Confirm the list of extended models:

Get the components and connections in a DC motor model:

Get the components locally declared in a model:

Get components inherited from "ExtendsModels":

"Components" includes both local and inherited components:

Get the connectors in a model:

Model Relations  (3)

Show the hierarchical relations of a model:

Show the parent:

Show the children:

Show the children's names:

Show the siblings:

Show the siblings' names:

Find all models that use a resistor as a component:

Find all models that build upon an electrical one-port:

Retrieving Model Plots  (3)

Get the names of plots in the model:

Simulate and show a model plot:

Get the full specifications of the plots in the model:

The same format can be used to set plots in models. Make a copy of the model without plots:

Add plot to the new model:

Simulate and show the plot:

Plots are inherited:

There are no plots saved locally in the model:

The plot comes from the extended model:

Modifying Model Plots  (12)

Define a parametric plot in a model:

Simulate and show the newly defined plot:

Define a plot with sensitivity of "integrator1.y" to parameter "sine.freqHz" varying by 10%:

Simulate with sensitivity analysis against the frequency parameter:

Show the model plot:

Define two plots in a group:

Simulate and show all plots in the group:

Define a plot with custom plot legends:

Simulate and show the plot:

Define a plot with custom axis labels:

Simulate and show the plot:

Define a plot with a restricted plot range:

Simulate and show the plot:

Define a plot with a constrained time range:

Simulate and show the plot:

Define a plot without axes labels:

Simulate and show the plot:

Define a plot with an axis label for one axis:

Simulate and show the plot:

Define a default plot:

Default plots are used in SystemModelPlot if no plot name or variables are given:

Giving the same name as an existing plot overwrites the plot:

The plot defined last is used:

Remove a plot from a model:

Remove one of the plots from the model by giving an empty subplot list:

Options  (4)

Method  (3)

Use a custom start time in initial equations:

Use a custom start time in initial seedings:

The Method option "Elimination" can be used to eliminate redundant equations:

Elimination can greatly reduce the number of equations:

Disable index reduction with the method option "ReduceIndex":

ProgressReporting  (1)

Control progress reporting with ProgressReporting:

Applications  (6)

Solve equations using NDSolve:

Construct initial equations from an initial values list:

Solve the system:

Plot the found solution:

Solve equations using DSolve:

Get the equations and system variables:

Get initial values:

Combine the equations and replace all parameters with their default values:

Solve the system and plot the result:

Find an equilibrium point for a model:

Get the equations:

Set derivatives to zero and solve:

FindSystemModelEquilibrium gives the same result:

Use the differential equations to study the behavior of a damped pendulum:

Transfer a StateSpaceModel of a mass-spring-damper system into a SystemModeler model:

Simulate the changed model:

Transfer a mass-spring-damper TransferFunctionModel into a model:

Get coefficients for denominator and numerator:

Set coefficients in the model:

Simulate the changed model:

Properties & Relations  (9)

A model is represented by a graphical representation:

The representation can be used as input to other functions:

The full name of the model as a string can be retrieved with a property:

The string of the model name can be used in place of the full SystemModel expression:

A shortened version of the name can be used to refer to a model if it is unique:

The resulting object will refer to the fully qualified model name:

Non-unique shortened names will give a message and not give a typeset object:

A diagram of a component may be different than a diagram of the component model:

The motor model itself does not have parameters set:

SystemModel generates a new model with applied changes:

The old and new models are two different objects:

SetSystemModel makes changes in place, modifying the given object:

Import loads a model from disk using the "MO" format:

After importing, the model can be accessed using SystemModel:

Use DeleteObject to delete a model:

Trying to use a deleted model will give an error:

Export saves a model to disk:

Save the newly model as "DiffEq":

Show the saved file:

Clean up by deleting the new file and model:

System models can be explored using entities:

List the available properties:

List the children of a system model:

Retrieve the system equations of a model:

Compare the solutions from SystemModelSimulate and NDSolve:

Solve using NDSolve:

Solve using SystemModelSimulate:

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

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2022_systemmodel, organization={Wolfram Research}, title={SystemModel}, year={2020}, url={https://reference.wolfram.com/language/ref/SystemModel.html}, note=[Accessed: 29-March-2024 ]}