Maren Ranheim Posted November 16, 2022 Share Posted November 16, 2022 Hi! I am trying to do a calculation of the residence time in a tank per hour based on a selection of parameters. In my formula I wish to use the previously calculated value for the residence time in the calculation for the next hour or calculation point. I tried using $signal.valueAt(now()-1h), however, I am not sure how to get this for every calculation point and not only for the last value. This might not be the best solution either so I would appreciate any advice. Additionally, I realize I will need a starting point for this formula. For this I have both a time and a value I can use, although I am not sure how to incorporate this into the formula. Does anyone know if this is possible to do through SEEQ? Thanks in advance. Link to comment Share on other sites More sharing options...

Administrators Teddy Posted November 16, 2022 Administrators Share Posted November 16, 2022 Can you explain in more detail how you are calculating residence time? It sounds like you are doing something more complicated than Volume/Flow. Link to comment Share on other sites More sharing options...

Maren Ranheim Posted November 17, 2022 Author Share Posted November 17, 2022 Thank you for the response. The challenge in this case is that the volume and flow in/out of the tank for which I am calculating the residence time are constantly changing. Occasionally, there is no flow in at all for up to a week or two, significantly affecting the residence time but not being taken into account through the traditional Volume/Flow. Basically, what my formula does is to estimate the average residence time (RT) for the fraction which has already been on the tank for x hours and the fraction which has just entered in the past hour. For simplicity, and since there is stirring on the tank, I assume a homogeneous mixture for the flow out of the tank. I figured estimating the residence time per hour should be enough. My final formula is: RT_{average}= ((RT_{old}+RT_{new})*amount_{old} + (RT_{new}*amount_{new})/2) / (amount_{total}) where RT_{old} is RT_{average}-1h (which is what I am struggling with expressing in my formula), RT_{new} is an hourly signal running regardless of conditions, amount_{old} is the amount that was on the tank at the previous hour, and amount_{new} is the amount entering the tank for the past hour, and the amount_{total} is the sum of amount_{old} and amount_{new}. At a certain point, the flow in was closed for approximately 2 weeks, and I figured this could serve as the starting point for the formula, providing an RT_{average} starting point of 2 weeks. I am not sure how to incorporate this into the formula, or how to get the formula started seeing how it is dependent on a previously calculated point. Link to comment Share on other sites More sharing options...

Administrators Teddy Posted December 1, 2022 Administrators Share Posted December 1, 2022 Maren, I recommend trying to avoid setting the problem up in a way that it depends on an initial value if you can. Initial values lead to excessive calculations because it will need to calculate from the initial value to your current window. If finding the instantaneous residence time and averaging that over an hour is an option, it would be much more performant even when including mass weighted averaging. If you still want to go down the initial value route you will want to look at the reduce() function in formula. Regards, Teddy 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 account## Sign in

Already have an account? Sign in here.

Sign In Now