You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
What is the recommended way to test code containing TC2_MC2 functions? #262
I want to test code containing an MC_MoveRelative from the TC2_MC2 library. I was wondering what the recommended way to do this is.
Currently, I have a successfully running test that tests code containing MC_Reset with the following setup:
A test Axis which is correctly configured and connected
My implementation with calls to MC_Reset
A test PLC project which runs in sequence
A test suite containing my test
The successful test itself is of the following form (omitted some unnecessary details):
VAR_INST
objectUnderTest
nCycleCounter
nCycleLimit
expected
END_VAR
----------
IF TEST_ORDERED('My test') THEN
IF nCycleCounter = 0 THEN
// Initialize my object under test
END_IF
objectUnderTest.Cycle(); // Perform a cycle containing MC_Reset
actual := objectUnderTest.something;
IF nCycleCounter = nCycleLimit OR actual = expected THEN
Assert();
TEST_FINISHED();
END_IF
END_IF
When attempting a similar test of code containing MC_MoveRelative, the MC_MoveRelative function block goes into an error state after two cycles (Error 0x701). There are no axis errors or MC_Power errors. I'm unable to figure out what causes this error, especially since the test containing MC_Reset completes correctly.
I am not asking for debug help specifically (though if you have experience with this or have some suggestions, feel free to comment). My question is: Am I testing the code containing the MC_MoveRelative block correctly? What are your recommendations? I'm thinking of adding a testing flag in the implementation so all TC2_MC2 related code is bypassed during test execution but I would rather test the complete code.
Activity