Merge 'tc_generic_struct/integration' into mbp-77/191204-SaveValuesOnPowerOff
Conflicts: solution/tc_project_app/POUs/MAIN.TcPOU solution/tc_project_app/tc_mca_std_lib
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
image: python:3.7.3
|
||||
options:
|
||||
max-time: 1
|
||||
pipelines:
|
||||
default:
|
||||
- step:
|
||||
script:
|
||||
- git submodule update --init
|
||||
- git submodule
|
||||
- python twincat_version_manager.py
|
||||
- python check_fix_white_space.py
|
||||
Executable
+96
@@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
#
|
||||
# Script to fix whithespace errors in files
|
||||
# All trailing white space are removed
|
||||
# TAB are replace by spaces
|
||||
#
|
||||
import glob
|
||||
import sys
|
||||
|
||||
file_patterns_tab_width = {"**/*.Tc*": 4,
|
||||
"**/*.py": 4,
|
||||
"**/*.sh": 8}
|
||||
def fix_white_space(debug, fix_files):
|
||||
"""
|
||||
Checks the Twincat source code for white space:
|
||||
TAB should not be used
|
||||
Trailing SPACE shoulf not be there.
|
||||
:return: A dictionary of white-space-damaged files
|
||||
"""
|
||||
incorrect_files = dict()
|
||||
for file_path, tab_width in file_patterns_tab_width.items():
|
||||
found_files = glob.glob(file_path, recursive=True)
|
||||
#if not found_files:
|
||||
# raise IOError("ERROR: No files of type {} found".format(file_path))
|
||||
|
||||
for pathname in found_files:
|
||||
dirty = False
|
||||
new_lines = []
|
||||
if debug >= 1:
|
||||
print("tab_with=%d pathname=%s" % (tab_width, pathname))
|
||||
file = open(pathname, 'r', newline='', encoding="iso-8859-1")
|
||||
lines = file.readlines()
|
||||
file.close()
|
||||
for old_line in lines:
|
||||
had_crlf = 0
|
||||
this_line_dirty = False
|
||||
if old_line.endswith('\r\n'):
|
||||
had_crlf = 2 # Both CR and LF
|
||||
elif old_line.endswith('\n'):
|
||||
had_crlf = 1 # LF
|
||||
# Convert all TAB into SPACE
|
||||
new_line = old_line.expandtabs(tabsize=tab_width)
|
||||
# Strip of all trailing white space, including the CRLF
|
||||
new_line = new_line.rstrip("\r\n ")
|
||||
if had_crlf == 2:
|
||||
new_line = new_line + '\r\n'
|
||||
elif had_crlf == 1:
|
||||
new_line = new_line + '\n'
|
||||
|
||||
if len(new_line) != len(old_line):
|
||||
dirty = True
|
||||
this_line_dirty = True
|
||||
new_lines.append(new_line)
|
||||
if this_line_dirty:
|
||||
if debug >= 2:
|
||||
print("had_crlf=%d" % had_crlf)
|
||||
print("old_line=%s" % old_line)
|
||||
print("new_line=%s" % new_line)
|
||||
# end of loop of all line in one file
|
||||
if debug >= 1:
|
||||
print("pathname=%s dirty=%d" % (pathname, dirty))
|
||||
if dirty:
|
||||
incorrect_files[pathname] = True
|
||||
if fix_files:
|
||||
file = open(pathname, 'w', newline='', encoding="iso-8859-1")
|
||||
file.writelines(new_lines)
|
||||
file.close()
|
||||
|
||||
return incorrect_files
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
argc = len(sys.argv)
|
||||
arg_idx = 1
|
||||
debug = 0
|
||||
fix_files = False
|
||||
while arg_idx < argc:
|
||||
if sys.argv[arg_idx] == "--fix":
|
||||
fix_files = True
|
||||
elif sys.argv[arg_idx] == "--debug":
|
||||
debug = debug + 1
|
||||
else:
|
||||
print("%s : [--fix|--debug]" % sys.argv[0])
|
||||
exit(2)
|
||||
arg_idx = arg_idx + 1
|
||||
incorrect_files = fix_white_space(debug, fix_files)
|
||||
if not fix_files:
|
||||
for file in incorrect_files:
|
||||
print("ERROR: '{}' has white space damage".format(file))
|
||||
if incorrect_files:
|
||||
exit(1)
|
||||
except IOError as e:
|
||||
print(e) # Likely no files found
|
||||
exit(2)
|
||||
+41
-91
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<TcSmProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.beckhoff.com/schemas/2012/07/TcSmProject" TcSmVersion="1.0" TcVersion="3.1.4022.28">
|
||||
<TcSmProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.beckhoff.com/schemas/2012/07/TcSmProject" TcSmVersion="1.0" TcVersion="3.1.4024.0">
|
||||
<DataTypes>
|
||||
<DataType>
|
||||
<Name GUID="{4C3FC5AC-D5AA-44C6-AC5A-159774BA0F6D}" Namespace="MC" TcBaseType="true" HideType="true" IecDeclaration="DWORD;">NCTOPLC_AXIS_REF_STATE</Name>
|
||||
@@ -411,8 +411,7 @@
|
||||
<SubItem>
|
||||
<Name>AxisState</Name>
|
||||
<Type GUID="{18071995-0000-0000-0000-000000000008}">UDINT</Type>
|
||||
<Comment>
|
||||
<![CDATA[Present State Of The Axis Movement (continuous axis):
|
||||
<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
|
||||
@@ -426,8 +425,7 @@ Slaves only:
|
||||
External Setpoint Generation:
|
||||
41 = EXTSETGEN_MODE1: external setpoint generation active
|
||||
42 = EXTSETGEN_MODE2: internal and external setpoint gen. active
|
||||
]]>
|
||||
</Comment>
|
||||
]]></Comment>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>64</BitOffs>
|
||||
</SubItem>
|
||||
@@ -440,8 +438,7 @@ External Setpoint Generation:
|
||||
<SubItem>
|
||||
<Name>HomingState</Name>
|
||||
<Type GUID="{18071995-0000-0000-0000-000000000008}">UDINT</Type>
|
||||
<Comment>
|
||||
<![CDATA[Axis Homing Status:
|
||||
<Comment><![CDATA[Axis Homing Status:
|
||||
0: idle
|
||||
1: start homing
|
||||
2: searching home switch
|
||||
@@ -449,22 +446,19 @@ External Setpoint Generation:
|
||||
4: moving off home switch
|
||||
5: searching sync pulse
|
||||
6: stopping after homing
|
||||
]]>
|
||||
</Comment>
|
||||
]]></Comment>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>128</BitOffs>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>CoupleState</Name>
|
||||
<Type GUID="{18071995-0000-0000-0000-000000000008}">UDINT</Type>
|
||||
<Comment>
|
||||
<![CDATA[Axis Coupling Status:
|
||||
<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>
|
||||
]]></Comment>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>160</BitOffs>
|
||||
</SubItem>
|
||||
@@ -690,13 +684,13 @@ External Setpoint Generation:
|
||||
<Type GUID="{F794B740-82D7-4637-848E-4F74A711D038}">NCAXLESTRUCT_TOPLC4</Type>
|
||||
</Relation>
|
||||
<Relation Priority="100">
|
||||
<Type GUID="{40BD39B0-C3EA-4F74-9F4F-5F1982786F7C}"/>
|
||||
<Type GUID="{40BD39B0-C3EA-4F74-9F4F-5F1982786F7C}"></Type>
|
||||
</Relation>
|
||||
<Relation Priority="100">
|
||||
<Type GUID="{40BD39B2-C3EA-4F74-9F4F-5F1982786F7C}"/>
|
||||
<Type GUID="{40BD39B2-C3EA-4F74-9F4F-5F1982786F7C}"></Type>
|
||||
</Relation>
|
||||
<Relation Priority="100">
|
||||
<Type GUID="{8CDE0C45-AB9D-42DB-BC94-1CF7521AB268}"/>
|
||||
<Type GUID="{8CDE0C45-AB9D-42DB-BC94-1CF7521AB268}"></Type>
|
||||
</Relation>
|
||||
</Relations>
|
||||
</DataType>
|
||||
@@ -913,30 +907,22 @@ External Setpoint Generation:
|
||||
<Name>PlcTask Inputs</Name>
|
||||
<Var>
|
||||
<Name>GVL.axes[1].inputs.bLimitFwd</Name>
|
||||
<Comment>
|
||||
<![CDATA[////Axis Inputs///////]]>
|
||||
</Comment>
|
||||
<Comment><![CDATA[////Axis Inputs///////]]></Comment>
|
||||
<Type>BOOL</Type>
|
||||
</Var>
|
||||
<Var>
|
||||
<Name>GVL.axes[1].inputs.bLimitBwd</Name>
|
||||
<Comment>
|
||||
<![CDATA[Backward limit switch]]>
|
||||
</Comment>
|
||||
<Comment><![CDATA[Backward limit switch]]></Comment>
|
||||
<Type>BOOL</Type>
|
||||
</Var>
|
||||
<Var>
|
||||
<Name>GVL.axes[1].inputs.bHomeSensor</Name>
|
||||
<Comment>
|
||||
<![CDATA[Reference siganl for homing]]>
|
||||
</Comment>
|
||||
<Comment><![CDATA[Reference siganl for homing]]></Comment>
|
||||
<Type>BOOL</Type>
|
||||
</Var>
|
||||
<Var>
|
||||
<Name>GVL.axes[1].inputs.bEncLAtch</Name>
|
||||
<Comment>
|
||||
<![CDATA[Reference index signal from inc. enconder]]>
|
||||
</Comment>
|
||||
<Comment><![CDATA[Reference index signal from inc. enconder]]></Comment>
|
||||
<Type>BOOL</Type>
|
||||
</Var>
|
||||
<Var>
|
||||
@@ -944,8 +930,7 @@ External Setpoint Generation:
|
||||
<Type GUID="{6A65C767-34E5-42BF-AD87-E1A503EAC7BE}" Namespace="MC">NCTOPLC_AXIS_REF</Type>
|
||||
<SubVar>
|
||||
<Name>AxisState</Name>
|
||||
<Comment>
|
||||
<![CDATA[Present State Of The Axis Movement (continuous axis):
|
||||
<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
|
||||
@@ -959,13 +944,11 @@ Slaves only:
|
||||
External Setpoint Generation:
|
||||
41 = EXTSETGEN_MODE1: external setpoint generation active
|
||||
42 = EXTSETGEN_MODE2: internal and external setpoint gen. active
|
||||
]]>
|
||||
</Comment>
|
||||
]]></Comment>
|
||||
</SubVar>
|
||||
<SubVar>
|
||||
<Name>HomingState</Name>
|
||||
<Comment>
|
||||
<![CDATA[Axis Homing Status:
|
||||
<Comment><![CDATA[Axis Homing Status:
|
||||
0: idle
|
||||
1: start homing
|
||||
2: searching home switch
|
||||
@@ -973,47 +956,36 @@ External Setpoint Generation:
|
||||
4: moving off home switch
|
||||
5: searching sync pulse
|
||||
6: stopping after homing
|
||||
]]>
|
||||
</Comment>
|
||||
]]></Comment>
|
||||
</SubVar>
|
||||
<SubVar>
|
||||
<Name>CoupleState</Name>
|
||||
<Comment>
|
||||
<![CDATA[Axis Coupling Status:
|
||||
<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>
|
||||
]]></Comment>
|
||||
</SubVar>
|
||||
</Var>
|
||||
<Var>
|
||||
<Name>GVL.axes[2].inputs.bLimitFwd</Name>
|
||||
<Comment>
|
||||
<![CDATA[////Axis Inputs///////]]>
|
||||
</Comment>
|
||||
<Comment><![CDATA[////Axis Inputs///////]]></Comment>
|
||||
<Type>BOOL</Type>
|
||||
</Var>
|
||||
<Var>
|
||||
<Name>GVL.axes[2].inputs.bLimitBwd</Name>
|
||||
<Comment>
|
||||
<![CDATA[Backward limit switch]]>
|
||||
</Comment>
|
||||
<Comment><![CDATA[Backward limit switch]]></Comment>
|
||||
<Type>BOOL</Type>
|
||||
</Var>
|
||||
<Var>
|
||||
<Name>GVL.axes[2].inputs.bHomeSensor</Name>
|
||||
<Comment>
|
||||
<![CDATA[Reference siganl for homing]]>
|
||||
</Comment>
|
||||
<Comment><![CDATA[Reference siganl for homing]]></Comment>
|
||||
<Type>BOOL</Type>
|
||||
</Var>
|
||||
<Var>
|
||||
<Name>GVL.axes[2].inputs.bEncLAtch</Name>
|
||||
<Comment>
|
||||
<![CDATA[Reference index signal from inc. enconder]]>
|
||||
</Comment>
|
||||
<Comment><![CDATA[Reference index signal from inc. enconder]]></Comment>
|
||||
<Type>BOOL</Type>
|
||||
</Var>
|
||||
<Var>
|
||||
@@ -1021,8 +993,7 @@ External Setpoint Generation:
|
||||
<Type GUID="{6A65C767-34E5-42BF-AD87-E1A503EAC7BE}" Namespace="MC">NCTOPLC_AXIS_REF</Type>
|
||||
<SubVar>
|
||||
<Name>AxisState</Name>
|
||||
<Comment>
|
||||
<![CDATA[Present State Of The Axis Movement (continuous axis):
|
||||
<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
|
||||
@@ -1036,13 +1007,11 @@ Slaves only:
|
||||
External Setpoint Generation:
|
||||
41 = EXTSETGEN_MODE1: external setpoint generation active
|
||||
42 = EXTSETGEN_MODE2: internal and external setpoint gen. active
|
||||
]]>
|
||||
</Comment>
|
||||
]]></Comment>
|
||||
</SubVar>
|
||||
<SubVar>
|
||||
<Name>HomingState</Name>
|
||||
<Comment>
|
||||
<![CDATA[Axis Homing Status:
|
||||
<Comment><![CDATA[Axis Homing Status:
|
||||
0: idle
|
||||
1: start homing
|
||||
2: searching home switch
|
||||
@@ -1050,47 +1019,36 @@ External Setpoint Generation:
|
||||
4: moving off home switch
|
||||
5: searching sync pulse
|
||||
6: stopping after homing
|
||||
]]>
|
||||
</Comment>
|
||||
]]></Comment>
|
||||
</SubVar>
|
||||
<SubVar>
|
||||
<Name>CoupleState</Name>
|
||||
<Comment>
|
||||
<![CDATA[Axis Coupling Status:
|
||||
<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>
|
||||
]]></Comment>
|
||||
</SubVar>
|
||||
</Var>
|
||||
<Var>
|
||||
<Name>GVL.axes[3].inputs.bLimitFwd</Name>
|
||||
<Comment>
|
||||
<![CDATA[////Axis Inputs///////]]>
|
||||
</Comment>
|
||||
<Comment><![CDATA[////Axis Inputs///////]]></Comment>
|
||||
<Type>BOOL</Type>
|
||||
</Var>
|
||||
<Var>
|
||||
<Name>GVL.axes[3].inputs.bLimitBwd</Name>
|
||||
<Comment>
|
||||
<![CDATA[Backward limit switch]]>
|
||||
</Comment>
|
||||
<Comment><![CDATA[Backward limit switch]]></Comment>
|
||||
<Type>BOOL</Type>
|
||||
</Var>
|
||||
<Var>
|
||||
<Name>GVL.axes[3].inputs.bHomeSensor</Name>
|
||||
<Comment>
|
||||
<![CDATA[Reference siganl for homing]]>
|
||||
</Comment>
|
||||
<Comment><![CDATA[Reference siganl for homing]]></Comment>
|
||||
<Type>BOOL</Type>
|
||||
</Var>
|
||||
<Var>
|
||||
<Name>GVL.axes[3].inputs.bEncLAtch</Name>
|
||||
<Comment>
|
||||
<![CDATA[Reference index signal from inc. enconder]]>
|
||||
</Comment>
|
||||
<Comment><![CDATA[Reference index signal from inc. enconder]]></Comment>
|
||||
<Type>BOOL</Type>
|
||||
</Var>
|
||||
<Var>
|
||||
@@ -1098,8 +1056,7 @@ External Setpoint Generation:
|
||||
<Type GUID="{6A65C767-34E5-42BF-AD87-E1A503EAC7BE}" Namespace="MC">NCTOPLC_AXIS_REF</Type>
|
||||
<SubVar>
|
||||
<Name>AxisState</Name>
|
||||
<Comment>
|
||||
<![CDATA[Present State Of The Axis Movement (continuous axis):
|
||||
<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
|
||||
@@ -1113,13 +1070,11 @@ Slaves only:
|
||||
External Setpoint Generation:
|
||||
41 = EXTSETGEN_MODE1: external setpoint generation active
|
||||
42 = EXTSETGEN_MODE2: internal and external setpoint gen. active
|
||||
]]>
|
||||
</Comment>
|
||||
]]></Comment>
|
||||
</SubVar>
|
||||
<SubVar>
|
||||
<Name>HomingState</Name>
|
||||
<Comment>
|
||||
<![CDATA[Axis Homing Status:
|
||||
<Comment><![CDATA[Axis Homing Status:
|
||||
0: idle
|
||||
1: start homing
|
||||
2: searching home switch
|
||||
@@ -1127,19 +1082,16 @@ External Setpoint Generation:
|
||||
4: moving off home switch
|
||||
5: searching sync pulse
|
||||
6: stopping after homing
|
||||
]]>
|
||||
</Comment>
|
||||
]]></Comment>
|
||||
</SubVar>
|
||||
<SubVar>
|
||||
<Name>CoupleState</Name>
|
||||
<Comment>
|
||||
<![CDATA[Axis Coupling Status:
|
||||
<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>
|
||||
]]></Comment>
|
||||
</SubVar>
|
||||
</Var>
|
||||
</Vars>
|
||||
@@ -1147,9 +1099,7 @@ External Setpoint Generation:
|
||||
<Name>PlcTask Outputs</Name>
|
||||
<Var>
|
||||
<Name>MAIN.bOutput1</Name>
|
||||
<Comment>
|
||||
<![CDATA[*****Outputs: Power for Limit switches and Home Sensors (every 4th output)*******]]>
|
||||
</Comment>
|
||||
<Comment><![CDATA[*****Outputs: Power for Limit switches and Home Sensors (every 4th output)*******]]></Comment>
|
||||
<Type>BOOL</Type>
|
||||
</Var>
|
||||
<Var>
|
||||
|
||||
Submodule solution/tc_epicscommodule updated: 6c86fc4bd9...a13d6bb622
@@ -1,14 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.17">
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
|
||||
<GVL Name="GVL_APP" Id="{8fe9690c-7907-432e-bedb-6fc99b5ce255}">
|
||||
<Declaration><![CDATA[{attribute 'qualified_only'}
|
||||
VAR_GLOBAL
|
||||
|
||||
|
||||
END_VAR
|
||||
|
||||
VAR_GLOBAL CONSTANT
|
||||
axisNum : UINT:=3;
|
||||
//axisCoupleMax : UINT:=4;
|
||||
axisNum : UINT:=3;
|
||||
//axisCoupleMax : UINT:=4;
|
||||
END_VAR]]></Declaration>
|
||||
</GVL>
|
||||
</TcPlcObject>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.17">
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
|
||||
<GlobalTextList Name="GlobalTextList" Id="{c3494959-baa5-4f73-b0cd-9c11912145dd}">
|
||||
<XmlArchive>
|
||||
<Data>
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.17">
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
|
||||
<POU Name="MAIN" Id="{33eb6f49-7781-4211-a70b-87ada6d80cb7}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[PROGRAM MAIN
|
||||
VAR
|
||||
sVersion: STRING:='1.0.0';
|
||||
i : UINT; //index variable for AXES()
|
||||
aFbAxes: ARRAY [1..gvl_app.axisNum] OF FB_Axis;
|
||||
hmiAxisSelection : INT:=1; //Not possible to use local hmi variables for array indexes
|
||||
|
||||
sVersion: STRING:='1.0.0';
|
||||
i : UINT; //index variable for AXES()
|
||||
aFbAxes: ARRAY [1..gvl_app.axisNum] OF FB_Axis;
|
||||
hmiAxisSelection : INT:=1; //Not possible to use local hmi variables for array indexes
|
||||
|
||||
(******Outputs: Power for Limit switches and Home Sensors (every 4th output)********)
|
||||
|
||||
bOutput1 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput2 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput3 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput4 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput5 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput6 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput7 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput8 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput9 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput13 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput17 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput21 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput24 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput28 AT %Q*: BOOL:= TRUE;
|
||||
|
||||
|
||||
bOutput1 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput2 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput3 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput4 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput5 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput6 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput7 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput8 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput9 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput13 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput17 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput21 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput24 AT %Q*: BOOL:= TRUE;
|
||||
//bOutput28 AT %Q*: BOOL:= TRUE;
|
||||
|
||||
(******Error Handling********)
|
||||
fbErrorSystem: FB_ErrorSystem;
|
||||
aFbAxesError: ARRAY [1..gvl_app.axisNum] OF FB_NC_Error;
|
||||
@@ -47,8 +47,9 @@ VAR
|
||||
fbReadEncRefSys : ARRAY [1..gvl_app.axisNum] OF MC_ReadParameter;
|
||||
fbUPS : FB_S_UPS_CX51x0;
|
||||
eUpsMode : E_S_UPS_Mode := eSUPS_WrPersistData_Shutdown;
|
||||
fbRestorePosition : ARRAY [1..GVL_app.axisNum] OF MC_SetPosition;
|
||||
|
||||
fbRestorePosition : ARRAY [1..GVL_app.axisNum] OF MC_SetPosition;
|
||||
|
||||
|
||||
END_VAR
|
||||
VAR PERSISTENT
|
||||
iPositionAtShutdown : ARRAY [1..gvl_app.axisNum] OF LREAL;
|
||||
@@ -77,7 +78,7 @@ ERROR();]]></ST>
|
||||
<Implementation>
|
||||
<ST><;
|
||||
aFbAxes[GVL.iAxis](stAxisStruct:=gvl.axes[GVL.iAxis]);
|
||||
END_FOR
|
||||
|
||||
|
||||
@@ -90,35 +91,35 @@ END_FOR
|
||||
(****FB containting the log of the errors****)
|
||||
//
|
||||
fbErrorSystem(
|
||||
En:= TRUE,
|
||||
bReset:= ,
|
||||
nErrorNum:= ,
|
||||
bACK:= ,
|
||||
bValidSelection:= ,
|
||||
nTableRowIndex:= ,
|
||||
EnO=> ,
|
||||
nSelectedError=> ,
|
||||
pErrorSystem=> );
|
||||
En:= TRUE,
|
||||
bReset:= ,
|
||||
nErrorNum:= ,
|
||||
bACK:= ,
|
||||
bValidSelection:= ,
|
||||
nTableRowIndex:= ,
|
||||
EnO=> ,
|
||||
nSelectedError=> ,
|
||||
pErrorSystem=> );
|
||||
|
||||
|
||||
FOR GVL.iAxis:=1 TO gvl_app.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);
|
||||
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
|
||||
the variable "fbErrorSystem.pErrorSystem" to the input ErrorSystem in each FB E. g. :
|
||||
add "TRUE" in the input En, the corresponding number of termianl to the iTerminal_ID and
|
||||
the variable "fbErrorSystem.pErrorSystem" to the input ErrorSystem in each FB E. g. :
|
||||
fbEL1808(
|
||||
En:= TRUE,
|
||||
iTerminal_ID:= 01,
|
||||
ErrorSystem:= fbErorSystem.pErrorSystem,
|
||||
EnO=> ,
|
||||
bError=> );
|
||||
En:= TRUE,
|
||||
iTerminal_ID:= 01,
|
||||
ErrorSystem:= fbErorSystem.pErrorSystem,
|
||||
EnO=> ,
|
||||
bError=> );
|
||||
*)
|
||||
|
||||
]]></ST>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.6">
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
|
||||
<Task Name="PlcTask" Id="{96ece0eb-a21b-4000-8986-812071c196ce}">
|
||||
<!--CycleTime in micro seconds.-->
|
||||
<CycleTime>1000</CycleTime>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.17">
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
|
||||
<VisuManager Name="Visualization Manager" Id="{9ab27b0a-e061-4269-b032-b221661a7379}">
|
||||
<XmlArchive>
|
||||
<Data>
|
||||
|
||||
Submodule solution/tc_project_app/tc_mca_std_lib updated: 32b87da57e...ab99f8caaf
@@ -0,0 +1,40 @@
|
||||
import glob
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
VERSION_TAGS = {"**/*.Tc*": "ProductVersion", "**/*.tsproj": "TcVersion"}
|
||||
CORRECT_VERSION = "3.1.4024.0"
|
||||
|
||||
|
||||
def check_versions():
|
||||
"""
|
||||
Checks the Twincat version used to create a file.
|
||||
It assumes that the version is stored as an attribute on the top element of the file, the attribute names are
|
||||
listed in VERSION_TAGS.
|
||||
:return: A dictionary of incorrect files and their version numbers
|
||||
"""
|
||||
incorrect_files = dict()
|
||||
for file_path, version_attrib in VERSION_TAGS.items():
|
||||
found_files = glob.glob(file_path, recursive=True)
|
||||
if not found_files:
|
||||
raise IOError("ERROR: No files of type {} found".format(file_path))
|
||||
for file in found_files:
|
||||
tree = ET.parse(file)
|
||||
try:
|
||||
found_version = tree.getroot().attrib[version_attrib]
|
||||
if found_version != CORRECT_VERSION:
|
||||
incorrect_files[file] = found_version
|
||||
except KeyError:
|
||||
print("WARNING: No version found for {}".format(file))
|
||||
return incorrect_files
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
incorrect_files = check_versions()
|
||||
for file, version in incorrect_files.items():
|
||||
print("ERROR: {} has incorrect version {}, expected version {}".format(file, version, CORRECT_VERSION))
|
||||
if incorrect_files:
|
||||
exit(1)
|
||||
except IOError as e:
|
||||
print(e) # Likely no files found
|
||||
exit(2)
|
||||
Reference in New Issue
Block a user