09-08-2008 04:58 PM - edited 09-08-2008 04:58 PM
Does anyone know if there is "if else" command in Dasylab? I want to compare if an input value is positive or negative. I used interpretor module, but it only gave me True or False, not the value itself. I then tried logical operator and comaparator modules, but they only gave "TTL" signals. Any suggestions will be very appreciated.
Thanks
09-12-2008 09:23 AM
Hi fzwq,
Have you tried using the Action Module? It sounds like you're able to make your comparison just fine, but then you want to perform some type of action resulting on the comoparison. Could you explain what you'd like the outcome of the "if else" command to be? For faster DASYLab support please see this forum. I hope this helps!
09-12-2008 09:39 AM
If you are in the formula interpreter module, you want something that looks like this....
(IN(0)>=4.2)*IN(0)
The test is the first part, which results in 0 or 1, then multiply by the value, and the output is 0 or the value.
To do If then else
(IN(0)>=4.2)*IN(0) + (IN(0)<4.2)*(IN(0)*2)
Only one side will evaluate to a number, depending on the test.
You can use a compound test
((IN(0) >=4.2) AND (IN(0) <=5.0)) * IN(0) will evaluate whether the input is in the range 4.2 to 5.0
and
((IN(0) >=4.2) OR (IN(0) <=5.0)) * IN(0) will evaluate whether the input is out of the range 4.2 to 5.0
Ensure that your test phrase is exclusive - you don't want both testing positive.
Note that the "=" operator is pretty picky.
Depending on what else you are doing, you could consider the Combi Trigger and a Relay combination. The Trigger is the test, and the output controls what the Relay will release.
09-15-2008 03:03 PM
Guys, thank you so much. Lion-o, what cj says is what I would like to do. Really appreciate your help, smart!