Digital value to engineering units...where should I do the conversion?

Mas01

Member
Join Date
Oct 2020
Location
Leicester, England
Posts
1,105
Context: Mitsubishi Q series
Hi, today I configured an analogue input into the PLC.
Then I injected 4-20mA at the terminal block. The digital value on the PLC showed 0 at 4mA & 4000 at 20mA, as expected.
This value is going to represent a water flow in m3/hr.
I need to convert it into these units. I know that at 4mA this equates to 0m3/hr, and 20mA equates to 100m3/hr.

Question... where's the best place to do the conversion? In the ladder logic or maybe "hidden" in the details of the digital display of the flow rate on the HMI GUI ie in GT designer3 (which is linked to the Data register, in my case D45).
Hope that makes sense. If not,.I will try to clarify. Thanks.
 
Last edited:
Just discussing the pro's/con's of this recently here:

http://www.plctalk.net/qanda/showthread.php?t=127472

Thanks for the link.
Thinking about it a little more, intuitively it doesn't seem like a good idea to do any "number crunching" in the GUI GT designer3. So I'm leaning towards doing the conversion in the ladder logic. That said, there must be a reason why you can adjust/scale values from within the GUI.
 
Originally posted by Mas01:

That said, there must be a reason why you can adjust/scale values from within the GUI.

Some HMIs will support protocols to communicate directly with things like drives. In that case there may not be conversion capability other than in the HMI.

Some HMI developers may not be comfortable with or have the capability of programming the plc that the HMI is connecting to. All they were given was a list of registers and what they represent. From there the developer needs to display a meaningful number.

Just a couple of possibilities. I'm sure there are others.
Keith
 
Just a couple of possibilities. I'm sure there are others.
Keith
In Ye Olde Dayes, floating point math was a bit of a luxury and many PLC's either didn't support it, or if they did, doing too much of it would be very taxing. I've come across many projects where all process values are stored and manipulated as integers in the PLC, with an implied x100. That is, a value of 12.34% would be programmed in the PLC as 1234, and a "high level" alarm threshold of 98% would be programmed in the PLC as 9800. Then the SCADA scales all the values to and from decimals, so you get all the benefits of decimal precision on your user interface, with all the speed benefits of integer math in your PLC.

Of course in Ye Newe Times, there's no longer any real need for this. Unless there is a very, very good reason for it*, I absolutely always do my scaling in the PLC. What's on the PLC, is what's on the HMI. Makes diagnostics a whole lot easier.

That said - where my PLC allows the analog input module to perform the scaling, I still don't do that. I'll scale my analog input so 4-20mA = 4,000 to 20,000. Then I read the analog input once, scale it into engineering units, and use the scaled value for everything. I do this because (a) it makes troubleshooting the analog input very easy - if your analog input reads 13421, I should be able to put my mA meter in the loop and read 13.421mA in the field. Again, diagnostics. And (b), because then I can use a standard structure for scaling that's accessible to any SCADA platform for ease of commissioning, and is not dependent on which hardware I've been forced to use.


*and I've not yet had an application with a reason good enough
 
I made the transition as well, scaling in the modules 4000 to 20000 for those that have internal scaling...nice to know the equivalent raw ma value at a glance. Since I don't use aliases and map all i/o anyway, its no more work to scale to EU in a CPT vs a MOV of an internally scaled value.
 
I agree with Peter, do the conversion in the PLC, It means any calculations are easy to do, that way you only do it once. Although some HMI's can scale the raw to required values doing any calculations in raw in the PLC makes it more difficult. The program you have is in ladder and not easily converted into a structured project so function blocks are far more difficult to write (the way Mitsubishi works), in saying that not impossible in a manner. The only problem you have is you will probably use the same code over & over again for more than one scaling bit of code in the structure of ladder in your existing project.
Some months ago, I converted a simple ladder into a structured project but what it does is the existing code is still in ladder in the old format but allows you to split the code into separate program blocks and allow new program blocks to be written in FBD, it also allows the creation of Functions or Function blocks. The only way to convert ladder into FBD in the "Q" is to take the original ladder and re-write it in FBD, a lengthy process and prone to mistakes being made.
While we are on the subject of scaling I would guess you intend to control a pump speed so that the flow set point of say 3 Cm/3 will control the pump, this will also require at least a PI loop, Just assuming you could set an analogue output to a pre-set does not mean it will run at that. again it would depend on how accurate you want the flow.
I probably, more than most have a grasp and knowledge of your project as I have been conversing with you over the last few weeks on many posts and some who have posted on some of this or other threads may not have read your other posts.
 
While we are on the subject of scaling I would guess you intend to control a pump speed so that the flow set point of say 3 Cm/3 will control the pump, this will also require at least a PI loop, Just assuming you could set an analogue output to a pre-set does not mean it will run at that. again it would depend on how accurate you want the flow.
I probably, more than most have a grasp and knowledge of your project as I have been conversing with you over the last few weeks on many posts and some who have posted on some of this or other threads may not have read your other posts.
Yes, cheers, parky. And very valuable your replies have been too.
Right now I've just received a Danfoss VLT HVAC Drive FC102 - once it's installed, there will be a 12-core cable running from the inverter directly to the PLC cabinet. All I need to do (famous last words) is to be able to remotely turn it ON/OFF and control the flow UP/DN from the PLC GUI.
Edit...what's a PI loop?
 
Last edited:
PID without the "D" (Proportional, integral & Derivative) the idea is that the code in the PID will take the actual feedback process value (your flowmeter) and a set -point and control an analogue output so if the flowmeter sends less than the required set point flow it increases the analogue output to compensate or if above set-point it decreases it. It is predictive so in short it tries to speed up or slow down the pump to achieve the required flow, the idea is so that on initial start, it ramps up the pump to get to the flow setpoint as quick as possible without over shoot, it then continuously adjusts the output to keep it at the required set point. without PID i.e. if you just moved the difference between the set point and actual to the output it would hunt up & down, however if you just put a pre-set value to the drive depending on other factors like back pressure suction and other factors even though you told it to run at a particular speed (cm/3) it may not deliver it.
For some applications where the actual flow is not too important then just setting the pump to run at a particular speed (volume) will be fine however, For accurate control of speed/flow then at least PI control is essential, D component is only needed where it is difficult to control. I will not go into too much detail as it is a very complex mathematical problem, in saying that, setting up a PI or PID loop there are a lot of possible parameters and not for the faint hearted, Mitsubishi do have a PID function but there are over 200 possible parameters that can be used depending on the functions required, I wrote a simple PI control function that works quite well in most applications and have used it many many times in speed, pressure, temperature control, typically it will control within tight limits with only 3 parameters, these are time slice (the frequency you call the logic), the proportional & Integral components. It has been used by others to control feed rates on conveyors i.e. kg/h successfully.
 
Yes, cheers, parky. And very valuable your replies have been too.
Right now I've just received a Danfoss VLT HVAC Drive FC102 - once it's installed, there will be a 12-core cable running from the inverter directly to the PLC cabinet. All I need to do (famous last words) is to be able to remotely turn it ON/OFF and control the flow UP/DN from the PLC GUI.
Edit...what's a PI loop?
Edit: this is the inverter in question:
https://files.danfoss.com/download/Drives/MG11AK22.pdf
 
Normally you would use a screened separate 2 core cable for the analog signal
It is bad practice to mix signals/voltages into one cable. You say a 12 core this probably means you intend running the 415v in the multicore certainly not recommended.
 
If a customer wants dual units, for example, inches and mm, psi and bar, then I will pick one unit to be primary and that is the one converted to in the PLC. Then I'll use functions in the HMI to do the dual unit display.
 
Normally you would use a screened separate 2 core cable for the analog signal
It is bad practice to mix signals/voltages into one cable. You say a 12 core this probably means you intend running the 415v in the multicore certainly not recommended.

Good to know. That job's not been done yet. I was anticipating 0-20mA for the analog output from PLC to inverter to control Inverter speed (plus maybe a few others), plus 24VDC for switching the inverter On/OFF. Should these be in seperate cable runs?
 

Similar Topics

On the laser displacement sensor now connected to my PLC, the manual says 4mA=643 and 20mA=64,877. However, I checked with a Fluke, injecting...
Replies
5
Views
881
I'm new to S7/TIA. There's no devices connected to the PLC yet. I've got a laser measurement sensor (Micro-Epsilon optoNCDT 1220). From the...
Replies
18
Views
2,927
Hi guys, I want to measure the temperature of water and have that value read in a plc. I have all the hardware but I don't know what function to...
Replies
2
Views
1,307
Basically I have a digital value I need to scale down using this equation: 'end_value = (D1-1000)/100' but I'm having trouble writing it down to...
Replies
3
Views
2,159
So i have a scada system, of course, and it is doing a most odd thing. So we are monitoring fine blah blah blah then for some reason be it...
Replies
10
Views
2,406
Back
Top Bottom