Surendra Posted August 29, 2022 Share Posted August 29, 2022 I have a saw-tooth signal (cumulative value) of water flow rate, that resets to zero every morning at 06:00 hrs. So, when I say daily total (for DPR purposes), it is the peak of the saw-tooth signal just before resetting to zero. On any particular day, at any random time, let's say 16:10 hrs, when I want to check the estimated total volume of water for the day, I have to check the last value of the signal (which is cumulative till then since morning 06:00 hrs) and add the extrapolated hourly values for remaining time period until next morning 06:00 hrs. So, here 1. How do I calculate the hourly average value of the signal (since morning 06:00 hrs)? That means, I have to divide the last value of the saw-tooth signal at 16:10 hrs by 8h 10 min i.e 8.166 hours. This gives me the flow rate of water, and 2. How do I multiply the hourly flow rate values with remaining duration and add that value to current value? 3. Also, whenever there is a system start-up post shut down, the flow rates will not be constant until steady state is reached, in such cases, I want to extrapolate the values based on previous start-up scenario. How to do that? Link to comment Share on other sites More sharing options...
Seeq Team Joe Reckamp Posted August 29, 2022 Seeq Team Share Posted August 29, 2022 Hi Surendra, 1. You will need to first create a capsule that represents the sawtooth schedule. If it's always 6am reset time, I would recommend creating a periodic condition that is daily, running from 6am to 6am in your time zone. From there, a formula function known as timesince exists to calculate the amount of time that has passed in each capsule. Therefore, you could do the following formula to get the time passed since the last capsule (ending the calculation at "now"): timesince($condition, 1h).within(past()) From there, you can simply do the calculation you want to get hourly average: $signal/$timesince 2. First, you can get the latest hourly average value and project that forward until the end of the day using: $hourlyaverage.aggregate(endvalue(true), $condition, durationkey()).within(not past()) Then you can multiply that by the hours in the day to get the extrapolation going forward: $LatestHourlyAverage * timesince($condition, 1h) 3. For this, you'll probably want to use the Reference Profile tool: https://seeq.atlassian.net/wiki/spaces/KB/pages/142770210/Reference+Profile Link to comment Share on other sites More sharing options...
Surendra Posted August 29, 2022 Author Share Posted August 29, 2022 I'm getting an empty signal when I run this, as show in the screenshot below. Pls help $hourlyaverage.aggregate(endvalue(true), $condition, durationkey()).within(not past()) Link to comment Share on other sites More sharing options...
Surendra Posted August 29, 2022 Author Share Posted August 29, 2022 Can I use this command instead for "Latest Hourly average"?? $hourlyaverage.aggregate( average(), periods(1hour, 5min), endKey()) Link to comment Share on other sites More sharing options...
Seeq Team Joe Reckamp Posted August 29, 2022 Seeq Team Share Posted August 29, 2022 Does the display range go out into the future? That formula would only have data beyond the "now" timestamp. Link to comment Share on other sites More sharing options...
Seeq Team Joe Reckamp Posted August 29, 2022 Seeq Team Share Posted August 29, 2022 You can use the formula you suggested for latest hourly average, but that would not provide the same result. In that case, you would be averaging an hour worth of data rather than the entire last day of data. In addition, the result would need to extend until the end of the day instead of stopping at the latest data point. Link to comment Share on other sites More sharing options...
Surendra Posted August 29, 2022 Author Share Posted August 29, 2022 I didn't get you. BTW, can you pls explain the use cases of this command? $hourlyaverage.aggregate( average(), periods(1hour, 5min), endKey()) Link to comment Share on other sites More sharing options...
Seeq Team Joe Reckamp Posted August 29, 2022 Seeq Team Share Posted August 29, 2022 This is the example of the formulas I sent you: It starts with the Signal in blue. I then calculated the timesince value in orange, followed by the hourly average for each day in dark blue. The spot it seems you are running into issues is with the green signal, which is calculating the latest hourly average. Notice that all the other signals stop at "now" about halfway through the screen. In order to see the result of the latest hourly average, you'll have to set your display range to view the remainder of the day beyond "now" as I have done above as that signal will only appear in the future remaining part of the day. From there, the last formula I mentioned creates the red extrapolation at the top that continues the trend using that hourly average. The formula that you suggested: $hourlyaverage.aggregate( average(), periods(1hour, 5min), endKey()) is not going to do the same function as the green signal above and should not be used as a replacement. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now