simulate a system - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Science and Engineering : Dynamic Systems : Simulation Tools : DynamicSystems/Simulate

DynamicSystems[Simulate] - simulate a system

Calling Sequence

Simulate( sys, input, opts )

Parameters

sys

-

System; system object

input

-

algebraic, list(algebraic), Vector(realcons), list(Vector(realcons)), or Matrix(realcons); input signal

opts

-

(optional) equation(s) of the form option = value; specify options for the Simulate command

Description

• 

The Simulate command computes the transient response of sys, a linear system object, to input, a given input waveform. Both continuous and discrete systems can be simulated.

Continuous Systems

• 

Continuous systems are simulated using dsolve[numeric]. The system is converted to a set of differential equations and initial conditions that are passed to dsolve.

• 

Systems of type transfer function, coefficient, or zero-pole-gain are converted to a state-space representation that is then converted to a set of differential-equations.

• 

If the variable names for the states are not given (transfer function, coefficient, and zero-pole-gain) then the value of statevariable from DynamicSystems[SystemOptions] is used with a numerical index appended.

• 

A state-space system is converted to a set of differential equations.

• 

A diff-equation system is used as is.

• 

The input waveform, input, is given in terms of t, the time variable. For a single input system input is an algebraic expression, for a multiple-input system input is a list of algebraic expressions.  Heaviside functions in the input are converted to equivalent event-based steps.

• 

By default the output is a dsolve procedure that takes the value of t as the input parameter.

Discrete Systems

• 

A discrete system is simulated by converting it to a state-space representation and then iterating through the state-space equations.

• 

If the variable names for the states are not given (transfer function, coefficient, and zero-pole-gain) then the value of statevariable from DynamicSystems[SystemOptions] is used with a numerical index appended.

• 

The input waveform, input, consists of discrete values. For a single input system it is a Vector or a one-column Matrix. For a multiple input system it is a list of Vectors or a Matrix; the number of Vectors (columns of the Matrix) corresponds to the number of inputs of sys.

• 

The output is a list of Vectors. Each Vector corresponds to an output of the system. The dimension of the Vectors match the dimension of the input Vector.

• 

The calculation can be performed either as a hardware floating-point or software floating-point.  The environment variable UseHardwareFloats determines which floating-point representation is used.

Examples

withDynamicSystems:

ts:=0.1

ts:=0.1

(1)

t_sim:=10.0

t_sim:=10.0

(2)

in_t:=Sine1,1,0,0

in_t:=&lcub;0t<0sintotherwise

(3)

in_z:=Sine1&comma;1&comma;0&comma;0&comma;samplecount&equals;roundt_simts&comma;sampletime&equals;ts&comma;discrete

in_z:= 1 .. 100 VectorcolumnData Type: anythingStorage: rectangularOrder: Fortran_order

(4)

sys:=DiffEquation0.5&DifferentialD;&DifferentialD;tit&plus;it&equals;vt0.01&DifferentialD;&DifferentialD;t&theta;t&comma;0.01&DifferentialD;&DifferentialD;t&DifferentialD;&DifferentialD;t&theta;t&plus;0.1&DifferentialD;&DifferentialD;t&theta;t&equals;0.01it&comma;inputvariable&equals;vt&comma;outputvariable&equals;&theta;t&comma;it

sys:=Diff. Equationcontinuous2 output(s); 1 input(s)inputvariable&equals;vtoutputvariable&equals;θt&comma;it

(5)

sysz:=ToDiscretesys&comma;ts

sysz:=Diff. Equationdiscrete; sampletime = .12 output(s); 1 input(s)inputvariable&equals;vqoutputvariable&equals;θq&comma;iq

(6)

sol:=Simulatesys&comma;in_t

sol:=procx_rkf45...end proc

(7)

p1:=plots&lsqb;odeplot&rsqb;sol&comma;t&comma;&theta;t&comma;t&equals;0..t_sim&comma;numpoints&equals;200&comma;color&equals;red&colon;

ret:=Simulatesysz&comma;in_z

ret:= 1 .. 100 VectorcolumnData Type: float8Storage: rectangularOrder: Fortran_order&comma; 1 .. 100 VectorcolumnData Type: float8Storage: rectangularOrder: Fortran_order

(8)

out_z:=ret1

out_z:= 1 .. 100 VectorcolumnData Type: float8Storage: rectangularOrder: Fortran_order

(9)

p2:=DiscretePlotout_z&comma;0&comma;ts&comma;style&equals;stair&comma;color&equals;blue&colon;

plots&lsqb;display&rsqb;p1&comma;p2

sys2:=TransferFunction1s2&plus;s&plus;10

sys2:=Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable&equals;u1soutputvariable&equals;y1s

(10)

ret:=Simulatesys2&comma;in_t&comma;&apos;output&apos;&equals;&apos;solution&apos;&comma;&apos;de&apos;&comma;&apos;statevariable&apos;&comma;&apos;outputvariable&apos;&colon;

sol:=ret1&colon;

de_list:=ret2&colon;

state_v:=ret3&colon;

output_v:=ret4&colon;

sol0.1

t&equals;0.1&comma;x1t&equals;0.000161695975336734&comma;x2t&equals;0.00479344012872838&comma;y1t&equals;0.000161695975336734

(11)

de_list

&DifferentialD;&DifferentialD;tx1t&equals;x2t&comma;&DifferentialD;&DifferentialD;tx2t&equals;10.x1t1.x2t&plus;&lcub;0t<0sintotherwise&comma;y1t&equals;1.x1t&comma;x10&equals;0&comma;x20&equals;0

(12)

state_v

x1t&comma;x2t

(13)

output_v

y1t

(14)

plots&lsqb;odeplot&rsqb;sol&comma;seqt&comma;i&comma;i&equals;state_v&comma;t&equals;0..10&comma;title&equals;system states

plots&lsqb;odeplot&rsqb;sol&comma;seqt&comma;i&comma;i&equals;output_v&comma;t&equals;0..10&comma;title&equals;system output

See Also

DynamicSystems, DynamicSystems[ResponsePlot]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam