How to do prediction using dates in ignition

Hi,

I have a value b = 500 created in table with date 07/01/2020
i have value 600

if my b value reaches greater than 600
i want to find the exact date when my value changed
how to do my predicition

can any one give me script or idea please

You need to be more descriptive. How does value b change?

For instance you could track it in your audit log possibly.

Or the ideal way would to be create an alarm for b. And set a notification pipeline to inform you when it triggers.

What is value b?
how does value b change?
How do you need to track or be notified of value b changing?

1 Like

value b will change according to my calculation

i am doing a calculation like example
pervious record date = 07/01/2020
insterting record date = 08/0/2020
difference between the record is 30 days and i adding and dividing some value so b value change
like wise i am while inserting b value change for each row

but i want to find the when b value will became greater then 500 (note: 500 is constant)
is there any way to run loop until my exact date is found?

my idea is currrent date is 07/01/2020
if i add one year 07/01/2021
difference in date is 365 days and some calculation to get b value

i will check b > 500 or not
if it is greater than i have to check which month and week and date exactly b value change

how to run loop for this one?

i want to insert record which date when b value change… until that i have to run loop and check

Would you be able to post your code. It’s very hard since I don’t know what your math is like.

Again, if you want to know when b reaches this value. make b a tag and setup and alarm for it.

what do you want to happen when said date is found?

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

this is the formula… i will get max a and max b and temperature value from tag … difference between the time 30 days for example and divide by 365
i will get b value

i want to run the loop and until b> 500

note : 500 is constant

then only i want to insert record to table

when date is found i want to insert record to tabel

i don’t know how to run loop to check the condition… which exact date is b value changing

i want to predict it this date the value b value becomes greater than 500

please help me out in this… to check this condtion

see this article https://docs.inductiveautomation.com/display/DOC79/Conditions+and+Loops

it explains scripting if conditions in ignition.

1 Like

Imo an alarm should be an alarm, not used for other things. I would make it a tag and use a tag change event handler to check its value.

I'm still quite confused what the end goal is though. I'll have a better read in a bit and come back to this

yaa please read my all post. you will uunderstand

What is the purpose of what you’re trying to do ?

I’ve read everything and I’m still not sure I understand…

Let me try, though:
You have a variable that depends on a date/time, and you want to process that variable with an expression/formula to predict when that variable will reach a certain value, and insert that date/time into your database.
Is that correct ?

2 Likes

exactly thats is what i want

predict the value change… its furnace module… so i want to predict the coating change in future. in which date coating is changing one coating to another

Do you already have a linear approximation model or similar for predicting future temps based on current temperatures? Or do you have enough data to where you can formulate one? For this predictive model you are trying to build to have any value it should be accurate to some degree and only you can come up with that based on your historical data you have on your hands.

At the very least, the easiest model seems to be to get the current temperature differential per minute/hour or whatever is most appropriate for your furnace (I have no idea how long it takes your furnace to heat up), and use that in a y=mx+b to solve for when you would expect to hit 600.

3 Likes

Coming in late to the party. Not much to add yet,

  • Are A, B and Temperature coming from tag histories?
  • Would a linear regression be helpful?

EDIT: Looks like Brian and I are on the same page. :slight_smile:

2 Likes

Haha yea. Fact of the universe is that most things, especially when you “zoom” in, are at least pretty well approximated by a linear function or group of linear functions. Definitely the best place to start.

If I recall calc 4 correctly there are some differential equations related to heating/cooling that might be useful, but the extra degree of accuracy you get from that might not be worth all the extra coding/math you’d have to do. I would most definitely start with linear approximations/regression.

1 Like

When tag hits value insert record into table to track date value was hit. Unless I mis understood that sounds like an alarm to me. He could have an alarm journal showing each time b hits 500. Unless he wants to do something other than display data.

1 Like

If it's to predict when to recoat the inside of the furnace, then dead naught accuracy probably isn't needed.

This is a nice example of wanting to do predictive maintenance, though.

I barely remember college in general.

3 Likes