Main Content

Generated Code Structure for Subsystem Mask Parameters

In the generated code for masked subsystems, the mask parameters map to function block inputs. The values you specify in the subsystem mask are assigned to these function block inputs in the generated code.

For example, the following subsystem, Subsystem, contains two instances, Filt1 and Filt2, of the same masked subsystem.

The two subsystems, Filt1, and Filt2, have different values assigned to their mask parameters. In this example, Filt1_Order_Thau is a constant with a value of 5.

Therefore, for the Filt1 subsystem, the Filt1_Order_Thau parameter has a value of 8, and for the Filt2 subsystem, the Filt1_Order_Thau parameter has a value of 5.

The following generated code shows the Filt1 function block inputs. The rtp_Filt1_Order_Thau input was generated for the Filt1_Order_Thau mask parameter.

FUNCTION_BLOCK Filt1
VAR_INPUT
    ssMethodType: SINT;
    InitV: LREAL;
    InitF: BOOL;
    Input: LREAL;
    rtp_Filt1_Order_Thau: LREAL;
    rtp_InitialValue: LREAL;
    rtp_Filt1_Order_Enable: BOOL;
END_VAR

The following generated code is from the FUNCTION_BLOCK Subsystem. The function block assigns a value of 8 to the rtp_Filt1_Order_Thau input for the i0_Filt1 instance, and assigns a value of 5 to the rtp_Filt1_Order_Thau input for the i1_Filt1 instance.

SS_INITIALIZE: 
        (* InitializeConditions for Atomic SubSystem: '<S1>/Filt1' *)
        
        i0_Filt1(ssMethodType := SS_INITIALIZE, InitV := In3, 
                 InitF := In2, Input := In1,
                 rtp_Filt1_Order_Thau := 8.0,
                 rtp_InitialValue := 0.0,
                 rtp_Filt1_Order_Enable := TRUE);
        Out1 := i0_Filt1.Out;
        
        (* End of InitializeConditions for SubSystem: '<S1>/Filt1' *)
        
        (* InitializeConditions for Atomic SubSystem: '<S1>/Filt2' *)
        i1_Filt1(ssMethodType := SS_INITIALIZE, InitV := In6,
                 InitF := In5, Input := In4,
                 rtp_Filt1_Order_Thau := 5.0,
                 rtp_InitialValue := 4.0, 
                 rtp_Filt1_Order_Enable := TRUE);
        Out2 := i1_Filt1.Out;
        
        (* End of InitializeConditions for SubSystem: '<S1>/Filt2' *)
SS_STEP: 
        (* Outputs for Atomic SubSystem: '<S1>/Filt1' *)
        
        i0_Filt1(ssMethodType := SS_OUTPUT, InitV := In3, InitF := In2,
                 Input := In1, rtp_Filt1_Order_Thau := 8.0,
                 rtp_InitialValue := 0.0,
                 rtp_Filt1_Order_Enable := TRUE);
        Out1 := i0_Filt1.Out;
        
        (* End of Outputs for SubSystem: '<S1>/Filt1' *)
        
        (* Outputs for Atomic SubSystem: '<S1>/Filt2' *)
        i1_Filt1(ssMethodType := SS_OUTPUT, InitV := In6, InitF := In5,
                 Input := In4, rtp_Filt1_Order_Thau := 5.0,
                 rtp_InitialValue := 4.0,
                 rtp_Filt1_Order_Enable := TRUE);
        Out2 := i1_Filt1.Out;
        
        (* End of Outputs for SubSystem: '<S1>/Filt2' *)