Power System Blockset    

Customizing Your Nonlinear Model

Up to now, you have used a nonlinear model with fixed parameters. If you plan to use this block in other circuits with different parameters (for example an inductance with a different voltage rating or a saturation characteristic defined with more than two segments), you will find more convenient to enter the block parameters in a dialog box, rather than modifying individual blocks of your subsystem.

In the following section, you will learn how to use the Simulink masking facility to create a dialog box, an icon and a documentation for your model. For more details, refer to the chapter entitled Using Masks to Customize Blocks in the Using Simulink manual.

Block Initialization

Select the Nonlinear Inductance subsystem and in the Edit menu, select Mask Subsystem. The Mask Editor window appears.

Select the Initialization tab. In the Mask type field, enter:

The parameters that you have to specify are: the nominal voltage, the inductance in the linear region and the flux-current characteristic (flux and current vectors in p.u.).

Click on Add. In the Prompt field, enter:

In the Variable field, enter the variable name associated with that field:

Repeat the above steps to define the dialogs and associated variables listed below:

In the Initialization commands section, type the following MATLAB commands.This code prepares the two vectors Current_vect and Flux_vect to be used in the Look-Up Table block of the model.

As the saturation characteristic is specified only in the first quadrant, three lines of code are added to complete the negative part of the saturation characteristic. Notice also how the validity of the first segment of the saturation characteristic is verified. This segment must be defined by two points [0 0; 1 1] specifying a 1 p.u. inductance (nominal value) for the first segment.

Press on the OK button to close Mask Editor window. Double-click on the icon of your masked block. Its dialog opens with all fields empty. Enter the values as shown on Figure 1-24.

Figure 1-24: Dialog Box of Your Nonlinear Inductance

Before you can use the masked block, you must apply the two internal variables defined in the initialization section to the Look-Up Table block. Select your block and, In the Edit menu, select Look Under Mask.

The Nonlinear Inductance subsystem opens. Open the Look-Up Table block dialog box and enter the following variable names in the two fields:

Close the Nonlinear Inductance subsystem and start the simulation. You should get the same waveforms as shown on Figure 1-23.

Block Icon

In this section you will learn how to customize your block's icon and make it more attractive.

Select your block and, in the Edit menu, select Edit Mask. The Mask Editor window opens. Select the Icon tab.

In the Drawing commands section, you can specify any drawing that will appear in your block icon by using the plot function. You can, for example, plot the flux-current characteristic of your inductance.

Remember that the currents and fluxes of the nonlinear characteristic are stored respectively in the Current_vect and Flux_vect internal variables of the masked block. Type the following command in the Drawing commands section:

Press Apply and notice that the saturation characteristic is displayed on the icon. Notice also that the input and output names have disappeared.

To make them visible, in the Icon transparency pop-up menu, select Transparent. Click on OK to close the Mask Editor window.

Block Documentation

In this section, you will add documentation appearing in your block dialog box. Select your block and, in the Edit menu, select Edit Mask. The Mask Editor window opens.

Figure 1-25: Icon and Documentation Windows of the Block Editor

Select the Documentation tab and enter in the Block description the text shown in the dialog box of Figure 1-26. Then, click on OK to close the Mask Editor window. The next time you will double-click on your block, this description will appear on the dialog box of the block.

.

Figure 1-26: Block Dialog Box with Its Documentation


 Modeling a Nonlinear Inductance Modeling a Nonlinear Resistance