Jump to content

Dan FR

Seeq Team
  • Posts

    4
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Dan FR

  1. That sounds interesting and I'm glad to hear you were able to find a good stable period! It makes sense that there would be gaps in the formula output, as we are only considering data within the 150 and 320 limits. Anytime the signal is outside of the 150 and 320 limits there would be a gap in the calculated signal.
  2. Hi Jan, I can help you out with this. Could you provide more details about your goals for this analysis? You mentioned you want to find the time span where range of your signal within a fixed period is smallest. Do you just need to identify that period or do you also want to trend or visualize this signal deviation over time? To get you started, here's some example code for Formula Tool to calculate the range of your signal within a periodic condition. This will output a signal representing the range of your initial signal '$s' within each 4-hour period and whenever the signal is within your specified limits. // Condition defining when signal $s is within limits. This can optionally be created using the Value Search tool. $withinLimits = $s.isBetween(150, 320) // Periodic condition every 4 hours. This can optionally be created using the Periodic Condition Tool. $periodic = periods(4h, 4h) // Combine the periodic and limit conditions. This can optionally be created using the Composite Condition Tool. $combined_condition = $withinLimits.intersect($periodic) // Calculate the signal range over each 4 hour period whenever signal is within limits. $signalRange = $s.aggregate(range(), $combined_condition, durationKey()) $signalRange In this example, we use the '.aggregate()' function with 'range()', which computes the difference between the maximum and minimum values of your signal within the associated condition. Alternatively, you can calculate the Standard Deviation by swapping in 'stdDev()' in place of 'range()'. Depending on your requirements, we could also compute this using rolling 4 hour windows and then search for the specific 4 hour period where your deviation is lowest. Hope this helps! Dan
  3. Hi Sam, Thanks for your response and the additional information. To create the table you need, we can utilize the transform function along with a capsule expression to iterate through each product run capsule. Within this loop we will calculate the previous year averages and dynamically set these to capsule properties based on the Product ID. If you're not familiar with transforms and capsule expressions, here is a good Tips and Tricks article. Below is an example of formula code you can integrate with your existing Product Type signal to condition formula. // existing $product_type.toCondition('Product ID') code here ... // I am assuming this is defined as $product_condition // if necessary, define your measurement signals filtered for $good_runs $a_good = $a.within($good_runs) $b_good = $b.within($good_runs) $b_good = $b.within($good_runs) $months = months() // monthly periodic condition // Loop through each capsule in $product_condition and calculate last year's measurement averages $product_condition.transform($capsule -> { $productid = $capsule.property('Product ID') // get Product ID from the current capsule // Extract a monthly capsule from $months one year prior to the current capsule. Note that your current capsule could span two months. // .first() selects the month based on the start month of the capsule. Change this to .last() if you want the ending month. $previous_year_month_capsule = $months.toGroup(capsule($capsule.startKey()-1y,$capsule.endKey()-1y)).first() // Calculate scalar averages over the previous year month capsule, filtered for current product ID $a_avg = $a_good.within($product_condition.keep('Product ID', isEqualTo($productid))).average($previous_year_month_capsule) $b_avg = $b_good.within($product_condition.keep('Product ID', isEqualTo($productid))).average($previous_year_month_capsule) $c_avg = $c_good.within($product_condition.keep('Product ID', isEqualTo($productid))).average($previous_year_month_capsule) // Set averages as capsule properties $capsule.setProperty('Previous Year Month Average A', $a_avg) .setProperty('Previous Year Month Average B', $b_avg) .setProperty('Previous Year Month Average C', $c_avg) }) From here, create a Condition Table and use the Columns selector to pick each of the Capsule properties you want in the table. Here's an example of how you might set up the Condition Table using the Example >> Batch Data >> Reactor 1 data source: We'll mostly ignore my previous reply 😅 - helpful if you want the previous year average signals for analysis but not for the table filtered by Product ID. Hope this helps! Dan
  4. Hi Sam, Thanks for your questions. I have a partial answer for you, but I'll need to follow up regarding Product ID grouping. To find the previous year's monthly averages under good run conditions, you can try the following within Formula Tool. Assuming '$good_runs' is what you have defined as your composite good run condition and '$monthly' is a monthly periodic condition: // keep signal $a only when $good_runs is true $a_cleansed = $a.within($good_runs) // shift our cleansed signal to represent data from one year prior $last_year_cleansed = $a_cleansed.move(1yr) // Aggregate the shifted signal to calculate monthly averages. This step can optionally be completed using the Signal From Condition Tool $last_year_monthly_avg = $last_year_cleansed.aggregate(average(), $monthly, durationKey()) // return final computed monthly average signal $last_year_monthly_avg Let me know if that helps. Unfortunately, grouping by Product ID in Workbench isn't straightforward and will likely require a datalab script. Could you share the format of the Product ID data in Seeq - ie. is it a string signal, capsule property, etc.?
×
×
  • Create New...