How to do prediction using dates in ignition

Thanks for all for your replies… I will try to implement knowledge shared by all… If any difficulty i will face i wil get back to you

How did you get this formula? it seems rather basic to predict something like that... where are the material constants like heat resistance?... you sure you are calculating something usefull here?
predicting matrial degration usualy isnt that simple...

Also loop over it untill you find the answer really? that is fundamentally wrong, sorry, this is a maths, you should not have to try out every single day to find the answer but you should convert the equation... Idk what you are trying here but i dont think anything is correct, sorry

1 Like

Yaa i will try to find a perfect solution

This may be fairly simple, but you need to be looking at two or more previous values to determine rate of change over some known time period.

For example, you mentioned b = 500 on 7/1/2020. To predict when you would reach 600, you would need to know how b is changing over time. So, let’s say you measured b again on 7/2/2020 and got b=510. This would tell you the rate of change on b is 10 for a 1 day period. To do the calculation, then you would say what is the difference between your trigger point (600) and the current value (510) divided by the rate of change (10): (600 - 510)/10 = 9

So we found the period is 9 based on the 2 dates values, and we know the period is 1 day (we set this), so the total time is 1 day * 9 periods = 9 days from the last value, 7/2/2020, or 7/11/2020.

I think you can do this a number of ways, but if you want it real-time, I think you could do this with 3 tags: TagValue, PredictionDate, SetPoint

SetPoint - What is the value we are attempting to predict will occur.
PredictionDate - This is the prediction date for when we would hit the SetPoint.
TagValue - You would use a Tag Event Script and fire on a Value Change. In this event, you have the previous value and the current value. You would set this tag’s scan class to be a known interval, say 1 day. When the event fires, you would take currentValue - previousValue and store to a local variable. This is the rate of change. Then, calculate the difference between SetPoint and currentValue to get the difference between them and divide by the rate of change to get number of periods. Next, multiple number of periods by the scan class (1 day) to get total days. Finally, using some built in date functions, add those days to the current date, and update PredictionDate with this new value.

FYI, this all depends on the fact that the value would always change by even a small amount. Otherwise, adding some other “triggering” tags or something would be necessary so if the value didn’t change, but we moved a day, then theoretically, the date would need to adjust, but because you have a 0 rate of change, it would result in a DIV/0 error, so would want to figure out how to handle that case, or set the max predicted date to something like 1 year out. Anyway, hope that helps get the thought process going.

1 Like

This is where linear regression comes in as @JordanCClark mentioned, or other methods for determining the equation that approximates the trend line using captured data points. The more points you have, the better the approximation can be, assuming the process is predictable. A simple linear equation derived from 2 points will likely not be very accurate for real-world applications.

@prasath.t do you have a screenshot of the trend of your data?

2 Likes

trends like these usualy are not linear, so you will need quite a few datapoints to find the right equation.
atleast his formula did have a power in it so thats something xd

And i doubt the temprature change would be noticable every day, and then might also even go down some days too.
The thing is, isnt this something the coating company/product should already have done?
Unless this is a very new technology, there already should be tons of data about how long their product lasts, so why are you trying to reproduce their years of testing?

Some functions here are no longer needed, since we now have newer versions of Jython (we were at v2.2 when I started this). But, I did manage to squeeze in a simple linear and polynomial regressions.

1 Like

Probably, but the estimates are usually fairly conservative, with a YMMV caveat tossed in for good measure.

True, still should be something to use to check the prediction against, if its way off there probably is something wrong with it^^

if you function is correct you can solve it with maths i guess...
you can try run these and see if it give you any reasonable number of years, but i doubt it.

Max A * Temperature ^ Max B * (Time Actual - Time n-1)/365

x = (temprature^(-maxb) x(73x maxa x timenow x temprature^(maxb) - 100))/(73 x maxa)

if you forgot to add brakcets (which seems like a more logical complex funtion) like this:

Max A * Temperature ^ (Max B * (Time Actual - Time n-1)/365)

x = (365 x maxb x timnow x log(temprature) - log(500/maxa))/(365 x maxb x log(temp))

1 Like

I will check this one

Thanks will check this function

Trend willbe some thing like this

Thanks will try to implement and check this one

its called exponential ^^

2 Likes

@prasath.t ok then you should be starting with Y=Ae^(kt) where e is the natural number, t is time, and k is your growth rate, and A is your starting temperature. You will be solving for k.

Then you should back test this model again past iterations and see how well it compares.

3 Likes

Did you stick with the general equation Y=Ae^(kt) or did you export the data to excel for someone to work on?

What did you determine in your experience?