Jump to content

If logic to differ between conditions

Recommended Posts


I am trying to create a formula which accounts for different reference times depending on the product to be produced. It would be like the Splice function, but for conditions instead of signals or scalars.

My objective is to create a pressure reference profile which is modified depending on the product which is produced. For this matter, I need:

- A formula with different reference capsules (input condition in the reference profile tool).

- A formula with different conditions depending on the product ((Apply to condition in the reference profile tool).


What I would like to do (if it was possible), would be the next:


condition(capsule("2021-06-27T07:15+02:00", "2021-06-28T10:50+02:00"
.splice(condition(capsule("2021-06-27T07:15+02:00", "2021-06-28T10:50+02:00")),$GradeA)
.splice(condition(capsule("2021-06-27T07:15+02:00", "2021-06-28T10:50+02:00")),$GradeB)
.splice(condition(capsule("2021-06-27T07:15+02:00", "2021-06-28T10:50+02:00")),$GradeC)


Edited by Eduardo Fernández
Link to comment
Share on other sites

I may not understand your question fully, but it seems like you already have the solution. I would create different reference profiles for each grade, then splice the reference signals together. If you try to create one reference profile, it may cause issues since the reference statistic would be calculated across different grades. The only issue with this method would be that it is not dynamic, so as different grades come on-line you'd have to create a new reference profile for each, but I don't see a way around that.

To 'splice' conditions, you would use one of the many methods available to combine conditions. You can see these in the formula documentation under 'Combining Conditions'. One way to create a condition where the Grade is either A,B,or C would be to use the or keyword in formula. 

$gradeSignal.isMatch('GradeA') or $gradeSignal.isMatch('GradeB') or $gradeSignal.isMatch('GradeC')



Link to comment
Share on other sites

Thank you so much for your answer.

What you mention about creating a reference profile and then splicing the different reference signals together is the way I found suitable to do it. The thing is that I would need 2 reference signals for each variable (pressure and temperature), and that multiplied by the different grades make quite a lot of signals per Reactor. I wanted to avoid creating too many signals, but apparently that may be the only solution.

Regarding the "splice" os conditions, the issue I found is that I do not manage to found a way to  do the next logic:

If Grade = A;


ReferenceTime = AAAA  //Reference Time for grade A


if Grade = B;


ReferenceTime =BBBB //Reference Time for grade B



Reference Time =CCCC //Reference Time for grade C


Something Like that (not an expert in programming as you see 🙂 ). The option that you mention are useful to identify the capsules and manipulate them, but not to chose between already identified capsules. 

Again, thank you so much!




Link to comment
Share on other sites

Are you wanting to train the reference profile on different time based on the grade in production? I don't believe you can do that currently. You would have to build different reference profiles and splice them together, and you could do that in a single formula to make it easier to manage. I can work up an example if that is what you are trying to do.


Link to comment
Share on other sites

That's exactly what I am trying to do, but I am afraid it's not possibly as you say.

I have already tried to create different reference profiles and splice them together in a single formula. It works, so for now I guess I will have to do that.  It will be just a matter of keeping everything organized when creating that large amount of signals.

Thank you so much Andrew!

Link to comment
Share on other sites

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...