YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Calculate Shift Cycle Options · View
squatty
#1 Posted : Tuesday, July 26, 2011 10:07:11 AM
Rank: Advanced Member

Groups: Member

Joined: 4/7/2011
Posts: 137
Location: KZN, South Africa
We have a shift cycle which repeats itself every 28days. Is there a way you can indicate this shift in an array of days using PI-PE, we don't have PI-ACE of PI-AF so we are stuck with PI-PE. Below you will see the table formate of the shifts. Also keep in mind that during weekends we work a 12 hours shift.

| WEEKDAYS ||||| WEEKENDS
01 | C | D | A ||||| X | X
02 | X | X | X ||||| C | A
03 | X | X | X ||||| C | A
04 | B | C | D ||||| X | X
05 | B | C | D ||||| X | X
06 | A | B | C ||||| X | X
07 | A | B | C ||||| X | X
08 | D | A | B ||||| X | X
09 | X | X | X ||||| D | B
10 | X | X | X ||||| D | B
11 | C | D | A ||||| X | X
12 | C | D | A ||||| X | X
13 | B | C | D ||||| X | X
14 | B | C | D ||||| X | X
15 | A | B | C ||||| X | X
16 | X | X | X ||||| A | C
17 | X | X | X ||||| A | C
18 | D | A | B ||||| X | X
19 | D | A | B ||||| X | X
20 | C | D | A ||||| X | X
21 | C | D | A ||||| X | X
22 | B | C | D ||||| X | X
23 | X | X | X ||||| B | D
24 | X | X | X ||||| B | D
25 | A | B | C ||||| X | X
26 | A | B | C ||||| X | X
27 | D | A | B ||||| X | X
28 | D | A | B ||||| X | X

Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
squatty
#2 Posted : Tuesday, July 26, 2011 11:18:22 AM
Rank: Advanced Member

Groups: Member

Joined: 4/7/2011
Posts: 137
Location: KZN, South Africa
I can build a Totalizer tag that increments with 1 every morning at 6am and with a Period of "+28d" which will solve the issue of my shoift cycle evey 28 days.

I can then use this Totalizer to identify which shift is 1st,2nd,3rd (4th and 5th for weekends) using the curve function

Curve(Totalizer,(1,3)(2,4)(3,1)(4,0)(5,0))
Curve(Totalizer,(1,0)(2,0)(3,0)(4,3)(5,1))
Curve(Totalizer,(1,0)(2,0)(3,0)(4,3)(5,1))
Curve(Totalizer,(1,2)(2,3)(3,4)(4,0)(5,0))
Curve(Totalizer,(1,2)(2,3)(3,4)(4,0)(5,0))
Curve(Totalizer,(1,1)(2,2)(3,3)(4,0)(5,0))
Curve(Totalizer,(1,1)(2,2)(3,3)(4,0)(5,0))
Curve(Totalizer,(1,4)(2,1)(3,2)(4,0)(5,0))
Curve(Totalizer,(1,0)(2,0)(3,0)(4,4)(5,2))
Curve(Totalizer,(1,0)(2,0)(3,0)(4,4)(5,2))
Curve(Totalizer,(1,3)(2,4)(3,1)(4,0)(5,0))
Curve(Totalizer,(1,3)(2,4)(3,1)(4,0)(5,0))
Curve(Totalizer,(1,2)(2,3)(3,4)(4,0)(5,0))
Curve(Totalizer,(1,2)(2,3)(3,4)(4,0)(5,0))
Curve(Totalizer,(1,1)(2,2)(3,3)(4,0)(5,0))
Curve(Totalizer,(1,0)(2,0)(3,0)(4,1)(5,3))
Curve(Totalizer,(1,0)(2,0)(3,0)(4,1)(5,3))
Curve(Totalizer,(1,4)(2,1)(3,2)(4,0)(5,0))
Curve(Totalizer,(1,4)(2,1)(3,2)(4,0)(5,0))
Curve(Totalizer,(1,3)(2,4)(3,1)(4,0)(5,0))
Curve(Totalizer,(1,3)(2,4)(3,1)(4,0)(5,0))
Curve(Totalizer,(1,2)(2,3)(3,4)(4,0)(5,0))
Curve(Totalizer,(1,0)(2,0)(3,0)(4,2)(5,4))
Curve(Totalizer,(1,0)(2,0)(3,0)(4,2)(5,4))
Curve(Totalizer,(1,1)(2,2)(3,3)(4,0)(5,0))
Curve(Totalizer,(1,1)(2,2)(3,3)(4,0)(5,0))
Curve(Totalizer,(1,4)(2,1)(3,2)(4,0)(5,0))
Curve(Totalizer,(1,4)(2,1)(3,2)(4,0)(5,0))

Now i need to solve the timing issue, any ideas?
squatty
#3 Posted : Thursday, August 04, 2011 11:16:38 AM
Rank: Advanced Member

Groups: Member

Joined: 4/7/2011
Posts: 137
Location: KZN, South Africa
OK it seems I'm having a conversation with myself here.

STEP1. Needed to create a tag to indicate the start of a day
if Hour('*')=6 and Minute('*')=0 then 1 else NoOutput()

STEP2. Calculate which shift is currently active
if(if Weekday('*') in (1,7)=1 and Hour('*') in (6 .. 24)=1 or Weekday('*') in (2,1)=1 and Hour('*') in (0 .. 5)=1 then "WEEKEND" else "WEEKDAY")="WEEKDAY" then if Hour('*') in (6 .. 13)=1 then 1 else if Hour('*') in (14 .. 21)=1 then 2 else 3 else if Hour('*') in (6 .. 17)=1 then 4 else if Hour('*') in (16 .. 6)=1 then 5 else 5

STEP3. Build totalizer tag that resets every 28d cycle and increments by one, source is step1

STEP4: Create calculated tags based on each shift cycle
if 'STEP3'=1 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,3)(2,4)(3,1)(4,0)(5,0)) else 0
if 'STEP3'=2 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,0)(2,0)(3,0)(4,3)(5,1)) else 0
if 'STEP3'=3 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,0)(2,0)(3,0)(4,3)(5,1)) else 0
if 'STEP3'=4 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,2)(2,3)(3,4)(4,0)(5,0)) else 0
if 'STEP3'=5 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,2)(2,3)(3,4)(4,0)(5,0)) else 0
if 'STEP3'=6 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,1)(2,2)(3,3)(4,0)(5,0)) else 0
if 'STEP3'=7 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,1)(2,2)(3,3)(4,0)(5,0)) else 0
if 'STEP3'=8 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,4)(2,1)(3,2)(4,0)(5,0)) else 0
if 'STEP3'=9 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,0)(2,0)(3,0)(4,4)(5,2)) else 0
if 'STEP3'=10 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,0)(2,0)(3,0)(4,4)(5,2)) else 0
if 'STEP3'=11 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,3)(2,4)(3,1)(4,0)(5,0)) else 0
if 'STEP3'=12 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,3)(2,4)(3,1)(4,0)(5,0)) else 0
if 'STEP3'=13 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,2)(2,3)(3,4)(4,0)(5,0)) else 0
if 'STEP3'=14 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,2)(2,3)(3,4)(4,0)(5,0)) else 0
if 'STEP3'=15 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,1)(2,2)(3,3)(4,0)(5,0)) else 0
if 'STEP3'=16 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,0)(2,0)(3,0)(4,1)(5,3)) else 0
if 'STEP3'=17 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,0)(2,0)(3,0)(4,1)(5,3)) else 0
if 'STEP3'=18 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,4)(2,1)(3,2)(4,0)(5,0)) else 0
if 'STEP3'=19 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,4)(2,1)(3,2)(4,0)(5,0)) else 0
if 'STEP3'=20 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,3)(2,4)(3,1)(4,0)(5,0)) else 0
if 'STEP3'=21 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,3)(2,4)(3,1)(4,0)(5,0)) else 0
if 'STEP3'=22 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,2)(2,3)(3,4)(4,0)(5,0)) else 0
if 'STEP3'=23 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,0)(2,0)(3,0)(4,2)(5,4)) else 0
if 'STEP3'=24 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,0)(2,0)(3,0)(4,2)(5,4)) else 0
if 'STEP3'=25 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,1)(2,2)(3,3)(4,0)(5,0)) else 0
if 'STEP3'=26 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,1)(2,2)(3,3)(4,0)(5,0)) else 0
if 'STEP3'=27 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,4)(2,1)(3,2)(4,0)(5,0)) else 0
if 'STEP3'=28 then Curve('SHIFT_TIMER_WEEKS_ENDS',(1,4)(2,1)(3,2)(4,0)(5,0)) else 0

STEP5: Create digital calculated tag to indicate which shift is currently in the mill.
Total('S_D_1','S_D_2','S_D_3','S_D_4','S_D_5','S_D_6','S_D_7','S_D_8','S_D_9','S_D_10','S_D_11','S_D_12','S_D_13','S_D_14','S_D_15','S_D_16','S_D_17','S_D_18','S_D_19','S_D_20','S_D_21','S_D_22','S_D_23','S_D_24','S_D_25','S_D_26','S_D_27','S_D_28')
caffreys_col
#4 Posted : Friday, September 09, 2011 2:41:00 PM
Rank: Advanced Member
Groups: Member

Joined: 4/6/2011
Posts: 40
Location: Grimsby UK
Ok Squatty, is it all 12 hour shifts or just at weekends? if it's just at weekends then it will need some jiggery/pokery. I have a set of PE's which workout our shift pattern (30 days/12 hour shifts). The PE's are quite long so it might be better if you just email me (colin.welsh@cristalglobal.com) and I'll send them to you in Excel. ThumbsUp

You should be able to amend them as necessary to fit what you need.

Rgds

Caffreys
squatty
#5 Posted : Monday, September 12, 2011 3:24:57 PM
Rank: Advanced Member

Groups: Member

Joined: 4/7/2011
Posts: 137
Location: KZN, South Africa
Hi Caffreys

We managed to solve this issue, our shift Cycle is 28 days, with a combination of 8 hours shift during weekdays and 12 hour shift during weekends. I built a array of PE tags for the weekday and weekends and using the Curve function to indicate which shift is currently on site, we then use a simple digital set to convert 1,2,3,4 to ShiftA,B,C,D

Thxs for the help though, you can still email me the excel file and your credit card numbers.Whistle
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.