Вы находитесь на странице: 1из 8

SE#3(1).

qxd

2/25/2005

3:17 PM

Page 12

, 12005



1. Simulink
MATLAB.
Simulink ,

.

,
. . .

kaf21@aanet.ru,
aqva@aanet.ru

:
2. SimPowerSystems.
3. SPS- .
4. .
5. ().

MATLAB
,
, , , . , , Windows,
Microsoft Office, . .


MATLAB ( Matrix Laboratory )
Math Works Inc. . .
, ,
. , 2001 Math Works MATLAB 6.1,
MATLAB 6.5 (Release 13).
2004 Math Works MATLAB 7.0 (Release 14),
.
MATLAB 6.5 (Release 13)
- Pentium II, Pentium III, Pentium IV, Xeon,
AMD Athlon, Athlon XP , 128 M ( 256 M). 1,1 .
Microsoft Word 8.0 (Office 97),
Office 2000 Office XP. , Office 95
.
MATLAB , -
install_guide.pdf ( Installation Guide for
Windows). ,
MATLAB .

12

MATLAB ,

. , MathCAD,
Maple, Mathematika .

, . MATLAB ,
, : , ( 800), ,
.
MATLAB , , .
Toolboxes. Simulink,
. www.finestreet.ru

SE#3(1).qxd

2/25/2005

3:17 PM

Page 13

, 12005
-,

. , , . Simulink
, , .
Simulink
SimPowerSystems (
Power Systems Blockset)

.
MATLAB 6.5 Simulink 5.0 SimPowerSystems 2.3.
,
. Simulink ,
.
, , , , , , . . SimPowerSystems

, , , , . Simulink
SimPowerSystems ,

, - , .
Simulink Sim
PowerSystems

.

SimPowerSystems,
,
Simulink,
. ,
OrCAD, PSpice,
DesignLab, Workbench . ., , ,
. ,
.

SimPowerSystems Simulink
MATLAB, . www.finestreet.ru

. 1. MATLAB 6.5

SimPowerSystems, ,
. , Simulink.
, SimPowerSystems Simulink

, .
1.
Simulink

, Simulink, , .
S- .
Simulink.
Simulink
Simulink
MATLAB

(. ),
//MATLAB ( , . .). (. 1), :
MATLAB (

MATLAB Command Window);
File, Edit, View, Web, Window,
Help ( . 1 1 6);
, , , . 1 7
Simulink;

;
.
Simulink :
7 ( , Simulink Library
Browser);

Simulink ( );

File/New/Model ( S- SPS-);

(
,
mdl-).
, . , S- , Simulink,
SPS- ,
SimPowerSystems.

( ). (
) .
,
, .
Simulink (. 2,
) :
Simulink Library
Browser;
;
;
;
( . 2 , - );

;
.

13

SE#3(1).qxd

2/25/2005

3:17 PM

Page 14

, 12005

1 2 3 4

10

. 3. S-

. 2. ()
Simulink


Simulink ( )
( )
. ,
SimPowerSystems. :
+, .

.

4 (. 2):
1. File () : ,
mdl-.
2. Edit () .
3. View () .
4. Help ()
.
, :
1. Create a new model ( ).
2. Open a model .
3. Stay on top
.
4. Find , (
).
S-
S- . -

14

, File/New/
Model, 1 (. 2).
,
,

View/Library Browser
MATLAB (
).
(. 3)
:
;
;
;
;
, .

Untitled
, .
mdl- File-Save as
Work
MATLAB.

. ( ) . .
: Diod_3_04. ,
, .
, ,
. .:
1. File () mdl- ,

;
2. Edit () ;
3. View ()
;
4. Simulation ()
;
5. Format ()
;
6. Tools ( )
;
7. Help () Simulink,
, S- . .

, (. 3).
.
:
1. Start-Pause-Continue Simulation
-- (
.
2. Stop .
.
3. Normal/Accelerator/External / . , Simulink Performance Tool.
4. Build all
(exe.) Real Time
Workshop ( ).
5. Update diagram .
6. Build Subsystem
.
7. Library Browser
.
8. Toggle Model Browser .
9. Go to parent system
. .
10. Debug .
,
. ,
Simulink: Ready (), Running (), :
;
;
;
.

.
S-
. .
10 . Simulink
+ Source
Source . www.finestreet.ru

SE#3(1).qxd

2/25/2005

3:17 PM

Page 15

, 12005

)
)
. 4. Sources () Sinks ()
Simulink

Source (. 4). Constant ( ),


, ,
. , , ,
(. 5). . Edit/Add to the current model.
.
Sinks (. 4).
Display ( ).
(. 5).
, . Constant ( ), (
), Display ( ).
:
,
, ,
;
Constant,
Ctrl, ,
, Display Ctrl.
, Display
(. 5). . Constant 10 .

)
. 5. S-

www.finestreet.ru

15

SE#3(1).qxd

2/25/2005

3:17 PM

Page 16

, 12005

Block parameters: Constant. Constant value
1 10 (. 5).
Apply ( )
Ok ( ,
).
Constant 1 10 (. 5).
Display ,
.
.
, .
Display , 10 (. 5).
,
S- :
;
Simulink
, ;
;
,
;
;
mdl-;

Simulink,
MATLAB File/Exit MATLAB.

S-:
() ( ), - ,
, ( );
, , (
,
);
( )
( ,
);
Delete (

, ,
,

);
;

16



,

;


, ;

( , ) .
, , ( ), . .
Format .
Simulink

Simulink. MATLAB
Simulink
Library Browser (. 2).
Simulink.
1. Continuous () .
2. Discontinuous .
3. Discrete ()
.
4. Look-Up Tables .
5. Math Operations
.
6. Model Verification
.
7. Model-Wide Utilities .
8. Port&Subsystems .
9. Signal Attributes
.
10. Signal Routing ,
.
11. Sinks .
12. Sources .
13. User-Defined Function , .

Simulink,
. Simulink Library
Browser Simulink Sources.
Sources

Sine Wave
.
, , .
(. 6), , :

. 6.

;
;
.
, Sine type: Time based Sample
based.

u = Um sin (2^pi^f^t + ) + U0.


: Amplitude
Um, Bias () U0, Frequency f (/),
(2^pi^f), Phase (), Sample time TS, Interpret vector parameters as 1D .
MATLAB pi.
0
( ); > 0 ( ); 1 (
, ).
Sample based

u = Um sin (2^pi^f^k^TS + ) + U0 = Um
sin (2^pi^k + l)/ N + U0
f , N
, k
0 N1, l , .
: Amplitude
Um, Bias U0, Sample per period
N = 1/ (f^T S) p = 2^pi^N,
Number of offset samples l = ^p/(2^pi), Sample
www.finestreet.ru

SE#3(1).qxd

2/25/2005

3:17 PM

Page 17

, 12005

)
. 7. ()

()

time TS, Interpret vector


parameters as 1D
.
(. 7) (. 7) .

(Scope), .
Step
.
.
: Step time , Initial value
, Final value ( ), Sample
time TS, Interpret vector parameters as 1D
, Enable zero crossing detection
.
(Scope),

. 8.
Pulse
Generator
.

.
: Pulse Type :
Time based (TB) ;
Sample based (SB) .
Amplitude , Period
( TB SB), Pulse width
( TB SB), Phase delay
( TB www.finestreet.ru

)
. 8. ()

()

SB), Sample time TS, Interpret vector parameters as 1D


.
Pulse Generator

. 9.
Signal Generator
.

.
: Wave form
:
sine ;
square ( );
sawtooth ;
random .
Amplitude , Frequency , Units

)
. 10. ()

()

)
. 9. ()

()

(Hertz , rad/sec /), Interpret vector


parameters as 1D
.
. 10
Signal Generator .
Sinks
Sinks
Simulink. . Scope, .
Scope
.
.

. ( ) Scope,
.
. 11. (. 11):
1. Print .
2. Parameters .
3. Zoom
.
4. Zoom X-axis .
5. Zoom Y-axis .
6. Autoscale .
7. Save current axes settings .
8. Restore saved axes settings .
9. Floating scope .

17

SE#3(1).qxd

2/25/2005

3:17 PM

Page 18

, 12005

6 7
)

)
. 13. Solver ()
/ ()

9 1 0 11

)
. 11. (),
()
()

10. Lock/Unlock axes selection /



( Floating scope).
11. Signal selections (
Floating scope).
:
Zoom, Zoom X-axis,
Zoom Y-axis
, ( 2,5 ,
);
Zoom, Zoom X-axis,
Zoom Y-axis , ,
( )
( ) () ;
, , Axes properties ( ),
'Scope' properties: axis 1 ( ) (. 11) Y , , (Title).

'Scope' parameters,
Parameters : General Data history -

18

)
. 12. Scope

Workspace
MATLAB (. 12 12 ). General Number
axes ( ); Time range ( ,
); Tick labels : all ;
none ; bottom axis
only
. Sampling :
Decimation ( , , 2 ); Sample time
( ); Floating
scope ( ).
Data history
: Limit data points to last
( ,
); Save data
to workspace
MATLAB;
Variable name ;
Format : Array ; Structure ( );
Structure with time ( ) .

XY Graph
.
.
: x-min x-max
X; y-min y-max
Y,
Sample time TS.
Simulink
.


. Simulation/
Simulation Parameters.
(. 13), 5 : Solver ; Workspace I/O - ; Diagnostics
; Advanced ; Real-Time Workshop
' '.
Solver (. 13):
Simulation time
(Start time
) (Stop
time) ;
www.finestreet.ru

SE#3(1).qxd

2/25/2005

3:17 PM

Page 19

, 12005
Solver options , (Type)
(Fixed-step) (Variable-step) ;
Output options .
(Type) : ode45, ode23, ode113,
ode15s, ode23s, ode23t, ode23tb,
.
Type , Fixed-step
Variable-step. Variable-step,
,
:
Max step size .
(auto) 0,02 , (Stop time Start time)/50.
, ,

.
.
Min step size .
Initial step size
.
(Relative tolerance) 103 (Absolute tolerance) auto
.

(Output options):
Ref ine output ,

To Workspace. Refine factor.
1 ( ) n (
n- );
Produce additional output ,
,
(Output times)
.
.
Produce specified Output times .
Workspace I/O (.13) . :
www.finestreet.ru

Load from workspace


. Input
( ) , .
Initial State ( ) .

() In, Sources.
Save to workspace .
Save option . Limit rows ,
.
, . , 4 20 . Signal Generator
( ) Scope
. Scope
(. 14).
( . 11
6). ,
(. 14). .

T . ,
. Simulation/
Simulation Parameters
Solver.
t
( ).
T = 1/20 = 0,05 t 0,002.
Max step size.
,
, 4 , Stop time 0,2.
( Ok)
(. 14). .
, .
1. , Simulink SimPowerSystems,
MATLAB .
2. Simulink , -

)
. 14.

: , , , . .
3. S-
Simulink
drag-anddrop .
, , SimPowerSystems.
4.
S-, .
5.

, , .

19