Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: PLCwannabe on September 15, 2019, 01:17:49 AM

Title: Scan time savings
Post by: PLCwannabe on September 15, 2019, 01:17:49 AM
 Good evening all

 As my program is growing larger I notice the scan time increasing. I've seen it up to 20 mS. I'm using quite a few FOR loops now, seems like they are a little slow. Also wondering about rungs with multiple parallel branches, as opposed to math functions, which method increases the scan time more. Attached are a couple examples of the same control logic in different ways. I prefer the math function as takes up less space, but I don't want it to slow down the whole scan.
Title: Re: Scan time savings
Post by: BobO on September 15, 2019, 09:17:04 AM
Loops are slow, but when put into tasks/programs with a yielding time slice, can break the work up across multiple scans.

Math is fast, particularly integer math.
Title: Re: Scan time savings
Post by: ATU on September 16, 2019, 12:23:16 PM
Using stages to execute looping may actually yield a faster overall scan time, but the overall time of indexing the loop will be longer.  Which you choose, depends on your application.