SystemModel
Listing of Model Components »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":
-
Frame True show frame FrameTicks False show frame ticks GridLines None what grid lines to show PlotRange Automatic plot range in mm PlotRangePadding Automatic padding 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" Automatic plot identifier "Name" Automatic name of the plot "Group" None group name "Default" False whether the plot is a default one "Caption" None caption of the plot - Each subplot specification spi is an Association that includes the following keys:
-
"Variables" {v1,v2,…} list of variables (required) "Identifier" None subplot identifier "Title" Automatic title of the subplot "Interval" Automatic time interval "AxesLabel" Automatic axes label "PlotLegends" Automatic legends for curves "PlotRange" Automatic range 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:
-
Method Automatic methods for equation processing ProgressReporting $ProgressReporting control display of progress - Possible settings for "opti" in Method->{"opt1"->val1} include:
-
"Elimination" None eliminate simple equations "ReduceIndex" Automatic reduced index of DAEs in balanced models "StartTime" 0 simulation start time - The properties "PropertyAssociation" and "PropertyDataset" return computable forms of all properties.
Examples
open allclose allBasic Examples (5)
Get the representation of a model:
Retrieve a property using the model representation:
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:
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:
Model Representations (7)
Get the diagram of a model as a Graphics:
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 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:
Get a link to the documentation for a model:
Retrieve the simulation settings of a model:
From this model, create one with new simulation settings:
Retrieve the simulation settings of the new 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:
Retrieving Initial and Parameter Values (3)
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:
Give the string parameter a new value:
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:
Time Variable and Filtering (2)
Structural Properties (5)
Get the models a model builds on:
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":
Model Relations (3)
Retrieving Model Plots (3)
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:
Simulate and show all plots in the group:
Define a plot with custom plot legends:
Define a plot with custom axis labels:
Define a plot with a restricted plot range:
Define a plot with a constrained time range:
Define a plot without axes labels:
Define a plot with an axis label for one axis:
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 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 equations using DSolve:
Get the equations and system variables:
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:
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:
Transfer a mass-spring-damper TransferFunctionModel into a model:
Get coefficients for denominator and numerator:
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":
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:
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