Jump to content

Different Way to do the Same Thing - Program Help


zerop

Recommended Posts

Posted

I currently have the following two programs.  All variables are integer variables.  And for what I need it has to be "Status 'Thermostat' is On" and can not be "Control 'Thermostat' is Switched On".

 

CoolDiscrepancy

If
        Status  'Thermostats' is On
    And $Temperature <= $Outside

Then
        $Discrepancy += 1

Else
   - No Actions - (To add one, press 'Action')
CoolCount

If
        Status  'Thermostat' is On

Then
        $CoolOn += 1

Else
   - No Actions - (To add one, press 'Action')

 

Another way I thought of doing this is the following

CoolCount

If
        Status  'Thermostat' is On

Then
        $CoolOn += 1
        Run Program 'CoolDiscrepancy' (If)

Else
   - No Actions - (To add one, press 'Action')
CoolDiscrepency

If
        $Temperature <= $Outside

Then
        $Discrepancy += 1

Else
   - No Actions - (To add one, press 'Action')
Is there a benefit in having the ISY only having to wait for the change of status of a device for one program instead of two?  Does it make much difference in which way I implement this?  Is there a better way to do it, maybe with just one program? 

 

Posted

The short answer is "yes." The long answer is ask 10 programmers to .... B)

Posted (edited)

I don't see a way to do this in a single program, but this assumes I have accurately recognized WHAT you are trying to do from your programs.  If your current programs do what you want, the benefits of alternative methods will be mostly in the mind.  I doubt that there will be a perceptible functional benefit.

 

I am curious...what do you want those variables to become if either of those conditions are false?

Edited by oberkc
Posted

I am curious...what do you want those variables to become if either of those conditions are false?

 

I don't want anything to happen it they are false.

Thanks for the input.  My biggest question/concern was wondering if it made a difference that two programs were checking status instead of one (i.e. processing power of the ISY)  If it were only these two programs, no big deal but as I approach 300 programs or so having more and more programs checking status may put an undue load on the ISY processor and simplifying some programming may be better.

Posted

How many programs do you think might be running simultaneously? 

 

Your second program might be a better solution if this were truly a problem, but I doubt that you will notice any difference.I have never perceived this to be a problem.

Posted

I agree with oberkc. Lengthy and processor intensive programs running concurrently are more of a concern than the number of programs that are sitting idly by awaiting execution.

Posted (edited)

I don't believe that a program containing a "status" uses any more processor sitting idle than any other program.

 

I suppose if the "status" object (ie your thermostat) were constantly changing, then the program would be constantly getting triggered.  But I doubt the status of your thermostat changes very often, right.  It isn't like it is going on/off/on/off/on/off 

 

Here you have 3 programs that get triggered when the status changes from on to off or vice versa.  3 programs getting triggered simultaneous is no big deal.

Edited by apostolakisl
Guest
This topic is now closed to further replies.

×
×
  • Create New...