Help - Search - Members - Calendar
Full Version: Programming help
Forums.MrPLC.com > PLCs and Supporting Devices > Automation Direct
slav321
Hi
I am trying to build a logic for a machine which has 5 sequences,in other words depending on sequence chosen,outputs will be energized diffrently,using one of 5 logics,i would like to avoid using paralel branches but that's the only way i see.....may be subroutins?

Another question regarding subroutins-when subroutin is called,the main program is still implementing the logic in the main program or it's"stack" until subroutin is finished?
Can i duplicate outputs in diffrent subroutins which never ran simultaneously?

Since my expirience with PLCs is limited,i would appreciate a lot detailed answers.

Thanks.
milldrone
QUOTE (slav321 @ Nov 17 2009, 06:42 AM) *
Hi
I am trying to build a logic for a machine which has 5 sequences,in other words depending on sequence chosen,outputs will be energized diffrently,using one of 5 logics,i would like to avoid using paralel branches but that's the only way i see.....may be subroutins?


slav321,

You have not told us which processor you are using. If you are using a Direct logic series (05, 06, 205, 405), I would recomend using stages.

QUOTE (slav321 @ Nov 17 2009, 06:42 AM) *
Another question regarding subroutins-when subroutin is called,the main program is still implementing the logic in the main program or it's"stack" until subroutin is finished?


Yes.

QUOTE (slav321 @ Nov 17 2009, 06:42 AM) *
Can i duplicate outputs in diffrent subroutins which never ran simultaneously?


It is possible, but considered poor practice. Many pitfalls and gotchas. Such as when exiting a subroutine anything that needs to be turned off must be turned off before exiting. Here is the one that gets most newbies in trouble, "The last out in any active ladder wins"

QUOTE (slav321 @ Nov 17 2009, 06:42 AM) *
Since my expirience with PLCs is limited,i would appreciate a lot detailed answers.


With the details given this is as detailed as I can get.
slav321

Hi Milldrone

First,thanks for your quick replay.

A few more questions:

Is there other way(no stages)?

Regarding my question about subroutins - your answer YES standed for that main program continues implementing the logic in the main program when subroutin is called,or it is stack?

Are DL PLCs cosidered workhorse?,i heard they have many problems with outputs,espesialy relay outputs.

Thanks.

ps i'm using DL 250-1.

milldrone
QUOTE (slav321 @ Nov 17 2009, 04:24 PM) *
Is there other way(no stages)?


You can bunch it all in one ladder, or you can also have a "main" and 5 subroutines. The advantage in using a subroutine is that the logic in the 4 unused subroutines is not scanned. This can make the PLC much faster.

I'm disapointed you do not want to use stages, it makes the logic very intutitive. There are no problems turning something off before you exit the stage. In most applications it is far superior to subroutines. It also makes the PLC run faster as the unused logic is not scanned.

QUOTE (slav321 @ Nov 17 2009, 04:24 PM) *
Regarding my question about subroutins - your answer YES standed for that main program continues implementing the logic in the main program when subroutin is called,or it is stack?


My understanding of how a subroutine and the main work. Is that the scan starts at the first rung in the main and scans that, untill a subroutine is called at the end of the subroutine it goes back to the main over and over.

QUOTE (slav321 @ Nov 17 2009, 04:24 PM) *
Are DL PLCs cosidered workhorse?,i heard they have many problems with outputs,espesialy relay outputs.

Thanks.

ps i'm using DL 250-1.


The DL250-1 is considered a workhorse. Relay outputs on any PLC I have worked with have failures somewhere around 1/2 million cycles under light load 100,000 cycles when near their load rating.
slav321

Hi Milldrone

You know,i am kind of scared using stages:),i fill more comfortable with ladder...but i guess i need to take a look at it.

In my application DL 250-1 is gonna drive about 25 interposing relays(24vdc,~30mA) and i am undecided of what outputs to use(relays or transistors)...i've seen on automationdirect.com transistor output moduls short circuit protected....what you think is the best choice...advantages,disadvantages?,and generaly speaking which of them better withstands short circuits(the machine has a lot of oil,water leaks)


Thanks.
milldrone
QUOTE (slav321 @ Nov 20 2009, 06:50 AM) *
You know,i am kind of scared using stages:),i fill more comfortable with ladder...but i guess i need to take a look at it.


I hope you do. Perhaps Bernie or myself can tease you with an example.

QUOTE (slav321 @ Nov 20 2009, 06:50 AM) *
In my application DL 250-1 is gonna drive about 25 interposing relays(24vdc,~30mA) and i am undecided of what outputs to use(relays or transistors)...i've seen on automationdirect.com transistor output moduls short circuit protected....what you think is the best choice...advantages,disadvantages?,and generaly speaking which of them better withstands short circuits(the machine has a lot of oil,water leaks)


The new transistor protected output from Facts Engineering (F2-16TD1P ,F2-16TD2P ) is a much better unit.
milldrone
QUOTE (milldrone @ Nov 20 2009, 07:54 AM) *
tease you with an example.


Here is an example stage program with it's equivalent in std ladder below the end statement.

PLC 250-1

// Rung 1
// Address 0
ISG S0

// Rung 2
// Address 2
#BEGIN COMMENT
"http://www.plctalk.net/qanda/showthread.php?t=46161"
""
"It consists of four tanks."
"Tank1 supplies tank3 only when tank3 is below a set level controlled by a trim pot. This is "
"the first problem using greater than or equal to logic, which was explained in less than two "
"minutes and I still do not understand how this works or even more importantly how to use "
"and control this."
"When tank 1 has filled tank 3 to a set level controlled by a trim pot level sensor it turns off "
"valve 1 and opens valve 2 on tank 2. This continues to fill tank 3 to another set level on "
"a different trim pot."
"When tank three has reached its set level valve 2 closes and sets off a mixer for a set "
"time. Once the mixer unit has completed its set time it stops and valve 3 opens for 10 "
"minutes allowing tank 3 to empty. Then the process stops and awaits the start of the next "
"cycle."
#END
STR X100
AND X101
JMP S1

// Rung 3
// Address 5
SG S1

// Rung 4
// Address 7
#BEGIN COMMENT
"When you use stages no permissives other than the stage itself are needed. And the item "
"turns off when you exit the stage. If this tem were needed in another part of the process it "
"could be used in that stage. multiple outs when using stages are not an issue."
#END
STR X101
OUT Y0

// Rung 5
// Address 9
STR V2001 V2000
AND X101
JMP S2

// Rung 6
// Address 13
SG S2

// Rung 7
// Address 15
STR X101
OUT Y1

// Rung 8
// Address 17
STR V2002 V2001
AND X101
JMP S3

// Rung 9
// Address 21
SG S3

// Rung 10
// Address 23
STR X101
TMR T0 V400
OUT Y3

// Rung 11
// Address 27
STR T0
JMP S4

// Rung 12
// Address 29
SG S4

// Rung 13
// Address 31
STR X101
OUT Y2

// Rung 14
// Address 33
STRE V2001 K0
JMP S0

// Rung 15
// Address 36
END

// Rung 16
// Address 37
#BEGIN COMMENT
"http://www.plctalk.net/qanda/showthread.php?t=46161"
""
"It consists of four tanks."
"Tank1 supplies tank3 only when tank3 is below a set level controlled by a trim pot. This is "
"the first problem using greater than or equal to logic, which was explained in less than two "
"minutes and I still do not understand how this works or even more importantly how to use "
"and control this."
"When tank 1 has filled tank 3 to a set level controlled by a trim pot level sensor it turns off "
"valve 1 and opens valve 2 on tank 2. This continues to fill tank 3 to another set level on "
"a different trim pot."
"When tank three has reached its set level valve 2 closes and sets off a mixer for a set "
"time. Once the mixer unit has completed its set time it stops and valve 3 opens for 10 "
"minutes allowing tank 3 to empty. Then the process stops and awaits the start of the next "
"cycle."
#END
STR X100
STR C0
ANDN C1
ORSTR
OUT C0

// Rung 17
// Address 42
STRPD C0
OR X102
OR C2
AND X101
OUT C2

// Rung 18
// Address 47
STRPD C0
STR C3
AND C0
ORSTR
AND V2000 V2001
OUT C3

// Rung 19
// Address 54
STR C3
AND C2
OUT Y0

// Rung 20
// Address 57
STRND C3
OR C4
AND C0
AND V2002 V2001
OUT C4

// Rung 21
// Address 63
STR C4
AND C2
OUT Y1

// Rung 22
// Address 66
STRND C4
OR C5
AND C0
ANDN T0
OUT C5

// Rung 23
// Address 71
STR Y3
STR T0
AND C1
TMRA T0 V400

// Rung 24
// Address 76
STR C5
AND C2
OUT Y3

// Rung 25
// Address 79
STR C0
ANDND C5
OR C6
ANDNE V2001 K0
OUT C6

// Rung 26
// Address 85
STR C6
AND C2
OUT Y2

// Rung 27
// Address 88
STR C0
ANDND C6
PD C1

// Rung 28
// Address 91
END

// Rung 29
// Address 92
NOP


#BEGIN ELEMENT_DOC
"X100","","","start process push button"
"X101","","","stop process push button"
"X102","","","continue process pushbutton"
"Y0","","","valve 1 (it's on tank 1)"
"Y1","","","valve 2 (it's on tank 2)"
"Y2","","","valve 3 (it's on tank 3)"
"Y3","","","mixer"
"C0","","","start process SEALIN"
"C1","","","process done"
"C2","","","continue"
"C3","","","fill tank 3 to correct level with some of tank 1's contents"
"C4","","","fill tank 3 to correct level with some of tank 2's contents"
"C5","","","mix bit"
"C6","","","drain tank 3 bit"
"S0","","","start "
"S1","","","fill tank 3 to set level with tank 1's contents "
"S2","","","fill tank 3 to set level with tank 2's contents"
"S3","","","mix"
"S4","","","drain tank 3"
"T0","","","mix time"
"V400","preset mix value","",""
"V2000","","","set point to fill tank 3 with tank 1's contents"
"V2001","","","tank 3's level"
"V2002","","","set point to fill tank 3 with tank 2's contents"

#END
slav321


Thank you Milldrone.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.