BlockImporter
BuildDE
creates differential equations from the model
Calling Sequence
Parameters
Options
Description
Examples
BuildDE( sys, opts )
sys
-
record; system data
opts
(optional) equation(s) of the form option = value; specify options for the BuildDE command
makesets = truefalse
Specifies whether the equations and initialeqs fields are assigned lists or sets. The default is false.
The BuildDE command converts the equations in a BlockImporter data structure to a form that can be solved by dsolve.
The sys parameter is a Maple record. See BlockImporter[datastructure] for details.
The output is a record with fields equations, initialeqs, known, outputvars, parameters, and sourceeqs. With a small amount of further processing, the fields of this record can be passed to dsolve. See the Examples section, below.
equations = (list,set)(equation) -- contains the differential equations that describe the system. Differentials of state-variables in the input equations expressed in terms of D are converted to unevaluated functions of diff with t as the independent variable. For example, D(x) is converted to diff(x(t),t). If the keyword-option makesets is true, then the field is a set, otherwise it is a list.
initialeqs = (list,set)(function = anything) -- defines the initial values of the state variables of the system. If the keyword-option makesets is true, then the field is a set, otherwise it is a list.
known = set(name) -- the names of known functions that must be passed to dsolve/numeric using the known option.
outputvars = list(function) -- the names of the output of the system or subsystem. These are connected to the inputs of sink blocks and Outport blocks of subsystems. These are unevaluated functions of t.
parameters = list(indexed = anything) -- specifies the values of subsystem mask and MATLAB® global parameters used in equations. The left side of each equation consists of an indexed name K[num,str], where num is the block identifier of the subsystem in which parameter was defined (0 if the parameter is a MATLAB® global), and str is a string corresponding to the parameter name. The right side of the equation is the value of the name. It may be expressed in terms of other block parameters.
sourceeqs = list(function = algebraic) -- equations that define the time-behavior of sources. The left side is an unevaluated function of t. The right side is the definition of the source.
with⁡BlockImporter:
Create an example of an imported data structure.
sys≔BlockImporter:-Example⁡
sys≔record⁡equations,initialeqs,inputvars,notes,outputvars,parameters,procs,sourceeqs,statevars
Convert the imported data structure into a record with differential equations that are compatible with dsolve,numeric.
deq≔BuildDE⁡sys,makesets
deq≔record⁡equations,initialeqs,known,outputvars,parameters,sourceeqs
Substitute the values of the source equations and parameters into the equations. Substitute the differential equations into the output variables.
usedeqindeqs ≔ subs⁡sourceeqs,parameters,equations∪initialeqs;outs ≔ subs⁡deqs,outputvars;ins ≔ map⁡rhs,sourceeqsend use:
Solve the differential equations.
dsol≔dsolve⁡deqs,numeric,interr=false
dsol ≔ procx_rkf45_dae...end proc
Plot the results.
plotsodeplot⁡dsol,t,outs1,t,ins1,0..10,gridlines=true
See Also
BlockImporter[datastructure]
dsolve
Download Help Document