Newbie Question of the day

EmesiS

Member
Join Date
Oct 2006
Location
New Mexico
Posts
17
Ok here is a simple newbie question. Quick rundown, I'm writing a program for a batching system and the problem I'm having is with an audible alarm and indicator light. Once a certain process is finished I need the alarm and light to come on to notify the operator to add ingredients by hand. So I want the alarm to signal and when the operator adds by hand then he pushes the lighted PB turning the light and alarm off and the program continues to the next process. The problem is the rungs before these are staying true due to a timer in the logic.
This should be a simple process but I'm not an experienced programmer so this one has me stumped. Any suggestions would be greatly appreciated.
 
Use what is referred to as "State Logic'. This is applicable to any plc or processor. You must think about your process and understand all decisions that need to be made throughout the process.
In State Logic, you make a certain condition ENTER THE STATE (Latch). Once in the state, you do whatever logic that is required. Once that STATE is nearing an end, YOU MUST DO SOMETHING to LEAVE THE STATE. (Unlatch)
Your logic will be comprised of many states. Enter the State, unlatch the last state, command logic, then leave the state.
You must Psuedo code your logic before attempting to write your logic in any software environment.
 
I'm using just a Micrologix 1000. Company wanted to go as cheap as possible so I used what was available in the shop. SNK...I thought out the process but getting the logic to do what I want is the problem :) I am using latch and unlatch but as I said before in the rung prior there is a timer that keeps the rung true, so the latch just latches again. Sometimes it is hard to explain in words what is going on in the brain. I will post the code later when I get it to a postable state. Thanks for the replies.....
 
Get www.pdf995.com this is a program that will print to a pdf file. You can create a report with RSL then print it to a pdf, then attach that file to a post. This will allow many to look at what you have done and offer suggestions.
 
Hey Guys Thanx for the help. I wasn't able to use the ONS command SNK because it wasn't available. I guess maybe because I am using a Micrologix 1000 and RSLogix 500...I don't know :( Anyway I was able to use the OSR command and it worked. I tried that before last week and it didn't work but other things have been changed in the code also. All I know is it's working, so thanx again for the input.

Now I'm going to post another question soon about the JSR command and how to repeat the subroutine. :) the fun never stops!
 
EmesiS said:
Ok here is a simple newbie question. Quick rundown, I'm writing a program for a batching system and the problem I'm having is with an audible alarm and indicator light. Once a certain process is finished I need the alarm and light to come on to notify the operator to add ingredients by hand. So I want the alarm to signal and when the operator adds by hand then he pushes the lighted PB turning the light and alarm off and the program continues to the next process. The problem is the rungs before these are staying true due to a timer in the logic.
This should be a simple process but I'm not an experienced programmer so this one has me stumped. Any suggestions would be greatly appreciated.

If you can reprogam then do so using a sequencer. I always use sequencers for applications such as this. You need logic bits to start/stop and hold the sequencer, a sequencer step counter, a sequencer step timer and two arrays , one array containing sequencer output and control bits (array_bits[]) and the other containing sequencer step times(array_step_times[]).

When the sequencer is running , Step# indexes into array_bits[Step#] and indexes into array_step_times[Step#]. Once the timer times out, Step# increments and times the next step until a predetermined step that signals end of the sequence is reached.

The sequencer only advances when the step timer times out and triggers the sequencer to advance to the next step.
A bit pattern is created for each step, and some of these bits can be used to place the step timer on hold. Only when the hold conditions are met, can the step timer be allowed to time out.

One bit can be used to 'hold for setpoint' another bit could be used to ' hold for operator acknowledge'

Ian
 
Hey Ian I really appreciate the reply, but as you noticed I said newbie in my post. I have not yet attempted to figure out the sequencer commands, well I take that back, I tried a while back but got lost when it got to the mask part. Hence the term newbie....but thanx anyway...I'll get there someday.
 
Now I'm going to post another question soon about the JSR command and how to repeat the subroutine. :) the fun never stops!

I will answer it now and save you some time. To repeat a JSR command, simply insert an XIC (| |) instruction on the JSR rung. The XIC can be a Timer or Counter Done bit, or any other bit that is TRUE when the subroutine needs to run, so that the subroutine is repeated as needed.
 
EmesiS said:
Hey Ian I really appreciate the reply, but as you noticed I said newbie in my post. I have not yet attempted to figure out the sequencer commands, well I take that back, I tried a while back but got lost when it got to the mask part. Hence the term newbie....but thanx anyway...I'll get there someday.

The sooner you get there the better. A sequencer is the only way to do batching. You will really appreciate sequencers when you have to insert a step type into a sequence. With hard coded relay logic it gets very hairy.

You don't even need to use the SQO instruction for a sequencer.
Start with
Step # - N7:0
Create an array of bits using file N9,
N9:0 = 1
N9:1 = 2
N9:2 = 3
N9:4 = 4
.etc,

then use a MOV N9:[N7:0] into bits word B3:0
Use the data monitor to increment N7:0 from 0 - 4 and watch the resuts on B3:0.

Once you catch onto that, you can create, say, N11:0 for timer preset value.
Use MOV N11:[N7:0] into T4:1.PRE .

Once you get really brave then use T4:1.DN to increment N7:0....

Its a start

Ian
 
SNK wrote:

You must Psuedo code your logic before attempting to write your logic in any software environment.

Hi EmesiS. You probably didn't want to hear that, but it will help a lot if you can sit down and figure out what the system is doing before trying to code it. There are a lot of ways to do what you're trying to do, but this "state logic" that people are talking about is the most maintainable and most understandable. There are a lot of ways to actually write the ladder to accomplish it, but you have to begin with a map of what you're trying to do.

You probably don't need everything in the TOC below, but you probably do need something like the example sequence at the end. And, you'll find the most interesting part of the programming is actually changing between sequences and handling errors and alarms; those need to be considered too. See if you can describe what your system is doing before trying to code it, though... it really will help!

Paul T


A full Sequence of Operations might include some things like this:


TABLE OF CONTENTS



1.0 GENERAL SYSTEM INFORMATION



1.1 System Overview

1.2 Reference Documentation

1.3 Process Description

1.4 Cleaning/CIP Program

1.5 Glossary

1.6 Precautions



2.0 OPERATIONAL PARAMETERS



2.1 Operating Parameters and Limits

2.2 System Components

2.3 Instrumentation/Controllers

2.4 Alarm Functions

2.5 Timers, Counters and Status Displays

2.6 Interlocks

2.7 Data Logging



3.0 SEQUENCES



3.1 Process Cycle (Applies to Modified Batch and Batch Down Modes)

3.2 Flush Mode Cycle

3.3 Cleaning Cycle

3.4 Rinse Cycle

3.5 Autopurge Cycle



4.0 CONTROLS



4.1 General Controls Description

4.2 Push Buttons

4.3 Selector Switches







And the heart of it, the sequences, things like this:

3.6 AUTOPURGE SEQUENCE



Autopurge is an automatic function that, when enabled, will purge the system with clean water from the Rinse Tank after an alarm condition has shut down the stage. When an alarm condition occurs, the system will stop and the Autopurge delay timer will start. If the delay timer times out, the Autopurge sequence will run.



Autopurge will only run if:



The system is operating in Process Mode (Modified Batch or Batchdown)

An alarm condition creates an alarm

The Autopurge delay timer times out.



Autopurge will not run if, before the delay timer times out:



The alarm is cleared

The system is manually stopped

The Autopurge Enable is turned off.



System runs for 120 seconds or until the tank empties (empty tank is indicated by Process Feed Low Pressure Switch PSL-1). System may also be stopped manually before the 120-second timeout if desired.



Step 0

Alarm Horn on

Display “Alarm Condition Exists - Autopurge in nn sec - Alarm Reset to Recover”



Step 1

Alarm Horn off; P1, P2, P100 off

Display “Autopurge Mode - Waiting for Valves”



Step 2

V1, V42, V43, V44 closed



Step 3

V41, V45 open; V5 energized



Step 4

Wait for 5 seconds



Step 5

P2 on; V1 open

Display “Autopurge Mode Running - nn sec Remaining - Stop PB to End”



Step 6

NOP



Step 7

OPR ends mode by pressing Sys Stop or Stop Mode; or,

Mode times out after 120 sec; or,

TK2 empties and PSL-1 closes, indicating no pressure



Step 8

Stop SBR Step 00 – indicates Stop SBR active



Step 9

Stop SBR DONE bit – indicates Stop SBR has completed



Step 10

Stop SBR .not. Step 00 – indicates Stop SBR inactive



Step 11

Autopurge Mode DONE bit – on for one scan



 

Similar Topics

Howdy folks. Been doing PLC programming for like 15 years now in LD and ST, but I'm trying to learn SFC now and have a kind of dumb question... I...
Replies
4
Views
1,382
Hello. New to Unity and had a couple quick questions. Can a Modicon M340 output to a small multiline LCD screen and not a full HMI?
Replies
4
Views
958
Hi. I'm learning AOI programming in RSLogix 5000. I created an AOI with several input and output parameters but when I choose the AOI in the main...
Replies
17
Views
3,191
Good morning, I've had an inverter fail with firmware revision 5.002, the only spare is Rev 7.001, when updating the project with the new...
Replies
2
Views
1,258
Oh, I hope someone can help! I have one little problem holding me up from studying this weekend. I'm using Rslogix micro starter light, it's a...
Replies
7
Views
2,981
Back
Top Bottom