01-12-2006 12:43 PM
01-13-2006 02:52 PM
Is this triggering occurring in hardware or software? If the triggering is in hardware, then what is the hardware that you are trying to trigger? If the triggering is in software, then you can simply use some of the conditional structures (Select function, case structure, etc.) and boolean logic functions (AND, OR, etc.) in LabVIEW to accomplish the conditional logic.
01-16-2006 08:39 AM - edited 01-16-2006 08:39 AM
Thanks for the reply. It's software triggering based on user configuration. I think I've figured out how I'll be doing it, but will require me to limit the user somewhat...I'll allow them only a few (1-4) conditionals to check, and will not allow them to use parens or brackets to avoid order of precedent. This will actually be a bit more elegant than what they have now since they wont have to provide an enum for the conditional, and they'll be able to do condition checks between 2 different parameters. When the configuration file is parsed, I'll search for the index of the parameter since I store all data in one large array...so the config file will look something like...
[Triggers.ini]
Fan_Speed < 300 AND Intake_Temp > 500 OR Exhaust_Temp >800
So in code I'll have an array of clusters which includes the index of the parameter, the condition [<=>], and the boolean operator. It will simply go from left to right...so for example:
Fan_Speed < 300 AND Intake_Temp > 500 OR Exhaust_Temp >800
=TRUE AND FALSE OR TRUE
=FALSE OR TRUE
=TRUE.
Any comment on this approach ?
Thanks!
Message Edited by Jason Stallard on 01-16-2006 08:40 AM
Message Edited by Jason Stallard on 01-16-2006 08:41 AM
01-17-2006 05:28 PM
Jason,
I think the approach sounds great! Excellent job coming up with a solution on your own.
Kind Regards,
01-17-2006 06:05 PM
Put a post up if you get it working. This is one of LabVIEW's few weaknesses. I have wrote a system that uses text to drive a LabVIEW queued message handler. It is not to hard until you get to conditional branching. It supports whiles and ifs that once again is not impossible. The real fun is nested statements. Ifs and Whiles as deep as they want to go. I gave up when it came to compound statements and told them to use another if. It would be nice if someone came up with a good evaluate subroutine that supports compound logic.
Looking forward to hearing about your progress,
Matt
01-18-2006 08:23 AM
01-18-2006 10:28 AM
Jason,
You code looks excellent, well written. Correct me if I am wrong but I think there is precedence in evaluating the Boolean logic so scanning left to right may not work. I looked at the default statements:
Test1 2 == 100 AND Test2 0 <= 5 OR Test3 1 <= 3
Evaluates to
False AND True OR True that evaluated correctly but Trigger is True
Shouldn't it be evaluated as: False AND (True OR True)
False AND True
False so Trigger should not be True?
Let me know what you think,
Matt
| Operator | Order of Evaluation |
|---|---|
| >( ) | 1st |
| >AND, NOT | 2nd |
| OR | 3rd |
01-18-2006 11:49 AM
You're right. I said something to that effect in the code comments, but the only oder this VI will follow is left to right, and it doesn't support negation(NOT)..the person writing out the quasi-script would have to keep that in mind.
My intent isn't to write a full-fleged interpreter, but give the user more flexibility in how they define a 'trigger' event...and this is an in-house application...were it for public comsumption, I'd definitely try to put in full support for boolean operations....but then again it is quite a challange.
01-18-2006 12:29 PM
01-18-2006 12:37 PM
Jason,
Your code looks great and we will let someone else design the complete evaluator. I think what you have is fine for your application. You just need to sort the ANDs and ORs then evaluate the results.
Matt