10-23-2013 11:52 PM
Hey guys ,
A simple question but i'm having hard time to figure it out !
if i have a barrier and an obstacle sensor on the barrier , I opened the barrier before and i need it not to close when the car is crossing for example ..
I was using a while loop in a sequence structure , in the first frame i used the while loop which only exists when the obstacle sensor turn off , and then it will pass to the second frame in the sequence where i put to close the barrier .
this has done the job , but i need to do it without using while loops ! 😞
Any ideas would be appreciated ( with screen shots if it is possible )
thanks alot for your time 🙂
10-24-2013 02:30 AM
I would suggest that instead of using a sequence structure, you could construct the Simple State machine architecture, which is more flexible if required to be changed.
There is a pre-built template shipped with LabVIEW, which you can build your code into.
For example, you could have a 'wait for vehicle passed' state which is entered when the barrier is raised, and stays there until your detection tells you the vehicle has passed, then move to a 'wait for next vehicle' or similar state.
Regards
Dave
10-24-2013 04:35 AM
hey , thanks for your reply ..
but my problem is that i can't just say that if the obstacle sensor is off , then i close the barrier ..
because the obstacle sensor is off in the first place , so i need to say that if the obstacle sensor is on and after that it is off , close the barrier ..
how is this possible ?
10-24-2013 04:56 AM
so, you are looking for a negative going edge transition on your obstacle sensor, then do something?
How about setting up a User Event which triggers on that transition, then you could put the barrier control in your event structure.
10-24-2013 06:46 AM
Hmm i can'r really understand ur point , maybe i should include that i'm a bigginner in labview and this is my first project
10-28-2013 01:51 AM
Hi,
I would suggest to go for a state machine as an architecture.
An example of such an architecture can be found here: https://decibel.ni.com/content/docs/DOC-10862
Basically, you should acquire data from the proximity sensor continuously, process the data to find if you have obstacle or not take the decision of closing or not the bareer.
Let me know if you need more help with that.
Best regards,
IR