Ron_S

Float numbers

12 posts in this topic

I have a dosing system I did a few years back that has worked perfect ever since - but now they want to spoil it by adding 1/2 litres :)

By this I mean; they enter the amount of chemical to dose on the hmi in whole numbers.

ie 17 litres chemical 1

  2 litres chemical 5

They press the dose button and my program jumps into action

 

It checks each chemical for a positive number - if zero, it passes and then doses with the positive numbers.

The counter meter gives 100 pulses per litre so every 100 pulses I increment the 'litres dosed' counter.

I am trying to get the hmi/plc to accept say 17.5 litres so when it gets to 17 litres dosed it doses for another 50 pulses. (1/2 litre)

The 1/2 litre will be a small bit of extra code within that chemicals dose.

 

I have an HMI and plc set up on my desk to simulate the program but using 16 bit registers - it of course rounds it up or ignores the .5

Using 32 bit on say 17.5 litres just gives gobbdlygook numbers in the 2 registers that I dont know what to do with.

I need the plc to read the 17.5 entered by the hmi as 17 in one register an 5 in another

 

Any ideas?

 

 

Share this post


Link to post
Share on other sites

Then why not just have 2 16-bit fields on your HMI, 1 for the whole number then another for the decimal point?

Of convert from REAL to DINT/ INT and take your significant number off there?

 

 

Regards

Daniel

 

Share this post


Link to post
Share on other sites

Thanks

 

I thought about the 2 separate data inputs - but we are dealing with operators here who complain it's too difficult as it is

As soon as they miss a half litre by not inputting twice - they'll swear they did.

It's hard enough getting them to put more than one chemical in. They put one chemical dose in and then come back to put another in even though I have told them it will automatically put them all in, in an orderly fashion with water between the two chemicals.

The REAL to DINT etc, I have no experience of and that is probably the help I am asking for.

 

Cheers

 

Share this post


Link to post
Share on other sites

@Ron_S   

What is the maximum and minimum value you need to input?

What do we do about say 17.4 and 6.8? 

What HMI are you using?

Share this post


Link to post
Share on other sites

The maximum value was set at 99 and I don't think they go near that - the minimum of course is 0

17.4 and 6.8 might be a possibility as they try fine tune some recipes. In fact they will want .250 (1/4 litre on its own for one recipe)

The HMI on site is a beijers E1101 and I am using a E1043 to test with (both touch screen)

 

 

hmi1.png

Share this post


Link to post
Share on other sites

Thanks.

This has two different problems:

Problem 1 is operator input.

Problem 2 is how you work on the data in the PLC.

I have a few ideas for you to solve problem 1.  No point working on problem 2 until this is done.

See attached.  It's for a 1101. Just try Project -> Run to see if it any of the ideas are of use.

 

halflitretest.mpa.zip

HalfLitre.JPG

 

Edit : I would consider using pulses as your unit in the PLC and scaling to display in litres on the HMI.  

If you do want to stick to the half liter then go for the last option and just Div the D20 value in the example.

----[ DIV D20 K2 D30]

D30 will equal your number of litres 

D31 will be 1 if there is an extra half litre or zero if there is no extra half litre.

Edited by Veganic

Share this post


Link to post
Share on other sites

Ron.

I have made the following FB for you, it will convert any floating point to 2 seperate integers.

I have bench tested on my Q-Series and seems perfectly adequate for what you need.

Attached is the ASCII Import file you need plus a bitmap of an Instance working......

 

The logic is driven purely from the Real input value, if it changes, the calculations are completed over one whole scan and passed to the output parameters. 

The code takes advantage of the REAL_to_INT_E and reverse functions for generating rounded numbers in which the differences can calculate the signifjcant digits.

Hope it comes in handy.

iREAL (REAL); your HMI input value

oWholeNumber (INT); the whole value from the REAL

oSignificant (INT); the significant value (3 decimal places).

oSign (BOOL); the sign (I have an absolute in there at the moment as I assume you always want positive).

I would recommend you test that it works in the ranges required as ive only tested it to 500ish I think.

 

Regards

Daniel

FB_MrPLC.bmp

FB_MrPLC.jpg

FB_Real_MrPLC_V1.asc

Edited by collinsd70

Share this post


Link to post
Share on other sites

Thank you all for your solutions - FB;s and HMi test screens but it wasn't what I really wanted

I couldn't use the FB as I am using an FX1N in ladder and the slider was ok but too cumbersome.

I just wanted the operator to input, say - 17.5 litres and the hmi to show 17.5 - but the D register to have a workable number.

I have cracked it - or got a workable solution;

I used the 'gain' on the hmi. I set it to 0.1 and decimal places 1

17.5 Litres was shown on the screen correctly and I got 175 in the D register.

I can now work with that number.

 

 

Thanks - hope it can be of help to someone else one day

 

dose1.png

Share this post


Link to post
Share on other sites

Good idea - Keep it simple.  

The head-scratcher was trying to allow input in 0.5 increments only and not allow inbetween values which seems to be a lot more difficult than it first appears. None of the solutions I put up were ideal.

In other matters - are you using the inbuilt recipe function of the E1101? It is really simple and really useful. 

Share this post


Link to post
Share on other sites

Not in this case, they meddle with the recipes nearly every batch.

They input the values from a hand written piece of paper.

This hmi is a big step up for them. They were made to automate the dosing by the Health & Safety inspectors after an accident.

You can see the type of chemicals and acids they use on my screenshot above.

They used to use scaled buckets, drew the acid from a barrel  and tipped it in by hand

Until of course it went down someones leg one day. Hospital case and skin grafts.

One step at a time with these guys.

Share this post


Link to post
Share on other sites

 

Quote

They used to use scaled buckets, drew the acid from a barrel  and tipped it in by hand

 

We can't even do that with cutting fluid these days.  

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