Administrators Morgan Bowling Posted September 9, 2019 Administrators Share Posted September 9, 2019 We often do calculations where we are interested in having one result if one condition is true and a second result if another condition is true. In this post we will discuss how to do this calculation in Seeq. We will create a new single signal which runs different calculations during different periods of time. This technique can be used to replicate "if" logic or "if / else" logic currently being used in excel. Example existing code from excel or other systems IF Temperature > 90 then show a result of (Temperature * 100) IF Temperature < 90F then show a result of (Temperature + 10) Step 1: Identify two modes of operation In the Tools tab identify the following conditions using the Value Search tool: Step 2: Use formula to reconstruct "if/then statement" using Seeq's Splice Tool Variables: Name Item Type $Temperature Temperature Signal $HighTempCondition Greater than 90 Condition Seeq Formula: $HighTempCalc = $Temperature * 100 $LowTempCalc = $Temperature + 10 $LowTempCalc.splice($HighTempCalc,$HighTempCondition) Section 1 - $HighTempCalc This is the first arbitrary calculation which is to be run during periods of high temperature Section 2 - $LowTempCalc This is the first arbitrary calculation which is to be run when NOT in periods of high temperature Final - $LowTempCalc.splice($HighTempCalc,$HighTempCondition) Combine your two series. Use the LowTempCalc series, unless you are in the High Temperature condition, in which case use the HighTempCalc 2 Link to comment Share on other sites More sharing options...
Administrators Lindsey.Wilcox Posted September 17, 2019 Administrators Share Posted September 17, 2019 If the condition(s) used in the analysis have a maximum capsule duration that is greater than 30 days, an alternative method is recommended to replace "if" statements. If this is the case, users can use boolean signals, as described in the following post: Link to comment Share on other sites More sharing options...
Ingrid Posted April 11, 2021 Share Posted April 11, 2021 Why this isn't working? Link to comment Share on other sites More sharing options...
Thorsten Vogt Posted April 11, 2021 Share Posted April 11, 2021 Hi Ingrid, you try to use splice on a scalar, which is available since R51. In lesser versions you can apply splice only on signals, so changing $h to a signal first should resolve the issue: $h.tosignal().splice($l, $lfc) Regards, Thorsten 1 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