Floating point math in a Micro 1000

rockycortis

Guest
R
I'm using a micro 1000 and a an encoder. the circumference of the drive gear is such that I have to do floating point math. Every 1/16" rotation is equivalent to 3.26 pulses.

Sure would appreciate some help.

Thanx

[email protected]
 
Sounds to me that if you are looking at 1/16 of a revolution, you may need an absolute encoder in which case the Micrologix 1000 is still not a good choice. Register and explain exactly what you are trying to do. Someone will surely be able to help.
 
Not revolutions, seconds.

Sounds to me that if you are looking at 1/16 of a revolution

Read carefully

rockycortis said:
Every 1/16" rotation is equivalent to 3.26 pulses.

1/16" means 1/16 of a second. Does anyone know how small an angle that is? It would take much more than single precision floating point to handle such an application without having significant truncation and rounding problems. I am surprised that no one has caught this.
BTW, 1/16 of a second is less than 2 meters of an arc on the earth surface measured from the center of the earth.
 
Hence Peter Natchtwey's answer, how about multiplying your base numbers into a long integer and then calculate as normal integer numbers - would that jeopardize the presition of the application?
 
seconds or inches?

Since he mentioned circumference, my guess is that he means 1/16 inch movement on the circumference of the "drive gear".

0.019171779141104294478527607361963 inch/pulse
 
I am a little confused...what is new?

The ML1000 offers a high speed counter so an encoder should work...somehow.

Maybe you could look at adapting the encoder or gear it senses where the 1/16" is equal to a whole number...ie 3 pulses or any whole number. I would try to make it a number that gives a set distance per revolution...ie a 1024 ppr encoder using 4 pulse per 1/16" would give 16" per revolution. 1024ppr/4 pulses per 1/16" = 256 1/16" movements /16 = 16" per revolution.

The ML1000 may not offer everything but it does offer some bang for the buck...ie the HSC so there should be a way to work with the encoder.
 
Last edited:
Re: Not revolutions, seconds.

Peter Nachtwey said:
Read carefully

Doh! I didn't. But I could post all day about how not doing so has cost me a lot of time. But somehow I still think that Gerry's reply was acurate in as much as it appears that the original poster is trying to find absolute position of the gear.
 
I forgot to mention why I was confused. Why does 1/16" equal 1/16 of a second? No reference was made to speed, it could take an hour to go 1/16" or 5ms depending on device used. Note: I know that the symbols " and ' are used in navigation for location BUT normally in this business I am use to " meaning inches and ' meaning foot.

Sometimes y'all take things way too far to the extreme.
 
Ron, I think Peter Is talking about this kind of stuff

The word "degree" has many meanings in mathematics.

The most common meaning is the unit of angle measure defined such that an entire rotation is 360°. This unit harks back to the Babylonians, who used a base 60 number system. 360° likely arises from the Babylonian year, which was composed of 360 days (12 months of 30 days each). The degree is subdivided into 60 minutes per degree, and 60 seconds per minute. In Mathematica, the symbol giving the number of radians in one degree is Degree.

Just guessing as this is over my head
 
reality check

Who makes an encoder with resolution of 3.26 pulses per sixteenth of an arc-second? That would be 52.16 pulses per arc-second, 3129.6 pulses per arc-minute, 187776 pulses per degree, or 67599360 pulses per revolution. Assuming such an encoder exists, who would be trying to use it with a Micrologix 1000?

I think rockycortis is referring to inches of travel, not seconds of arc.
 
rockycortis said:
Every 1/16" rotation is equivalent to 3.26 pulses.

If I gave the figure (1/16" rotation) about half the people I know would assume that thats in deg.seconds and the other half would assume that it represents inches on the circumfrence. Which group does Rocky belong to? Judging from the question, I would bet he's refering to inches on the circumfrence.

I think Rocky needs to find an encoder that will better suit his project to that he gets the correct number of pulses (whole numbers) to do what he wants to do, without having to do floating point.

My faveroite saying: No amount of programming can ever make up for improperly applied field devices, or poorly designed equipment.

Additionally Rocky did not provide enough info on his application for us to help him go about it in the correct manner, (pick the right encoder ppr). In other words what is the cir of the gear? etc..etc..

Regards, Mike.
 
Last edited:
I know what Rockey meant, but it wasn't what he said.

1/16" of rotation sure sound like a an angle to me, but I know he must have been talking about linear travel at the radius. The first thing that pops into my mind when people use the symbols ' and " for angles is minutes and seconds like in units of longitude and latitude.

BTW 3.26 per 1/16 of an arc second is over 65.5 billion counts which is a lot more than would fit in a 32 bit number. As Steve points out there isn't an encoder like that, but what if there is gearing?

In any case 3.26 counts per 1/16 inches of travel are not nice numbers to work with. First, I doubt the 3.26 is accurate. Why, because PI 3.14.... is probably involved in the calculation. Since PI is irrational there is nothing that can be done to keep the errors from accumulating. The system will need to be homed every once in a while.

The best thing rocky can do is follow mike's advice about the hardware and set it up so there is an integer number of counts per revolution or lug. Then one can run all day and keep track of positions by lugs or revolutions traveled and fractions of lugs or revoltions. Keeping track of fractions requires only integer math, but it can be messy. I use fractions. I like to use fractions. I know I will not have to make excuses for why the controller is not at the correct position at the end of the day. The customers can just ooh and ah.
 

Similar Topics

I'm working on a math-heavy project on CompactLogix L45 (Rev. 20) and am running into some issues with a calculation to determine the angle...
Replies
8
Views
3,895
Processor: Micrologix 1400 When doing subtraction using floating points (SUB F34:0 F94:10 F94:15 ) I am subtracting two values which have a...
Replies
10
Views
2,507
am using s7200 cpu222 my cpu support cosine,sin,tan function....but i neeed arcsin(sin-1) function how can i obtain it?????
Replies
4
Views
2,247
Hello, I'm working with an AD DL05, integer math only. I've got a C-more micro for an HMI. I need to input inch dimensions for a cut to...
Replies
14
Views
19,027
Hello everybody I'm new to plc programming and i'm trying to program some simple math operations to convert some measurments for a project. The...
Replies
8
Views
5,568
Back
Top Bottom