How to program an analog I/O Module?

azecraze

Member
Join Date
Mar 2004
Location
New Zealand
Posts
73
Righto, I only do PLC programming on and off, and have never done any programming of analog stuff, and need a pointer in the right direction for the following scenario:

I am using a Allen-Bradley Micrologix 1200 with analog expansion module 1762-IF2OF2. This module has 2 analog inputs, and 2 analog outputs.
This is installed in a small Hydro Power Plant 150KW, and what needs to happen is that Input A0 (WaterFlowRate) needs to compare with Input A1 (OutputCurrent). The difference between them will be used as the analog output which controls an element bank water heating load dump so that maximum use is made of the water at all times.

What is the basic ladder logic required to achieve this goal and what bits am I supposed to reference?
I need to know how to implement this for both straight thru, and PID operation.

I programming using RSLogix500.
 
From the I'm lost department.....

Ok I need some clarification here........What is this water heat bank that you are trying to control? Is this something to absorb your excess power you are not capable of using?
What about the turbine setup? Does it have wicket gates or some other method of flow control or does it operate strictly run of river? Are you running synchronized to the local power grid or trying to run as a stand alone system? If stand alone does the turbine have a governor system?

When you say "maximum use" of the water this could mean many things.
First of all for maximum power generation per cubic foot of water you want your head to be as high as possible. So water flow needs to be controlled so that you are maintaining a head level exactly level with the top of the dam but not spilling to optimize power output. With that said can you utilize all of the water from your source or do you spill running at 100%?

If this is the case and you are not on the grid then speed control becomes the issue unless you have a governor. Usable power in your case I believe is in the 50hz range. If you can't consume all of the power output the generator will begin to overspeed increasing the frequency and voltage. With that said rotational speed now becomes the process variable and if I have this water heater bank thing figured right you need to modulate the load to it to balance your output and maintain proper frequency and voltage so that you don't damage whatever you are trying to power.

Clarify the setup and it should be easy enough to do.

Dave
 
Ok, to make it really confusing, this is what I am attempting to do...and I know it can be done.
There is a constant pressure (140PSI) and variable flow (20-400L/Min) on a Turgo type turbine.
There are 2 different "states" that this turbine is required to run in.
1/ Stand alone.
2/ Synchronised with either the mains or standby gen.

There are actually 2 element banks:
One is only about 5KW and is only used during the attempt to synchro cycle to fine tweak the speed to trim it to 50Hz.
This is being controlled by a separate controller, and requires no inclusion in the PLC control.

The other element bank which is 150Kw is used during both stand alone and while the turbine is synchronised with the mains.

While running stand alone, the variable is the frequency controlling the load dump, thereby governing the speed...as people turn on load, the element bank is trimmed so that there is a constant load on the turbine at all times, but of course as the water volume increases, so then the load is increased to maintain the correct speed. Or if water volume decreases, then load is shed.

When running synchronised with the mains, the turbine is locked in with the mains, and it will generate or motor depending on the water supply. This installation requires that there be no backfeed into the mains, and so I have installed reverse current monitoring relays to disconnect the turbine in this case.
This will occur if the water supply is too great for the turbine.
Now you are probably wondering why I dont just use the governor on the turbine, and the answer is that not only is it lousy, but the client wants every drop of water available to be used so he doesn't have to pay a penny to the e-supplier.
So I have a flowrate meter installed in the line which is 1000m long, 250mm diameter steel pipe - Head 100m.
The idea works like this:
We compare the difference between both the water flow rate which equates to something like one litre=one kw, and the current flow out of the turbine, to give us a value to be used on the load dump.
Therefore, as water supply increases, load must be increased, so there is no backfeed into the mains. As load is increased, it starts drawing current from the mains if it is already drawing more than the turbine can produce. Conversely, as load is decreased so then there is too much water, and load must be increased.
As water supply decreases, then load is increasingly drawn off the mains.
The PLC Analog module must compare the two inputs - current flow and water flow, and then the analog output must be the difference between them except for one important fact, and that is that as water supply increases, the difference between the two inputs increases which then increases the analog out, which increases the load, thereby creating no difference between the two inputs, which would then cause the load to drop off again, meaning there is now too much water and so the load increases.....and around and around in circles...seesawing madly.

The difference needs to ratchet the output, so that the output level is maintained until a new change in difference has occured. The input "ratchets" the output.
I would need the option to run it straight thru or thru a PID, depending on how it goes. Scaling can be done externally, so is not an issue.

Is there a word limit on this forum!!
See what you can make of all that. Any help on this is very much apppreciated
 
I've used the 1200 analog modules with 4-20 mA signals. The nominal range on the input channel data is 6240 (4 mA) to 31200 (20 mA). I've found the accuracy sucks, so I always use a simulator to establish the actual data value at 4 mA and 20 mA.

Once you know those values, you can use the SCP (SCale with Parameters) function to convert the readings to engineering units. Then you can do your compares, limts, ratios, etc.
 
so how far have you gotten with the controller hardware?

it sounds like you've got a solid idea of what you're trying to accomplish ... and it looks like Mtn_Bkng_Dave has the type of experience that will be a big help ... but Tom's post brings up a very good point ... you said:

I ... have never done any programming of analog stuff ...

sorry if I'm missing something here ... and maybe you've already got this part taken care of ... but let's take a quick look at the very basics ... have you already got your 1762-IF2OF2 analog input/output module wired up and configured? ... if you don't know what I mean by "configured" take a good look at:

MicroLogix Analog Input/Output Module Installation Instruction Manual

if you haven't already done so, you need to work your way through this little 24-page booklet and get the input signals properly set up and brought into the processor ... are you using 0 to 10 VDC for your inputs? ... or 4 to 20 mA? ...

you'll also need to wire up and configure the output signal(s) ... am I correct in thinking that the analog output will be used to drive the heater banks? ... example: 0% analog output = heaters off; 50% analog output = heaters half on; 100% analog output = heaters full on ... the analog module's output signals can be either voltage or current ... which will you be using? ... what hardware will you be using to connect the analog output signal to the actual real-world outputs? ...

and since you've said that you've never done any analog programming then it's a safe assumption that this is also your first exposure to using a PLC to do PID control ... forgive me for asking but ... while you're setting up this system and tuning the PID loop, just suppose that things sort of "get out of hand" ... are there any safety issues that need to be considered? ... most initial attempts at PID control involve a certain amount of trial and error ... it would be a good idea to think through just what effect those inevitable "errors" might have on civilization as we know it ...
 
Ok, I have the analog module both installed and configured. I already have 80rungs of existing code on my ladder for various functions of the system, and I have successfully added the I/O module to the config section. The addresses are showing up in the address list OK. The booklet that you mention came with the module.
Input and output signals are both 4-20mA, and are in a state of being connected directly to the 4-20mA terminals on the load controller.

As far as PID goes, well....... it is probably safe to assume that I don't need it in the initial stages anyway. This just tends to confuse it a bit for now, and I can leave it till the basics are running. I can always put a PID on before it even gets to the PLC if need be, so that the PLC is only handling what it thinks is raw data.

What Jenkins says about SCP is in the line of what I need to know.
What bit to send the input analog address to, and where to send it when I'm finished with it. I dont actually need to scale the input, as I have an external D/A convertor with scaling on it.
Sound like the output from the SCP would be an integer bit. Correct?

Do I just put an output bit on the rung with the analog output word address when I have done all the math on it? Or where on earth do I send it?

I'm a bit of a dummy on this, as PLC work is addon to being everything else.
 
Very good, very very good. This is what I need and I think I can work with this except how do I map from the resultant integer to the analog output address?
 
Tom-Thanks for reply to post-

Tom
If you use the omron plc line, could you post same example with screen shots using omron.
screen shots you posted, make it a lot easier to understand, happen to be working on a project in a few weeks where i will be trying to do almost the same thing using a omron cqm1h.

thanks
 
Sorry, Rock - I've never used Omron. For any unit conversion on any PLC you can use four function math with the following, which asumes integer math:

DataOffset = Data in input register at 4 mA (or zero analog signal of whatever range - for example 0 VDC on a 0-10 VDC transmitter)

DataSPan = Data at 20 mA - Data @ 4 mA

FACTOR = arbitrary factor (multiple of 10) needed to get proper resolution and accuracy

EU = Engineering Units x FACTOR

EUOffset = Engineering Units @ 4 mA x FACTOR

EUSpan = (Engineering Units @ 20 mA - Engineering Units @ 4 mA) x FACTOR

DATA = Actual data reading in input register

EU = ((EUSpan x (DATA - DataOffset))/DataSpan) + EUOffset

ProcessValue = EU / FACTOR

For Example, 0-60 psig from 4-20 mA with resolution of 0.1 psig:

FACTOR = 10
Data @ 4 mA = 6240
Data @ 20 mA = 31208
DataOffset = 6240
DataSpan = 31208 - 6240 = 24968
EUOffset = 0 x 10 = 0
EUSpan = (60 - 0) x 10 = 600

DATA = 18975

EU = ((600 x (18975 - 6240)) / 24968) + 0 = 306

Process Value = 306 / 10 = 30.6 psig
 
Thanks Tom that helps me a heap.
I am now struggling over how to achieve the ratchet effect on the analog output. eg
The analog output must increase by one value if the difference is detected as being one. But when there is no difference, the output must still maintain the one.
How do I use the "Insert Ladder" button to post?
 
azecraze said:
The analog output must increase by one value if the difference is detected as being one. But when there is no difference, the output must still maintain the one.

One thing you must ask yourself - how often does this increase happen? If you are not careful, you could wind up adding to the output every scan. This could cause your system to windup too fast. You need to add a value, and then wait for a while before deciding if you need to add the value again.

One useful feature about most PLC memory registers (particularly analog ones) is that they don't change their value unless the program tells them to change. So all you need to do is do a subtract to calculate the difference, and then on a separate rung, if the difference is greater than X, add the output to the value and store it back into the output.

azecraze said:
How do I use the "Insert Ladder" button to post?

When you use the LADDER button, it inserts the vB tags [LADDER] and [/LADDER] around the text you type into the box (assuming Normal mode).

Between those tags, anything you post will look exactly like you draw it, like this:
[LADDER]
START STOP MOTOR
----| |-----+-----|/|------( )
|
MOTOR |
----| |-----+
[LADDER]


(Except that the tags don't show up).

Without those tags, the ladder diagram looks ugly, like this:
START STOP MOTOR
----| |-----+-----|/|------( )
|
MOTOR |
----| |-----+

To post a screen capture, use the Attach File: thing below the post window, and add the vB tag [attachment] where you want the picture to be.
 
Hello all,
I'm half watching this and TV at the same time, just some larger D to A conversions ideas for AB CLx. I use the handy formulae in a compute statement....
(26222 * (output of PID in percent)/100) + 6545
That's with the output configured for 0 to 20 ma. and your PID output limit set for 0 to 100%
In bench testing this;
0% PID = 3.999 ma.
100% PID = 19.999 ma.
The output is linear over the intire range of 4 to 20 ma.

Bitmore
 
Allen Nelson wrote:

So all you need to do is do a subtract to calculate the difference, and then on a separate rung, if the difference is greater than X, add the output to the value and store it back into the output.

Am I on the right track here?

scr1.jpg
 

Similar Topics

Hello, the PLC in question is 1769-L30ER. I have a local 4-20mA Analog Output module (1769-OF4CI), and also a remote ethernet PointIO analog...
Replies
0
Views
363
Curious, is it common to program in offsets to calibrate/correct analog sensor readings in certain applications? As an example, I have a couple...
Replies
11
Views
3,016
Hi Guys, How is Analog 4-20mA Level sensor Programmed in CLICK software of Automation Direct? Which Instruction set.
Replies
5
Views
2,159
this is my first time using the analog programming . i want to take the input from the thermocouple and display it, I'm using step7 and plc...
Replies
0
Views
1,115
Help with a program setup. I am using a micrologix 1400 and inputting a 0-10VDC analog signal. My application is a part width measurement. The...
Replies
3
Views
1,851
Back
Top Bottom