Jump to content

Storing program math results


Go to solution Solved by larryllix,

Recommended Posts

Okay.... I am working on  program which will, each day, produce a mathematical result measured in terms of a variable (to be explicit, degree days, stored in an integer variable by the same name).

I would like to store those in a way that would let me later compile a total for a stated time period.. (again to be explicit from march 1 until a specified total number is reached.... basically from mar 1 until June 30)

Has anyone tackled something like this?

I am eyeing the TimeDate plug in as a part of the solution, but before I go searching for a champagne solution to a beer project thought I might solicit views on this problem.

Thank for looking and I solicit any and all thoughts...

Link to comment

I did a few things like this by using a block of ISY memory locations and creating a shift register that operated each day on a schedule.

A lot of hardcoding in ISY since it has no indexing function but....something like this.

Program Shifter
if
     whatever
Then
      set mem30 = mem29
      set mem29 = mem28
      set mem28 = mem27
     ......
      set mem1 = mem0
      set mem0 = Day.data
Esle
     --

Data over 30 days old will be lost but last 30 days will be available for a summation.

Program total30
If
    ---whatever
Then
      30dayTotal = mem30
      30dayTotla += mem29
      30dayTotla += mem28
     ....
      30dayTotal += mem0
      $s30dayTotal = 30dayTotal <--move to state variable for processing
Else
    ---
 

Link to comment

Larry thanks. I suspected this would be a "brute force" solution kind of task. I had set up a weeks worth of defined integer variables for the test. Is something like that what you are referring to a block of memory locations?

Edited by glacier991
Link to comment
  • Solution
Larry thanks. I suspected this would be a "brute force" solution kind of task. I had set up a weeks worth of defined integer variables for the test. Is something like that what you are referring to a block of memory locations?
Yes.

I had requested some form of indexing variables, years ago, but other expansions got in the way.

Sent from my SM-G781W using Tapatalk

Link to comment
11 hours ago, glacier991 said:

Is there any numeric limit on the number of variables Eisy can have (and support)?

I doubt that a human, manually coding without some automatic indexing code could ever run into that limit. ISY comes with GigaBytes now.

Link to comment
  • Whew. That means I am safe, for now.😉
  • On another matter, I followed your suggestion for creating a monthly register. For the total I approached it a little differently. On a daily basis I add the current day value to a variable I call Cumulative DD. I increment a counter at the same time. When the counter reaches 30 (or 31 depending on the month) following that days addition I move the Cumulative DD value into a state variable. Ka-ching.. I just saved 29 variables from a fate worse than math.
  • Like 1
Link to comment
  • Whew. That means I am safe, for now.
  • On another matter, I followed your suggestion for creating a monthly register. For the total I approached it a little differently. On a daily basis I add the current day value to a variable I call Cumulative DD. I increment a counter at the same time. When the counter reaches 30 (or 31 depending on the month) following that days addition I move the Cumulative DD value into a state variable. Ka-ching.. I just saved 29 variables from a fate worse than math.
I don't like basing things on long timers. They tend to fail or crash or I stall them by editing.

I would just trigger a program to save the tally, and possibly ckeaout all the registers each 12:00:05 each first of the month.

Of course I keep my own date variables based on ISY's provided system variables so that is easy.

Sent from my SM-G781W using Tapatalk


Link to comment

Definitely interested. Interestingly the Yolink thermometers keep their data for months or longer, and enable downloading it in comma delimited format for your stated date range. Not applicable in my situation, but interesting.

Link to comment

One of my program populates variables with 3 irrigation data points and then writes the data to a file in the IoX web server using a Notification. I believe there was a little setup on the web server but I can't find it right now.  Feels like it was just creating the location and the file within the web servers file structure, 
 

Irrigation Program segment

        $Water_Today_Start_I  = 'Flume Water / FlumeWater / Flume Sensor 6811460334891002' Today US gallons
        Set 'Yard / Yard:Front Mulch Beds' On 100%
        Wait  Zone_1 minutes 
        ...
        $Water_Today_End_I  = 'Flume Water / FlumeWater / Flume Sensor 6811460334891002' Today US gallons
        $Water_Today_Difference_I  = 0
        $Water_Today_Difference_I += $Water_Today_End_I
        $Water_Today_Difference_I -= $Water_Today_Start_I
        Send Notification to 'MeDataText' content 'Irrigation Log Data'
 

Irrigation Log Data Custom Notification

Subject :  @webpage:@append:/irrigate/irg_log.csv Irrigation

Body:       ${sys.program.#.name},${alert.date},${alert.time24},${var.1.42},${var.1.43},${var.1.44}

 

${var.1.42} etc

1=An Integer Variable

42=Integer Variable ID with the name Water_Today_Start_I

 

 

Edited by hart2hart
  • Like 1
Link to comment

@hart2hart That's nice!

There is a reference in iox 5.8.0 in January to a SQLite database being added for node values, but IIFC it was more a future feature and no details provided.

If that were available I would love to store / access values in it, using a client on my pc. 

Link to comment
@hart2hart That's nice!
There is a reference in iox 5.8.0 in January to a SQLite database being added for node values, but IIFC it was more a future feature and no details provided.
If that were available I would love to store / access values in it, using a client on my pc. 

I vaguely recall SQLite but seems like it was not ready for prime time yet.
Link to comment
On 2/28/2024 at 7:04 PM, glacier991 said:

Okay.... I am working on  program which will, each day, produce a mathematical result measured in terms of a variable (to be explicit, degree days, stored in an integer variable by the same name).

I would like to store those in a way that would let me later compile a total for a stated time period.. (again to be explicit from march 1 until a specified total number is reached.... basically from mar 1 until June 30)

Has anyone tackled something like this?

I am eyeing the TimeDate plug in as a part of the solution, but before I go searching for a champagne solution to a beer project thought I might solicit views on this problem.

Thank for looking and I solicit any and all thoughts...

There is a way to post data to a Google Sheet.  I post data once per minute to a sheet.  I think there's a maximum # of rows one can post.  Therefore, I clear my sheet (automatically) at 2am.  I just want current data.  If you're only going to post once per day, you can certainly have a year's worth of data in there.  

Link to comment
Posted (edited)

Interested, can you tell more about the ability to post to a "Google sheet? Getting data outside EISY where it can be otherwise used and manipulated seems possible, but elusive.

This sounds intriguing. So much so I am wondering is a separate topic addressing just that might be appropriate and welcomed! (From besides me.)

Edited by glacier991
because of fat fingers
Link to comment
Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.8k
    • Total Posts
      369.9k
×
×
  • Create New...