Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
samplestream:example [2024/04/25 22:35] optrix |
samplestream:example [2024/04/25 23:50] (current) optrix |
||
---|---|---|---|
Line 3: | Line 3: | ||
{{cupcakelag.png}} | {{cupcakelag.png}} | ||
- | In this case, we're going to ask for both the **oven temperature** and **final colour** on a cupcake-making machine. These two pieces of equipment are 50m apart from one-another. | + | In this case, we're going to ask for both the **oven temperature** and **final colour** on a cupcake-making machine. These two pieces of equipment are 50m apart from one-another. |
+ | |||
+ | ===Example Chart=== | ||
+ | |||
+ | This is what a chart of our temperature and colour | ||
+ | |||
+ | {{linechartbakerynormal.png}} | ||
+ | |||
+ | If we wanted to report on cupcake quality and get insight into //why// the quality was low, we can make this much clearer by compensating for the lag. | ||
+ | |||
+ | ===Identify Key Elements=== | ||
+ | |||
+ | First, we determine the [[source|source of our lag]]. The real source is // | ||
+ | |||
+ | The **speed of the conveyor** is perfect for this - it's a rate of // | ||
+ | |||
+ | Next, we determine our [[end asset|end asset]]. In this case, the last asset in the system is the **Inspection Section**. | ||
+ | |||
+ | Finally, we want to measure our [[distance|distances]] between each asset and our end asset. From the diagram at the top of the page, we can see that the distance between the Oven and the Inspection Station is **50m**. | ||
+ | |||
+ | ===The Code=== | ||
<code python> | <code python> | ||
- | srv = ardiapi.Server(' | + | srv = ardiapi.Server(' |
lcq = samplestream.LagCorrectedQuery(srv) | lcq = samplestream.LagCorrectedQuery(srv) | ||
- | lcq.RateLagQuery(' | + | lcq.RateLagQuery(' |
- | lcq.AddQuery("' | + | lcq.AddQuery("' |
- | lcq.AddQuery("' | + | lcq.AddQuery("' |
lcq.multiplier = 0.0166 | lcq.multiplier = 0.0166 | ||
lcq.shavems = True | lcq.shavems = True | ||
Line 28: | Line 48: | ||
This line tells the class that we are going to correct for lag based on the //Speed// property from our // | This line tells the class that we are going to correct for lag based on the //Speed// property from our // | ||
- | | + | |
- | This line adds a query for the 'darkness' of our cupcakes, measured at the **Inspection Station**. This station is our [[end asset|end asset]] (the machine at the end of our process), so we won't include a lag for it. | + | This line adds a query for the 'brownness' of our cupcakes, measured at the **Inspection Station**. This station is our [[end asset|end asset]] (the machine at the end of our process), so we won't include a lag for it. |
| | ||
Line 38: | Line 58: | ||
We then send a request for the last hour of data. | We then send a request for the last hour of data. | ||
- | ----- | + | ===The Results=== |
In our results, we get the following... | In our results, we get the following... | ||
Line 46: | Line 66: | ||
|1.2|62%|132.0| | |1.2|62%|132.0| | ||
|2.4|61%|131.9| | |2.4|61%|131.9| | ||
- | |3.6|55%|120.2| | + | |3.6|60%|131.8| |
- | |4.8|60%|131.7| | + | |4.8|55%|120.7| |
|6.0|62%|131.6| | |6.0|62%|131.6| | ||
- | You'll notice that you don't have a //time// index anymore in the resulting dataframe. Instead, you've got a total amount of whatever you're measuring as a //rate// or // | + | You'll notice that you don't have a //time// index anymore in the resulting dataframe. Instead, you've got a total amount of the [[source|source of lag]] seen (in this case, it's meters |
===What It Means=== | ===What It Means=== | ||
- | Originally, a chart of our values looked like this... | + | Reading |
- | + | ||
- | {{linechartbakerynormal.png}} | + | |
- | + | ||
- | Where people may certainly | + | |
But after lag compensation, | But after lag compensation, | ||
Line 64: | Line 80: | ||
{{linechartbakerysync.png}} | {{linechartbakerysync.png}} | ||
- | Each of the values are synchronised - so when **meters** is 0, we're seeing | + | Each of the values are synchronised - so when **meters** is 0, the level of browning |
+ | |||
+ | Looking at the data, you'll see a drop after 4.8m. **Both** the darkness and oven temperature decreased. This makes the correlation extremely obvious. | ||
- | Looking at the data, you'll see a drop at 3.6m into our data. Both the darkness and oven temperature decreased. | + | It also helps when dealing with noisy data. Variables are often influenced by a variety of different factors, which makes spotting root-causes difficult. But by correcting for lag, these relationships become **much** clearer, even for people unfamiliar with your system. |
- | If this was a normal query or trend, these two events would appear 5 minutes apart, making it awkward to clearly display that the issues are related. | + | ===Going Further=== |
- | But by compensating for the lag between | + | You can extend this even more by using ARDIs relationships and storing |
+ | See an [[adaptable_example|example of an adaptable solution]] for details. |