LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with second frame in flat sequence, it is not taking boolean inputs in to the while loop

hello sir,

 

i was doing a small task which controls the railway gate crossing. here i am using a flat sequence in which the first frame calculates the speed of the train and the second frame does the gate controlling job.the idea is to generate pwm based on the Gate inputs. so when the gate sensor 1 gets boolean 1 then pwm must be of 50% pulse width so that servo closes the gate. similarly when Gate sensor 2 gets boolean 1 then servo goes to normal state back. the first frame executes fine and when it enters in to the second frame the boolean inputs are not taking in. i am new to labview. i am not good in using these structures. if i am using these wrong pleas guide me. attaching the file below. 

 

please help me with the problem

0 Kudos
Message 1 of 26
(3,876 Views)

can some one please suggest the solution

0 Kudos
Message 2 of 26
(3,857 Views)

An interesting project, and a useful one for learning about LabVIEW.

 

Most of the people who participate in this Forum volunteer their time and many of them only look at the Forum in their break times at work. Your initial post was at 5 AM on a Saturday in the eastern United States when very few people are active on the Forum. Please be patient. If you have not received any replies after one business day in the USA, then another post, possibly with different information might be appropriate. This is not meant to be criticism as you are new to the Forum, but just to tell you a little about how it works.

 

The major problem with your VI is the way you have implemented the Event structure. If either the start or stop buttons on the track are pushed again after the the first time the stop is pressed, the front panel will lock up. The resaon is that the event structure continues to store up events even if it cannot run to process them. Once the left while loop completes execution and the program moves to the second frame, the event structure will never execute again (until the program stops and is restarted).

 

Generally a program with an event structure has that structure in a while loop which continues to run as long as the program is running. Usually that loop operates in parallel with another loop which actually does the calculations and data processing. Look at the Producer/Consumer (events) template which comes with LV to see how this can be done.

 

The use of sequence structures is generally discouraged because it breaks dataflow. A state machine architecture along with the Producer/Consumer architecture would be suitable for your project.

 

You may also need to initialize the shift registers and feedback nodes.

 

I suggest that you look at the online tutorials for getting started with LabVIEW.

 

Lynn

0 Kudos
Message 3 of 26
(3,840 Views)

yes sir now i understood the problem. the problem is in stop booblean. is there any way to overcome it. as u suggested using producer/consumer template vi, when i searched for it i came to know that it requires minimum labview 8.  as the ni elvis kits we use in our lab are installed with labview 7.1. i cannot use that template. any suggestion ?

 

and sorry for my previous post.

0 Kudos
Message 4 of 26
(3,825 Views)

Hi

have you get the solution of your problem, if no then save your vi in older version as i have LV 8.5. if it is not possible then take snap shot of your vi blck diagram and atached it..

(you can take snap shot by pressing the print screen button after open your vi and then save it in mspaint or else as jpeg.)


some general queries reagarding your vi development

have you put your flat structure in a while loop or else?

is it possible that both gate sensors give boolean 1 at the same time. or when one is boolean 1 the other is boolean 0 and vice versa.

 

as far as i understand your problem you only need one frame of flat structure in a while loop. inside the flat structure you make case struture. outside the case structure make some gate logic  to check whether which sensor input come first. i will try to straighten your VI when i will get your present work in LV 8.5 or snap shot

 

reagrds

 

0 Kudos
Message 5 of 26
(3,820 Views)

hi 

 

i saved the above compatable for labview8.0 and attached images too. i could not solve the problem, but modified to avoid the problem of getting  front panel lock up. instead of giving the stop boolean to end the while loop i used separate control to end the loop but i think its not the right way. 

 

i attached both previous and modified once please check. in the modified file  i used [stop 3] boolean to get out of first frame instead of using stop boolean on the track so that even if stop changes twice the front panel doesnt lock up. 

 

sorry if my programming is bad.

0 Kudos
Message 6 of 26
(3,801 Views)

i will see your vi , but in a mean time check my vi as well as its snapshot. i hope it will help you. give me your feedback.

 

 

regards

Download All
Message 7 of 26
(3,786 Views)

I no longer have access to LV 7.1 but there is nothing in Producer/Consumer which cannot be implemented in LV 7.1. I have programs written originally in LV 5 that employed the basic concepts. We did not have the Event structure or queues but there were other tools which allowed us to use the parallel loop concept.

 

I think the Event structure was introduced in LV 6.1, so it should be available in 7.1.   I am not sure about when queues were introduced. If they are not in LV 7.1, use the functional global variable VI method.

 

The VI you posted originally was done in LV2013, so I did not consider that you were using a 10 year old version of LV.

 

The most recent posts show you have not grasped the concept of data flow. The sequence structure does absolutely NOTHING! Please work through the Getting Started with LabVIEW tutorials. The few hours that might take will save you much more time over the next week or so.

 

You can Build Array directly. No need to Bundle a cluster followed by Cluster to Array.  Did you omit the case for both gates True intentionally? The default case seems unrealistic. Both gates false applies to the no train situation. Both gates True suggests a very long train.

 

Lynn

0 Kudos
Message 8 of 26
(3,773 Views)

i have seen your vi , you used event structure to check for start and stop which complicates the logic as event structure will continously check for value change which effect the running of remaining part of code.

 

i have attached a vi will calucalte the speed on the basis of start and stop sensors/button arival. it also check the status of gate 1 and 2 sensors in case structure. i hope this will help you.

 

 

Download All
0 Kudos
Message 9 of 26
(3,744 Views)

tirmizi, i understood it. once the start button is pressed, you set true to start indicator, which means it holds information of buttons start and stop. but i didnt get the importance of blocks which u have placed outside while loop and  how do we create them (in the image attacched) are they similar to enum type. the start, duration time are indicators how can we use them in 2nd and 3rd frame and  are giving out the previous value they stored..can you please clear me this ?

0 Kudos
Message 10 of 26
(3,730 Views)