Calculating difference of signals over two capsules

Recommended Posts

Posted (edited)

I have two pressure curves for two different periods (2 capsules). How can I calculate the difference between these two curves? So I want a graph where I can see the momentary differences between these two curves.

So this is the pressure value of 2 batches, and I would like to see a difference signal.

Edited by John Brezovec
formatting
Share on other sites

• John Brezovec changed the title to Calculating difference of signals over two capsules
• Seeq Team

Here are two ways to calculate the difference between the signal values during the two capsules. I am assuming you have one signal and one condition that has two capsules.

Using Reference Profile

The first method involves using the Model & Predict > Reference Profile tool to create a "duplicate" of the signal, and overlay it during each capsule. Since you only have two capsules, you will effectively take the signal values during the first capsule and overlay it onto the second capsule. Then, you can use Formula to calculate the difference between the original signal and the reference profile signal.

The key for this approach is to set the training window so it only includes the first capsule. Make sure to set a gridding period appropriate for your signal. Then you can select Average as the Reference Statistic (since only one capsule is in the training window, the average will be equal to the signal values during that one capsule).

Now you should have a "duplicate" of the signal during the first capsule during the time of the second capsule. Open Formula and calculate the difference: \$originalSignal - \$referenceProfileSignal.

Note that reference profiles will grid the result. You can increase or decrease the gridding resolution as needed.

Using Formula Only

This method involves using the move() function to create a new signal that matches the signal values of the first capsule and moving those values to the second capsule. Then, calculate the difference. The key for this approach is getting the duration between when the first capsule starts and when the second capsule starts. Let's assume the two capsules are less than 100 hours apart:

```// Adjust this value if the two capsule start times are more than 100 hours apart.
// This value can be approximate but should be greater than the actual duration.
\$timeDelta = 100h

// Create a signal that is the duration between the start of capsule 1 and the start of capsule 2
\$durationToMove = \$condition.growEnd(\$timeDelta).removeLongerThan(\$timeDelta-1).toSignal('Duration')

// Create a signal that moves the original signal by the duration between the capsule start times
\$movedSignal = \$signal.move(\$durationToMove,\$timeDelta).within(\$condition)

// Calculate the difference between the original signal and the moved signal
\$signal - \$movedSignal```

• 1