diff --git a/.gitignore b/.gitignore
index 8f8c117..63a08bd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,5 @@ logs.0*
solution/TrialLicense.tclrs
tools/linux/ADS/
tools/linux/getADSState/getADSState.bin
+_Config/NC/Axes
+_Config/IO
diff --git a/.gitmodules b/.gitmodules
index 744093e..3eb7f73 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,3 @@
-[submodule "solution/tc_epicscommodule"]
- path = solution/tc_epicscommodule
- url = https://bitbucket.org/europeanspallationsource/tc_epicscommodule.git
[submodule "solution/tc_project_app/tc_mca_std_lib"]
path = solution/tc_project_app/tc_mca_std_lib
url = https://bitbucket.org/europeanspallationsource/tc_mca_std_lib.git
diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml
index 7c786ab..873f48c 100644
--- a/bitbucket-pipelines.yml
+++ b/bitbucket-pipelines.yml
@@ -1,11 +1,10 @@
-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
+image: python:3.7.3
+options:
+ max-time: 1
+pipelines:
+ default:
+ - step:
+ script:
+ - git submodule update --init
+ - python twincat_version_manager.py
+ - python check_fix_white_space.py
diff --git a/check_fix_white_space.py b/check_fix_white_space.py
index cf6fe3c..6597e58 100755
--- a/check_fix_white_space.py
+++ b/check_fix_white_space.py
@@ -26,6 +26,8 @@ def fix_white_space(debug, fix_files):
for pathname in found_files:
dirty = False
+ had_TAB = False
+ had_trailing_WS = False
new_lines = []
if debug >= 1:
print("tab_with=%d pathname=%s" % (tab_width, pathname))
@@ -41,8 +43,16 @@ def fix_white_space(debug, fix_files):
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 new_line != old_line:
+ had_TAB = True
+ # Strip the CRLF
+ new_line = new_line.rstrip("\r\n")
+ # Strip trailing WS
+ tmp_line = new_line.rstrip(" ")
+ if tmp_line != new_line:
+ had_trailing_WS = True
+ new_line = tmp_line
+
if had_crlf == 2:
new_line = new_line + '\r\n'
elif had_crlf == 1:
@@ -61,7 +71,12 @@ def fix_white_space(debug, fix_files):
if debug >= 1:
print("pathname=%s dirty=%d" % (pathname, dirty))
if dirty:
- incorrect_files[pathname] = True
+ if had_TAB and had_trailing_WS:
+ incorrect_files[pathname] = 'has white space damage'
+ elif had_TAB:
+ incorrect_files[pathname] = 'has TAB'
+ elif had_trailing_WS:
+ incorrect_files[pathname] = 'has trailing whitespace'
if fix_files:
file = open(pathname, 'w', newline='', encoding="iso-8859-1")
file.writelines(new_lines)
@@ -88,8 +103,10 @@ if __name__ == "__main__":
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))
+ message = incorrect_files[file]
+ print("ERROR: '{}' {}".format(file,message))
if incorrect_files:
+ print('run %s --fix' % sys.argv[0])
exit(1)
except IOError as e:
print(e) # Likely no files found
diff --git a/solution/_Config/NC/NC.xti b/solution/_Config/NC/NC.xti
new file mode 100644
index 0000000..759c7a3
--- /dev/null
+++ b/solution/_Config/NC/NC.xti
@@ -0,0 +1,20 @@
+
+
+
+
+ NC-Task 1 SAF
+
+ Inputs
+
+
+ Outputs
+
+
+ Image
+
+
+
+ NC-Task 1 SVB
+
+
+
diff --git a/solution/solution.tsproj b/solution/solution.tsproj
index e0f327a..7219f74 100644
--- a/solution/solution.tsproj
+++ b/solution/solution.tsproj
@@ -1,1923 +1,27 @@
-
-
- UINTARR2
- 32
- UINT
-
- 0
- 2
-
-
- [%u, %u]
- [0]
- [1]
-
-
- 0x%08x [%u, %u]
- .
- [0]
- [1]
-
-
- 0x%08x (%u)
- .
- .
-
-
-
- NCENCODERSTRUCT_IN2B
- 320
-
- nDataIn1
- UINTARR2
- 32
- 0
-
-
- nDataIn2
- UINTARR2
- 32
- 32
-
-
- nState1
- USINT
- 8
- 64
-
-
- nState2
- USINT
- 8
- 72
-
-
- nState3
- USINT
- 8
- 80
-
-
- nState4
- USINT
-
- 8
- 88
-
-
- nDataIn3
- UINTARR2
- 32
- 96
-
-
- nDataIn4
- UINTARR2
- 32
- 128
-
-
- nDataIn5
- UINTARR2
- 32
- 160
-
-
- nDataIn6
- UINTARR2
- 32
- 192
-
-
- nState5
- USINT
- 8
- 224
-
-
- nState6
- USINT
- 8
- 232
-
-
- nState7
- USINT
- 8
- 240
-
-
- nState8
- USINT
- 8
- 248
-
-
- nDcInputTime
- DINT
- 32
- 256
-
-
- nDataIn7
- UINTARR2
- 32
- 288
-
-
-
- NCENCODERSTRUCT_IN
-
- 96
-
-
-
-
-
- NCENCODERSTRUCT_OUT2
- 320
-
- nDataOut1
- UINTARR2
- 32
- 0
-
-
- nDataOut2
- UINTARR2
- 32
- 32
-
-
- nCtrl1
- USINT
- 8
- 64
-
-
- nCtrl2
- USINT
- 8
- 72
-
-
- nCtrl3
- USINT
- 8
- 80
-
-
- nCtrl4
- USINT
- 8
- 88
-
-
- nDataOut3
- UINTARR2
- 32
- 96
-
-
- nDataOut4
- UINTARR2
- 32
- 128
-
-
- nDataOut5
- UINTARR2
- 32
- 160
-
-
- nDataOut6
- UINTARR2
- 32
- 192
-
-
- nCtrl5
- USINT
- 8
- 224
-
-
- nCtrl6
- USINT
- 8
- 232
-
-
- nCtrl7
- USINT
- 8
- 240
-
-
- nCtrl8
- USINT
- 8
- 248
-
-
-
- NCENCODERSTRUCT_OUT
-
- 96
-
-
-
-
-
- NCDRIVESTRUCT_IN2
- 320
-
- nDataIn1
- UINTARR2
- 32
- 0
-
-
- nDataIn2
- UINTARR2
- 32
- 32
-
-
- nState1
- USINT
- 8
- 64
-
-
- nState2
- USINT
- 8
- 72
-
-
- nState3
- USINT
- 8
- 80
-
-
- nState4
- USINT
-
- 8
- 88
-
-
- nDataIn3
- UINTARR2
- 32
- 96
-
-
- nDataIn4
- UINTARR2
- 32
- 128
-
-
- nDataIn5
- UINTARR2
- 32
- 160
-
-
- nDataIn6
- UINTARR2
- 32
- 192
-
-
- nState5
- USINT
- 8
- 224
-
-
- nState6
- USINT
- 8
- 232
-
-
- nState7
- USINT
- 8
- 240
-
-
- nState8
- USINT
- 8
- 248
-
-
- nDcOutputTime
- DINT
- 32
- 256
-
-
-
- NCDRIVESTRUCT_IN
-
- 96
-
-
-
-
-
- NCDRIVESTRUCT_OUT2
- 320
-
- nDataOut1
- UINTARR2
- 32
- 0
-
-
- nDataOut2
- UINTARR2
- 32
- 32
-
-
- nCtrl1
- USINT
- 8
- 64
-
-
- nCtrl2
- USINT
- 8
- 72
-
-
- nCtrl3
- USINT
- 8
- 80
-
-
- nCtrl4
- USINT
- 8
- 88
-
-
- nDataOut3
- UINTARR2
- 32
- 96
-
-
- nDataOut4
- UINTARR2
- 32
- 128
-
-
- nDataOut5
- UINTARR2
- 32
- 160
-
-
- nDataOut6
- UINTARR2
- 32
- 192
-
-
- nCtrl5
- USINT
- 8
- 224
-
-
- nCtrl6
- USINT
- 8
- 232
-
-
- nCtrl7
- USINT
- 8
- 240
-
-
- nCtrl8
- USINT
- 8
- 248
-
-
-
- NCDRIVESTRUCT_OUT
-
- 96
-
-
-
-
-
- PLCTONC_AXIS_REF_CTRL
- 32
-
- Enable
- BIT
- 1
- 0
-
-
- FeedEnablePlus
- BIT
- 1
- 1
-
-
- FeedEnableMinus
- BIT
- 1
- 2
-
-
- HomingSensor
- BIT
- 1
- 5
-
-
- AcceptBlockedDrive
- BIT
- 1
- 8
-
-
- PlcDebugFlag
- BIT
- 1
- 30
-
-
- NcDebugFlag
- BIT
- 1
- 31
-
-
- %08x
-
-
- 0x%08x
-
-
- 16#%08X
-
-
-
- PLCTONC_AXIS_REF
- 1024
-
- ControlDWord
- PLCTONC_AXIS_REF_CTRL
- 32
- 0
-
-
- Override
- UDINT
- 32
- 32
-
-
- AxisModeRequest
- UDINT
- 32
- 64
-
-
- AxisModeDWord
- UDINT
- 32
- 96
-
-
- AxisModeLReal
- LREAL
- 64
- 128
-
-
- PositionCorrection
- LREAL
- 64
- 192
-
-
- ExtSetPos
- LREAL
- 64
- 256
-
-
- ExtSetVelo
- LREAL
- 64
- 320
-
-
- ExtSetAcc
- LREAL
- 64
- 384
-
-
- ExtSetDirection
- DINT
- 32
- 448
-
-
- ExtControllerOutput
- LREAL
- 64
- 512
-
-
- GearRatio1
- LREAL
- 64
- 576
-
-
- GearRatio2
- LREAL
- 64
- 640
-
-
- GearRatio3
- LREAL
- 64
- 704
-
-
- GearRatio4
- LREAL
- 64
- 768
-
-
- MapState
- BOOL
- 8
- 832
-
-
- PlcCycleControl
- BYTE
- 8
- 840
-
-
- PlcCycleCount
- BYTE
- 8
- 848
-
-
-
- NcStructType
- 1
-
-
-
-
- NCAXLESTRUCT_FROMPLC3
-
-
-
-
- NCTOPLC_AXIS_REF_STATE
- 32
-
- Operational
- BIT
- 1
- 0
-
-
- Homed
- BIT
- 1
- 1
-
-
- NotMoving
- BIT
- 1
- 2
-
-
- InPositionArea
- BIT
- 1
- 3
-
-
- InTargetPosition
- BIT
- 1
- 4
-
-
- Protected
- BIT
- 1
- 5
-
-
- ErrorPropagationDelayed
- BIT
- 1
- 6
-
-
- HasBeenStopped
- BIT
- 1
- 7
-
-
- HasJob
- BIT
- 1
- 8
-
-
- PositiveDirection
- BIT
- 1
- 9
-
-
- NegativeDirection
- BIT
- 1
- 10
-
-
- HomingBusy
- BIT
- 1
- 11
-
-
- ConstantVelocity
- BIT
- 1
- 12
-
-
- Compensating
- BIT
- 1
- 13
-
-
- ExtSetPointGenEnabled
- BIT
- 1
- 14
-
-
- PhasingActive
- BIT
- 1
- 15
-
-
- ExternalLatchValid
- BIT
- 1
- 16
-
-
- NewTargetPos
- BIT
- 1
- 17
-
-
- ContinuousMotion
- BIT
- 1
- 19
-
-
- ControlLoopClosed
- BIT
- 1
- 20
-
-
- CamTableQueued
- BIT
- 1
- 21
-
-
- CamDataQueued
- BIT
- 1
- 22
-
-
- CamScalingPending
- BIT
- 1
- 23
-
-
- CmdBuffered
- BIT
- 1
- 24
-
-
- PTPmode
- BIT
- 1
- 25
-
-
- SoftLimitMinExceeded
- BIT
- 1
- 26
-
-
- SoftLimitMaxExceeded
- BIT
- 1
- 27
-
-
- DriveDeviceError
- BIT
- 1
- 28
-
-
- MotionCommandsLocked
- BIT
- 1
- 29
-
-
- IoDataInvalid
- BIT
- 1
- 30
-
-
- Error
- BIT
- 1
- 31
-
-
- %08x
-
-
- 0x%08x
-
-
- 16#%08X
-
-
-
- NCTOPLC_AXIS_REF_OPMODE
- 32
-
- OpModePosAreaMonitoring
- BIT
- 1
- 0
-
-
- OpModeTargetPosMonitoring
- BIT
- 1
- 1
-
-
- OpModeLoop
- BIT
- 1
- 2
-
-
- OpModeMotionMonitoring
- BIT
- 1
- 3
-
-
- OpModePEHTimeMonitoring
- BIT
- 1
- 4
-
-
- OpModeBacklashCompensation
- BIT
- 1
- 5
-
-
- OpModeDelayedErrorReaction
- BIT
- 1
- 6
-
-
- OpModeModulo
- BIT
- 1
- 7
-
-
- OpModeSimulationAxis
- BIT
- 1
- 8
-
-
- OpModePosLagMonitoring
- BIT
- 1
- 16
-
-
- OpModeVeloLagMonitoring
- BIT
- 1
- 17
-
-
- OpModeSoftLimitMinMonitoring
- BIT
- 1
- 18
-
-
- OpModeSoftLimitMaxMonitoring
- BIT
- 1
- 19
-
-
- OpModePosCorrection
- BIT
- 1
- 20
-
-
- OpModeAllowSlaveCommands
- BIT
- 1
- 21
-
-
- OpModeAllowExtSetAxisCommands
- BIT
- 1
- 22
-
-
- ApplicationRequest
- BIT
- 1
- 23
-
-
-
- NCTOPLC_AXIS_REF_STATE2_FLAGS
- 32
-
- AvoidingCollision
- BIT
- 1
- 0
-
-
- %08x
-
-
- 0x%08x
-
-
- 16#%08X
-
-
-
- NCTOPLC_AXIS_REF_STATE2
- 32
-
- Value
- DWORD
- 32
- 0
-
-
- Flags
- NCTOPLC_AXIS_REF_STATE2_FLAGS
- 32
- 0
-
-
- %08x
-
-
- 0x%08x
-
-
- 16#%08X
-
-
-
- NCTOPLC_AXIS_REF_CAMCOUPLINGSTATE
- 8
-
- CamActivationPending
- BIT
- 1
- 0
-
-
- CamDeactivationPending
- BIT
- 1
- 1
-
-
- CamActive
- BIT
- 1
- 2
-
-
- CamDataQueued
- BIT
- 1
- 6
-
-
- CamScalingPending
- BIT
- 1
- 7
-
-
-
- UINTARR8
- 128
- UINT
-
- 0
- 8
-
-
-
- NCTOPLC_AXIS_REF
- 2048
-
- StateDWord
- NCTOPLC_AXIS_REF_STATE
- 32
- 0
-
-
- ErrorCode
- UDINT
- 32
- 32
-
-
- AxisState
- UDINT
-
- 32
- 64
-
-
- AxisModeConfirmation
- UDINT
- 32
- 96
-
-
- HomingState
- UDINT
-
- 32
- 128
-
-
- CoupleState
- UDINT
-
- 32
- 160
-
-
- SvbEntries
- UDINT
- 32
- 192
-
-
- SafEntries
- UDINT
- 32
- 224
-
-
- AxisId
- UDINT
- 32
- 256
-
-
- OpModeDWord
- NCTOPLC_AXIS_REF_OPMODE
- 32
- 288
-
-
- ActPos
- LREAL
- 64
- 320
-
-
- ModuloActPos
- LREAL
- 64
- 384
-
-
- ActiveControlLoopIndex
- UINT
- 16
- 448
-
-
- ControlLoopIndex
- UINT
- 16
- 464
-
-
- ModuloActTurns
- DINT
- 32
- 480
-
-
- ActVelo
- LREAL
- 64
- 512
-
-
- PosDiff
- LREAL
- 64
- 576
-
-
- SetPos
- LREAL
- 64
- 640
-
-
- SetVelo
- LREAL
- 64
- 704
-
-
- SetAcc
- LREAL
- 64
- 768
-
-
- TargetPos
- LREAL
- 64
- 832
-
-
- ModuloSetPos
- LREAL
- 64
- 896
-
-
- ModuloSetTurns
- DINT
- 32
- 960
-
-
- CmdNo
- UINT
- 16
- 992
-
-
- CmdState
- UINT
- 16
- 1008
-
-
- SetJerk
- LREAL
- 64
- 1024
-
-
- SetTorque
- LREAL
- 64
- 1088
-
-
- ActTorque
- LREAL
- 64
- 1152
-
-
- StateDWord2
- NCTOPLC_AXIS_REF_STATE2
- 32
- 1216
-
-
- StateDWord3
- DWORD
- 32
- 1248
-
-
- TouchProbeState
- DWORD
- 32
- 1280
-
-
- TouchProbeCounter
- DWORD
- 32
- 1312
-
-
- CamCouplingState
- NCTOPLC_AXIS_REF_CAMCOUPLINGSTATE
-
- 0
- 8
-
- 64
- 1344
-
-
- CamCouplingTableID
- UINTARR8
- 128
- 1408
-
-
- ActTorqueDerivative
- LREAL
- 64
- 1536
-
-
- SetTorqueDerivative
- LREAL
- 64
- 1600
-
-
- ActPosWithoutPosCorrection
- LREAL
- 64
- 1792
-
-
- ActAcc
- LREAL
- 64
- 1856
-
-
- DcTimeStamp
- UDINT
- 32
- 1920
-
-
-
- NcStructType
- 2
-
-
-
-
- NCAXLESTRUCT_TOPLC
-
-
- NCAXLESTRUCT_TOPLC2
-
-
- NCAXLESTRUCT_TOPLC3
-
-
- NCAXLESTRUCT_TOPLC4
-
-
-
-
-
-
-
-
-
-
-
-
-
+
{3EBB9639-5FF3-42B6-8847-35C70DC013C8}
-
- PlcTaskCom
-
PlcTask
-
-
- NC-Task 1 SAF
-
- Inputs
-
-
- Outputs
-
-
- Image
-
-
-
- NC-Task 1 SVB
-
-
- Axis 1
-
-
-
-
-
-
-
-
- Inputs
-
- In
- NCENCODERSTRUCT_IN2B
- 1024
-
- nDataIn1
-
-
- nDataIn2
-
-
- nState4
-
-
-
- nDataIn3
-
-
- nDataIn4
-
-
- nDataIn5
-
-
- nDataIn6
-
-
- nDataIn7
-
-
-
-
- Outputs
-
- Out
- NCENCODERSTRUCT_OUT2
- 2048
-
- nDataOut1
-
-
- nDataOut2
-
-
- nDataOut3
-
-
- nDataOut4
-
-
- nDataOut5
-
-
- nDataOut6
-
-
-
-
-
-
-
-
-
-
- Inputs
-
- In
- NCDRIVESTRUCT_IN2
- 1344
-
- nDataIn1
-
-
- nDataIn2
-
-
- nState4
-
-
-
- nDataIn3
-
-
- nDataIn4
-
-
- nDataIn5
-
-
- nDataIn6
-
-
-
-
- Outputs
-
- Out
- NCDRIVESTRUCT_OUT2
- 2368
-
- nDataOut1
-
-
- nDataOut2
-
-
- nCtrl2
-
-
-
- nCtrl3
-
-
-
- nDataOut3
-
-
- nDataOut4
-
-
- nDataOut5
-
-
- nDataOut6
-
-
-
-
-
-
-
-
-
-
- Inputs
-
- FromPlc
- PLCTONC_AXIS_REF
-
-
-
- Outputs
-
- ToPlc
- NCTOPLC_AXIS_REF
-
- AxisState
-
-
-
- HomingState
-
-
-
- CoupleState
-
-
-
-
-
-
- Axis 2
-
-
-
-
-
- Inputs
-
- In
- NCENCODERSTRUCT_IN2B
- 2688
-
- nDataIn1
-
-
- nDataIn2
-
-
- nState4
-
-
-
- nDataIn3
-
-
- nDataIn4
-
-
- nDataIn5
-
-
- nDataIn6
-
-
- nDataIn7
-
-
-
-
- Outputs
-
- Out
- NCENCODERSTRUCT_OUT2
- 4736
-
- nDataOut1
-
-
- nDataOut2
-
-
- nDataOut3
-
-
- nDataOut4
-
-
- nDataOut5
-
-
- nDataOut6
-
-
-
-
-
-
-
-
-
-
- Inputs
-
- In
- NCDRIVESTRUCT_IN2
- 3008
-
- nDataIn1
-
-
- nDataIn2
-
-
- nState4
-
-
-
- nDataIn3
-
-
- nDataIn4
-
-
- nDataIn5
-
-
- nDataIn6
-
-
-
-
- Outputs
-
- Out
- NCDRIVESTRUCT_OUT2
- 5056
-
- nDataOut1
-
-
- nDataOut2
-
-
- nCtrl2
-
-
-
- nCtrl3
-
-
-
- nDataOut3
-
-
- nDataOut4
-
-
- nDataOut5
-
-
- nDataOut6
-
-
-
-
-
-
-
-
-
-
- Inputs
-
- FromPlc
- PLCTONC_AXIS_REF
- 1664
-
-
-
- Outputs
-
- ToPlc
- NCTOPLC_AXIS_REF
- 2688
-
- AxisState
-
-
-
- HomingState
-
-
-
- CoupleState
-
-
-
-
-
-
+
-
-
- tc_epicscommodule Instance
- {08500001-0000-0000-F000-000000000064}
-
-
-
-
-
tc_project_app Instance
{08500001-0000-0000-F000-000000000064}
-
- PlcTask Inputs
-
- GVL.axes[1].inputs.bLimitFwd
-
- BOOL
-
-
- GVL.axes[1].inputs.bLimitBwd
-
- BOOL
-
-
- GVL.axes[1].inputs.bHomeSensor
-
- BOOL
-
-
- GVL.axes[1].inputs.bEncLAtch
-
- BOOL
-
-
- GVL.axes[1].Axis.NcToPlc
- NCTOPLC_AXIS_REF
-
- AxisState
-
-
-
- HomingState
-
-
-
- CoupleState
-
-
-
-
- GVL.axes[2].inputs.bLimitFwd
-
- BOOL
-
-
- GVL.axes[2].inputs.bLimitBwd
-
- BOOL
-
-
- GVL.axes[2].inputs.bHomeSensor
-
- BOOL
-
-
- GVL.axes[2].inputs.bEncLAtch
-
- BOOL
-
-
- GVL.axes[2].Axis.NcToPlc
- NCTOPLC_AXIS_REF
-
- AxisState
-
-
-
- HomingState
-
-
-
- CoupleState
-
-
-
-
PlcTask Outputs
@@ -1925,14 +29,6 @@ External Setpoint Generation:
BOOL
-
- GVL.axes[1].Axis.PlcToNc
- PLCTONC_AXIS_REF
-
-
- GVL.axes[2].Axis.PlcToNc
- PLCTONC_AXIS_REF
-
diff --git a/solution/tc_epicscommodule b/solution/tc_epicscommodule
deleted file mode 160000
index a13d6bb..0000000
--- a/solution/tc_epicscommodule
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit a13d6bb6221ab2fbe8fa8f7f2345ca8cd791f8d1
diff --git a/solution/tc_project_app/GVLs/GVL_APP.TcGVL b/solution/tc_project_app/GVLs/GVL_APP.TcGVL
index 9e800ab..c284299 100644
--- a/solution/tc_project_app/GVLs/GVL_APP.TcGVL
+++ b/solution/tc_project_app/GVLs/GVL_APP.TcGVL
@@ -7,8 +7,7 @@ VAR_GLOBAL
END_VAR
VAR_GLOBAL CONSTANT
- axisNum : UINT:=2;
- //axisCoupleMax : UINT:=4;
+ axisNum : UINT:=0;
END_VAR]]>
\ No newline at end of file
diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU
index 81ced47..8e73b6a 100644
--- a/solution/tc_project_app/POUs/MAIN.TcPOU
+++ b/solution/tc_project_app/POUs/MAIN.TcPOU
@@ -6,6 +6,7 @@ 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
(******Outputs: Power for Limit switches and Home Sensors (every 4th output)********)
@@ -25,19 +26,6 @@ VAR
//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;
-
- //fbEL1018 : EL1018;
- //fbEL2808 : EL2808;
- //fbEL5101 : EL5101;
- //fbEL9505 : EL9505;
- //fbEL1252 : EL1252;
- //fbEL9410 : EL9410;
- //fbEL7037 : EL7037;
- //fbEK1110 : EK1110;
-
(******Startup, Shutdown and UPS********)
fbUPS : FB_S_UPS_CX51x0;
eUpsMode : E_S_UPS_Mode := eSUPS_WrPersistData_Shutdown;
@@ -48,6 +36,7 @@ VAR
iRetry : INT;
fbReadEncRefSys : ARRAY [1..gvl_app.axisNum] OF MC_ReadParameter;
fbRestorePosition : ARRAY [1..GVL_app.axisNum] OF MC_SetPosition;
+ fbGetDeviceIdentification : FB_GetDeviceIdentification;
END_VAR
@@ -55,25 +44,11 @@ VAR PERSISTENT
bRestoreOnStartup : BOOL;
END_VAR]]>
- eSUPS_PowerFailure THEN
- (* next cycles of powerfailure *)
- (* skip regular code execution for the remaining cycles of the powerfailure/writing of persistent data/quick shutdown ... *)
- RETURN;
-END_IF*)
-
-RESTORE_POSITIONS();
+
+AXES();]]>
+
END_FOR]]>
-
+
- ,
- nSelectedError=> ,
- pErrorSystem=> );
+ ,
- bError=> );
- *)
-
-]]>
+IF eGlobalSUpsState = eSUPS_PowerFailure THEN
+ (* first cycle of powerfailure *)
+ (* execute code that should only be done once with each powerfailure, i.e. increase powerfailure counter *)
+ bRestoreOnStartup:=TRUE;
+ STORE_PERSISTENT();
+ RETURN;
+ELSIF eGlobalSUpsState <> eSUPS_PowerOK THEN
+ (* next cycles of powerfailure *)
+ (* skip regular code execution for the remaining cycles of the powerfailure/writing of persistent data/quick shutdown ... *)
+ RETURN;
+END_IF]]>
+
+
+
+
+ '0') THEN
+ CHECK_UPS();
+ RESTORE_POSITIONS();
+END_IF]]>
-
+
if busy then continue with PLC cycle and check again next time.
@@ -199,14 +159,14 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN
// .valid=FALSE and .busy=FALSE which indicateds the FB probably hasn't started and thus needs to see a rising edge.
// Set execute to low, Exit MAIN.STARTUP and go back a step in the CASE statement.
bExecuteReadEncRefSys:=FALSE;
- eStartUp:=eStartUp-1;
+ eStartUp:=ReadAxisFeedbackType;
iRetry:=iRetry+1; // counter used for troubleshooting to see how many cycles it takes before fbReadEncRefSys function blocks are read correctly
RETURN;
END_IF
END_IF
END_FOR
// If the code gets here all axes either have .valid=TRUE for all axes
- eStartUp:=eStartUp+1;
+ eStartUp:= ExecuteRestore;
ExecuteRestore:
// Execute position restore by setting fbRestorePosition.execute = TRUE
@@ -217,7 +177,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN
END_IF
END_IF
END_FOR
- eStartUp:=eStartUp+1;
+ eStartUp:= CheckRestore;
CheckRestore:
// Check the set position fbs are finished
@@ -232,7 +192,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN
END_IF
END_IF
END_FOR
- eStartUp:=eStartUp+1;
+ eStartUp:= FinishRestore;
FinishRestore:
// Remove execute = TRUE for fbRestorePosition
@@ -245,7 +205,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN
END_IF]]>
-
+
-
-
-
-
+
-
+
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
diff --git a/solution/tc_project_app/Test/app_tests/tcUNIT_APP_RUN.TcPOU b/solution/tc_project_app/Test/app_tests/tcUNIT_APP_RUN.TcPOU
new file mode 100644
index 0000000..7326c7d
--- /dev/null
+++ b/solution/tc_project_app/Test/app_tests/tcUNIT_APP_RUN.TcPOU
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/solution/tc_project_app/Test/common/FB_tcUNIT_common.TcPOU b/solution/tc_project_app/Test/common/FB_tcUNIT_common.TcPOU
new file mode 100644
index 0000000..9fb8d47
--- /dev/null
+++ b/solution/tc_project_app/Test/common/FB_tcUNIT_common.TcPOU
@@ -0,0 +1,149 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/solution/tc_project_app/Test/common/tcUNIT_GVL.TcGVL b/solution/tc_project_app/Test/common/tcUNIT_GVL.TcGVL
new file mode 100644
index 0000000..10cbe42
--- /dev/null
+++ b/solution/tc_project_app/Test/common/tcUNIT_GVL.TcGVL
@@ -0,0 +1,23 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/solution/tc_project_app/Test/standard_library_tests/FB_Axis_TEST.TcPOU b/solution/tc_project_app/Test/standard_library_tests/FB_Axis_TEST.TcPOU
new file mode 100644
index 0000000..36cf024
--- /dev/null
+++ b/solution/tc_project_app/Test/standard_library_tests/FB_Axis_TEST.TcPOU
@@ -0,0 +1,248 @@
+
+
+
+ of the axis within GVL.axes[] to test against.
+END_VAR]]>
+
+
+
+
+
+
+ nMaxCycles OR ExpectedResult = Result THEN
+ AssertEquals(Expected := ExpectedResult,
+ Actual := Result,
+ Message := 'Axis is not moving.');
+ TEST_FINISHED();
+ELSE
+ nCycle := nCycle + 1;
+END_IF]]>
+
+
+
+
+
+ nCycleMax OR ExpectedResult = Result THEN
+ AssertEquals(Expected := ExpectedResult,
+ Actual := Result,
+ Message := 'fPosition of the axis is different.');
+ TEST_FINISHED();
+ELSE
+ nCycle := nCycle + 1;
+END_IF]]>
+
+
+
+
+
+
+
+
+
+
+
+ nMaxCycles OR ExpectedResult = Result THEN
+ AssertEquals(Expected := ExpectedResult,
+ Actual := Result,
+ Message := 'Axis is not enabled.');
+ TEST_FINISHED();
+ELSE
+ nCycle := nCycle + 1;
+END_IF
+]]>
+
+
+
+
+
+
+
+
+
+
+
+ nMaxCycles OR ExpectedResult = Result THEN
+ AssertEquals(Expected := ExpectedResult,
+ Actual := Result,
+ Message := 'Axis bLimitFwd is not enabled.');
+ TEST_FINISHED();
+ELSE
+ nCycle := nCycle + 1;
+END_IF]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/solution/tc_project_app/Test/standard_library_tests/tcUNIT_STD_LIB_RUN.TcPOU b/solution/tc_project_app/Test/standard_library_tests/tcUNIT_STD_LIB_RUN.TcPOU
new file mode 100644
index 0000000..e7cb079
--- /dev/null
+++ b/solution/tc_project_app/Test/standard_library_tests/tcUNIT_STD_LIB_RUN.TcPOU
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/solution/tc_project_app/tc_project_app.plcproj b/solution/tc_project_app/tc_project_app.plcproj
index 00b04b1..fcff0a3 100644
--- a/solution/tc_project_app/tc_project_app.plcproj
+++ b/solution/tc_project_app/tc_project_app.plcproj
@@ -6,7 +6,7 @@
{fb261665-fd20-4bf2-97f8-2854c82b752d}
True
tc_project_app
- 3.1.4023.0
+ 3.1.4022.6
{047dee04-c246-47b2-8ccc-a15e36987c43}
{ae4eb5ee-6030-47a6-bf35-5a6afd9efeeb}
{5ef19bd0-aca2-493f-b2a1-89e363647697}
@@ -14,6 +14,7 @@
{26d08e27-a705-49a9-95de-a3a0b6ea049c}
{577f21c4-8eb2-4f2c-a24e-4c3f62ca96d2}
true
+ false
@@ -74,117 +75,6 @@
Code
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
-
- Code
-
Code
@@ -232,6 +122,21 @@
Code
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
Code
@@ -239,26 +144,18 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
@@ -337,6 +234,10 @@
Tc3_Module, * (Beckhoff Automation GmbH)
Tc3_Module
+
+ TcUnit, * (www.tcunit.org)
+ TcUnit
+
VisuDialogs, * (System)
VisuDialogs