Mitsubishi Q-series: Converting integer to engineering units...

Mas01

Member
Join Date
Oct 2020
Location
Leicester, England
Posts
1,105
Hi,
Our PLC measures WATER FLOW RATE as an analog input.
The PLC reads it as an integer value (D34) in the range 0-4000 as follows:
Range: 0-100 m3/hr
Current: 4-20mA
Linear relationship:
4mA= 0 m3/hr (PLC value 0000)
12mA= 50 m3/hr (PLC value 2000)
20mA= 100 m3/hr (PLC value 4000)

The conversion is as follows:
Flow Rate = [ (PLC value/200,000) * 6250] -25

What's the best way to do this conversion? In the ladder logic or "linked" to the "script" in the GUI?

The data analysis person has asked for the exported data (csv file) to be shown in engineering units, not the raw value.

At the moment he gets the raw value and has to do the conversion himself, but prefers engineering units

Can the PLC (Q-series) handle the division without losing too much accuracy?

Should the conversion be done in the ladder logic? Is that the best place to do it? Thanks
 
Last edited:
Edit: Just realised I started a similar thread elsewhere, but feel free to reply to this one.


Edit 2: Please answer on this thread - the other thread got completely de-railed with off-topic comments.
 
Last edited:
Do it in the PLC, this way you can do any further maths on it and if you are controlling a pump with a PID it makes sense.
So first convert the analogue value to a real, then do the maths. to display it on an HMI although the value will have 6 decimal places you can limit them on the HMI to x number of decimal places.
Also your calculation is incorrect 2000 will not equal 50 Cm3 that is 2400
All you need to do is convert the analogue to a float divide that by 40 that will give you your answer.
your calc works for 4000 but not for 2000
((2000/200,000) *6250) -25 = 37.500
((4000/200,000) *6250) -25 = 100.000
Think about it: if 4000 = 100 cm3 then 40 = 1 cm3
2000 / 40 = 50.000
4000 / 40 = 100.000
Edit: The Q series will have a resolution to 3 decimal places at least

Flow Calc.png
 
Last edited:
Do it in the PLC, this way you can do any further maths on it and if you are controlling a pump with a PID it makes sense.
So first convert the analogue value to a real, then do the maths. to display it on an HMI although the value will have 6 decimal places you can limit them on the HMI to x number of decimal places.
Also your calculation is incorrect 2000 will not equal 50 Cm3 that is 2400
All you need to do is convert the analogue to a float divide that by 40 that will give you your answer.
your calc works for 4000 but not for 2000
((2000/200,000) *6250) -25 = 37.500
((4000/200,000) *6250) -25 = 100.000
Think about it: if 4000 = 100 cm3 then 40 = 1 cm3
2000 / 40 = 50.000
4000 / 40 = 100.000
Edit: The Q series will have a resolution to 3 decimal places at least
Brilliant - thanks for this.
Yes - my mistake : 50m3/hr is "2400". Turns out the original formula given to me was from another system - and they were reading a different mA range.
I shall implement the above logic. Clear explanation too, thanks.
 
Do it in the PLC, this way you can do any further maths on it and if you are controlling a pump with a PID it makes sense.
So first convert the analogue value to a real, then do the maths. to display it on an HMI although the value will have 6 decimal places you can limit them on the HMI to x number of decimal places.
Also your calculation is incorrect 2000 will not equal 50 Cm3 that is 2400
All you need to do is convert the analogue to a float divide that by 40 that will give you your answer.
your calc works for 4000 but not for 2000
((2000/200,000) *6250) -25 = 37.500
((4000/200,000) *6250) -25 = 100.000
Think about it: if 4000 = 100 cm3 then 40 = 1 cm3
2000 / 40 = 50.000
4000 / 40 = 100.000
Edit: The Q series will have a resolution to 3 decimal places at least
One question:
In your ladder logic, if I wanted to display D104 on the GUI, what 'Data Type' do I need to specify in the Numerical Display?
The options are:
Signed BIN16
Unsigned BIN16
Signed BIN32
Unisigned BIN32
BCD16
BCD32
Real


...I think it should be REAL. Do you agree?

IMG_20210107_143409.jpg
 
Last edited:
You have to use a real, remember, real (float) numbers take up two registers so in actual fact D104 is D104 and D105 but you only reference them as D104, it knows to use D105. If you tried to display it as an integer the value would not make sense.
That goes for converting an integer so in the logic I posted where we convert the integer to a float D102 uses D102 and D103 that is why I did not use D103 for the result.
 
You have to use a real, remember, real (float) numbers take up two registers so in actual fact D104 is D104 and D105 but you only reference them as D104, it knows to use D105. If you tried to display it as an integer the value would not make sense.
That goes for converting an integer so in the logic I posted where we convert the integer to a float D102 uses D102 and D103 that is why I did not use D103 for the result.
Brilliant, that makes sense. Thanks again for a clear explanation.
 
UPDATE: The data analysis person now wants the units in litres/second....ok...
So this means I need to multiply my m3/hr value (D104) by 0.278 to convert it to litres/second (if my maths is correct).


How can I represent 0.278 in ladder logic so I can do this? (D106 to hold the value in litres/second):


--------------[E* D104 "E0.278" D106]---


---------------------------------------------[END]




(yes, I could multiply by 278 , then divide by 1000, but was wondering if there was a neater way).
 
Last edited:
Yes that correct so for example if you use D106 as a floating point number then it will automatically use D106 & D107 so do not use D107 for anything else.
It also makes sense to start floating point numbers with even registers this makes it more likely that you will not overlap by mistake for example if you have D106 to D110 as 32 bit floating point numbers then you know D110 is a float then the next 16 bit register is D112 not 111. Just makes it a little easier.
 
Yes that correct so for example if you use D106 as a floating point number then it will automatically use D106 & D107 so do not use D107 for anything else.
It also makes sense to start floating point numbers with even registers this makes it more likely that you will not overlap by mistake for example if you have D106 to D110 as 32 bit floating point numbers then you know D110 is a float then the next 16 bit register is D112 not 111. Just makes it a little easier.

Good advice that, thanks.
 

Similar Topics

How do I convert a float to an integer? I've got a floating-point number D606, value 3999.863. I need to convert it to an integer (4000), then I...
Replies
14
Views
4,125
In this sample programming, what does U4 mean? Any assistance would be greatly appreciated.
Replies
8
Views
260
Hi, I have a project with a R04CPU, RD77GF16 and a RJ71PN92 modules. The cell is given to me to change the program since the previous integrator...
Replies
9
Views
281
Hi One of the PLC's that I maintain/update is a Mitsubishi Q-Series, probably installed about 10 years ago. At the moment, ALL the wires from...
Replies
13
Views
1,165
Hello All, I have an existing Mitsubishi L06CPU-06 PLC, and I am going to add a new serial communication card, LJ71C24, for modbus communication...
Replies
0
Views
473
Back
Top Bottom