Emre Hatipoglu Posted May 29, 2023 Share Posted May 29, 2023 Hello, I have a signal which I integrate over a condition. Of course, it starts from zero for each capsule of the condition and integrates. I need to create a signal with two terms being added: Signal=(Integral Signal)+(End Value of the Integral Signal at the Previous Capsule) The signal can reset to zero at the start of each month. i.e. Pin 3 at the screenshot below is placed at the end of the first capsule of the May (it seems like the first capsule extends back to the previous month but it is actually split at the end/start of month), the value is 10.787 h. I want the next integration through the next capsule to shift up in the y-axis by 10.787 h. And the 3rd capsule to shift up by whatever the result of 2nd capsule would be and so on until the end of the month, resetting to zero only at the start of each month. Would you recommend a way to achieve this? Link to comment Share on other sites More sharing options...
Thorsten Vogt Posted May 29, 2023 Share Posted May 29, 2023 Hi Emre, you could try to sum up the running deltas for each months: $signal.setMaxInterpolation(20d).runningdelta().runningSum(months('CET')) Regards, Thorsten 1 Link to comment Share on other sites More sharing options...
Emre Hatipoglu Posted May 29, 2023 Author Share Posted May 29, 2023 Hi Thorsten, This worked perfectly well. Thank you very much! Regards, Emre Link to comment Share on other sites More sharing options...
Emre Hatipoglu Posted June 12, 2023 Author Share Posted June 12, 2023 Hello again, In the same case, there is a condition (say condition A) that lights up sometimes, creating capsules in between purple capsules in Thorsten's example. I want to add a constant value (say +3) to the running sum of the running delta If A lights up in between the purple condition's capsules. Would you recommend a solution for this? Best Regards, Emre Link to comment Share on other sites More sharing options...
Thorsten Vogt Posted June 12, 2023 Share Posted June 12, 2023 Hi Emre, one way to achieve this would be counting the conditions and multiply them with you constant. This signal is then added to the other signal: $signal.setMaxInterpolation(20d).runningdelta().runningSum(months('CET')) + $conditionA.aggregate(count(), $conditionA, startKey(), 0s).runningCount(months('CET')).toStep(30d) * 3 The second term of the formula will calculate the number of capsules during each capsule (which is 1) and put that as a discrete value to the start of the capsule. This value will be summed up during the month, transformed to a step signal and multiplied with the constant. The screenshot shows the previous calculation (red) together with the new calculation (blue). Condition A is represented by the green capsules. Regards, Thorsten Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now