ADICON Support Forum Applied Digital, Inc.
Page 1 of 1 1
Topic Options
#12664 - 11/26/05 12:15 PM How to simulate a between statement
johnb Offline
newbie


Registered: 11/14/05
Posts: 10
I am new to Ocelot programing.
What I want to do is to program a heating system based on the readings of the bobcat temps.

Lets's say there are 3 heating periods per day.
Lets say
6am - 9am
11am - 1pm
6pm - 11pm

What I would really like is a function with
if - between - time of day - and - time of day.

What I have tried to do is:

If - time of day (is more than) time of day (start time)
AND - time of day (is less than)time of day (end time)
THEN do the heating stuff

This does not work because it is ON (always true) all the time.

Could you give me an idea of the best way I might achieve this?

Top
#12665 - 11/26/05 02:15 PM Re: How to simulate a between statement
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
This is where the difference between a static condition(s) and a single triggering event becomes important. You don't say what the triggering action is (such as the temperature falling below a certain temperature during each time interval) but here is an example of how it could be done:

IF - time of day is > 6:00 time of day (start time, static)
AND - time of day is < 9:00 of day (end time, static)
AND - Temperature variable becomes < 72 (temperature event, single triggering)
THEN Turn on heating...

IF - time of day is > 6:00 time of day (start time, static)
AND - time of day is < 9:00 of day (end time, static)
AND - Temperature variable becomes > 72 (temperature event, single triggering)
THEN Turn off heating...

In these examples, the temperature becoming higher or lower then the triggering values is what turns the heat on or off. You could have different temperatures for other time intervals simply by copying this set of statements to create new conditions.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#12666 - 01/01/07 08:45 PM Re: How to simulate a between statement [Re: Guy Lavoie]
Griz4X4 Offline
newbie


Registered: 01/01/07
Posts: 8
Is there a way to copy code from a program file to text for posting here? I built a routine to convert time of blocks to a variable and then the variable can be use in many places for the logic. I basically split the day up into 6 blocks. It works great, but I can't get it to cut and paste to the message system.
Top
#12667 - 01/01/07 09:40 PM Re: How to simulate a between statement [Re: Griz4X4]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
To copy text from a program, use the "File" --> "Print to File" feature of C-Max. You can then post the copied text to a forum post. To cut out portions of a program, just post it to a temporary text file first (like with Notepad) and then extract the part you want from there.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#12668 - 01/02/07 06:57 PM Re: How to simulate a between statement [Re: Guy Lavoie]
Griz4X4 Offline
newbie


Registered: 01/01/07
Posts: 8
AHA! Got it.

Part of day variable.
I used variable 4 as a "flag" and apply other logic lines to the flag (see example at bottom)
I used an internal timer to make sure the outside lights get turned on and dimmed at night. I used a 30 minute cycle because with 3 teenagers in the house, coming and going at all kinds of odd hours, it assures that they do not leave them on bright (waste of energy) or turn them off (security issue). After midnight (curfew time) I let the timers expire and turn the lights off.

0013 - IF Time of Day is > Sunrise offset 0 minutes
0014 - AND Time of Day is < 08:00
0015 - AND V4-Time-of-Day-Flag is NOT = 1
0016 - THEN V4-Time-of-Day-Flag = 1
0017 - IF Time of Day is > 07:59
0018 - AND Time of Day is < 16:00
0019 - AND V4-Time-of-Day-Flag is NOT = 2
0020 - THEN V4-Time-of-Day-Flag = 2
0021 - IF Time of Day is > 15:59
0022 - AND Time of Day is < Sunset offset 0 minutes
0023 - AND V4-Time-of-Day-Flag is NOT = 3
0024 - THEN V4-Time-of-Day-Flag = 3
0025 - IF Time of Day is > Sunset offset 0 minutes
0026 - AND Time of Day is < 23:00
0027 - AND V4-Time-of-Day-Flag is NOT = 4
0028 - THEN V4-Time-of-Day-Flag = 4
0029 - IF Time of Day is > 22:59
0030 - AND Time of Day is < 23:59
0031 - AND V4-Time-of-Day-Flag is NOT = 5
0032 - THEN V4-Time-of-Day-Flag = 5
0033 - IF Time of Day is > 00:00
0034 - AND Time of Day is < 05:00
0035 - AND V4-Time-of-Day-Flag is NOT = 5
0036 - THEN V4-Time-of-Day-Flag = 5

(for cycling the outside lights on a 30 minute cycle)

0112 - IF V4-Time-of-Day-Flag is = 4
0113 - AND T1-Nightime-Cycle-Timer is = 0
0114 - THEN T1-Nightime-Cycle-Timer = 1
0115 - THEN Transmit X10, O - All Units OFF (17)
0116 - THEN O2-Porch-Light, Turn ON
0117 - THEN O3-Porch-Light, Turn ON
0118 - THEN Transmit X10, O - 2
0119 - THEN Transmit X10, O - 3
0120 - THEN Transmit X10, O - Dim (21), 8 time(s)
0121 - IF T1-Nightime-Cycle-Timer is > 1800
0122 - THEN T1-Nightime-Cycle-Timer = 0

Top
#12669 - 01/02/07 07:04 PM Re: How to simulate a between statement [Re: Griz4X4]
Griz4X4 Offline
newbie


Registered: 01/01/07
Posts: 8
I have written a complete control sequence for both my H/AC units using RCS based thermostats. It watches the outside temps (bobcat) internal temps (scanned from the stat itself). I do a comparision and set from ventilate mode (using a motor driven damper piped from air intake to outside air) if the temp is condusive for ventilate instead of wasting energy on AC compressor.
Top
#12670 - 01/08/07 11:16 PM Re: How to simulate a between statement [Re: Griz4X4]
Keith_White Offline
newbie
****

Registered: 03/11/06
Posts: 19
Loc: Turner Maine
Will you post it here on the site, I would like to see what you have done or mail me the code.

Thanks Regard, Keith

Top
Page 1 of 1 1


Moderator:  Dan Smith, Monte G, ADI Tech Support, Guy Lavoie 
Hop to:
Who's Online
0 registered and 65 anonymous users online.
Recent Posts
Secu16 inputs not working correctly
by ADI Tech Support
10/03/17 06:01 AM
Ocelot Battery
by ADI Tech Support
09/22/17 07:38 AM
Shout Box

Newest Members
brigiel, vevevie, zhutree, 416, saiqul
3003 Registered Users
Forum Stats
3003 Members
19 Forums
4003 Topics
23440 Posts

Max Online: 132 @ 11/13/16 10:07 AM
October
Su M Tu W Th F Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31