when I perform a Unit Test with an IF-loop with multiple runs (> 1000, used in the method prvCyclicAction) my test breaks off after about 40s due to timeout.
How can I prevent it with the same number of passes?
Regards,
Malcolm
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2014-03-18
Originally created by: M.Schaber
Hi, Malcolm,
Malcolm hat geschrieben:
when I perform a Unit Test with an IF-loop with multiple runs (> 1000, used in the method prvCyclicAction) my test breaks off after about 40s due to timeout.
How can I prevent it with the same number of passes?
I have to admit I'm a little bit confused by your question.
First, there is no IF-loop. An if-construct is not a loop, as it does not have any repetitions, it only provides conditional execution.
Second, you should not use long-running loops in code which runs in the IEC task cycle. You will exceed the tasks cycle time, and block all other operations (like other tasks, refreshing of inputs and outputs, and communication with CODESYS).
You need to "inverse" the logic of thinking here: your code is already running in a loop (the task cycle), so within the prvCyclicAction method, just perform a single pass of your loop. This may look strange, but it is the IEC-61131 way of thinking.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
M.Schaber hat geschrieben:
First, there is no IF-loop. An if-construct is not a loop, as it does not have any repetitions, it only provides conditional execution.
Sorry fΓΌr the confusion. I have an if-construct with an inner if-construct which resets in a specific condition nCycle.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think your problem could be the default timeout of 15 seconds for a test case. You need to specifiy a bigger timeout by adding the following attribute to the declaration of the test POU:
{attribute'testcasetimeout':='3600000'}
The specified string for the timeout must be convertable to an 32-bit signed integer. For example '3600000' for an 1 hour (= 3600000 ms) timeout.
Regards,
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
when I perform a Unit Test with an IF-loop with multiple runs (> 1000, used in the method prvCyclicAction) my test breaks off after about 40s due to timeout.
How can I prevent it with the same number of passes?
Regards,
Malcolm
Originally created by: M.Schaber
Hi, Malcolm,
I have to admit I'm a little bit confused by your question.
First, there is no IF-loop. An if-construct is not a loop, as it does not have any repetitions, it only provides conditional execution.
Second, you should not use long-running loops in code which runs in the IEC task cycle. You will exceed the tasks cycle time, and block all other operations (like other tasks, refreshing of inputs and outputs, and communication with CODESYS).
You need to "inverse" the logic of thinking here: your code is already running in a loop (the task cycle), so within the prvCyclicAction method, just perform a single pass of your loop. This may look strange, but it is the IEC-61131 way of thinking.
Sorry fΓΌr the confusion. I have an if-construct with an inner if-construct which resets in a specific condition nCycle.
Hi Malcolm.
Okay, that makes sense.
I think your problem could be the default timeout of 15 seconds for a test case. You need to specifiy a bigger timeout by adding the following attribute to the declaration of the test POU:
The specified string for the timeout must be convertable to an 32-bit signed integer. For example '3600000' for an 1 hour (= 3600000 ms) timeout.
Regards,
Martin
Hi Martin,
thank you for your solution. That's exactly what I was looking for. Now it works perfect.
Regards,
Malcolm