(* * * File: hyd_press_model.exp * * IEC 61131-3 Structured Text (ST) code generated for Simulink model "hyd_press_model.mdl" * * Model version : 1.215 * Sample time : 0.1s * Simulink PLC Coder version : 1.2 (R2011a) 09-Mar-2011 * ST code generated on : Fri Jun 03 16:57:46 2011 * * Target IDE selection : 3S CoDeSys 2.3 * Test Bench included : No * *) FUNCTION_BLOCK PLC VAR_INPUT ssMethodType: SINT; Positions: ARRAY [0..2] OF LREAL; Setpoint: ARRAY [0..2] OF LREAL; END_VAR VAR_OUTPUT Output: ARRAY [0..2] OF LREAL; END_VAR VAR Compensator1_DSTATE: LREAL; Compensator2_DSTATE: LREAL; Compensator3_DSTATE: LREAL; END_VAR VAR_TEMP END_VAR CASE ssMethodType OF SS_INITIALIZE: (* InitializeConditions for DiscreteTransferFcn: '/Compensator 1' *) Compensator1_DSTATE := 0; (* InitializeConditions for DiscreteTransferFcn: '/Compensator 2' *) Compensator2_DSTATE := 0; (* InitializeConditions for DiscreteTransferFcn: '/Compensator 3' *) Compensator3_DSTATE := 0; SS_OUTPUT: (* Outport: '/Output' incorporates: * DiscreteTransferFcn: '/Compensator 1' * DiscreteTransferFcn: '/Compensator 2' * DiscreteTransferFcn: '/Compensator 3' *) Output[0] := 0.018350336495810825 * Compensator1_DSTATE; Output[1] := 0.018350336495810825 * Compensator2_DSTATE; Output[2] := 0.018350336495810825 * Compensator3_DSTATE; (* Update for DiscreteTransferFcn: '/Compensator 1' incorporates: * Update for Inport: '/Positions' * Update for Inport: '/Set point' * Sum: '/Sum' *) Compensator1_DSTATE := (Setpoint[0] - Positions[0]) - (-0.44213500604592693 * Compensator1_DSTATE); (* Update for DiscreteTransferFcn: '/Compensator 2' incorporates: * Update for Inport: '/Positions' * Update for Inport: '/Set point' * Sum: '/Sum' *) Compensator2_DSTATE := (Setpoint[1] - Positions[1]) - (-0.44213500604592693 * Compensator2_DSTATE); (* Update for DiscreteTransferFcn: '/Compensator 3' incorporates: * Update for Inport: '/Positions' * Update for Inport: '/Set point' * Sum: '/Sum' *) Compensator3_DSTATE := (Setpoint[2] - Positions[2]) - (-0.44213500604592693 * Compensator3_DSTATE); END_CASE; END_FUNCTION_BLOCK VAR_GLOBAL CONSTANT SS_INITIALIZE: SINT := 2; SS_OUTPUT: SINT := 3; END_VAR VAR_GLOBAL END_VAR