automation direct plc project I AM STUMPED!

gr8benwa

Member
Join Date
Mar 2012
Location
indiana
Posts
57
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
 
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.
 
Last edited:
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
 
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!
 
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/eztouch/eztouch_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.
 
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.
 
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:
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
 
@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:
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.
 
(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.)
 
(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.
 
Last edited:

Similar Topics

Hello, I have an automation direct d2 262 plc and C-more HMI EA9T6CL-R. I need to prepare a program, scheduled to be performed on a future date. I...
Replies
1
Views
10
Does AD have a line of PLC's that can perform like Guardlogix?
Replies
2
Views
1,449
Hi, I am currently challenging in a new requirement on my new project. We have delivered a project long year ago using DL-250-1 PLC+ 8 point...
Replies
1
Views
1,491
Does anyone know if it is possible to control an Automation Direct PLC (P3-550E) using an Allen Bradley Panelview HMI (2711P series)? I'm not...
Replies
5
Views
1,682
Looking at using a Click Basic PLC with Ethernet on some counting applications to count objects entering a certain area and count objects exiting...
Replies
10
Views
2,404
Back
Top Bottom