Sign in to follow this  
Followers 0
chuyen

PLC Real number

10 posts in this topic

Dear all How can I calculate real number in PLC of mitsubishi

Share this post


Link to post
Share on other sites
Usually put a E in front of the instruction MUL => EMUL Edited by Gambit

Share this post


Link to post
Share on other sites
I'd never heard of the method for putting an E in front of the instruction, so looked it up and it seems that it can be used on the Q range of PLCs only (including the QnA series). I've used floating point numbers on FX2Ns, but have used a different method - see attached graphic. The theory is that I tend to keep the variables in integer or double integer form for use elsewhere in the programme and on the HMI, but need to do accurate floating point calculations to work out what those variables are. I also tend to use a lot of multiplication and division by factors of 10 to get the accuracy that I need in the engineering value. For example, if calculating a fat % on the product, then 2 dp is required (eg 48.19) as this is the accuracy that the customer can measure to, so the integer variable in the PLC will always be 100 times larger than the actual value (eg 4819). This scaling means that it's very easy to produce numbers greater than decimal 32,767 (the max for integer numbers), so I tend to always use double integers unless I'm sure that it's not possible for the number to exceed 32,767. I think the attached graphic shows one of the major plus points of IEC Developer when compared to GX Developer. In the equation shown, only the input variables and the output variables need to be defined in Global Variables, and all the variables that would normally be needed to store the results of the individual function blocks of the equation are automatically created as system variables when the code is compiled. IEC is very good at letting you easily programme this type of complex equation. Edited by Colin Carpenter

Share this post


Link to post
Share on other sites
MAybe i was a bit short in my last reply But the same also applies for the FX series. See attachment. since a float/Real number is a double word an extra D is also required. ADD => DEADD SUB => DESUB MUL = > DEMUL DIV => DEDIV SQR => DESQR Please specify which PLC and software package you are using. Like Colin already shown in IEC the compiler will automically take care of some points float.pdf Edited by Gambit

Share this post


Link to post
Share on other sites
Hi Gambit, Colin, I am now programming a FX2N for 2 axis: servo control and ac motor (with encoder) control). So I use many floating calculation. But I just found out that FX2N floating will only able to do 3 digit after the dot. (eg: tangent 65.841879 will produce 2.231, when I calculate using Excel it produces 2.229458). Both calculations must be converted to radian degree first. Then when I use it for later calculation, the end result will be different, even after 1 digit behind the fraction dot, sorry I don't know what is the correct terminology of 1 digit after the dot). Is it really the capability of FX2N to do the round-up of floating calculation up to 3 digits only after the dot? Do you guys, have any experience in this? Thanks in advance. Best regards, Kuncoro Wijaya

Share this post


Link to post
Share on other sites
that's strange, if there was such limitation, it should be in the manual... are you sure you are using 32-bit instructions? what value you are passing to DTAN instruction?

Share this post


Link to post
Share on other sites
The standard IEEE floating point format allows for 7 significant digits. This includes the ones before and after the decimal place. All Mitsubishi PLCs use the standard IEEE format for floating point numbers.

Share this post


Link to post
Share on other sites

Guys, how can I use 64-bit float in Mitsubishi Qxxx PLC? Is there any library? Thnx.

Share this post


Link to post
Share on other sites

There are built in commands for Double Real numbers.  No libraries needed.

Share this post


Link to post
Share on other sites

So, we talk about GID 7.04, Works2 or Works3 ?? For me GID 7.04 is preferable. And you talk about DEADD, DESUB, DEMUL etc - I found these operators only in Works3...

OK guys it works even in GID! Depends on plc type. Thnx everybody!

Edited by eziccc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0