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 3rd, 2012, 06:35 AM   #1
gr8benwa
Member
United States

gr8benwa is offline
 
Join Date: Mar 2012
Location: indiana
Posts: 57
Exclamation automation direct plc project I AM STUMPED!

I am in deep trouble! If anyone can help me figure out how to make this one output work using the real time clock to control when it is true and when it is false !!!please school me!!!

I have been writing logic for a couple years now and have taught myself everything I know. I am now stumped. I usually can figure it out myself by just tinkering or searching on the web... but my boss has thrown a job at me that he thought I could do, usually I can, this time uggh! I have to figure out how to automate office lighting for 40 rooms. The hours for these rooms will vary depending on their work schedules. POINT BLANK... I dont know how to do it. I've spent my last 2 weekends searching the web and now the project starts soon. I have to start writing now. If you are a wiz with automation direct plcs, please show me how to write one time based output and I will surely be able to modify the hours as needed.

please.. thank you.


below is what I need help with.



PLC 440

// Rung 1
// Address 0
#BEGIN COMMENT
"I need a light (output Y0) to become true at 7:00 and stay true, then to become false at 16:00 , and "
"repeat the next day. HELP?!?!"
""
"This example provides a 24-hr clock value for use in Time-of-day operations."
""
"Rung 1 updates the clock value once per second"
#END
STR SP4
PD C0

// Rung 2
// Address 2
#BEGIN COMMENT
"Rung 2 loads the 'Hours' value, shifts it left by 2 digits, and adds the 'Minutes' value, "
"resulting in a Time-of-Day value in HHMM format."
#END
STR C0
LD V7770
SHFL K8
ADD V7767
OUT V2000

// Rung 3
// Address 8
END

// Rung 4
// Address 9
NOP
  Reply With Quote
Old March 3rd, 2012, 08:42 AM   #2
bernie_carlton
Lifetime Supporting Member + Moderator
United States

bernie_carlton is offline
 
bernie_carlton's Avatar
 
Join Date: Apr 2002
Location: Yakima, Washington
Posts: 6,244
A good start. Try this for your next rung:

STR V2000 K700
ANDN V2000 K1600
OUT Y0


For improvement of the program you will next have to tackle :

1. How to control multiple outputs with possibly different times.

2. How to control outputs with user variable times

3. How to control outputs which may start in one day but end in the next.

Have fun.

I see that you also checked at the AutomationDirect forum. It's good to use multiple sources.
__________________
Controlling outputs is the PLC's way of getting its inputs to change.

www.thePLCguy.com

Last edited by bernie_carlton; March 3rd, 2012 at 08:45 AM.
  Reply With Quote
Old March 3rd, 2012, 09:33 AM   #3
jrwb4gbm
Lifetime Supporting Member + Moderator
United States

jrwb4gbm is offline
 
Join Date: Apr 2002
Location: NC
Posts: 2,218
An example of Sunday from 9AM to 6PM.

#BEGIN COMMENT
"Typical ""Day of Week"" rung."
#END
STRE V7771 K0
AND V2000 K900
ANDN V2000 K1800
OUT Y1
  Reply With Quote
Old March 3rd, 2012, 11:22 AM   #4
gr8benwa
Member
United States

gr8benwa is offline
 
Join Date: Mar 2012
Location: indiana
Posts: 57
thanks jrwb4gbm & bernie_carlton!

I am starting to see patterns in how this V memory can be used. To be honest I became to complacent in my skill level. I can write A+ ladders using timers, latching relays, one shots, and all that jazz. I had been getting away with the easy stuff for several years but now I'm regretting it. My boss doesnt understand any of this stuff but could always count on me writing whatever the customer needed. Now he won the bid to do a job for G.E. and what they want is a bit more than I can do right now. I've mostly written logic based on real world devices like a proxy sensor input and a magnetic coil output, then throw in a timer here and there. simple stuff. what I need to figure out now is way beyond my current skill level but I am on a mission to learn it.

BUT I am in deep.

this is what they want:

floor one: 40 office rooms.
one plc and one hmi to control floor one .
timed lighting based on work day hours for that employee.
hmi that can change those times if needed.

floor two: same as above but on floor two plc & hmi

uggggh!
  Reply With Quote
Old March 3rd, 2012, 11:51 AM   #5
jrwb4gbm
Lifetime Supporting Member + Moderator
United States

jrwb4gbm is offline
 
Join Date: Apr 2002
Location: NC
Posts: 2,218
Not the same PLC platform but take a quick look at this thread for an example of different time of day event scheduling.
Link:
http://www.plctalk.net/qanda/showthread.php?t=69662

What HMI are you planning to use? I believe they are using C-More currently, but I haven't used it. EZ Automation was partnering with Automation Direct at one time. I like the EZ Automation stuff but you might like something different. Here is a link for the EZAutomation Touchpanels for an example.
http://flash.ezautomation.net/eztouc...h_overview.htm

I can see you have a lot to develop based on the number of different loads. Maybe Bernie can help you figure a way to condense the code.
  Reply With Quote
Old March 3rd, 2012, 12:15 PM   #6
gr8benwa
Member
United States

gr8benwa is offline
 
Join Date: Mar 2012
Location: indiana
Posts: 57
I will appreciate any and all help! yes I am using a cmore. i have a DL405 440cpu with i/o cards, cmore hmi, all the software and cables. Ive got it all hooked up at home so i can work on it. I have written prob 25 ladders with automation direct plcs and played around with a couple cmore panels. I have written or edited about 100 rslogix 500 ladders . Ive got some experience but lacking some skills. I'm kind of embarrassed that this project has me beat. I should know more than I do.. I'm willing to learn so any help I can get will be appreciated.
  Reply With Quote
Old March 3rd, 2012, 02:21 PM   #7
bernie_carlton
Lifetime Supporting Member + Moderator
United States

bernie_carlton is offline
 
bernie_carlton's Avatar
 
Join Date: Apr 2002
Location: Yakima, Washington
Posts: 6,244
Maybe, or maybe not, a help with AutomationDirect style for those most familiar with AllenBradley at my site
__________________
Controlling outputs is the PLC's way of getting its inputs to change.

www.thePLCguy.com
  Reply With Quote
Old March 3rd, 2012, 03:38 PM   #8
jrwb4gbm
Lifetime Supporting Member + Moderator
United States

jrwb4gbm is offline
 
Join Date: Apr 2002
Location: NC
Posts: 2,218
I've combined your original example, added bernie's example and changed my example on the Day of Week rung to allow the HMI to write values to V memory registers.

Code:
 
PLC 440
// Rung 1
// Address 0
#BEGIN COMMENT 
"I need a light (output Y0) to become true at 7:00 and stay true, then to become false at 16:00 , and "
"repeat the next day. HELP?!?!"
""
"This example provides a 24-hr clock value for use in Time-of-day operations."
""
"Rung 1 updates the clock value once per second"
#END
STR SP4
PD C0
// Rung 2
// Address 2
#BEGIN COMMENT 
"Rung 2 loads the 'Hours' value, shifts it left by 2 digits, and adds the 'Minutes' value, "
"resulting in a Time-of-Day value in HHMM format."
#END
STR C0
LD V7770
SHFL K8
ADD V7767
OUT V2000
// Rung 3
// Address 8
#BEGIN COMMENT 
"Typical ""Constant Time Each Day"" rung."
#END
STR V2000 K700
ANDN V2000 K1600
OUT Y0
// Rung 4
// Address 13
#BEGIN COMMENT 
"Typical ""Day of Week"" rung."
#END
STRE V7771 V3000
AND V2000 V3010
ANDN V2000 V3020
OUT Y1
// Rung 5
// Address 20
END
// Rung 6
// Address 21
NOP
 
#BEGIN ELEMENT_DOC
"Y1","","","ROOM 1"
"V2000","","","TIME OF DAY"
"V3000","","","DAY FROM HMI"
"V3010","","","TIME ON FROM HMI"
"V3020","","","TIME OFF FROM HMI"
"V7771","","","ACTUAL DAY OF WEEK"
#END

Last edited by jrwb4gbm; March 3rd, 2012 at 03:40 PM.
  Reply With Quote
Old March 3rd, 2012, 05:31 PM   #9
gr8benwa
Member
United States

gr8benwa is offline
 
Join Date: Mar 2012
Location: indiana
Posts: 57
HOLY COW! This is freaking amazing! You guys are awesome! I cant wait till all this CLICKS and bam... I can start posting stuff I have figured out and get your opinion on it. I really want to learn this stuff. I feel alot better now that some progress is being made, I have been spinning my wheels for 2 weeks reading .pdfs and googling keywords. You guys are really inspirational, I hope I can pass on the knowledge someday! thanks -ben
  Reply With Quote
Old March 3rd, 2012, 07:40 PM   #10
bernie_carlton
Lifetime Supporting Member + Moderator
United States

bernie_carlton is offline
 
bernie_carlton's Avatar
 
Join Date: Apr 2002
Location: Yakima, Washington
Posts: 6,244
And another one hooked ! Bwaaaa Haaa Haaa Haaa. We SHALL rule the world! - Sorry, that slipped out.
__________________
Controlling outputs is the PLC's way of getting its inputs to change.

www.thePLCguy.com
  Reply With Quote
Old March 3rd, 2012, 08:35 PM   #11
jrwb4gbm
Lifetime Supporting Member + Moderator
United States

jrwb4gbm is offline
 
Join Date: Apr 2002
Location: NC
Posts: 2,218
@bernie carlton,
I know next to nothing about pointers and recipes but this application sure looks like it could be written much simpler using them. There seem to be so many variables. Trying to enter all the setpoints thru an HMI is going to be a challenge. It would be much easier (to me) to hard code most of the setpoint selections with the PLC and just use the HMI to monitor "On" or "Off" in each room. Maybe have an "All Off" and "All On" button on the HMI. In the past I have programmed something similar to this without using pointers . It was just for one room. To duplicate this for 40 rooms with advancing addresses for each setup would become an enormous task without pointers.
Here is a small list of variable items I see, I'm sure there are more.
1. Day of Week (0 to 6)
2. Day of Week (On or Off)
3. Time On (Day 0 to 6)
4. Time Off (Day 0 to 6)
5. Room Number (1 to 40)

Maybe you could write a typical rung or more to illustrate the use of pointers to help the OP (and me) understand. I think since I have retired that I'm just getting too old to understand how to tie it all together. If I had to do this today, I believe I would just buy individual programmable 7-day timers for each room.

Last edited by jrwb4gbm; March 3rd, 2012 at 09:07 PM.
  Reply With Quote
Old March 4th, 2012, 09:05 AM   #12
Clay B.
Lifetime Supporting Member
United States

Clay B. is offline
 
Clay B.'s Avatar
 
Join Date: Jun 2005
Location: Concord,NC
Posts: 1,304
Quote:
Originally Posted by bernie_carlton View Post
And another one hooked ! Bwaaaa Haaa Haaa Haaa. We SHALL rule the world! - Sorry, that slipped out.


Too Funny...
  Reply With Quote
Old March 4th, 2012, 09:28 AM   #13
bernie_carlton
Lifetime Supporting Member + Moderator
United States

bernie_carlton is offline
 
bernie_carlton's Avatar
 
Join Date: Apr 2002
Location: Yakima, Washington
Posts: 6,244
In the examples which have been given the hour and minute have been combined into a single value at V2000. We will continue with that.

Also, we will assume that the ON and OFF times are within a single day, the ON time is before the OFF time. We will use a special case of ON = OFF for days when the lights won't be turned on.

This first discussion concerns the determination of the lights being ON or OFF for a specific room on a particular day of the week.

We will develop two pointers. One will 'point to' the ON time and the other to the OFF time. They will be stored in V2010 and V2011.

The comparison rung, using the pointers, looks like this: (I am using >< for the 'not equal to')



V2000 P2010 V2000 P2011
---] >= [-----------] < [----------------( OUT )




As a note the rung will not become true if the two values are equal. This takes care of the days when the lights will not be on. We will deal with the undefined 'OUT' later.

To have ON and OFF entries for 40 rooms for all seven days of the week we will need 560 memory locations. I will reference the DL06. I like to use the chunk of memory starting at V10000 for tables since it is 4096 words long.

We will arrange the table like this:

[Day of Week], [Room]. [ON time], [OFF time]


This is how we develop the pointers to the start of the group of room hour settings for a given day of the week:

LD V7771 - Get the day of the week

MULB K50 - multiply by 80 - expressed as the hexadecimal K50. This points to the beginning of that day's information

ADDB K1000 - this adds the above total to the start of the table which is at V10000 - expressed in hexadecimal as K1000.

OUT V2010 - store the ON time pointer

ADDB K1 - bump to the next location

OUT V2011 - Store the OFF time pointer

Refer again to the rung I first presented - as I mentioned, ignore the undefined OUT command.

More in the next post.
__________________
Controlling outputs is the PLC's way of getting its inputs to change.

www.thePLCguy.com
  Reply With Quote
Old March 4th, 2012, 10:30 AM   #14
bernie_carlton
Lifetime Supporting Member + Moderator
United States

bernie_carlton is offline
 
bernie_carlton's Avatar
 
Join Date: Apr 2002
Location: Yakima, Washington
Posts: 6,244
(This is a continuation of my previous post)

Once we have these pointers we will use a loop type format to increment through all 40 rooms.

Once one room's information is processed we will use

LD V2011
ADDB K1
OUT V2010
ADDB K1
OUT V2011 - to bump each pointer by 2 - pointing to the next room's information

But we will need to stop and begin again at the beginning of the block after the 40 rooms are processed.

So, at the end of the 'day' block pointer setup I'll add:

LD K0
OUT V2020 - current room being processed

I will add just before the above increment a test for V2020 being 39 or greater. If so jump back to the setting of the block. Otherwise do the increment and loop, adding 1 to V2020. (Details will be in the program offered at the end of this discussion.)
__________________
Controlling outputs is the PLC's way of getting its inputs to change.

www.thePLCguy.com
  Reply With Quote
Old March 4th, 2012, 11:35 AM   #15
bernie_carlton
Lifetime Supporting Member + Moderator
United States

bernie_carlton is offline
 
bernie_carlton's Avatar
 
Join Date: Apr 2002
Location: Yakima, Washington
Posts: 6,244
(the final continuation - with program)

The truly difficult portion of this exercise is the output. There does not exist a pointer to a single variable bit for use with the OUT command. Don't confuse this with the 'Bit of Word' available is some of the CPUs. The 'bit' part of the 'Bit of Word' cannot be varied at runtime.

So we will set up a new table. I'll start it at V11200 which is after our 'time' table. This will have 40 pairs of information. The first will be the output word and the second will be the bitmask within that word for the particular room. For example, if a room's control is at Y43 then we need a pointer to the full word beginning at Y40 and a bit mask which pick out bit 3.

So the first of the pair will contain K4142 (Hex version of octal 40502 or VY40 - check your manual tables) These are a little difficult to first set up but they probably won't be changing. Use your Windows calculator. Set it to Octal, enter the '40502' then select hex.

Bit '3' would be entered in the second word of the pair. Again, using the calculator in binary mode enter the '1' followed by three zeroes to place it in the proper position then change to hex. We get 8 as the equivalent bit pattern.

Complete this for all 40 rooms. Now that we have an output table.

During the initialization above also set up two pointers, V2012 and V2013 to 'point' to the output.

LDA O11200 - 'Load' the address of the table - V11200 in octal, converting it to binary

OUT V2012 - store it as the pointer to the word

ADDB K1 - add 1

OUT V2013 - and store that as the pointer to the bit pattern

After each pass through the loop these will be incremented also.

LD V2013
ADDB K1
OUT V2012
ADDB K1
OUT V2013

Now for processing:

The 'output' of the comparison rung will now changed to end in an OUT to 'C0'



V2000 P2010 V2000 P2011 C0
---] >= [-----------] < [----------------( OUT )




We add two rungs based on the status of C0

STR C0 If we want to turn ON the output
LD P2013 then LD the bit pattern
OR P2012 OR it with the current value of the output
OUT P2012 and send it to the output

STRN C0 If we want to turn the output OFF
LD P2013 then LD the bit pattern
INV Invert it (1' become 0' and 0's become 1's)
AND P2012 AND it with the current value of the output
OUT P2012 and send it to the output

The program is attached below.
Attached Files
File Type: txt daytime.txt (2.1 KB, 19 views)
__________________
Controlling outputs is the PLC's way of getting its inputs to change.

www.thePLCguy.com

Last edited by bernie_carlton; March 4th, 2012 at 11:38 AM.
  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
Automation Direct Analog CLICK plc JonHopper LIVE PLC Questions And Answers 5 June 3rd, 2010 11:03 AM
New Automation Direct (Koyo) PLC CharlesM LIVE PLC Questions And Answers 4 October 24th, 2008 06:11 PM
PID for direct automation d-06 plc randymr LIVE PLC Questions And Answers 1 September 15th, 2007 11:07 PM
Lookout direct SCADA to Automation direct DL06 PLC wireless communication problem e_pramod LIVE PLC Questions And Answers 3 June 14th, 2007 02:27 PM
Need Suggestions about Plc project JoBlack LIVE PLC Questions And Answers 4 December 14th, 2006 03:17 AM


All times are GMT -5. The time now is 12:23 PM.


.