Add missing FB for ErrorHandling FB_NC_Error

This commit is contained in:
Federico Rojas
2019-07-16 13:29:44 +02:00
parent 81b2a6c326
commit 175bdae2de
4 changed files with 489 additions and 8 deletions

View File

@@ -1574,6 +1574,460 @@ External Setpoint Generation:
1: axis is a master axis
2: axis is master and slave
3: axis is a slave axis
]]>
</Comment>
</SubVar>
</Var>
</Vars>
</Axis>
<Axis CreateSymbols="true" AxisType="1" Id="2">
<Name>Axis 2</Name>
<AxisPara>
<OtherSettings AllowMotionCmdToSlave="true"/>
</AxisPara>
<Encoder Name="Enc" EncType="1">
<Vars VarGrpType="1">
<Name>Inputs</Name>
<Var>
<Name>In</Name>
<Type GUID="{901C2423-655B-45CE-B7E3-21F174F0F99F}" Namespace="MC">NCENCODERSTRUCT_IN2B</Type>
<BitOffs>2688</BitOffs>
<SubVar TypeFormatIndex="2">
<Name>nDataIn1</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn2</Name>
</SubVar>
<SubVar>
<Name>nState4</Name>
<Comment>
<![CDATA[Encoder Status 4 (automatically linked):
0x01 (Bit 0) = IO data invalid (e.g. EtherCAT 'WcState')
0x02 (Bit 1) = IO data input toggle (e.g. EtherCAT 'InputToggle')
]]>
</Comment>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn3</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn4</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn5</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn6</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn7</Name>
</SubVar>
</Var>
</Vars>
<Vars VarGrpType="2">
<Name>Outputs</Name>
<Var>
<Name>Out</Name>
<Type GUID="{9CC50AB2-5D79-4869-A3C2-1FA7761BAFEA}" Namespace="MC">NCENCODERSTRUCT_OUT2</Type>
<BitOffs>4736</BitOffs>
<SubVar TypeFormatIndex="2">
<Name>nDataOut1</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut2</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut3</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut4</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut5</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut6</Name>
</SubVar>
</Var>
</Vars>
</Encoder>
<Drive Name="Drive" DrvType="5">
<DrvPara>
<Analog ScaleFactorActTorque="0.1"/>
</DrvPara>
<Vars VarGrpType="1">
<Name>Inputs</Name>
<Var>
<Name>In</Name>
<Type GUID="{F95C7C69-0C87-46C4-9559-1285CCA5B23A}" Namespace="MC">NCDRIVESTRUCT_IN2</Type>
<BitOffs>3008</BitOffs>
<SubVar TypeFormatIndex="2">
<Name>nDataIn1</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn2</Name>
</SubVar>
<SubVar>
<Name>nState4</Name>
<Comment>
<![CDATA[Drive Status 4 (automatically linked):
0x01 (0000 0001) = IO data invalid (e.g. EtherCAT 'WcState')
0x02 (0000 0010) = IO data input toggle (e.g. EtherCAT 'InputToggle')
Drive Status 4 (manually linked):
0x80 (1000 0000) = Fast axis stop (digital IO interrupt)
]]>
</Comment>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn3</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn4</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn5</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn6</Name>
</SubVar>
</Var>
</Vars>
<Vars VarGrpType="2">
<Name>Outputs</Name>
<Var>
<Name>Out</Name>
<Type GUID="{644DC4BD-3D15-4DCB-94C7-24F3A5D579AA}" Namespace="MC">NCDRIVESTRUCT_OUT2</Type>
<BitOffs>5056</BitOffs>
<SubVar TypeFormatIndex="2">
<Name>nDataOut1</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut2</Name>
</SubVar>
<SubVar>
<Name>nCtrl2</Name>
<Comment>
<![CDATA[Digital Outputs Setpoint Generator:
0x41 (0100 0001) = Minus (0x42 for inverse motor polarity)
0x42 (0100 0010) = Plus (0x41 for inverse motor polarity)
0x80 (1000 0000) = Stop
]]>
</Comment>
</SubVar>
<SubVar>
<Name>nCtrl3</Name>
<Comment>
<![CDATA[Digital Outputs (Setpoint Generator + Position Controller):
0x41 (0100 0001) = Minus (0x42 for inverse motor polarity)
0x42 (0100 0010) = Plus (0x41 for inverse motor polarity)
0x80 (1000 0000) = Stop
]]>
</Comment>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut3</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut4</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut5</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut6</Name>
</SubVar>
</Var>
</Vars>
</Drive>
<Controller Name="Ctrl" CtrType="1">
<CtrPara PriorControlFactor="1">
<Observer BandWidth="20"/>
</CtrPara>
</Controller>
<Vars VarGrpType="1" InsertType="1">
<Name>Inputs</Name>
<Var>
<Name>FromPlc</Name>
<Type GUID="{63A84524-72E3-41C8-BEAB-4CCE44690A13}" Namespace="MC">PLCTONC_AXIS_REF</Type>
<BitOffs>1664</BitOffs>
</Var>
</Vars>
<Vars VarGrpType="2" InsertType="1">
<Name>Outputs</Name>
<Var>
<Name>ToPlc</Name>
<Type GUID="{6A65C767-34E5-42BF-AD87-E1A503EAC7BE}" Namespace="MC">NCTOPLC_AXIS_REF</Type>
<BitOffs>2688</BitOffs>
<SubVar>
<Name>AxisState</Name>
<Comment>
<![CDATA[Present State Of The Axis Movement (continuous axis):
0 = INACTIVE: axis has no job
1 = RUNNING: axis is executing a motion job
2 = OVERRIDE_ZERO: axis is executing a job but override is zero
3 = PHASE_VELOCONST: axis is moving at constant velocity
4 = PHASE_ACCPOS: axis is accelerating
5 = PHASE_ACCNEG: axis is decelerating
Slaves only:
11 = PREPHASE: slave axis is in a motion pre-phase
12 = SYNCHRONIZING: slave axis is synchronizing
13 = SYNCHRONOUS: slave axis is moving synchronously
External Setpoint Generation:
41 = EXTSETGEN_MODE1: external setpoint generation active
42 = EXTSETGEN_MODE2: internal and external setpoint gen. active
]]>
</Comment>
</SubVar>
<SubVar>
<Name>HomingState</Name>
<Comment>
<![CDATA[Axis Homing Status:
0: idle
1: start homing
2: searching home switch
3: stopping on home switch
4: moving off home switch
5: searching sync pulse
6: stopping after homing
]]>
</Comment>
</SubVar>
<SubVar>
<Name>CoupleState</Name>
<Comment>
<![CDATA[Axis Coupling Status:
0: axis is a single axis (not coupled)
1: axis is a master axis
2: axis is master and slave
3: axis is a slave axis
]]>
</Comment>
</SubVar>
</Var>
</Vars>
</Axis>
<Axis CreateSymbols="true" AxisType="1" Id="3">
<Name>Axis 3</Name>
<AxisPara>
<OtherSettings AllowMotionCmdToSlave="true"/>
</AxisPara>
<Encoder Name="Enc" EncType="1">
<Vars VarGrpType="1">
<Name>Inputs</Name>
<Var>
<Name>In</Name>
<Type GUID="{901C2423-655B-45CE-B7E3-21F174F0F99F}" Namespace="MC">NCENCODERSTRUCT_IN2B</Type>
<BitOffs>4352</BitOffs>
<SubVar TypeFormatIndex="2">
<Name>nDataIn1</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn2</Name>
</SubVar>
<SubVar>
<Name>nState4</Name>
<Comment>
<![CDATA[Encoder Status 4 (automatically linked):
0x01 (Bit 0) = IO data invalid (e.g. EtherCAT 'WcState')
0x02 (Bit 1) = IO data input toggle (e.g. EtherCAT 'InputToggle')
]]>
</Comment>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn3</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn4</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn5</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn6</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn7</Name>
</SubVar>
</Var>
</Vars>
<Vars VarGrpType="2">
<Name>Outputs</Name>
<Var>
<Name>Out</Name>
<Type GUID="{9CC50AB2-5D79-4869-A3C2-1FA7761BAFEA}" Namespace="MC">NCENCODERSTRUCT_OUT2</Type>
<BitOffs>7424</BitOffs>
<SubVar TypeFormatIndex="2">
<Name>nDataOut1</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut2</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut3</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut4</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut5</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut6</Name>
</SubVar>
</Var>
</Vars>
</Encoder>
<Drive Name="Drive" DrvType="5">
<DrvPara>
<Analog ScaleFactorActTorque="0.1"/>
</DrvPara>
<Vars VarGrpType="1">
<Name>Inputs</Name>
<Var>
<Name>In</Name>
<Type GUID="{F95C7C69-0C87-46C4-9559-1285CCA5B23A}" Namespace="MC">NCDRIVESTRUCT_IN2</Type>
<BitOffs>4672</BitOffs>
<SubVar TypeFormatIndex="2">
<Name>nDataIn1</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn2</Name>
</SubVar>
<SubVar>
<Name>nState4</Name>
<Comment>
<![CDATA[Drive Status 4 (automatically linked):
0x01 (0000 0001) = IO data invalid (e.g. EtherCAT 'WcState')
0x02 (0000 0010) = IO data input toggle (e.g. EtherCAT 'InputToggle')
Drive Status 4 (manually linked):
0x80 (1000 0000) = Fast axis stop (digital IO interrupt)
]]>
</Comment>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn3</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn4</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn5</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataIn6</Name>
</SubVar>
</Var>
</Vars>
<Vars VarGrpType="2">
<Name>Outputs</Name>
<Var>
<Name>Out</Name>
<Type GUID="{644DC4BD-3D15-4DCB-94C7-24F3A5D579AA}" Namespace="MC">NCDRIVESTRUCT_OUT2</Type>
<BitOffs>7744</BitOffs>
<SubVar TypeFormatIndex="2">
<Name>nDataOut1</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut2</Name>
</SubVar>
<SubVar>
<Name>nCtrl2</Name>
<Comment>
<![CDATA[Digital Outputs Setpoint Generator:
0x41 (0100 0001) = Minus (0x42 for inverse motor polarity)
0x42 (0100 0010) = Plus (0x41 for inverse motor polarity)
0x80 (1000 0000) = Stop
]]>
</Comment>
</SubVar>
<SubVar>
<Name>nCtrl3</Name>
<Comment>
<![CDATA[Digital Outputs (Setpoint Generator + Position Controller):
0x41 (0100 0001) = Minus (0x42 for inverse motor polarity)
0x42 (0100 0010) = Plus (0x41 for inverse motor polarity)
0x80 (1000 0000) = Stop
]]>
</Comment>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut3</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut4</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut5</Name>
</SubVar>
<SubVar TypeFormatIndex="2">
<Name>nDataOut6</Name>
</SubVar>
</Var>
</Vars>
</Drive>
<Controller Name="Ctrl" CtrType="1">
<CtrPara PriorControlFactor="1">
<Observer BandWidth="20"/>
</CtrPara>
</Controller>
<Vars VarGrpType="1" InsertType="1">
<Name>Inputs</Name>
<Var>
<Name>FromPlc</Name>
<Type GUID="{63A84524-72E3-41C8-BEAB-4CCE44690A13}" Namespace="MC">PLCTONC_AXIS_REF</Type>
<BitOffs>3328</BitOffs>
</Var>
</Vars>
<Vars VarGrpType="2" InsertType="1">
<Name>Outputs</Name>
<Var>
<Name>ToPlc</Name>
<Type GUID="{6A65C767-34E5-42BF-AD87-E1A503EAC7BE}" Namespace="MC">NCTOPLC_AXIS_REF</Type>
<BitOffs>5376</BitOffs>
<SubVar>
<Name>AxisState</Name>
<Comment>
<![CDATA[Present State Of The Axis Movement (continuous axis):
0 = INACTIVE: axis has no job
1 = RUNNING: axis is executing a motion job
2 = OVERRIDE_ZERO: axis is executing a job but override is zero
3 = PHASE_VELOCONST: axis is moving at constant velocity
4 = PHASE_ACCPOS: axis is accelerating
5 = PHASE_ACCNEG: axis is decelerating
Slaves only:
11 = PREPHASE: slave axis is in a motion pre-phase
12 = SYNCHRONIZING: slave axis is synchronizing
13 = SYNCHRONOUS: slave axis is moving synchronously
External Setpoint Generation:
41 = EXTSETGEN_MODE1: external setpoint generation active
42 = EXTSETGEN_MODE2: internal and external setpoint gen. active
]]>
</Comment>
</SubVar>
<SubVar>
<Name>HomingState</Name>
<Comment>
<![CDATA[Axis Homing Status:
0: idle
1: start homing
2: searching home switch
3: stopping on home switch
4: moving off home switch
5: searching sync pulse
6: stopping after homing
]]>
</Comment>
</SubVar>
<SubVar>
<Name>CoupleState</Name>
<Comment>
<![CDATA[Axis Coupling Status:
0: axis is a single axis (not coupled)
1: axis is a master axis
2: axis is master and slave
3: axis is a slave axis
]]>
</Comment>
</SubVar>
@@ -1867,6 +2321,14 @@ External Setpoint Generation:
<Link VarA="PlcTask Inputs^GVL.axes[1].Axis.NcToPlc" VarB="Outputs^ToPlc"/>
<Link VarA="PlcTask Outputs^GVL.axes[1].Axis.PlcToNc" VarB="Inputs^FromPlc"/>
</OwnerB>
<OwnerB Name="TINC^NC-Task 1 SAF^Axes^Axis 2">
<Link VarA="PlcTask Inputs^GVL.axes[2].Axis.NcToPlc" VarB="Outputs^ToPlc"/>
<Link VarA="PlcTask Outputs^GVL.axes[2].Axis.PlcToNc" VarB="Inputs^FromPlc"/>
</OwnerB>
<OwnerB Name="TINC^NC-Task 1 SAF^Axes^Axis 3">
<Link VarA="PlcTask Inputs^GVL.axes[3].Axis.NcToPlc" VarB="Outputs^ToPlc"/>
<Link VarA="PlcTask Outputs^GVL.axes[3].Axis.PlcToNc" VarB="Inputs^FromPlc"/>
</OwnerB>
</OwnerA>
</Mappings>
</TcSmProject>

View File

@@ -27,6 +27,8 @@ VAR
(******Error Handling********)
fbErrorSystem: FB_ErrorSystem;
aFbAxesError: ARRAY [1..gvl.axisNum] OF FB_NC_Error;
//fbEL1018 : EL1018;
//fbEL2808 : EL2808;
//fbEL5101 : EL5101;
@@ -37,6 +39,7 @@ VAR
//fbEK1110 : EK1110;
END_VAR
]]></Declaration>
@@ -49,7 +52,7 @@ ERROR();]]></ST>
<Implementation>
<ST><![CDATA[
FOR GVL.iAxis:=1 TO gvl.axisNum DO
aFBAxes[GVL.iAxis](stAxisStruct:=gvl.axes[GVL.iAxis]);
aFbAxes[GVL.iAxis](stAxisStruct:=gvl.axes[GVL.iAxis]);
END_FOR
@@ -71,6 +74,16 @@ fbErrorSystem(
EnO=> ,
nSelectedError=> ,
pErrorSystem=> );
FOR GVL.iAxis:=1 TO gvl.axisNum DO
aFbAxesError[gvl.iAxis](EN:=TRUE,
nNC_ErrorID:= gvl.axes[gvl.iAxis].status.nErrorID,
nNC_AxisID:=gvl.axes[gvl.iAxis].Axis.NcToPlc.AxisId,
ErrorSystem:= fbErrorSystem.pErrorSystem);
END_FOR
(*call all the necessary instance (input assistance F2 or right click) according to the terminals that you have in your hardware and
add "TRUE" in the input En, the corresponding number of termianl to the iTerminal_ID and
@@ -80,10 +93,9 @@ fbEL1808(
iTerminal_ID:= 01,
ErrorSystem:= fbErorSystem.pErrorSystem,
EnO=> ,
bError=> );
For axis add *)
//
bError=> );
*)
]]></ST>
</Implementation>
</Action>
@@ -112,10 +124,14 @@ For axis add *)
<LineId Id="10" Count="1" />
<LineId Id="34" Count="8" />
<LineId Id="1" Count="0" />
<LineId Id="90" Count="1" />
<LineId Id="88" Count="1" />
<LineId Id="92" Count="2" />
<LineId Id="87" Count="0" />
<LineId Id="79" Count="1" />
<LineId Id="12" Count="0" />
<LineId Id="44" Count="8" />
<LineId Id="55" Count="0" />
<LineId Id="53" Count="0" />
<LineId Id="62" Count="0" />
<LineId Id="14" Count="0" />
<LineId Id="33" Count="0" />
</LineIds>

View File

@@ -70,6 +70,9 @@
<Compile Include="tc_mca_std_lib\POUs\ErrorHandling\FB_GenericError.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\POUs\ErrorHandling\FB_NC_Error.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\POUs\ErrorHandling\FB_TerminalError.TcPOU">
<SubType>Code</SubType>
</Compile>