Search the Community
Showing results for tags 'zipwith'.
Guest posted a topic in General Seeq DiscussionsThis question comes up fairly often, so I thought best to put one solution in the forum. Please feel free to suggest other approaches. Say you have two temperature signals and you want a third signal that shows always uses the larger value of the two. The logical thought is an if statement, e.g., in pseudo-code: If temperatureA > tempertureB then temperatureA else temperatureB So the question often hits Seeq support, as "How do you do an IF statement in Seeq". Seeq, at this time, does not have IF statements, but we have some techniques to achieve the same thing. For this particular example, we'll do some signal math, a value search, and then a splice. The if statement is effectively done by the value search. So, here's one approach to solve this problem: Here are the two temperatures plotted, we want to create a 3rd signal that always uses the greater of the two. The next two steps are: Subtract the two temperatures, and do a value search on the results. The value search identifies regions where the blue trace is greater than the green trace. There's one point of caution, and that is the maximum capsule duration. That has to be long enough to capture the periods where the 2nd temperature is less than the first. The last step is use splice to create the 3rd signal. The logic of splice is "use the green signal, except where ever there's a 'B greater than A' capsule, splice in the blue signal". There's an option on splice to blend in the transitions, I did not use that in this example. Here's the splice and the results: Please comment here if you have any questions or have a better way of doing this.