Jump to content

Help: Average value from signal when a condition is true.


Recommended Posts

Hello,

 

Im working on a project that i need to display a signals average when a condition is true. 

The signal is:

  • WFF FS4H.

The conditions i want to evaluate this signal are the following:

  • CRU 4.0 and down
  • CRU 4.0-4.5
  • CRU 4.5-5.0 
  • CRU 5.0-5.5 
  • CRU 5.5 and up

I know how to display the average of the signal for each time one of these conditions become true. But i want to display the cumulative average of the signal for these conditions during per say a 6 month period. Is this possible? For example below: You can see that these conditions are alternating and intermittent.

image.thumb.png.61cc2b2df440274fa55e894efd312e6c.png

Link to comment
Share on other sites

  • Seeq Team

Hello,

yes this is possible and you can do it in different ways:

  • You can use the Union Operator to unify all these condition into a single one then calculate the average for each capsule. The Formula tool is useful here and forumula should look like: $signal.aggregate(average(), $condition1.union($condition2).union($condition3).union($condition4).union($condition5), startKey())
  • You can also use formula and the splice operator to achieve similar result: $signal.aggregate(average(), $condition1, startKey()).splice($signal.aggregate(average(), $condition2, startKey()), $condition2).splice($signal.aggregate(average(), $condition3, startKey()), $condition3)....

With one of the above methods, you will get the average of your signal for each capsule of the conditions 1 to 5. 

Finally, as you want to calculate the cumulative average, you can apply the runningsum() formula to the result of the previous step.

Let me know if this is helpful.

  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...
  • Seeq Team

Hi Mkuhl70, 

Alternatively, you can use the runningAggregate(average()) function in Seeq Formula to calculate the cumulative average of the signal. Kindly refer to the example below. 

$condition_I_want = $condition1 or $condition2

$sixmonthcondition = periods(6month, 6month)

$signal.remove(not $condition_I_want).runningAggregate(average(), $sixmonthcondition)

 

Link to comment
Share on other sites

  • 4 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...