time travel

ganutenator

Lifetime Supporting Member
Join Date
May 2002
Location
kansas
Posts
1,440
ok, not exactly.

want to program an event in a plc (m340) to start some light display during a particular time.

the delio, is that depending on what they put in for the start time and stop time, it could intend to work at night (outside the range) or during the day (inside the range).

I originally had it programmed as:
start when time equals set point
stop when time equals set point

problem w/ that, is it confused the customer if they changed the range and it didn't come on or turn off.
 
rough draft

Code:
(*Idle Bay Light Show*)

(*No cars entering, washing, or drying runs light show.
If they did get a wash w/ dryers, then end of drying
If they didn't get dryers then end of wash + 15 seconds

*)

(*reasons to inhibit the light show
entering
wiu
dryer_sign_start
*)

LightShowEOWTof (IN := WashInUse, PT:= t#15s);

If entering or WashInUse or dryer_sign_start or LightShowEOWTof.q Then
	LightShowInhibit:= true;
else
	LightShowInhibit:= false;
end_if;

(*turns the start and stop times into minutes to determine if the start time is less than the stop time.
start time less than stop time = time active during day
stop time less than stop time = time active during night*)

LightShowStartTotalMin:= LightShowStartHr * 60 +  LightShowStartMin;
LightShowStopTotalMin:= LightShowStopHr * 60 + LightShowStopMin;
CurrentTotalMin:= CurrentHourInt * 60 + CurrentMinInt;

If LightShowStartTotalMin < LightShowStopTotalMin Then
	LightShowOnAm:= true;
	LightShowOnPm:= false;
elsif LightShowStartTotalMin > LightShowStopTotalMin Then
	LightShowOnAm:= false;
	LightShowOnPm:= true;
else
	LightShowOnAm:= false;
	LightShowOnPm:= false;
end_if;

If LightShowOnAm & (CurrentTotalMin >= LightShowStartTotalMin) & (CurrentTotalMin < LightShowStopTotalMin) Then
	LightShowTimeActive:= true;
elsif LightShowOnPm & not((CurrentTotalMin >= LightShowStopTotalMin) & (CurrentTotalMin < LightShowStartTotalMin)) Then
	LightShowTimeActive:= true;
elsif (LightShowStartTotalMin = LightShowStopTotalMin) Then
	LightShowTimeActive:= true;
else
	LightShowTimeActive:= false;
end_if;



(*Time Control For Idle Bay Light Show*)
If ((LightShowTimeActive & LightShowTimeEn) or LightShowAlwaysEn) & not LightShowInhibit Then
	LightShowActive:= true;
else
	LightShowActive:= false;
End_if;
 
So you have three times
Ts Te Tn, for start end now
You have 6 possible combinations
Ts <Te<Tn OFF
Ts <Tn<Te ON
Te <Ts<Tn ON
Te <Tn<Ts OFF
Tn <Te<Ts ON
Tn <Ts<Te OFF

So do something like
Code:
If Ts <Tn and Tn<Te 
  ON
Elsif Te <Ts and Ts<Tn 
  ON
Elsif Tn <Te and Te<Ts 
  ON
Else
  OFF
Endif

Sort the syntax out yourself
 
So you have three times
Ts Te Tn, for start end now
You have 6 possible combinations
Ts <Te<Tn OFF
Ts <Tn<Te ON
Te <Ts<Tn ON
Te <Tn<Ts OFF
Tn <Te<Ts ON
Tn <Ts<Te OFF

So do something like
Code:
If Ts <Tn and Tn<Te 
  ON
Elsif Te <Ts and Ts<Tn 
  ON
Elsif Tn <Te and Te<Ts 
  ON
Else
  OFF
Endif

Sort the syntax out yourself

dang. going to have to look at this in the am. but if your code legit, i'm going to feel like a moron for over writing.
 

Similar Topics

Hi all, This is my 2nd post and I just want to say thanks for your feedback! I appreciate every single one of your responses! I have been...
Replies
17
Views
1,782
A customer of mine has a problem. His AB PLC5 1785-L40E is faulted, and the plant is at standstill. He cannot get online to diagnose the fault...
Replies
19
Views
3,505
This has been a very touchy subject at my workplace for awhile, so I'm curious what your companies do for pay hourly guys? Travel to customer? Do...
Replies
20
Views
8,044
Can anyone explain the different Rockwell servo travel modes to me? I see three options under the setup: unlimited, limited, and cyclic. I...
Replies
1
Views
1,860
Hello All. We had an incident yesterday where the hard overtravel limit switch was stuck, which we didn't find out until some wasted time...
Replies
2
Views
1,487
Back
Top Bottom