Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: MarkTTU on October 05, 2022, 12:48:23 PM

Title: BRX input processing time
Post by: MarkTTU on October 05, 2022, 12:48:23 PM
I have a pretty simple program that is calculating RPM for 32 different shafts. BRX CPU with two BX-16ND3 cards (published 2ms on/off transition time). Shafts aren't crazy fast, roughly 540 RPM with 4 pulses per second so expecting a pulse every 27ms. Scan time sits around 3800us until more than 16 shafts are running and then it starts to spike up to 7800us periodically. Still, I wouldn't think that would be an issue, but when those spikes happen the FREQTMR instructions start calculating much lower RPM than real world. Anyone have a thought on what is going on?
Title: Re: BRX input processing time
Post by: BobO on October 05, 2022, 03:11:20 PM
I have a pretty simple program that is calculating RPM for 32 different shafts. BRX CPU with two BX-16ND3 cards (published 2ms on/off transition time). Shafts aren't crazy fast, roughly 540 RPM with 4 pulses per second so expecting a pulse every 27ms. Scan time sits around 3800us until more than 16 shafts are running and then it starts to spike up to 7800us periodically. Still, I wouldn't think that would be an issue, but when those spikes happen the FREQTMR instructions start calculating much lower RPM than real world. Anyone have a thought on what is going on?

How wide is the pulse?
Title: Re: BRX input processing time
Post by: MarkTTU on October 05, 2022, 03:19:19 PM
I have a pretty simple program that is calculating RPM for 32 different shafts. BRX CPU with two BX-16ND3 cards (published 2ms on/off transition time). Shafts aren't crazy fast, roughly 540 RPM with 4 pulses per second so expecting a pulse every 27ms. Scan time sits around 3800us until more than 16 shafts are running and then it starts to spike up to 7800us periodically. Still, I wouldn't think that would be an issue, but when those spikes happen the FREQTMR instructions start calculating much lower RPM than real world. Anyone have a thought on what is going on?

How wide is the pulse?

About 4.3ms.
Title: Re: BRX input processing time
Post by: BobO on October 05, 2022, 04:05:05 PM
About 4.3ms.

With a base scan of 3.8ms, spiking to 7.8ms, you are gonna miss those often.
Title: Re: BRX input processing time
Post by: MarkTTU on October 05, 2022, 04:09:29 PM
About 4.3ms.

With a base scan of 3.8ms, spiking to 7.8ms, you are gonna miss those often.

Ya... working on a resolution for that now.

Have another question. In looking closer and using the max scan time memory to track (resetting it after things are running) I'm seeing some momentary spikes in scan time to crazy high numbers; like 119ms (119811us). Any thoughts?
Title: Re: BRX input processing time
Post by: BobO on October 05, 2022, 05:13:17 PM
Have another question. In looking closer and using the max scan time memory to track (resetting it after things are running) I'm seeing some momentary spikes in scan time to crazy high numbers; like 119ms (119811us). Any thoughts?

Loops? Something else in the logic? If not, there may be a hardware issue.
Title: Re: BRX input processing time
Post by: MarkTTU on October 05, 2022, 05:32:03 PM
Have another question. In looking closer and using the max scan time memory to track (resetting it after things are running) I'm seeing some momentary spikes in scan time to crazy high numbers; like 119ms (119811us). Any thoughts?

Loops? Something else in the logic? If not, there may be a hardware issue.

I have all of the programs that contain loops set to always yield so I wouldn't think any of those. Maybe a comm taking a really long time to complete? I changed my program to use the FREQCNT instruction instead of the FREQTMR instruction and now my scan rate is much more consistent around 3.2ms and the momentary spikes are down to 14-15ms.

Still missing some pulses, but that's an issue that needs to be resolved mechanically.
Title: Re: BRX input processing time
Post by: MarkTTU on October 06, 2022, 09:47:38 PM
Just wanted to report back on my resolution of this issue. I moved the RPM calculations into a dedicated PLC and all other code to a separate processor. The RPM calculations PLC enjoys a scan time of 1.1ms with a peak of 3.2ms and the other PLC has a san of 4-5ms with a peak of 15ms. No idea why having this code all together was creating those huge spikes, but seems to be working well as two separate bits of code with independent CPUs doing the work.

Bob, many thanks for getting me on the right track. Up until you asked how wide the pulse was I wasn't even looking at that and it wound up being the core issue I was having.
Title: Re: BRX input processing time
Post by: BobO on October 06, 2022, 11:12:17 PM
Glad it's working! Happy to help.