Jump to content

(IL)LOGIC?


Go to solution Solved by dbwarner5,

Recommended Posts

Eisy v5.8.0

I have a logic problem!  A program sets a state variable to 0 or 1 depending on sunset and luminance.  A second program turns lights on or off, depending on the value of that variable.  It works very well on gloomy days…until 32 minutes before sunset, which was at 5:27 p.m.

At 4:44 p.m. it correctly emailed me that “lux level dropped to 13 lux. Eisy turned on selected lights.”  And then at 4:55 p.m. (35-3=32 minutes before sunset) it illogically emailed me that “lux level increased to 13 lux. Eisy turned off selected lights.”  Lux level did not increase, and at 13 lux, Eisy should have turned lights on, not off.

This happens frequently on gloomy (but not on bright) days.  Obviously, I’m missing something here.  Can someone please correct my logic?

Den Low Lux 15 Variable - [ID 000A][Parent 001D]
If
        From     8:05:00AM
        To      Sunset  - 35 minutes (same day)
    And 'Den Temp and Lux' Luminance <= 15 lux
Then
        // Wait for both conditions to test
        Wait  3 minutes 
        $Den_Low_Lux  = 1
Else
        // Wait for both conditions to test
        Wait  3 minutes 
        $Den_Low_Lux  = 0
 

Den Low Lux 15 Send - [ID 0019][Parent 001D]
If
        $Den_Low_Lux is 1
Then
        Set 'LR1' On
        Set 'LR2' On
        Set 'BR' On
        Set 'Bar' On
        Send Notification to 'Notification List' content 'Den Low Lux Email'
        Resource 'Den Low Lux Message'
        Wait  15 minutes 
        // …to prevent rapid switching
Else
        Set 'LR1' Off
        Set 'LR2' Off
        Set 'BR' Off
        Set 'Bar' Off
        Send Notification to 'Notification List' content 'Den Low Lux Ended Email'
        Resource 'Den Low Lux Ended Message'
        Wait  15 minutes 
        // …to prevent rapid switching

 

Edited by GHenry
formatting
Link to comment

I fixed this problem by splitting the first program into 2. One program detects dark as <= 15 lux while the second program detects light as > 25 lux. (And removing any Else clauses)

For me, this prevented the little cloud rolling by near sunset from causing the it's-dark....wait no it's light flip-flopping.

Edited by gviliunas
  • Like 1
Link to comment
  • Solution

I think your programs are running correctly, just the logic is wrong, @gviliunas points out the easist way to fix. 

What is happening is that at sunset -35 minutes, the first program goes false, running the ELSE. So 3 minutes go by and then the lux variable changes to 0. 

This triggers the ELSE in the second program which turns off the lights, regardless of what the LUX value actually is, because the variable turned to 0 in the first program. 

It seems like you expect the lux value to overrule the time condition, which wont happen. If either are false, the first program will turn false due to the AND. 

After you think thru this a bit, feel free to post your changes and others can comment if you are still having problems accomplishing what you want.

 

 

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

    • Total Topics
      36.5k
    • Total Posts
      367.6k
×
×
  • Create New...