LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Elevator program

Hello, I created an elevator program and I would really like some help with it. I would that the boolean buttons outside every floor could turn off over a certain period of time, like in a real elevator. Right now they function well, but they remain on.

Download All
0 Kudos
Message 1 of 8
(3,972 Views)

It looks to me like the program has a lot bigger problems than the light staying on. How do you go to another floor once in the elevator? When I press a number the door closes but nothing else happens. You really need to consider a better architecture for this. A state machine would be much more appropriate. 

0 Kudos
Message 2 of 8
(3,952 Views)

@sebastiantc wrote:

Hello, I created an elevator program and I would really like some help with it. I would that the boolean buttons outside every floor could turn off over a certain period of time, like in a real elevator. Right now they function well, but they remain on.


I have never heard of an elevator that does that!

 

The only time the buttons on the elevator floor turn off is when the elevator actually arrives at that floor going in that direction.

0 Kudos
Message 3 of 8
(3,940 Views)

I agree. It should go off when the elevator arrives. The bigger problem is that the elevator doesn't work, and with all of the sequences, nested loops, and local variables is likely to be a big problem to get it to work.

Message 4 of 8
(3,936 Views)

@sebastiantc wrote:

Hello, I created an elevator program and I would really like some help with it. I would that the boolean buttons outside every floor could turn off over a certain period of time, like in a real elevator. Right now they function well, but they remain on.


You have way too much code! It is a really bad idea to have loops inside loops inside loops and event structures deeply buried somewhere in the middle. 

 

All you need is one while loop and one case structure, a state enum and a cluster in a shift register that contains all current values (... and no sequence structures!). Each state will manipulate the values and then update all indicators. The only local variables needed are to update your controls at certain times, not for storing state information. Well written code with all functionality could probably fit on a postcard.

 

Maybe see if there are a couple of elevator examples or similar in the certification discussion forum. This seems like a typical practice exam.

Message 5 of 8
(3,935 Views)

Thank you for responding,

 

I know that sometimes it seems it does not work but this is probably due to the "Time Elapsed" function I put in. Another thing is that the inside panel won't work at all if there are no people inside the elevator. That is why the "Adentro" (which means "in") control must be greater than 0.

0 Kudos
Message 6 of 8
(3,905 Views)

Thank you so much for your response,

 

I hace not found any discussion forums that contain an elevator program. The only ones I found were asking advice for a "CLA exam". 

 

I don't really know how to use a state enum or a cluster. If you could help me by showing me how to use them on this specific program I would be incredibly greatful.

 

Thanks again.

0 Kudos
Message 7 of 8
(3,903 Views)

Look at some LabVIEW state machine examples. Also, research using shift registers. You will need these for both the enum and to pass the data from state to state.

 

The enum is just a way to have enumerate your states. You can find an enum constant on the numeric pallette. I suggest making this into a Type Def. Edit the items to have all of the states that you need. Feed the enum to a case structure. Right click the case structure and add case for every value.

 

The cluster is just a way to hold data of different type in a single control/indicator/wire. Make a cluster constant on the block diagram and then add a constant of the correct data type for each of your controls/indicators. Be sure to give each of these a title. Then you can use bundle and unbundle by name to read and write values. 

 

Once you have a good architecture resetting the control can be done in a few ways - local variables and value properties are two of the ways.

Message 8 of 8
(3,883 Views)