Number Conversion

Tim Ganz

Member
Join Date
Dec 2010
Location
Dallas, Texas
Posts
689
I have a PLC 5 program where the outlet drive speed ref is calculated to meters per minute and it's a floating point number. There is also a grinder that has a 4-20 ma analong output from the PLC 5 as it's speed command and currently there is a hard integer nunber of 6840 that is going to the analog output to control the grinder speed.

Now we want this grinder to follow the outlet drive speed and have a little offset.

I wish I could upload the program to the forum but it's against company policy.

I need to change the floating point number from the outlet drive in MPM to a integer number and then add an offset before it's send to the analog output controlling the grinder.

I am new to this part and have mostly been doing on off type control stuff in the plc. Can someone help me with the math to convert floating point MPM to an integer number.
 
Lot's of options here and lots of things to decide...depends on what resolution you want to maintain?

For example, if your MPM is 100.5, is the .5 important? If not, then simply do a MUL and multiply the float by 1 and store it in an INT file....

If .5 is important then multiply by 10, but realize that your final result is as such.

Once you have the result you have to figure out what to do with it. It appears your analog is currently unscaled with a value of 6840. So you'll need to unscale your result above and add it to the 6840. The question is what amount to unscale? Only you know that at this point.
 
Which PLC/5 are you using? If its an enhanced (model ends with 0) then we can use a CPT. If its not (model ends with 5) then well have to build it with discrete math.
 


------+-CPT----------------------------+-
|Destination OUTPUT|
|Expression |
|(DriveSpeedRef * Ratio) + Offset|
+--------------------------------+




You'll need to provide the ratio and offset values.
 


------+-CPT----------------------------+-
|Destination OUTPUT|
|Expression |
|(DriveSpeedRef * Ratio) + Offset|
+--------------------------------+




You'll need to provide the ratio and offset values.

In your example would the driveSpeedRef be the integer converted MPM valvue from my outlet drive speed?

What is the ratio used for in your calculation?
 


------+-CPT----------------------------+-
|Destination OUTPUT|
|Expression |
|(DriveSpeedRef * Ratio) + Offset|
+--------------------------------+




You'll need to provide the ratio and offset values.

His OUTPUT is currently unscaled Analog....He'll have to Unscale the MPM before applying the above.
 
I need to change the floating point number from the outlet drive in MPM to a integer number and then add an offset before it's send to the analog output controlling the grinder.

I am new to this part and have mostly been doing on off type control stuff in the plc. Can someone help me with the math to convert floating point MPM to an integer number.

Number conversion is automatic in all Allen-Bradley PLCs and Controllers.

A simple MOV from F8:0 to N7:0 will convert it for you. If you have to do any math, then the math instructions (even CPT) will accept mixed data types, the result of a floating point calculation is then stored in the destination, and if that is an integer address, the result is traditionally rounded (.5 and greater - up) before storing in the destination.
 
Tim, to get a DETAILED answer you need to tell the forum more about your system ...

suggestion: make a chart something like this (based on converting Centigrade degrees to Fahrenheit degrees) ...


C_DEG_IN = 0 ... F_DEG_OUT = 32
C_DEG_IN = 37 ... F_DEG_OUT = 98.6
C_DEG_IN = 100 ... F_DEG_OUT = 212



a CPT which would accomplish that conversion would look like the screen shot below (there are other ways to get this done which would also work) ...

TIP: if you can get the math right, then the INTEGER to FLOATING POINT piece of the puzzle will usually take care of itself ...

once you post the DETAILS, then there are many members who can knock out the expression for you within a few seconds ... without the DETAILS, all the forum can do is make GENERAL suggestions ...

if you want to learn how to do the math, there is a "scaling" write-up (PDF in two parts) on the Sample Lessons and Videos page of my website that explains the concepts (in gruesome detail) ... just scroll down past the videos ...

.

C_to_F.PNG
 
Last edited:
Also this card is a 1746-NO4V which is a SLC cvard but is being controlled by the PLC 5 over Univgersal Remote I/O Blue Hose so is the analog scaling the same?

The manual for this card says 0-10 VDC is 0-32,764 so is that how I should be scaling my range or is it different because it has an PLC 5 controlling it?
 
your first post mentioned a 4 to 20 mA CURRENT signal ...

the catalog number that you just posted is for a module with a VOLTAGE output ...

are we still talking about the same project? ...

I'm guessing that "converting" and "scaling" are not your biggest worries right now ...
 
your first post mentioned a 4 to 20 mA CURRENT signal ...

the catalog number that you just posted is for a module with a VOLTAGE output ...

are we still talking about the same project? ...

I'm guessing that "converting" and "scaling" are not your biggest worries right now ...

Smae project I was just wrong in my original Post. The 1746-NO4V is correct.
 

Similar Topics

Hello all, We use machine serial numbers to generate the pass words to lock the PLCs in the machines we build. I was looking for some insight on...
Replies
5
Views
3,596
I am working on a project using a NB screen and NX1P2 PLC. I am having a really hard time getting a real number to properly translate through to...
Replies
3
Views
121
Complete noob here, using a Click C0-02DD1-D to run a test stand. Requirement is to turn on motor run for X seconds, turn off and dwell for X...
Replies
6
Views
1,078
Hi, I have this weird issue whenever I try to change the SNN from a Point IO Im missing the three ... dots to open the pop up and change it...
Replies
4
Views
615
I'm doing my first PanelView 5000 application with Logix View Designer v8, and am of course jumping in headfirst. One thing I don't find is a way...
Replies
4
Views
697
Back
Top Bottom