Jump to content

When there is no value in a cell


Butterbean

Recommended Posts

I have an energy monitoring system that I am building.  This EMS gathers data once per minute and drops that data into a mssql db.  I have php set up to interpret the values and allow the customer to query the mssql for data for a peak value within a 15 minute interval.  

 

The user enters the 15 minute interval into the web app, along with the timeperiod (15 minute interval in question)  example   (2014-10-16 at 07:30:00 - 07:44:59 ).  Sometimes there is no data in that interval because there was nothing reported (due to power outages or internet connection issue).  When there is no data to report, there is not even an entry row set in mssql, therefore the time and date it is querying is not present.  

 

I am trying to find a way that if php queries mssql and the row that is queried does not exist,  have php look forward than backwards simultaneously until it finds any value (it can even be a zero as long as its a value) to report.  I would think I could cover any situation including a major power outage by looking forward three (3) days and back three (3) days.  I'm not sure where to even start with something like this.  Does anyone have a suggestion on how to start?

Edited by Butterbean
Link to comment
Share on other sites

I see why you would think that, however, if there is no data, the metering sends an empty packet with zero values.  So there will be a row in mssql that has all zeros.  Occasionally there is no row of data sent by the EMS, so if it doesnt exist, it doesnt mean that they were using zero energy, it just means that the data never reached the server ( in the timestamped period), so we look at the next timestamps.  In that event I need a backup plan to look forward then backward until it finds data (that data can even be zero).  

 

This system never stops sending data, so if it doesnt make it to the server, there is some reason (something blocking the 900 MHz, internet down or electric down).

Edited by Butterbean
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.