You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old March 16th, 2004, 06:48 PM   #1
azecraze
Member
New Zealand

azecraze is offline
 
azecraze's Avatar
 
Join Date: Mar 2004
Location: New Zealand
Posts: 73
How to program an analog I/O Module?

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.
  Reply With Quote
Old March 16th, 2004, 10:13 PM   #2
Mtn_Bkng_Dave
Member
United States

Mtn_Bkng_Dave is offline
 
Mtn_Bkng_Dave's Avatar
 
Join Date: Feb 2004
Location: South Carolina
Posts: 130
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
  Reply With Quote
Old March 17th, 2004, 01:47 AM   #3
azecraze
Member
New Zealand

azecraze is offline
 
azecraze's Avatar
 
Join Date: Mar 2004
Location: New Zealand
Posts: 73
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
  Reply With Quote
Old March 17th, 2004, 08:11 AM   #4
Tom Jenkins
Lifetime Supporting Member
United States

Tom Jenkins is offline
 
Tom Jenkins's Avatar
 
Join Date: Apr 2002
Location: Milwaukee, WI
Posts: 5,264
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.
  Reply With Quote
Old March 17th, 2004, 08:57 AM   #5
Ron Beaufort
Lifetime Supporting Member
United States

Ron Beaufort is offline
 
Ron Beaufort's Avatar
 
Join Date: Jul 2002
Location: Charleston, SC
Posts: 4,403
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:

Quote:
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 ...
__________________

2-B ?
Best regards, ----+----] [----+------------( )----
Ron | |
PLC Training Boot Camp | 2-B |
+----]/[----+

I once was lost, but now am found, was blind, but now I see.

  Reply With Quote
Old March 17th, 2004, 05:13 PM   #6
azecraze
Member
New Zealand

azecraze is offline
 
azecraze's Avatar
 
Join Date: Mar 2004
Location: New Zealand
Posts: 73
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.
  Reply With Quote
Old March 17th, 2004, 05:52 PM   #7
Tom Jenkins
Lifetime Supporting Member
United States

Tom Jenkins is offline
 
Tom Jenkins's Avatar
 
Join Date: Apr 2002
Location: Milwaukee, WI
Posts: 5,264
One picture is worth .....
Attached Images
File Type: jpg 1200_ai.jpg (52.4 KB, 830 views)
  Reply With Quote
Old March 17th, 2004, 06:47 PM   #8
azecraze
Member
New Zealand

azecraze is offline
 
azecraze's Avatar
 
Join Date: Mar 2004
Location: New Zealand
Posts: 73
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?
  Reply With Quote
Old March 18th, 2004, 07:43 AM   #9
Tom Jenkins
Lifetime Supporting Member
United States

Tom Jenkins is offline
 
Tom Jenkins's Avatar
 
Join Date: Apr 2002
Location: Milwaukee, WI
Posts: 5,264
The easy way is to use another SCP block, but with the variables rearranged.
Attached Images
File Type: jpg 1200_ao.jpg (17.3 KB, 759 views)
  Reply With Quote
Old March 18th, 2004, 07:50 AM   #10
rock
Member
United States

rock is offline
 
Join Date: Aug 2003
Posts: 35
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
  Reply With Quote
Old March 18th, 2004, 03:37 PM   #11
Tom Jenkins
Lifetime Supporting Member
United States

Tom Jenkins is offline
 
Tom Jenkins's Avatar
 
Join Date: Apr 2002
Location: Milwaukee, WI
Posts: 5,264
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
  Reply With Quote
Old March 18th, 2004, 03:52 PM   #12
azecraze
Member
New Zealand

azecraze is offline
 
azecraze's Avatar
 
Join Date: Mar 2004
Location: New Zealand
Posts: 73
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?
  Reply With Quote
Old March 18th, 2004, 04:43 PM   #13
Allen Nelson
Member
United States

Allen Nelson is offline
 
Join Date: Apr 2002
Location: West Chester, PA
Posts: 1,368
Quote:
Originally posted by azecraze
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.

Quote:
Originally posted by azecraze
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.
__________________
  Reply With Quote
Old March 18th, 2004, 07:43 PM   #14
Bitmore
Member
United States

Bitmore is offline
 
Bitmore's Avatar
 
Join Date: Dec 2003
Location: Automation Alley, Oakland County, Michigan
Posts: 477
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
  Reply With Quote
Old March 19th, 2004, 04:58 PM   #15
azecraze
Member
New Zealand

azecraze is offline
 
azecraze's Avatar
 
Join Date: Mar 2004
Location: New Zealand
Posts: 73
Allen Nelson wrote:

Quote:
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?
Attached Images
File Type: jpg scr1.jpg (40.3 KB, 657 views)
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Controllogix elledge LIVE PLC Questions And Answers 43 February 12th, 2014 03:55 AM
Subroutine philosophy Doug-P LIVE PLC Questions And Answers 31 February 11th, 2013 07:40 AM
S7-300 Analog I/O module step7moj LIVE PLC Questions And Answers 7 October 20th, 2003 09:39 PM
Micrologix 1200 analog I/O module error taknevs LIVE PLC Questions And Answers 1 January 25th, 2003 07:16 PM
SLC 5/03 data loss andydaoust LIVE PLC Questions And Answers 1 October 10th, 2002 06:38 PM


All times are GMT -5. The time now is 02:32 AM.


.