GroveStreams
Josephny private msg quote post Address this user
Hi,

I'm pretty new to GS and sure could use some help.

I would like to graph the gallons of propane used per minute of boiler operating time.

I have a data stream that takes a twice per day feed of the percentage of a 1000 gallon propane tank remaining (e.g., 30% at 1am on day 1, 29.5% at 1pm on day 2, 28% at 1am on day 2, etc. which translates into 300 gallons, 295 gallons and 280 gallons remaining, respectively) AND a stream of total number of minutes from midnight to midnight on each calendar day that the boiler is running.

The sample times between the streams do not coincide. And sometimes there will be a missing propane tank reading due to a wifi failure for the single-attempt pushed data from the remote tank reader.

Can someone please help with this derivation?

Thank you!

Joe
Post 1 IP   flag post
MikeMills private msg quote post Address this user
What resolution do you want the graph? For example is it plotting gallons per minute for each day - the graph has one point for each day?
Post 2 IP   flag post
Josephny private msg quote post Address this user
Minutes per gallon (of boiler burner in operation) per day I think would be good. So, yes, 1 pt/day.

For example:

3/17/2018 40 minutes/gallon
3/18/2018 35 minutes/gallon
3/19/2018 42 minutes/gallon

Thanks!
Post 3 IP   flag post
Josephny private msg quote post Address this user
BTW, this is what I have so far:

https://tinyurl.com/ybdqh5ye
Post 4 IP   flag post
MikeMills private msg quote post Address this user
Here's my best guess. I didn't test it. Let us know if this works:

I think you're uploading minutes per day, but GS can calculate that for you and also take Daylight Savings days into account. This example does this by creating a "Minutes" stream, setting its base cycle to minutes and then using the "Base Interval Count" for each Day cycle. User your stream or this one.

This example assumes percentage sampls are a decimal between zero and one. Change the expression if they are between 1 and 100.

Note the stream types on the first image. Two streams were created as "Regular" streams and the Minutes stream is created as an "Interval" stream.

The Offset values will grab the previous Day's interval.
The Day cycle will use the Function to calculate a result for the day - for this example, it is returning the last reading of the Day. So it will work if there is one or more readings during the day and it will use the very last reading of the current day. The expression is doing its calculation using the last reading of the previous day and the last reading of the current day.

The "if" and "isNull" statements in the expression checks if there were any readings for the day. If today or yesterday has no readings then the expression will return NULL which forces the derivation engine to not return a value for that day. There will be no result for that calculated day.

Days are defined by the cycle definition in component studio, which by default are midnight to midnight in the Component's set timezone.













Post 5 IP   flag post
MikeMills private msg quote post Address this user
Thinking about this more...I think you want mins for the current day, so you would change minYesterday to minsToday and set its Intvl Offset to zero.
Post 6 IP   flag post
MikeMills private msg quote post Address this user
I'm not sure derivation will run with the given settings. You can try setting Advanced- When any dependent values have arrived. Usually requires use of IS_NULL
Post 7 IP   flag post
MikeMills private msg quote post Address this user
Thinking about this more...You don't really need the Minutes stream as we can use the existing "Percent Remaining" Stream.

So I removed the Minutes stream and tweaked the Base cycle for the "Percent Remaining" stream and the derivation.

Derivation will now run whenever any new samples arrive.





Post 8 IP   flag post
MikeMills private msg quote post Address this user
Ooops...Leave the isNull checks in the expression:

if(isNull(yesterday) || isNull(today), NULL, (yesterday*1000) - (today*1000) / minsToday)
Post 9 IP   flag post
Josephny private msg quote post Address this user
I've been trying to make this work, but haven't been successful.

On a basic level, when I attempt to add Variables it calls up the list of existing component streams. Do I use the stream that provides the Percent Remaining in the propane tank? I tried that.

But, more globally, how does this use the total minutes of boiler operating time in any calendar day (my stream name: auxHeat1RuntimeDaily) and use it together with the difference in propane level to calculate the number of minutes the boiler runs for every gallon of propane used?

Thank you!
Post 10 IP   flag post
MikeMills private msg quote post Address this user
Quote:
Originally Posted by Josephny
Do I use the stream that provides the Percent Remaining in the propane tank?
- Yes, that one will be your "today" variable and your "yesterday" variable. Add it twice and rename the variable name. Not sure why you can't add that. You need to edit the derived stream, "Gallons per Min" and select the Derivation tab and add the stream twice to its derived variables by clicking Add or by clicking Pin for Drag and Drop and dragging it onto the grid - then click Pin for Drag and Drop again to un-toggle it and get out of the drag mode.

Quote:
Originally Posted by Josephny
...how does this use the total minutes of boiler operating time in any calendar day
- OK. My solution used the total minutes in a day so that's not right. I think you said you had the running time in a stream so you can just use that as the replacement for the minsToday stream. The trick is to use the right sample(s) from that stream. Since the derived stream's base cycle is Days, it is deriving a day from midnight to midnight. Derivation will use the samples in the range being derived. You can SUM them or use the last one in the day. I'll assume you're summing them. Here's what I would try:

Create a new derived stream from scratch. Make it an "Interval" stream with a Base cycle of Days. Make it derived from three streams: "percentage remaining" twice and "running time". Select "Days" for the cycle for all three. Select "Last" for "percentage remaining" and Select "SUM" for running time. Sum will sum all of the running time sample amounts for the day being derived.

You will still have three variables. The expression will still be:
if(isNull(yesterday) || isNull(today), NULL, (yesterday*1000) - (today*1000) / minsToday)


I'm making some assumptions so I can be off a little and we may need to adjust things more. For example, I'm not sure how your tank amount stream sample times align with the running time streams. I'm guessing there's no correlation so the result of the derivation will be an approximate since the amount remaining reading may have occurred during a running time span.
Post 11 IP   flag post
Josephny private msg quote post Address this user
Cool -- we're getting closer.

So the propane level readings (we'll call it: LEVEL) feeds 2 values per day, at random times. For example, at 1am a value might come in at 29% and at 2:10pm another value might come in at 28.5%.

The runtime minutes (we'll call it: auxHeat1Runtime) feeds once per day at 12:10am and contains the previous 24 hour's total boiler running time.

So, if I understand correctly, I'll need to sum the LEVEL readings for a particular day and somehow associate that with the single auxHeat1Runtime reading that comes in on the following calendar day (12:10am).

This is way above my current skill level, but I'm trying.

And I really appreciate your help! Thank you!
Post 12 IP   flag post
MikeMills private msg quote post Address this user
I don't think you want to SUM the level readings since they are percentages. I think what you want to do is take the latest reading from the day before and the latest reading from the current day and use those to calculate how much was used between those two readings.

That's what this does:
if(isNull(yesterday) || isNull(today), NULL, (yesterday*1000) - (today*1000)


At least your RUNTIME is recorded close to midnight, or slightly after. Since it is actually after midnight, use an Intvl Offset of -1 in the derivation for usage/min to force derivation to use the amount in the day before calculation.

The big issue is that the LEVEL readings are during the day so you don't really know what the level is around midnight to get an accurate calculation of propane/min per day.

A couple of options:
1) Reprogram the LEVEL devices to report close to midnight or report more frequently such as by hour.
2) Use derivation to estimate what the LEVEL is at midnight. Probably by estimating how much was used per minute in the previous days (maybe a rolling average stream) and doing this:
levelReading + (avgUsedPerMinuteInPreviousDays * numberOfMinutesFromLevelReadUntilMidnight)

If this is for home, the above, #2, isn't too complicated. If this is industrial then calculating the average is trickier since the avg amount used is different for each day of week (weekends might use less). We actually have a function to calculate average using previous days of weeks that match the current day of week. For example, if it is Monday being calculated, we can calculate the average for the last 5 Mondays. This is common calculation technique in the Energy world.

Is #1 above an option for you?
Post 13 IP   flag post
Josephny private msg quote post Address this user
Wow -- I've learned so much from your help! Thank you again!

I think I've made some good progress.

I have a 7-day running-average daily minutes of boiler runtime per gallon of propane used going with this.

It's an odd metric (questionable value), but I think it might indicate a form of boiler efficiency and/or how much the boiler is modulating itself (reducing it's input BTU on its own).











Post 14 IP   flag post
MikeMills private msg quote post Address this user
Great - Thanks for posting the solution!
Post 15 IP   flag post
2688 15 15
Log in or sign up to compose a reply.
destitute