Possible ways to get MPH from HSC, ML1500

Vito26

Member
Join Date
Jan 2013
Location
Ohio
Posts
4
Hi,

I'm looking for some ideas on calculating MPH from a vehicle drive shaft encoder coming into a Micrologix 1500. I have great pulses coming into HSC0 (about 9-12 pulses per foot) and I eventually need to get running distance traveled as well as miles per hour updating my float address (F8:5) about every 3 seconds.

I'm just looking for some ladder advice from experienced users before I over think this.

Thanks Guys,
 
I recommend that you try using math, that is the calculation of numerical data. It used to be taught in school, back before computers.
 
Sir,
I do recall stumbling across a few math scenarios throughout the process of obtaining my BS in mechanical engineering, however I do not recall any lectures in regards to comparing cyclic time to pulse rate in PLC ladder logic or specifically which type of internal timer or instruction to use in a ML1500. Perhaps I should have been more specific in my posting as to the degree of advice I was seeking (my apologies!).

My intentions are not to find someone to write the logic or provide specific formulas (I am more than capable of such myself), rather a basic "Here's what I would do" general approach. Having very little experience with rslogix500, I am not very familiar with many of the non-basic instructions and those for obtaining time segments or using the PLC's clocks. I'm also trying to avoid writing inefficient code -using 50 rungs of instructions that could possibly be accomplished with 10 -using some instructions or methods I am simply unfamiliar with. Maybe I provided too much detail in my posting which suggested I was requesting a complete turn-key solution, however reading other postings on this forum prompted me to give as much information as possible- as all too often the responder asks for more details regarding the project.

With the given response, I suppose I will continue to use what I am familiar with and hope for the best.

Good Day.
 
Check out Chapter 5 in the instruction set manual:
http://literature.rockwellautomation.com/idc/groups/literature/documents/rm/1762-rm001_-en-p.pdf

One approach would be to set the high preset of the counter (HSC:0.HIP) to some meaningful multiple of your pulse count. Each time the preset is reached, the subroutine specified in HSC:0.PFN will be executed. That subroutine should increment a normal counter to keep track of your end units, then reset the high speed counter with a RAC instruction.

For example, say you get 10 pulses per foot of travel from the encoder. Set the HIP to 10. Create a subroutine and put its program number in the PFN register. The subroutine should ADD 1 to register N7:0 (or a long word if you prefer) and do a RAC on HSC:0. That's it, two rungs. Now N7:0 represents the number of feet traveled and is updated after every foot.

Measuring speed simply means throwing a timer into the mix. Create a millisecond timer that counts the number of feet traveled in some fixed time, say 1 second. Now you just need to convert feet per second to miles per hour, hopefully your BS degree will help you with that. (y)
 
Kolyur

Thank you, Just like that, I would not have thought to look into the function file and use the High Preset, instead I was adding to the integer using CTU then resetting the acc within the ladder, saved a few rungs there. Also I didnt realize the ability of PFN to jump to when HIP is reached. Great function.
Just researching some timing methods now and I'll be all set.

Much thanks for the advice, really helped me out!


@Peter, May I ask the reference of the "Sad" reply?
 
...saved a few rungs there.
FYI, the reason for using the HSC function file is not about saving rungs but rather the ability to count faster. The high speed counter in these PLCs runs in dedicated hardware and is independent of the scan time. So, you can accurately count pulses up to 20 kHz or so. If you simply use ladder instructions to do the counting, the scan time determines your maximum rate. For a typical scan time of 2 msec, you'd start to miscount beyond 250 Hz or so. You didn't specify the rate of your encoder so it's hard to say which would be the best option.
 
Vito26,

What is the maximum speed of the vehicle?
What is the desired resolution for the 'MPH' reading?
 
John,

I knew to use the HSC for the pulse generator due to the scan time limits, however I never thought of the HSC running completely independent. It makes sense when I think about it now but its good to know for keeping scan times to a min and using the power of the HSC functions when possible. I'll surely remember that.


One thing to clarify if you could when referring to timers,(bordering embarrassment to ask) can their timing accuracy be directly affected by a very large program with longer scan times or do they run independently as well always keeping perfect time? Just a thought!

My bad, I guess instead of saying "saving rungs" I should have implied "better programming practices and more efficient code"

Thanks again John,

@AJZ
The rate of speed will vary depending on the vehicle speed but I definitely wont near 20 kHz in this project. Around 45MPH will be max for the application and by resolution, if you are referring to pulses per foot, the encoder currently calculates out to (12-15 pulses/ft) (63k-79k pulses/mile)(under 1k pulses/sec @ max speed). I would like to update the speed at least every 3 seconds.

Thanks.
 
Hi !

Very useful solution for me, thanks ! I have problem with display of calculated speed, the numbers run fast and is difficult to read a certain value of speed; any idea for this ?

I am using FBD on Zelio PLC
 
Hi !

Very useful solution for me, thanks ! I have problem with display of calculated speed, the numbers run fast and is difficult to read a certain value of speed; any idea for this ?

I am using FBD on Zelio PLC

You can use a move instruction to move data from the register containing the value of speed to another register every half second or any other time interval according to your preference/requirement and then use this second register to display the value.The value will then become readable but the drawback will be that the displayed data will lag from the most recently read value by a maximum time equal to that set by you to move the data.
 

Similar Topics

Hello All, I need the ability to remotely reboot a Red Lion CR3000 HMI. Due to some graphics issues when the database is updated the HMI must be...
Replies
4
Views
218
Hello The plant is running and there is no shutdown nowadays therefore I can add 1734- AENTR and its card while PLC is in Run? I do not wanna...
Replies
8
Views
346
Folks, I have a client with an old ABB Advant / MOD300 system (v14.4). Around y2k I installed the ABB Industrial IT MOD300 OPC Server 1.1/2...
Replies
1
Views
178
Hi all so i have a robot project im working on were i need to set the layers. using the hmi screen i would like to use the numeric data display to...
Replies
11
Views
821
I have a FactoryTalk View Se project, Is it possible to export Direct Reference tags to edit in a CSV file or Excel? I know I can export HMI...
Replies
1
Views
288
Back
Top Bottom