Jump to content
  • To Search the Seeq Knowledgebase:


Search the Community

Showing results for tags 'formula'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Community Technical Forums
    • General Seeq Discussions
    • Seeq Admin Forum
    • Training Resources
    • Product Suggestions
    • Seeq Data Lab
  • Community News
    • Seeq Blog Posts
    • News Articles
    • Press Releases
    • Upcoming Events
    • Resources


  • Seeq FAQs
  • Online Manual
    • General Information

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



About Me



Level of Seeq User

  1. Summary Chain View enables a nice visual of all the time periods stacked side-by-side; however, sometimes it is useful to create a new signal from all these capsules that has been scrunched together. This avoids the maximum limit of how many capsules can be shown in Chain View. Note this is different from "time warping" which realigns the samples by some amount. Signal scrunching keeps the relative sample alignment the same within each capsule - but it does move each "snippet" of the signal next to each other. Steps Here is a screenshot of all the signals and conditions needed for this analysis. Add signal to the display with the specified time range. Create the time periods, condition capsules, of interest. Using the Custom Condition tool, create a new capsule that surrounds all the capsules containing the data for the new signal. Note, the signal will start at the beginning of this capsule. Create Inverse of the time periods of interest that occurs within the 'Condition for New Signal'. This will be used to calculate the time lag between the capsules in the 'Condition for Time Periods of Interest'. $cftp.inverse().removeLongerThan(1wk).intersect($cfns) Create the signal snippets that occur only within the 'Condition for Time Periods of Interest' and the 'Condition for New Signal'. $t.within($cftp.intersect($cfns)) Create a new signal to calculate the delay between each of the 'Condition for Time Periods of Interest' capsules. 1.toSignal().aggregate(totalized(), $icfc, startKey()).convertUnits('h').toStep() Create a running sum of the delay - this will be used to shift all the snippets to the beginning of the 'Condition for New Signal' capsule. $dbtp.runningSum($cfns) Scrunch the signal. $ts.delay(0-$rsod, 1wk)
  2. In some cases you may want to do a calculation (such as an average) for a specific capsule within a condition. In Seeq Formula, the toGroup() function can be used to get a group of capsules from a condition (over a user-specified time period). The pick() function can then be used to select a specific capsule from the group. The Formula example below illustrates calculating an average temperature for a specific capsule in a high temperature condition. // Calculate the average temperature during a user selected capsule of a high temperature // condition. (The high temperature condition ($HighT) was created using the Value Search tool.) // // To prevent an unbounded search for the capsules, must define the search start/end to use in toGroup(). // Here, $capsule simply defines a search time period and does not refer to any specific capsules in the $HighT condition. $capsule = capsule('2019-06-19T09:00Z','2019-07-07T12:00Z') // Pick the 3rd capsule of the $HighT condition during the $capsule time period. // We must specify capsule boundary behavior (Intersect, EnclosedBy, etc.) to // define which $HighTcapsules are used and what their boundaries are (see // CapsuleBoundary documentation within the Formula tool for more information). $SelectedCapsule = $HighT.toGroup($capsule,CapsuleBoundary.EnclosedBy).pick(3) // Calculate the temperature average during the selected capsule. $Temperature.average($SelectedCapsule)
  3. FAQ: I've got a signal with drop-outs and I want to filter my signal to only visualize samples with values above a threshold. Is there a quick way to do this in Seeq? Solution: We can use Seeq's Signal Filtering capabilities to break down a signal into individual samples and create a new signal that keeps the samples only above your specified threshold. 1. Visualize your signal with drop-outs and determine the threshold value. For this example, we will filter out all samples with a value of less than or equal to 40F. 2. Open a new Seeq Formula window and use the search documentation to look for information on filtering a signal. When we begin to type filter, we see right away an option "filter() Signal". Open the documentation to get an understanding of what the function is doing and example syntax. The first example below is taking a string signal and breaking it down into samples, then keeping samples only if their string value is not equal to 'T4A' (note single or double quotes are required for string inputs). The second example is filtering to remove infinite values or NaN values. The first logical statement "$sample.getValue().isValid()" is keeping only the samples with valid values, removing NaN or other invalid values. The second logical statement "$sample.getValue().isFinite()" is keeping only the samples with finite values. Note that we can string as many logical criteria together as we want here using the && operator. In our case, we want to filter our temperature signal to show only samples with values above 40F. The syntax in the formula input window below "$Temp.filter($sample -> ($sample.getValue().isGreaterThan(40)))" shows how we are able to take our temperature signal, break it down into individual samples, and then only keep samples whose value is greater than 40F. The new filtered signal appears nearly exactly the same as the original, but with the drop-outs removed.
  4. We often do calculations where we are interested in having one result if one condition is true and a second result if another condition is true. In this post we will discuss how to do this calculation in Seeq. We will create a new single signal which runs different calculations during different periods of time. This technique can be used to replicate "if" logic or "if / else" logic currently being used in excel. Example existing code from excel or other systems IF Temperature > 90 then show a result of (Temperature * 100) IF Temperature < 90F then show a result of (Temperature + 10) Step 1: Identify two modes of operation In the Tools tab identify the following conditions using the Value Search tool: Step 2: Use formula to reconstruct "if/then statement" using Seeq's Splice Tool Variables: Name Item Type $Temperature Temperature Signal $HighTempCondition Greater than 90 Condition Seeq Formula: $HighTempCalc = $Temperature * 100 $LowTempCalc = $Temperature + 10 $LowTempCalc.splice($HighTempCalc,$HighTempCondition) Section 1 - $HighTempCalc This is the first arbitrary calculation which is to be run during periods of high temperature Section 2 - $LowTempCalc This is the first arbitrary calculation which is to be run when NOT in periods of high temperature Final - $LowTempCalc.splice($HighTempCalc,$HighTempCondition) Combine your two series. Use the LowTempCalc series, unless you are in the High Temperature condition, in which case use the HighTempCalc
  5. FAQ: How do I put a pump curve in Seeq? As of R21.0.44.00 this can be done the with the scatter-plot tool. This method does require version R21.0.44.00 or newer to work. See the steps below for details. Determine the X&Y components of the curve. This can be done with a tool such as https://apps.automeris.io/wpd/. Enter or paste the components in columns A and B in the CurveFitter excel sheet. See screenshot below for details. The CurveFitter file can be found here. CurveFitter.zip Once the new Flow and Head data has been pasted into excel copy the contents in from D2 to E9 and paste them into the Seeq formula tool. See screenshots below for copy paste details Copy: Paste: Paste the following syntax in the same formula under the coefficients. Be sure that the flow signal has the variable name “$flow”. $f=$flow.remove($flow.isNotBetween($lower,$upper)).setunits('') $coeff4*$f^4+$coeff3*$f^3+$coeff2*$f^2+$coeff1*$f+$const Final formula view: Add the line to the Scatterplot by selecting the f(x) in the Scatterplot tool bar and pick the correct item from the select item dropdown. If adding more than one curve, then click on the item properties “i” of the first curve and click on duplicate. Once in the formula tool copy the new coefficients from excel replacing the old one and hit execute. Follow step 5 to add the curve to the plot. Final View:
  6. Use Case: It is common in industry to seek to use the behavior of upstream process variables to predict what the behavior of a downstream variable might be minutes, hours or days from the present time. Solution: A traditional predictive modeling workflow can be applied to solve this problem. Identify an appropriate training data set Perform any necessary data cleansing Create a predictive model Evaluate the model fit Improve the model Operationalize the model What differentiates this use case from any other predictive modeling use case is a specific data cleansing step for adjusting signals to remove process lag. 1. Load Data Load your target signal and the relevant upstream signals into the display pane. In this example, the target signal is the product viscosity, measured in an analytical lab based off a sample from a downstream sample point. Three upstream signals: the reactor temperature, reactant conversion, and viscosity modifier flow to the reactor significantly influence the product viscosity measurement and will be used as inputs into the model signal. 2. Identify Training Data Set Identify an appropriate training data set for your regression model. This may involve a longer time window to include variability in product type or seasonality. In this example, we will pan out to 3 months to capture multiple cycles of different product types. With an appropriate training window identified, you can also limit your training data set to a subset of samples present during a particular condition. If this interests you, consult the "advanced options" section of the Prediction Tool KB article for more information. This method is particularly useful if you're wishing to create different models for different modes of operation. 3. Cleanse Signals -- Adjust for Process Lag We can time-shift our upstream signals using either a known constant delay, a known variable delay (like a calculated residence time signal), or an unknown delay of maximum correlation to the target signal. The first two of these options will utilize the .move() function in Formula (or .delay() in earlier versions of Seeq). The latter will utilize the .correlationOffset() function. In this example, we have a known lag of 1.5 hours between the reactor and the product sampling point. We will use the move function with an input scalar of 1.5h, as shown below. The time shift calculation should be applied across all relevant input signals. More information on the different options for time shifting signals using fixed, variable, or calculated offsets is available in this forum post: 4. Cleanse Signals -- Remove signal noise, outliers, abnormal operating data In this example, we apply an agileFilter to each of our time-shifted model input signals. Apply the same technique to each of the model inputs. Note that steps 3 & 4 could have been combined into a single formula. An example of this would be: $reactor_temp.move(1.5h).agileFilter(1min) For guidance on additional cleansing techniques, consult the Interactive Training. 5. Build the Predictive Model Use the Prediction tool panel to create a model of your target signal based on your cleansed, time-adjusted input signals. Ensure your model training window matches the date range that you identified in step 2. You can view the model parameters like coefficients, rSquared, and p-values using the "+ Prediction Model" option. 6. Evaluate the Model Fit Use Scatter Plot view and the model parameters to evaluate the goodness of fit of the model. Switch to a time range outside of your training data set to ensure your model is a good fit for data throughout time. 7. Improve Model (as needed) If the scatter plot indicates a non-linear relationship, test out additional model scales in the prediction tool panel. Consider eliminating variables with p-values higher than your significance level cutoff (frequently 0.05). Add additional variables if relevant. If distinct modes of operation introduce significant signal variability, consider creating a model for each operating mode and stitch the models together into a single model using the splice() function in Formula. 8. Deploy the Model The model should project out into the future by the amount of the process lag between the upstream and target signals.
  7. FAQ: I have a condition for events of variable duration. I would like to create a new condition that comprises the first third of the time (or 4th, or 10th) of the original condition. Solution: A stepwise approach can be taken to achieve this functionality. 1. Begin with your condition loaded in the display pane. 2. Create a new Signal using Signal from Condition that calculates the total duration of each of your event capsules, interpolated as a step signal. 3. Create a new signal that is your total event duration multiplied by the proportion of the event that you would like to capture. e.g. for the first 1/3 of the event, divide your total duration signal by 3, as shown below. 4. Create an arbitrary discrete signal with a sample at the start of each of your event capsules. 5. Shift the arbitrary discrete signal in time by the value of your signal calculated in step 3. In this example, the 1/3 duration signal. Note, depending on your version of Seeq, the function to do this may be called move() or delay(). 6. Use the toCapsules() function in Formula to create a tiny (zero duration) capsule at each of your shifted, discrete samples. 7. Join the start of your original condition with the capsules created in step 6 using the composite condition tool.
  8. FAQ: I have a CSV file that has the start and end times of some historical events and various information about the events that I would like to use in my analysis in Seeq. How do I go about getting these events and all of their associated information into Seeq? Solution: Use the Import from CSV tool and Seeq Formula to bring in a condition comprised of each of these events and assign the data in each column of the CSV as a property of the condition. 1. Ensure your CSV file is formatted correctly for import into Seeq. The first column should be the event start time, the second column should be the event end time, and all other data columns should be to the right of these. A list of acceptable timestamp formats can be found on the Seeq Knowledge Base in this article. 2. Use the Import CSV File tool to bring the condition into Seeq. Drag and drop your CSV file or navigate to your file through Windows (Mac) Explorer. Under "Import File as" select "condition". Choose the start-time and end-time columns in the "Choose columns" section. Specify a max capsule duration that is just longer than your longest event. 3. Once your condition is imported, use Seeq Formula to assign the data from the other columns of our CSV as properties of each capsule. Begin by using the item properties for the CSV imported condition to duplicate the condition to Formula. Once in Formula, add the column headers from your CSV to the query in line 1 of the code, separated by commas. Then use the setProperty() function to assign each of the columns of the CSV as a property of each capsule. Once executed, the output is a new condition that looks exactly like the original from trend view in the display pane. However, this new condition has properties, that can be added to the capsules pane using the gridded+ button.
  9. FAQ: I have a signal with a gap in the data from a system outage. I want to replace the gap with a constant value, ideally the average of the time period immediately before the data. Solution: 1. Once you've identified your data gaps, extend the capsules backwards by the amount over which time you want to take the average. In this example, we want to fill in the gap with the average of the 10 minutes before the signal dropped, so we will extend the start of the data gap capsule 10 minutes in the past. This is done using the move function in Formula: $conditionForDataGaps.move(-10min,0min) 2. Use Signal from Condition to calculate the average of the gappy signal during the condition created in step 1. Make sure to select "Duration" for the timestamp of the statistic. 3. Stitch the two signals together using the splice function. The validvalues() function at the end ensures a continuous output signal. $gappysignal.splice($replacementsignal,$gaps).validvalues()
  10. I have an interesting question that I need some assistance on. We have a signal that generally has no dominant frequency. However, it sometimes does get a dominant frequency and when it does, we are really interested in two things: What is the dominant frequency? How dominant is it? ( Let's call this "magnitude." ) Tracking both the dominant frequency and the intensity over time using a rolling 2 to 3 hour window every 5 minutes. This value has predictive capability when it does show up, and it intensifies as it gets closer to a particular event we are trying to predict. I've been able get the peak frequency because the formulas are clear enough to figure this out. The problem is the magnitude. The "Frequency Analysis" panel results show something like this: How do I get that peak value? I don't want to have to specify a hard-coded frequency band for this. The problem is that I don't see a function for that. I can call the fft() function in a way in which it returns a "Table" type. signal.fft ( bounds , period , units ) : Table Create a table of frequency magnitudes by analyzing the signal in the bounds. The table will have 2 columns, frequency and magnitude. Then I can use the top() function to return the top 1 row ordered by the greatest "magnitude" column: table.top ( limit , columnName , direction ) : Table However, I cannot for the life of me figure out how to get the "mangitude" value out of the first row returned in "Table" the above function and convert it into a sample at the ending point of the rolling 3 hour/5min period. Is this even possible. Is there a better way? // Getting a rolling 3 hour window every 5 minutes. $periods = periods(3h, 5min) // for condition, get a signal with samples ending at each capsule representing: // key: end of 3hr window // value: peak magnitude of the fft of the $waveSignal $periods.transformToSamples( $cap -> { // excute the expression for each capsule in condition. $tbl = $waveSignal.fft($cap, 1s, 's') // want the results in period lengths, not frequencies. // get the largest magnitude, filtering for the frequency/period length range of interest // get the first row of that table. $r = $tbl.filter('frequency'. isBetween(30s, 150s)) .top(1, 'magnitude', 'desc') .getFirstRow() // *******HOW DO I DO THIS???****** // convert that magnitude calculated to sample located at the end of this capsule. sample($cap.getEnd(), $r.get('magnitude')) } ) Thanks in advance! Even better would be: getting the sum of the values in the peakFrequency +-/ 2s window.
  11. Various parts of the world display date and time stamps differently. Often times, we get requests for changing the order of month and day in the timestamp string or to display the date as a Scorecard metric in a specific format. This can be done using the replace() operator in Formula. For example, let's say we wanted to pull the start time for each capsule in a condition and display it as mm/dd/yyyy hh:mm format: $condition.transformToSamples($cap -> Sample($cap.getStart(),$cap.getProperty('Start')), 1d) .replace('/(?<year>....)-(?<month>..)-(?<day>..)T(?<hour>..):(?<minute>..):(?<sec>..)(?<dec>.*)Z/' , '${month}/${day}/${year} ${hour}:${minute}') This takes the original timestamp (for example: '2019-11-13T17:04:13.7220714157Z') and parses it into the year, month, day, hour, minute, second, and decimal to be able to set up any format desired. The various parts of the string can then be called in the second half of the replace to get the desired format as shown above with ${month}/${day}/${year} ${hour}:${minute}. From there, you can either view this data in the trend or use Scorecard Metric to display the Value at Start in a condition based metric. If the end time is desired instead of the start, the only changes needed would be to (1) switch the .getStart operator to .getEnd, and (2) switch the .getProperty('Start') to .getProperty('End'). Note: The '1d' at the end of the 2nd line of the formula represents the maximum interpolation for the data, which is important if you want to view this as a string signal. This value may need to be increased depending on the prevalence of the capsules in the condition.
  12. Hello, I am trying to create a polynomial formula using the formula tool but I get the following error message "t is not compatible with t² at" with 'add' or 'subtract' after. Same with t² and t³. How can I create such formula? Example: 2 * $a^3 + 5 * $a^2 - 8 * $a + 200
  13. Hi, Is it possible to calculate the duration of valve opening (from time when change from "close" to "not close" to time when change from "not close" to "close") I've tried to do this by derivative function, but the values are string type. For the period of time, e.g. a year need to receive the number of the scalar values of these periods and then perform some calculations with formula with each of that scalar value.
  14. Hey there, My question splits into two parts: Firstly, I want to create a condition based on multiple criteria: if signal A equal to 3, B equal to 4, C is greater than 5 than condition is valid. I know i could create 3 individual capsule and overlap them. Is there a simple way to use formula to do so? Secondly, in my analysis i have 10 signals and associated conditions(alert), then I want to know in the past 7 days how many alert in total(repeated instance or capsule doesnt count) ? and How long is the total alert time? Thank you
  15. Background: When looking to identify trends or step changes in a signal, we typically recommend an approach of smoothing the signal, taking the first derivative, then identifying when that derivative is positive or negative. This method works well most of the time, but employing this technique in combination with others can be more effective at capturing trends/step changes when the value change in the signal is more subtle. Solution: When looking for step changes, we can use a technique of calculating a range of the signal on a rolling periodic basis and search for when the range exceeds some limit. We can then combine this condition with when the derivative is positive (increasing step changes) or negative (decreasing step changes) to capture our final condition. 1. Create a rolling window over which you will look at the range (max-min value) of the signal. In my example I used a 4h window every 30 minutes, because my tank draining events were typically never longer than 4h. Select the smallest time period that you can that is still longer than your longest draining event. 2. Use Signal from Condition to calculate the range (max-min) of your signal over each of the rolling windows. Make sure to place the time stamp of the statistic at the end of each rolling capsule. 3. Identify time periods when that range calculation is above some threshold. In this example we used a threshold of 2 based looking at the trend output of our step 2. If we zoom in on a smaller range of time, we see that our capsules for when the range value is high actually extend beyond the completion of our decreasing signal. 4. We can intersect this condition that we have identified for high range in the signal with a condition for when the derivative of the signal is negative to capture our desired events. First calculate the first derivative of the signal. We apply a smoothing agileFilter in this step as well to remove signal noise. 5. Identify when that derivative value is less than zero using the value search tool. 6. Now take the intersection of the condition for negative derivative of the level and the condition for high range. The final view of the original signal and the events identified: Use chain view to validate your calculations:
  16. Seeq is often used to contextualize data with respect to production runs. These product runs may be a text or string signal that is the product code, or a very large numerical signal. Users commonly use Value Search to find a specific product run to further analyze. If they want to work with a couple of similar product runs, for example ones that start with or end with the same few letters or numbers, a few Value Searches followed by Composite Condition may be acceptable. This approach may not be realistic if there are hundreds of different product codes to analyze. Recently a user asked for a trim function because they wanted to categorize all product codes by the first few letters the product code. For example, ABC-123-XYZ and ABC-456-DEF would both fall under the "ABC" product category. In Excel, users might use something like the functions LEFT and RIGHT to return the first few characters (LEFT(3) in this ABC example). One way to do this text or string manipulation in Seeq is to use the replace() function with a regular expression. Regular expressions can be intimidating to those who have not used them before, but they can also be very powerful. A little exploration on sites like https://regex101.com can help evaluate what kind of regular expression is appropriate for a specific use case. Given the above example product codes, the below Seeq Formula incorporates a regular expression within the replace() function to parse the string signal by the "-" and then return only the first part of that parsed string based on the "$1". $productcode.replace('/(.*)-(.*)-(.*)/', '$1') I could similarly categorize by the last three characters with a function like $productcode.replace('/(.*)-(.*)-(.*)/', '$3') Once this simplified text signal is available, any other tools can be used in the analysis. If the product code was a very large number instead of a string, apply toString() to benefit from the replace() function. There are often many ways to solve a problem. An alternate approach to categorize product codes like this might be to pair toCapsules() and filter() off the Value property in Formula. Perhaps the best solution is incorporating regular expressions into Value Search like in the example below to create conditions any time the product code starts with ABC (/^ABC.*/) or any time it ends with XYZ (/.*XYZ$/). The slashes here indicate regular expressions should be used, similar to searching with regex in the Data Pane. But this approach is likely not obvious or easy without a little experience with regular expressions. So while regular expressions may feel foreign at first, do not be intimidated! They really can pay off in the long run.
  17. FAQ: I've created a condition for a particular event of interest and now I would like to create a signal that is the running count of these events in a given time period. This analysis is common in equipment fatigue use cases when equipment degrades slowly based on a number of cycles (thermal, pressure, tension, etc) that it has undergone during it's life or since a last component replacement. Solution: We can convert each of these capsules into a signal comprised of a single sample (with value of 1) per capsule, then take a running sum of this new signal over the current equipment life condition. 1) Use Formula to create a signal with a constant value of 1 and a sample every 1 second. (1).toSignal(1sec) 2) Use Signal from Condition to create a new signal with a single sample of value 1 per capsule. Take the average of the "1 signal" during each of the event capsules. 3) Use Formula to calculate the running sum of the 1 sample per capsule signal during the Current Equipment Life capsule. $OneSamplePerCapsule.runningSum($CurrentLife).toLinear(7d)
  18. I have a piece of equipment that regularly goes through cycles and I want to compare the cycles. In this case I know the exact date and time of the equipment runs so I have used the Custom Condition tool to specify my Previous Run and Current Run. Custom Condition allows you to enter dates for the condition you are interested in. This can also be done in formula. To create the condition for my Next Run I used Seeq's formula because this run is currently on going and I do not know the end date. This approach allows me to specify that this condition end at now. condition(2d, capsule('2020-06-01T17:48Z', now())) Now that I have defined my Previous, Current and Next runs I want to calculate the run time of each of those periods. I can do this in Seeq's formula tool using the time since function. This will allow me to create a signal whose value is the time since the start time of a condition. This signal will end at the end of the condition. In this case my time counter will be in hours, if you wanted it in days instead you would change the 1h to 1d. timeSince($condition, 1h) I duplicated this formula three times for my previous, current and next runs. Remember, you can always duplicate a formula by clicking the "i" by item properties. You can compare the run lengths of the 3 runs by putting them on the same lane and same axis. You'll noticed my Next Run has just started so the time since for it is much smaller. Lastly, you can switch to capsule time view to compare the run length as well as different signals over the run. In this case we are looking at the temperature of each run as well as the run length. You could imagine using this approach to monitor heat transfer coefficients, reactor temperature, reactor conversion, or % sulfur removed.
  19. Question: How do I normalize a signal in Seeq? Sometimes it can be helpful to view data on a normalized scale or used normalized inputs in a model. Solution: This solution is posted using R22.0.47 but is applicable to earlier versions. Slight modifications of the formula may be required for earlier versions. 1. Let's start by loading our signal... 2. Next we'll use Formula to create a normalized signal. In Formula we do the following steps Define the time period over which we will do the normalization Calculate the min and max values which occur during that time period Calculate the delta between the min and max Finally, calculate the normalized signal Here is the code snippet if you'd like to copy and paste... $timePeriod = capsule('2019-01-01T00:00-05:00', '2020-01-01T00:00-05:00') $max = $signal.maxValue($timePeriod) $min = $signal.minValue($timePeriod) $delta = $max - $min ($signal - $min) / $delta 3. View the results in Seeq. Note that I optionally created scalar boundaries at 0 and 1 to highlight the normalization of my signal...
  20. Hello Everyone, I hope you are doing well. I need some help with creating a function. I have multiple conditions that I have created that tell me if the equipment is stopped, lag, standby, or other attributes. I want to be able to be able to: ADD Durations for when equipment is stopped and in lag OR when the equipment is stopped or standby. ADD Durations for when equipment is stopped but not in lag or standby. The example variables are in hours. Stopped ($i5) Standby($i6) Lag ($i) I would appreciate the help.
  21. Recently an interesting question came up about converting a number to binary within Seeq. The goal was to convert an integer (0-255) to an 8-bit binary number. This can be done by dividing the integer by 2, 8 times and keeping track of the remainders. More information about binary numbers can be found here. https://en.wikipedia.org/wiki/Binary_number Note: For this conversion to work the input signal needs to be an integer between 0 and 255, also it cannot have units. Below is the formula syntax that will do the conversion. $i=$signal.ceiling().setUnits('') $div1=($i/2).floor() $div2=($div1/2).floor() $div3=($div2/2).floor() $div4=($div3/2).floor() $div5=($div4/2).floor() $div6=($div5/2).floor() $div7=($div6/2).floor() $div8=($div7/2).floor() $rem1=($i/2-$div1).ceiling().toString() $rem2=($div1/2-$div2).ceiling().toString() $rem3=($div2/2-$div3).ceiling().toString() $rem4=($div3/2-$div4).ceiling().toString() $rem5=($div4/2-$div5).ceiling().toString() $rem6=($div5/2-$div6).ceiling().toString() $rem7=($div6/2-$div7).ceiling().toString() $rem8=($div7/2-$div8).ceiling().toString() $rem8+$rem7+$rem6+$rem5+$rem4+$rem3+$rem2+$rem1 Below is a screenshot of the syntax in the formula tool. Result:
  22. As of Seeq R21.044 we have a couple interesting new ways to compare signals in formula! When creating a value based condition, the usual default is the value search tool, but it has always been possible using formula as well, however these functions have typically been limited to signal against scalar comparisons. As of R21.044 however, common math operators like <, <=, >, >=, == (is equal to), != (is not equal to), and && (logical and) are all available for use as signal against scalar, or signal against signal comparisons! Whenever the mathematical condition is met, a condition will be created just like a typical value search, however unlike value search the mathematical operators in formula will also work with two signals. For more information, search for "Comparison Functions for Signals" in your formula documentation. Here are a few examples of these operators in use: Signal and scalar comparison: Signal and scalar comparison with logical and: Signal against Signal: For a full list of whats new in R21.044 check out this KB article: https://seeq12.atlassian.net/wiki/spaces/KB/pages/571375775/What+s+New+in+R21.0.44
  23. In many industries (pharmaceuticals, food and beverage, etc.), mean kinetic temperature (MKT) is used to measure the temperature fluctuations of a material during storage and shipment. Mean Kinetic Temperature is a non-linear weighted average temperature that is set up to provide an impact on product stability. In general, product stability follows an exponential trend with temperature as it is inherently a decomposition reaction of the desired product. Therefore, the mean kinetic temperature takes into account the exponential reaction rate to determine the average temperature weighted by the kinetics of the reaction over time. The formula for mean kinetic temperature is: Where: is the mean kinetic temperature in Kelvin is the activation energy (in kJ mol−1) is the gas constant (in J mol−1 K−1) to are the temperatures at each of the sample points in kelvins to are time intervals at each of the sample points This formula can be inserted into Seeq through a couple of steps: 1. Calculate the time intervals for each of the data points (tn). In many cases these are evenly spaced and the formula simplifies, but in case they are not, this can be calculated in Seeq Formula by creating capsules for each data point and then aggregating the duration of those capsules: $temp.tocapsules().aggregate(totalduration(),$temp.tocapsules(),startkey()).tostep() 2. Calculate the exponential relationship for each sample point (t*exp(-deltaH/RTn)) using Seeq Formula. For this example, delta H was set to 83.14 kJ/mol: $H = 83.14kJ/mol $TimeInterval*CONSTANT.E^(-$H/CONSTANT.R/$temp) 3. At this point, the desired time period to perform the MKT calculation over must be selected. This can be done by creating a capsule with the Custom Condition tool. The desired time period can be as long or short as desired. 4. The next step is to sum the numerator and denominator of the natural log portion of the MKT calculation. These summations across the time period signified in step 3 can be performed with the Signal from Condition tool by selecting the sum statistic, the time period from step 3, and the aggregation at the middle timestamp of the condition. This step should be performed for both calculated signals from steps 1 (time intervals for denominator) and 2 (exponential rates for numerator). 5. Finally, the MKT calculation can be calculated with Seeq Formula: $H = 83.14kJ/mol (($H/CONSTANT.R)/(-ln($TotalizedNumerator/$TotalizedDenominator))) .convertUnits('K') As an example, below is a graph showing this calculation being done over multiple time periods of interest (green capsules at top):
  24. FAQ: I would like to capture the value of a signal at the exact center of each capsule within a condition. Is there a way to do this with Seeq? Solution: 1. Begin with your signal and the condition over which you want the middle value in the display pane. 2. Open a new formula window and use the getMiddles() function to create a zero length capsule at the center of each capsule within your condition of interest. $myCondition.getMiddles() Note, depending on which tool what used to create the red condition shown in your screenshot, you may need to add a max capsule duration during this step as well. If you receive an error saying that the condition needs a maximum duration, try instead: $myCondition.removelongerthan(1d).getMiddles() the 1d in the removelongerthan() function above applies a max capsule duration of 1d to $mycondition. Ensure your max capsule duration is longer than the longest capsule in your condition. 3. Now you can use the Signal from Condition tool to calculate the value of your signal during each capsule of your "middle of each capsule" condition. Note: The statistic you select is not important here because the capsule is infinitesimally small so Average, Median, Value at End, etc will return the same value. The final result in chain view:
  25. Is it possible to create an inverse or NOT capsule? For example, I have capsules that mark equipment failures, I would like a capsule that is the inverse of failure, not failed. The reason I would like to do this is so I can aggregate run hours between failures. Thanks for any pointers! Regards, Ivan
  • Create New...