¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Comparing Time


digitalstudiowerks
 

Hi,
I am trying to get a idea on how others maybe programing time comparisons without using
SIMPL+.

For example You manually turn Kitchen Lights on. If Time is = or > 5PM leave on. Else if
Time is <5PM turn off in 5 min.

I am also looking to compare Astrological Time.

Modifying the same example above. You manually turn Kitchen Lights on. If Time is = or >
Sunset leave on. Else if Time is <Sunset turn off in 5 min.

I am not looking to actually do the above those are just examples of what I would like to see
others doing to program an action based on time comparisons.

Thanks
~james


Chip Moody
 

Haven't done this myself, but if I was going to...

Unless I'm not considering something, I'd think analog comparisons
are all you need? If you need hour resolution, you have practically
no work to do. If you need minute resolution, you convert all your
times to "minutes of the day" and compare on those...

- Chip


--- In Crestron@..., "digitalstudiowerks"
<digitalstudiowerks@...> wrote:

Hi,
I am trying to get a idea on how others maybe programing time
comparisons without using
SIMPL+.

For example You manually turn Kitchen Lights on. If Time is = or >
5PM leave on. Else if
Time is <5PM turn off in 5 min.

I am also looking to compare Astrological Time.

Modifying the same example above. You manually turn Kitchen Lights
on. If Time is = or >
Sunset leave on. Else if Time is <Sunset turn off in 5 min.

I am not looking to actually do the above those are just examples of
what I would like to see
others doing to program an action based on time comparisons.

Thanks
~james


bfschroe
 

You can do with analogs (if you have time converted to analog).
I tend to use the WHEN or PAST symbols connected to an interlock to
keep track of timeofday states (morning, afternoon, evening,
night,etc.)

Once you have a set of digitals that reflect the timeofday you can
and or buffer, etc.

Bruce
--- In Crestron@..., "Chip Moody" <cfm@...> wrote:


Haven't done this myself, but if I was going to...

Unless I'm not considering something, I'd think analog comparisons
are all you need? If you need hour resolution, you have practically
no work to do. If you need minute resolution, you convert all your
times to "minutes of the day" and compare on those...

- Chip


--- In Crestron@..., "digitalstudiowerks"
<digitalstudiowerks@> wrote:

Hi,
I am trying to get a idea on how others maybe programing time
comparisons without using
SIMPL+.

For example You manually turn Kitchen Lights on. If Time is = or >
5PM leave on. Else if
Time is <5PM turn off in 5 min.

I am also looking to compare Astrological Time.

Modifying the same example above. You manually turn Kitchen Lights
on. If Time is = or >
Sunset leave on. Else if Time is <Sunset turn off in 5 min.

I am not looking to actually do the above those are just examples
of
what I would like to see
others doing to program an action based on time comparisons.

Thanks
~james


 

We have been doing this with and without proximity sensors or motion
sensors tied into the security for time outs but in your case you could
just use an AND gate with the ASTRONOMICAL CLOCKs Digital IN-DAYTIME
with a NOT and a SIMPLE TIMER.

If (Feedback) from KITCHEN LIGHT is High AND 5PM (using IN DAYTIME
output) is HIGH then after 5 min (SIMPLE TIMER) turn off lights.
Remember to pulse the Kitchen FB or the AND will lock out. Plus you
would want to see if the kitchen is pressed again to have the procedure
repeat again using the FB from the kitchen press. This is just one way
to do this.

Aloha pat


 

Depending on what the OP needs, look at the Astronomical clock (Speedkey: ACLOCK) and Time Offset (Speedkey: OFFSET) symbols.

This is the easiest way (IMO) to pull off comparisons based on fixed (non-user-adjustable) times of day. For instance, I'm using a parameter in an offset of -60d on sunset to trigger a very slow fade up of select exterior lighting an hour before the astro clock sunset (an OFFSET with a parameter of 0d will go high -at- that time).

For user-adjustable stuff, I do what Chip suggests and convert everything to minutes (eg 1d = 12:01am, 1439d = 11:59pm) and use Analog Compares to deal with the rest -- although even that involves a tiny amount of SIMPL+ (couldn't come up with an easy way in SIMPL to get TOD to an analog without relying on things that aren't documented, so it basically just wakes up once a minute to update the analog with (time in hours * 60) + (time in minutes). -- although, now that I'm re-acquainting myself with OFFSET it has occurred to me that you could probably do everything with OFFSET.

Lincoln

--
Lincoln King-Cliby, CTS
Applications Engineer
ControlWorks Consulting, LLC
V: 440.729.4640 x1107 F: 440.729.0884 I:
Crestron Authorized Independent Programmer

-----Original Message-----
From: Crestron@... [mailto:Crestron@...] On Behalf Of Chip Moody
Sent: Friday, January 30, 2009 2:37 PM
To: Crestron@...
Subject: [Crestron] Re: Comparing Time


Haven't done this myself, but if I was going to...

Unless I'm not considering something, I'd think analog comparisons
are all you need? If you need hour resolution, you have practically
no work to do. If you need minute resolution, you convert all your
times to "minutes of the day" and compare on those...

- Chip


--- In Crestron@..., "digitalstudiowerks"
<digitalstudiowerks@...> wrote:

Hi,
I am trying to get a idea on how others maybe programing time
comparisons without using
SIMPL+.

For example You manually turn Kitchen Lights on. If Time is = or >
5PM leave on. Else if
Time is <5PM turn off in 5 min.

I am also looking to compare Astrological Time.

Modifying the same example above. You manually turn Kitchen Lights
on. If Time is = or >
Sunset leave on. Else if Time is <Sunset turn off in 5 min.

I am not looking to actually do the above those are just examples of
what I would like to see
others doing to program an action based on time comparisons.

Thanks
~james


------------------------------------



Check out the Files area for useful modules, documents, and drivers.

A contact list of Crestron dealers and programmers can be found in the Database area.
Yahoo! Groups Links


Chip Moody
 

That's kind of ironic. You just made me realize that of two modules
I recently posted that use the clock driver output, one would be
considered "safe", while the other can't...really...be. :)

- Chip

--- In Crestron@..., Lincoln King-Cliby <lincoln@...> wrote:

convert everything to minutes (eg 1d = 12:01am, 1439d = 11:59pm) and
use Analog Compares to deal with the rest -- although even that
involves a tiny amount of SIMPL+ (couldn't come up with an easy way
in SIMPL to get TOD to an analog without relying on things that
aren't documented


roomy4545
 

The way i do this type of logic is to use Astronomical clock a few Past symbols and a good ol truth table to do the comparison and/or the actual turning off the lights (depends on how many as i don't like to make humonguous TT)

That way is easy and it works.

The reason i use a few past symbols is to mark certain times of day as the signals all remain high until midnight once the time passes. So if you say past 3pm and past 6pm
at 7pm both will still be high

This may not be what you are looking for but
hope this helps




________________________________
From: digitalstudiowerks <digitalstudiowerks@...>
To: Crestron@...
Sent: Friday, January 30, 2009 2:16:46 PM
Subject: [Crestron] Comparing Time


Hi,
I am trying to get a idea on how others maybe programing time comparisons without using
SIMPL+.

For example You manually turn Kitchen Lights on. If Time is = or > 5PM leave on. Else if
Time is <5PM turn off in 5 min.

I am also looking to compare Astrological Time.

Modifying the same example above. You manually turn Kitchen Lights on. If Time is = or >
Sunset leave on. Else if Time is <Sunset turn off in 5 min.

I am not looking to actually do the above those are just examples of what I would like to see
others doing to program an action based on time comparisons.

Thanks
~james






[Non-text portions of this message have been removed]


danrobinanna
 

--- In Crestron@..., "digitalstudiowerks"
<digitalstudiowerks@...> wrote:

Hi,
I am trying to get a idea on how others maybe programing time
comparisons without using
SIMPL+.
Why the hesitation to use SIMPL+ unless you a) are planning on
running it on an ST-CP or something or b) don't know SIMPL+. A 60
second (or longer) period to waking up a task isn't going to hurt
anything. I'd even wager that it is more efficient (less processor
time) to do the whole thing in SMIPL+ than it is to generate a time
in SIMPL+ and cobble together a bunch of SIMPL.

Way back in my Wang Labs days, the Performance Analysis group used to
laugh at the Operating Systems group for "optimizing the leap year
interupt." Makes me smile whenever I remember that gem.

For my own system, I do faily complicated computations to decide when
to lower and raise shades, based upon the sun, time of day, day of
week (they're noisy and I want to sleep in a bit on weekends) and
month (the reason for lowering them in winter is the opposite of the
reason for summer). I bet I could run it every 5 seconds and not
notice performance problems.


Joseph K. Vossen
 

[snip]

Way back in my Wang Labs days, the Performance Analysis group used to
laugh at the Operating Systems group for "optimizing the leap year
interupt." Makes me smile whenever I remember that gem.
LOL....

that reminds me of something that happend to me once. A guy I worked with
spent about 8 months tweaking a Linux network driver for high-performance; it
was being tested with a SmartBits chassis for high-volume throughput. He got
it to work fine (in the high-volume case), but customers were testing it
using ping(1) before rolling the box out in production and with that,
performance was terrible. I went back and spent about 3 weeks reworking the
driver to allow it to perform well in both low- and high-volume
traffic....some people spend way too much time on stuff that just doesn't
matter.

[more snip]


 

Wasn't there the story of an Army project from way, way back that had "impossible" specs for the performance and reliability of some component such as a relay?

Much time and money was spent engineering a solution that would meet these specs cycle after cycle with little success.

Eventually someone asked how many cycles the relay was expected to be used before replacement, and therefore, how long the relay had to be able to maintain those specifications.

The answer: Once.

There's always a balance to be struck, half the battle is figuring out where that balance is.

--
Lincoln King-Cliby, CTS
Applications Engineer
ControlWorks Consulting, LLC
V: 440.729.4640 x1107 F: 440.729.0884 I:
Crestron Authorized Independent Programmer

-----Original Message-----
From: Crestron@... [mailto:Crestron@...] On Behalf Of Joseph K.Vossen
Sent: Friday, January 30, 2009 7:56 PM
To: Crestron@...
Subject: Re: [Crestron] Re: Comparing Time

[snip]

Way back in my Wang Labs days, the Performance Analysis group used to
laugh at the Operating Systems group for "optimizing the leap year
interupt." Makes me smile whenever I remember that gem.
LOL....

that reminds me of something that happend to me once. A guy I worked with
spent about 8 months tweaking a Linux network driver for high-performance; it
was being tested with a SmartBits chassis for high-volume throughput. He got
it to work fine (in the high-volume case), but customers were testing it
using ping(1) before rolling the box out in production and with that,
performance was terrible. I went back and spent about 3 weeks reworking the
driver to allow it to perform well in both low- and high-volume
traffic....some people spend way too much time on stuff that just doesn't
matter.

[more snip]

------------------------------------



Check out the Files area for useful modules, documents, and drivers.

A contact list of Crestron dealers and programmers can be found in the Database area.
Yahoo! Groups Links


 

Why the hesitation to use SIMPL+ unless you a) are planning on
running it on an ST-CP or something or b) don't know SIMPL+. A 60
second (or longer) period to waking up a task isn't going to hurt
anything.

Well said. I agree 100%.

I use a simpl+ for this in all my projects and have never had
problems.
It takes max 5 lines of coding...

I have posted on battle simpl+ simpl and this is one examle where
using simpl+ is just what it takes....


Why the hesitation to use SIMPL+ unless you a) are planning on
running it on an ST-CP or something or b) don't know SIMPL+. A 60
second (or longer) period to waking up a task isn't going to hurt
anything.
raf

--- In Crestron@..., "danrobinanna" <dan@...> wrote:

--- In Crestron@..., "digitalstudiowerks"
<digitalstudiowerks@> wrote:

Hi,
I am trying to get a idea on how others maybe programing time
comparisons without using
SIMPL+.
Why the hesitation to use SIMPL+ unless you a) are planning on
running it on an ST-CP or something or b) don't know SIMPL+. A 60
second (or longer) period to waking up a task isn't going to hurt
anything. I'd even wager that it is more efficient (less processor
time) to do the whole thing in SMIPL+ than it is to generate a time
in SIMPL+ and cobble together a bunch of SIMPL.

Way back in my Wang Labs days, the Performance Analysis group used
to
laugh at the Operating Systems group for "optimizing the leap year
interupt." Makes me smile whenever I remember that gem.

For my own system, I do faily complicated computations to decide
when
to lower and raise shades, based upon the sun, time of day, day of
week (they're noisy and I want to sleep in a bit on weekends) and
month (the reason for lowering them in winter is the opposite of
the
reason for summer). I bet I could run it every 5 seconds and not
notice performance problems.


 

hello

i will upload the new 2 module for u , but its s+ module .if u have
any question about the module please inform me .

in this module u can enable and desable the dynamic timer, change the
time of automatic on and the automatic off . such hours , or minuts.

name of the module : dynamic tymer4.0 , autorefrech
note this 2 module must be tied toghether.
DIGITAL_INPUT refrech,increment_hours_ON ,
decrement_hours_ON,increment_minutes_ON ,
decrement_minutes_ON,increment_hours_OFF ,
decrement_hours_OFF,increment_minutes_OFF ,
decrement_minutes_OFF,enable ;
STRING_OUTPUT auto_time_ON,auto_time_OFF,enbable_feedback;
digital_output
out1_ON,out2_ON,out3_ON,out4_ON,out1_OFF,out2_OFF,out3_OFF,out4_OFF;
integer current_hours_ON ,
required_hour_ON,current_minutes_ON,temp_day_ON,today_ON,required_minu
tes_ON,current_hours_OFF ,
required_hour_OFF,current_minutes_OFF,temp_day_OFF,today_OFF,required_
minutes_OFF;

PUSH increment_hours_ON
{
if (enable=1)
{
if (required_hour_ON=24)
{
required_hour_ON=1;
}
else
{
required_hour_ON=required_hour_ON+1;
}
auto_time_ON=itoa(required_hour_ON) + ":" + itoa
(required_minutes_ON);
temp_day_ON=0;
}
}

PUSH decrement_hours_ON
{
if (enable=1)
{
if (required_hour_ON=1)
{
required_hour_ON=24;
}
else
{
required_hour_ON=required_hour_ON-1;
}
auto_time_ON=itoa(required_hour_ON) + ":" + itoa
(required_minutes_ON) ;
temp_day_ON=0;
}
}

PUSH increment_minutes_ON
{
if (enable=1)
{
if (required_minutes_ON=59)
{
required_minutes_ON=0;
}
else
{
required_minutes_ON=required_minutes_ON+1;
}
auto_time_ON=itoa(required_hour_ON) + ":" + itoa
(required_minutes_ON) ;
temp_day_ON=0;
}
}

PUSH decrement_minutes_ON
{
if (enable=1)
{
if (required_minutes_ON=0)
{
required_minutes_ON=59;
}
else
{
required_minutes_ON=required_minutes_ON-1;
}
auto_time_ON=itoa(required_hour_ON) + ":" + itoa
(required_minutes_ON) ;
temp_day_ON=0;
}
}


PUSH increment_hours_OFF
{
if (enable=1)
{
if (required_hour_OFF=24)
{
required_hour_OFF=1;
}
else
{
required_hour_OFF=required_hour_OFF+1;
}
auto_time_OFF=itoa(required_hour_OFF) + ":" + itoa
(required_minutes_OFF) ;
temp_day_OFF=0;
}
}

PUSH decrement_hours_OFF
{
if (enable=1)
{
if (required_hour_OFF=1)
{
required_hour_OFF=24;
}
else
{
required_hour_OFF=required_hour_OFF-1;
}
auto_time_OFF=itoa(required_hour_OFF) + ":" + itoa
(required_minutes_OFF) ;
temp_day_OFF=0;
}
}

PUSH increment_minutes_OFF
{
if (enable=1)
{
if (required_minutes_OFF=59)
{
required_minutes_OFF=0;
}
else
{
required_minutes_OFF=required_minutes_OFF+1;
}
auto_time_OFF=itoa(required_hour_OFF) + ":" + itoa
(required_minutes_OFF) ;
temp_day_OFF=0;
}
}

PUSH decrement_minutes_OFF
{
if (enable=1)
{
if (required_minutes_OFF=0)
{
required_minutes_OFF=59;
}
else
{
required_minutes_OFF=required_minutes_OFF-1;
}
auto_time_OFF=itoa(required_hour_OFF) + ":" + itoa
(required_minutes_OFF) ;
temp_day_OFF=0;
}
}

PUSH refrech
{
if (enable=1)
{
enbable_feedback="";
enbable_feedback="timer is enabled";
current_hours_ON=GetHourNum();
current_minutes_ON=GetMinutesNum();
today_ON = GetDateNum();
current_hours_OFF=GetHourNum();
current_minutes_OFF=GetMinutesNum();
today_OFF = GetDateNum();
if (temp_day_ON=today_ON)
{
}
else
{
if (required_hour_ON=current_hours_ON)
{
if (required_minutes_ON=current_minutes_ON)
{
pulse(100,out1_ON);
pulse(100,out2_ON);
pulse(100,out3_ON);
pulse(100,out4_ON);
temp_day_ON=GetDateNum();
}
}
}
if (temp_day_OFF=today_OFF)
{
}
else
{
if (required_hour_OFF=current_hours_OFF)
{
if (required_minutes_OFF=current_minutes_OFF)
{
pulse(100,out1_OFF);
pulse(100,out2_OFF);
pulse(100,out3_OFF);
pulse(100,out4_OFF);
temp_day_OFF=GetDateNum();
}
}
}
}
else
{
enbable_feedback="Timer is disabled";
}
}
Function Main()
{
}


module 2 : auto refrech

DIGITAL_INPUT ENABLE ,STOP ;
DIGITAL_OUTPUT REFRECH ;

push ENABLE
{
WHILE ( ENABLE = 1 )
{
PULSE(100,REFRECH) ;
DELAY(100) ;
IF ( STOP = 1 )
{
BREAK ;
}
}
}


 

in the end of the second module i forget to write the logic of stop
but u can ignor that because the timer will be always in refreching
mode .else

change stop
{
if (stop=1 )
{
stop_temp=1;
}
else
{
stop_temp=0;
}
}
finaly dont forget to define the variable stop_1 as integer
integer stop_1
and replace stop by stop_1 inside the condictio (if)
sorry about the spelling because i wrote this small time .


digitalstudiowerks
 

Hi,
Thanks for everyones feedback, especially for the Simpl+ module post. I really appreciate it.

I asked this questions because I have a employee, a beginning programmer, working on a
demo project and he is not yet familiar with Simpl+ yet and I have not had the need to use
"Time Comparison" the way it needs to be used in this project. For the more complex and
difficult programming jobs we hire a CAIP to do the programming but this is a just a demo
project and I wanted him to actually learn how to do it. Plus at the same time I learn.

Again, thanks for all the feedback and assistance.

~James