Author Topic: Repeate Until  (Read 10193 times)

Offline Loader

  • PLUS+1 Expert
  • ****
  • Posts: 50
  • Karma: +3/-0
  • If something can go wrong, it will!
Repeate Until
« on: April 11, 2017, 02:00:02 PM »
Hi All,
About your experiences, how many iterations can be reachable in relation at loop time in the secondary SC processor?
Have someone an example?
Thanks
« Last Edit: April 11, 2017, 02:24:16 PM by Loader »

Offline Nilla

  • PLUS+1 Guru
  • *****
  • Posts: 253
  • Karma: +14/-0
Re: Repeate Until
« Reply #1 on: April 19, 2017, 09:17:54 AM »
Hi Loader!

I'm not sure this is what you are looking for but loop time and also iteration will be affected by the user application software programmed ExecTimeOut.  There are some requirements that are mentioned on page 13 in the Safety Manual for PLUS+1 SC0XX-1XX Controller Family, see attached. This manual can be found here; http://powersolutions.danfoss.com/search/#/?q=PLUS%2B1%C2%AE%20Microcontrollers&region=corp&segment=ps&tab=doc&offset=0&hits=10&facet_lang=english%20(us)&facet_productgroup1=Mobile%20Electronics%20and%20Controls&facet_productfamily1=Microcontrollers%20and%20Input%2FOutput%20Modules&facet_document_type=User%20guide

Best regards
Nilla
PLUS+1 Helpdesk

Offline Loader

  • PLUS+1 Expert
  • ****
  • Posts: 50
  • Karma: +3/-0
  • If something can go wrong, it will!
Re: Repeate Until
« Reply #2 on: April 19, 2017, 02:03:40 PM »
Hi Nilla, thank you for the document. But I would know if I have a specific loop time, for example 20 ms, how many iteration can I obtain in a repeate-until loop. There is a guide line for define this number or I need to proceed for attempts, seeing the ExecTimeOut?
Thanks
Regards

Offline Nilla

  • PLUS+1 Guru
  • *****
  • Posts: 253
  • Karma: +14/-0
Re: Repeate Until
« Reply #3 on: April 21, 2017, 01:38:00 PM »
Hello again!

The number of iterations possible in a repeat-until loop depends on a number of factors:
-   The main loop time (in your case 20 ms)
-   How much of the main loop time has already been spent before arriving at the repeat-until loop
-   How much time each iteration in the repeat-until loop takes.

You can use the difference between multiple instances of the “Get Time ?s” Component to find out the answers to the last 2 items in the list above.

However, the recommendation is to not assume a specific number of iterations.
Instead it is recommended to simply resume any incomplete work from the previous loop in the next loop.
For example, if you are making some kind of long-running calculation over an array of values, then simply use a component such as the “Loop Counter Level” in order to keep track of where to continue working when resuming.

Note: If a fixed number of iterations per main loop is absolutely necessary, then the best option is to use a for-loop within a Structured Text POU. (For-loops should be used with some care since long-running loops that are only executed intermittently could have undesired effects on real-time behavior.)

Best regards
Nilla
PLUS+1 Helpdesk