simulink的伺服系统英文文献和中文翻译(2)

Figure 3. Electro-hydraulic position servo system simulation model IV. APPLYING M FILE TO TRANSFER PARAMETER M file is the file with a letter M for its extension and is the executable file in Matlab [


Figure 3.  Electro-hydraulic position servo system simulation model

IV.  APPLYING M FILE TO TRANSFER PARAMETER

M file is the file with a letter M for its extension and is the executable file in Matlab [9-10]. This paper introduces that using M file to transfer parameters, which are not input or output parameter but refers to the use of variable in M files topasses parameters. Because the variables that M files created are variables of  Matlab working space, when a program run to the end, the variables store in the working space, the other programs or simulation model can directly call these variables, in order to achieve the purpose of transmitting parameters.

A complex Simulink model, in order to be versatile and portable, each module parameter often set in parameter name rather than specific value. Assign or initialize these variables before simulation. There have many ways to initialize variables, commonly used the methods as follows.

A.   Make a system parameter initialized data files

Make a system parameter initialized data files (Matlab M files), open and run this file manually before running Simulink, load the variable value to working space to initialize the module parameters.

B. Put the variable statements in the form of text  

Put the assignment of variable statements directly in the form of text below Simulink figure, first copy these statements into the command window and run them, and then run the simulink model.  

C. Load simulation model and automatic run initialized files

Load simulation model and automatic run initialized data files. The method is click on the corresponding Simulink Model ,then choice “File \Model properties \ Callback”, enter the m  file name to run in parameters box “PreLoadFcn “, so Simulink model can save the variable to workspace when the model is loaded.  

D. Run m files through double-click a module

Run m files through double-click a module in Simulink environment. The method is that first add a most common SubSystem module to Simulink model, and delete all internal content (general is an input and an output port and a line between them) in this Sub-system module, then return to the Simulink model, right-click on the Subsystem module and choice the shortcut menu “Mask Subsystem”, and get into the editor of mask Subsystem to complete Subsystem mask. In this paper write “disp (‘Variable Initialization’)” in the Icon drawing command bar. If execute the initial m files by double-click on the module, need to select the module and choice “Edit” block properties “Callbacks” and write m file name in OpenFcn dialogue.

In these methods, the method A needs to open and run m files manually every time before simulation, so it is more tedious. The method B is suit for less parameter. The methods C load m files only when loading model, if modified data in m file, must shut down the Simulink model and open it again. The methods D is the most effective method, double-click on the module at any time according to need. So this paper selects method D to establish a “svdata.m” file as the M file to initialize variable in every module [11-12].

IV. M ASK MODULE  

Mask module is a powerful function in Simulink, it allows users to define dialog and ICONS for subsystem. Using mask module has the following functions.

A.   Simplify the use of model.  

Users can input all the parameters at the same time for sub-system through masked dialog .

B.   Provide users with a better interface

Provide users with a better interface by defining dialog module descriptions, identify of parameter fields and help text.  

C.   Avoid changing the content

Avoid changing the content of sub-system in mask interface.

In this paper, it is very convenient to adjust three parameters of P, I, D after masking the PID controller. It can edit all parameters at the same time in one dialog box. The model before masking is shown in Fig. 4. After masking, when double-click the PID module, popup the dialog box as Fig.5 shows.