Professional Documents
Culture Documents
70428352 دورة المحاكاة بإستخدام السميولينك SIMULINK PDF
70428352 دورة المحاكاة بإستخدام السميولينك SIMULINK PDF
70428352 دورة المحاكاة بإستخدام السميولينك SIMULINK PDF
SIMULINK
SIMULINK
Subsystems
simulink Debugger
Simulink Accelerator
S-function
S-function M-files
SIMULINK
: Simulink
Simulink
.
simulink
simulink
.
SIMULINK Model-Based Design
nonlinear
.
Demo
.
simulink graphical user interface
)(GUI
S-function .
simulation
simulation non-real time
real time
Xpc Target Real Time Workshop .
Simulation
Simulation
Toolboxs .
: Building a Model
signal generator
signals
square wave.
Transfer function
Scope
Simulation
Mux block
signal scope
::
simulink
>>simulink
Signal generator
simulink
sources
signal generator
: scope
1 - simulink
2- sinks
3- scope
: transfer function
simulink
continuous
transfer function
:: Mux block
simulink
Signal Routing
Mux
::
::
node
ctrl
.
:
+
+
.
Configuring the Model
:: double click signal generator
::
Transfer function
Simulation
simulation 10
: start simulation :
start simulation double click Scope
Simulation square
wave 10
:
.
.
Block Diagram
(nonvirtual block and virtual blocks) .
.
1- built-in blocks
2-
custom blocks User-defined
States
states : Discrete continuous
.
intervals .
States
continuous states :
Integrator
State-Space
State-Space
Transfer Fcn
transfer function
Zero-Pole
transfer function
zero-pole-gain S .
Continuous States
Discrete States
update functions
.
Block Parameters
Parameter
Parameters .
.
A tunable parameter
recompiling
parameters .
continuous sample time .
implicit sample time
fundamental sample time of the inputs
.
An implicit discrete sample time
.
subsystem
virtual and nonvirtual
Subsystems
.
Block Methods
:
Outputs
Update
Derivatives
::
BlockType.MethodType
Start Simulation
Model Compilation
executable form
:
1-
block parameter expressions
2-
3-
attribute propagation
4-
optimizations
5-
hierarchy
6-
block sorted order
7-
Sample Time
: Link Phase
1-
2-
3-
zero-crossing detection
( (
4-
.
successive states
solvers
1- Fixed-step solvers
step
size step size .
2- Variable-step solvers
.
Solvers
1- Continuous solvers
.
2- Discrete solvers
Zero-Crossing Detection
.
.
.
Algebraic Loops
direct feedthrough
:
The Math Function block
The Gain block
The Integrator block's initial condition ports
The Product block
The State-Space block when there is a nonzero D matrix
The Sum block
The Transfer Fcn block when the numerator and denominator are of the same
order
The Zero-Pole block when there are as many zeros as poles
algebraic loop
direct feedthrough
:
z = u z z = u/2
Algebraic Constraint
algebraic loop
2- Sample-time inheritance
.
fixed-step
gain
::
1-
2-
::
1- parameters nontunable
2- ) (inf
.
Tunable Parameters
Sample Time Propagation
::
.mdl
::
Model Editor
::
1- Menu Bar
2- Toolbar
3- Canvas
block diagram
4- Status Bar
Format
Port/Signal Displays
ode45
ode3
:: M-file
:
function new_model(arab_eng)
% NEW_MODEL Create a new, empty Simulink model
% NEW_MODEL('MODELNAME') creates a new model with
% the name 'MODELNAME'. Without the 'MODELNAME'
% argument, the new model is named 'my_untitled'.
% the model name is arab_eng
if nargin == 0
arab_eng = 'arab_eng';
end
Format Foreground color
Background color Screen color
set_param
RGB
::
::
Annotation
Properties ::
M function Annotation
TeX Formatting
1-
annotation Enable
TeX Commands ::
TeX
::
\alphara\beta-\iteng
Creating Subsystems
simulink & ports
subsystems subsystem ::
::
::
input
outport
::
::
create subsystem
::
Open Block
edit open block ::
Window Reuse
File Preferences Window reuse
type ::
::
Read/Write permissions
ReadOnly
NoReadOrWrite
ReadWrite
Enabled Subsystems
Triggered Subsystems.
Triggered and Enabled Subsystems
A control flow subsystem
sine wave
Enable block Ports & Subsystems
subsystem :
::
::
:
Output when disabled
Held
Reset
Initial
output .
Enable block ::
States when enabling
Held
Reset
Outputting the Enable Control Signal.
scope
Zero-Crossing Detection
Triggered Subsystems
Trigger
trigger input
Trigger
Rising
Falling
Either
.
:
trigger .
trigger R F
3 trigger
ports & subsystems
trigger
:
trigger
:
:
triggered subsystems
enabled subsystems
Function-Call Subsystems
S-function
.
::
Trigger
) (-1
.
::
trigger
::
::
sine wave trigger step
input
.
pulse 10
50% duty cycle
enable
trigger
sine trigger
.
Creating Alternately Executing
Subsystems
merge
full-wave rectifier
:
::
Conditional Execution Behavior
Switch Multiport Switch
simulation format
Block displays
sorted order ::
simulation
:
X:Y
X layer
X=0
Y :
Pulse generator
constant subsystem gain scope X
Y
1- Pulse generator
2- constant
3- subsystem
4- gain
5- scope
subsystem } 0:2{1
::
1:0
subsystem
Subsystem parameters
Propagate execution context across subsystem boundary
gain
:
constant gain
1- constant
2- subsystem
3- gain
Conditional Execution Behavior
CE behavior
execution context
:
1-
2-
3-
testpoint
4-
execution context
5- multirate block
6- sample time
execution context
execution context
Switch
execution context
.
:: conditional
execution behavior
Configuration Parameters Optimization
Conditional input branch execution
::
Propagate execution context across subsystem boundary
triggered subsystem
subsystem's execution context
Propagate
execution context
Referencing Models
.
model
simulink
Ports & subsystems
instance
.
S-function the referenced
model's simulation target .
simulation target .
Referencing Referencing
root model
- model parent
parent Referencing
Global data
global data
.
Model Reference
Creating a Model
Reference
set path
::
Inline parameters optimization
simulation
configuration parameters
optimization Inline parameters
model
ref1 :
model
::
ref1
solver
Fixed step
edit model reference parameters
step scope
::
global tunable parameters
global tunable parameters.
.
:
1- Declare model workspace variables that determine the
model's behavior as model arguments
workspace workspace
global nontunable parameters
global tunable parameters
Model Arguments
::
Model block's parameter
edit
Model Argument ::
::
counter
!
6-
Triggered subsystem
Function call
iterator subsystem
simulation target
simulation target
default
Discrete-Time Integrator
Rate Limiter
Sine Wave
::
model
model:
Bus I/O Limitations
bus
1- bus object
2- bus object workspace
3- bus Bus Creator block
0 - or 1- based indexing
for
:
0- or 1-based indexing
rate
.
targets
.
slprj
Simulink Accelerator Real-Time Workshop
Function-Call Models
Function-Call Generator
function-call model.
trigger trigger function
call Model
function call controller
ports & subsystem
model
simulation configure parameters
solver fixed step
Periodic sample time constraint
Ensure sample time independent
scalar
:
Tools Model Reference Graph
view_mdlrefs
Convert to Model Block atomic subsystem