WSMModelData
WSMModelData["mmodel"]
gives a diagram representation of the model "mmodel", usable as input to other functions.
WSMModelData["mmodel","property"]
gives the specified "property" for the model "mmodel".
Details and Options
- WSMModelData["mmodel","Properties"] gives a list of possible properties.
- Properties related to the whole model: »
-
"Description" top-level description of model "Diagram" diagram view of model "Icon" icon view of model "ModelicaText" show Modelica model code "ModelName" fully qualified path of model "LocalPlotNames" names of plots saved locally in model "PlotNames" names of plots, including inherited "SourceFile" file where the model is saved "Summary" model summary data - "ModelicaText" creates a cell with style "Program" containing the textual form of "mmodel".
- With a text-based interface, "ModelicaText" returns the textual form of "mmodel" as a string.
- WSMModelData[{"mmodel","c1","c2",…}, "Diagram"] shows the diagram for component "c1.c2...ci" in "mmodel".
- WSMModelData["mmodel",{property,options}] accepts the following options for property "Diagram" and "Icon":
-
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 equations and variables: »
-
"SystemEquations" differential and algebraic equations "InitialEquations" initial value equations "StateVariables" differentiated variables "AlgebraicVariables" non-differentiated variables "SystemVariables" state and algebraic variables "InputVariables" variables specified as inputs "OutputVariables" variables specified as outputs "ParameterNames" parameters "DiscreteVariables" variables changing only at events - "SystemEquations" gives equations depending on t.
- WSMModelData["mmodel","SystemEquations",t] gives equations depending on t.
- WSMModelData[…] 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, WSMModelData["mmodel",{prop,patt}] returns the elements of prop whose Modelica form match the string pattern patt.
- Properties related to the structure of the model:
-
"BaseClasses" classes the model extends "Components" model components "Connections" model connections "Connectors" model connector components "LocalComponents" components defined locally in model - Properties related to relations with other models:
-
"ExtendingClasses" classes that build upon this model "InstantiatingClasses" classes that use this model as a component - The shortest unique model name mmodel can be used where WSMNames["*.mmodel"] gives a unique match.
- The following options can be given:
-
Method Automatic methods for equation processing - Possible settings for "opti" in Method->{"opt1"->val1} include:
-
"Elimination" All eliminate simple equations "ReduceIndex" True reduced index of DAEs in balanced models "StartTime" 0 simulation start time
Examples
open allclose allBasic Examples (4)
Scope (30)
General Properties (12)
Show a list of possible properties:
Get the description of a model:
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:
Get the path of the file containing a model:
Get the names of saved plots in the model:
Simulate and show a saved plot:
There are no plots saved locally in the 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:
Initial and Parameter Values (3)
Naming (2)
Options (3)
Method (3)
Use a custom start time in initial equations:
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":
Applications (4)
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:
WSMFindEquilibrium gives the same result:
Use the differential equations to study the behavior of a damped pendulum:
Properties & Relations (3)
Compare the solutions from WSMSimulate and NDSolve:
Solve using NDSolve:
Solve using WSMSimulate:
A model is represented by its diagram:
The diagram representation evaluates to WSMModelData["modelname"]:
The diagram representation can be used directly as input in other functions:
A diagram of a component may be different than a diagram of the component class: