Results 1 to 8 of 8

Thread: Code Review Please

  1. #1
    Frequent Visitor KRoss's Avatar
    Join Date
    Apr 2014
    Location
    Albany, NY
    Posts
    120

    Code Review Please

    I been able to use Russ Code, and do three phases of light, but I want to introduce a few more options. I been trying to replicate my Graph I made, but I seem not to be able to determine why LED Evening and Sundown ever take place. Below is the code.

    Set Off
    If Sun 000/-600 Then LED_Sunrise
    If Sun 120/-480 Then LED_Morning
    If Sun 240/-240 Then LED_Noon
    If Sun 480/-120 Then LED_Evening
    If Sun 600/000 Then LED_Sundown
    If Outlet Pre_Weather = ON Then PreWeather
    If Outlet Clouds = ON Then Cloudy
    If Outlet Storms = ON Then Stormy
    If Outlet Post_Weather = ON Then PostWeather



    My Assumption is 000 Sunrise, 2 hours later Morning, 2 Hours Later Noon, 2 Hour Later Evening and 2 Hours after that to the end Sundown. The - after is to ensure each one does not step on each other. Russ's graph that he once displayed was a great visual but I seem not to be able to get above 3.

    Any help would be great.
    Thanks

  2. #2
    Frequent Visitor BertL's Avatar
    Join Date
    Nov 2013
    Location
    Carlsbad, CA
    Posts
    775
    Have not figured out why yet... Will think on it, but Russ will probably figure it out in 2 seconds as his head seems to work the way an Apex does (that's a compliment, Russ!). ...but someone is sooner or later gonna ask, so you should post your sunrise/sunset times in your Season Table for at least the last couple of days... That's the other part of this equation we need to know.
    Bert

  3. #3
    Frequent Visitor KRoss's Avatar
    Join Date
    Apr 2014
    Location
    Albany, NY
    Posts
    120
    I am using The following Season Table for example today:

    Jul 27 06:50/19:39 09:00/21:00 7 80.1


    So My Assumption is:

    06:50 LED_Sunrise
    08:50 LED_Morning
    10:00 LED_Noon
    12:00 Then LED_Evening
    14:00 Then LED_Sundown

    I wish there was a way to figure out exactly mid day off the If SUN command. I actually will be adjusting for two more points, but first wanted to start with inserting two but at the end want to insert 4, I have the code to adjust cloudy, and storms based on the mode of lighting now.

  4. #4
    Master Control Freak RussM's Avatar
    Join Date
    Dec 2012
    Location
    California - US Pacific
    Posts
    22,495
    Change the order:

    If Sun 000/-360 Then LED_Sunrise
    If Sun 120/-360 Then LED_Morning
    If Sun 360/000 Then LED_Sundown
    If Sun 360/-120 Then LED_Evening
    If Sun 240/-240 Then LED_Noon

    The midday statement MUST be last so it takes precedence over the others. Similarly, the morning line must come after the sunrise and the evening line must come after the sundown line. This is how you get the proper stepping.

    If you sketch it out in the same manner as I did in the image you mentioned, it will help visual the overall effect.

    Are you doing this so you can get more granular with the spectrum throughout the day?
    Please do not send me PMs with technical questions or requesting assistance - use the forums for Apex help. PM me ONLY if the matter is of a private or personal nature. Thanks.

  5. #5
    Frequent Visitor KRoss's Avatar
    Join Date
    Apr 2014
    Location
    Albany, NY
    Posts
    120
    Thanks Russ,

    Yes I am trying to add some more points to match my graph I showed in post your radion graph to adjust the spectrum. The one I posted was working great but wanted to introduce storms and clouds and the base code you provided was great having my pumps interact with the lights.

    I want to add a total of 7-9 points.

    Let me graph it out with all the points and post. My confusion is order but your explanation cleared that up.

  6. #6
    Frequent Visitor KRoss's Avatar
    Join Date
    Apr 2014
    Location
    Albany, NY
    Posts
    120

    Final Code Review - 7 Events

    Russ, (First thanks for the help!!)

    This was the final code I came up with. I even included a visual chart, am I correct on the logic?

    If Sun 000/-360 Then LED_Sunrise
    If Sun 120/-360 Then LED_Morning
    If Sun 180/-360 Then LED_MidMorn
    If Sun 360/000 Then LED_Sundown
    If Sun 360/-120 Then LED_Evening
    If Sun 360/-240 Then LED_Afternoon
    If Sun 240/-300 Then LED_Noon
    If Outlet Pre_Weather = ON Then PreWeather
    If Outlet Clouds = ON Then Cloudy
    If Outlet Storms = ON Then Stormy
    If Outlet Post_Weather = ON Then PostWeather

    Below is the Chart I did (Hopefully I am right)

  7. #7
    Master Control Freak RussM's Avatar
    Join Date
    Dec 2012
    Location
    California - US Pacific
    Posts
    22,495
    Standby - I need to go swallow a handful of Excedrin to ward off the headache which looking at that will give me
    Please do not send me PMs with technical questions or requesting assistance - use the forums for Apex help. PM me ONLY if the matter is of a private or personal nature. Thanks.

  8. #8
    Master Control Freak RussM's Avatar
    Join Date
    Dec 2012
    Location
    California - US Pacific
    Posts
    22,495
    The program is good, but the visualization is not quite right - the blocks for Afternoon and Evening should be swapped
    Please do not send me PMs with technical questions or requesting assistance - use the forums for Apex help. PM me ONLY if the matter is of a private or personal nature. Thanks.

Similar Threads

  1. Question: Skimmer Code review?
    By 1lastcast in forum Misc Apex Usage & Programming
    Replies: 2
    Last Post: 04-19-2020, 06:23
  2. 3 floats ato code review
    By neomaxmaya in forum Apex Programming for Dosing, ATO, and AWC
    Replies: 8
    Last Post: 02-27-2020, 06:05
  3. Please review my ATO code?
    By theguyonthecouch in forum Apex Programming for Dosing, ATO, and AWC
    Replies: 9
    Last Post: 06-10-2014, 20:00
  4. Heater code review
    By sandstorm in forum Apex Programming for Heaters and Chillers
    Replies: 8
    Last Post: 02-16-2014, 08:40
  5. Code review - lighting off
    By dmatt56 in forum Apex Programming for Lighting
    Replies: 9
    Last Post: 01-20-2014, 11:12

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •