LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

moving elements from array to array

Sorry, I am currently on the road. Will look at it later. Note that a screenshot is not a vi. I can't even look at it because the filename is not compatible with my phone.

0 Kudos
Message 11 of 84
(1,114 Views)

This is my entire code, But all I need is help with this one section with text.

 

 

 

 

0 Kudos
Message 12 of 84
(1,110 Views)

Hi dan³,

 


@dannn2020 wrote:

This is my entire code,


Nope.

Still only images, no LabVIEW code attached!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 84
(1,099 Views)

Im so sorry i didnt understand you the first time, I just attached my VI file.

 

Thanks for the help.

0 Kudos
Message 14 of 84
(1,089 Views)

OK, that does not clarify the problem at all!

 

I recommend first to go over the training resources listed at the top of the forum.

 

  • why is the cluster a control if the value does not matter. Should be a diagram constant.
  • All you need is one toplevel loop. There is no need for and Aztec pyramid of loops inside loops inside loops!
  • That loop can have three shift registers, one for each array.
  • How often does "device name" change during the run? Shouldn't that control be outside the loops?
  • Your spinning your loops as fast as the computer allows, millions of time a second. There should be a reasonable wait!
  • Why is life expectancy not an integer? I've never seen a fractional value for that.
  • What kid of data comes from the DAQ? Can you create a simulation instead? We don't have your hardware.
  • Why is the index of the boolean array indicator set to 5??? This means you can't see the first five elements!!!
  • You said you have three arrays. Where are their indicator? I only see one!!!

 

OK, now sit down and write the exact requirements. Your code did not make it any clearer. Sorry.

 

What happens over time?

What is the user supposed to see?

 

0 Kudos
Message 15 of 84
(1,080 Views)

Ok so firstly, this is a simulation that runs for 240 seconds, representing people entering a store, and moving from queue to queue (each queue has specific conditions), the DAQ is connected to a few buttons ( which can be pressed as many times within the time the simulation is being run) , whenever a button is pressed a person is created and they enter a queue ( in a store) (depending on which button was pressed, the person is created with a "number" from 1-4, corresponding to the buttons, and "random" number to go with it), then as soon as they enter this first queue, they are moved to a second queue( but this second queue can only take a max of 2 people at once and each person enters this queue for only 5 seconds then moves on to a third queue), so if the buttons are pressed 5 times directly after each other, the first 2 enter the first queue then directly move to the second queue, while the other 3 wait in the first queue until there's a free spot in the second queue ( which will be 5 seconds later).

 

Please note that I don't have the third array yet, because I still didn't get to it, because I first need to make it so that this second queue holds only 2 people and keeps them in for 5 seconds, then ill initialise a third array that hold the people that go from queue 2.

 

Also the only part I need help with is this second array and making it hold a max of 2 elements and each element for only 5 seconds.

 

PS: whenever I refer to a queue, I mean a queue in the real world which is presented by arrays in LabView.

0 Kudos
Message 16 of 84
(1,068 Views)

@dannn2020 wrote:

 whenever a button is pressed a person is created and they enter a queue ( in a store) (depending on which button was pressed, the person is created with a "number" from 1-4, corresponding....


 

  • OK, so the boolean array encodes which button is pressed. How big is that array (A: At least 3 elements, encoding values in binary?  OR B: 4 elements, each representing a button?)
  • Why are there 6 cases???
  • Can you guarantee that only one button is pressed at once?
  • I assume you only want to append new values if the array changes AND is not all false, right? How often do you think is reasonable to check for new values? There needs to be some defined timing, right?

 

Maybe you should change the simulation such that we have four buttons instead of hardware IO so we can run it.

 


@dannn2020 wrote:

PS: whenever I refer to a queue, I mean a queue in the real world which is presented by arrays in LabView.


LabVIEW does have queues too.

 


@dannn2020 wrote:

Also the only part I need help with is this second array and making it hold a max of 2 elements and each element for only 5 seconds..


Let me say that a nicely as possible, but you need much more help than that!

Virtually100% of your current code is completely misguided and wrong!

 

0 Kudos
Message 17 of 84
(1,043 Views)

Sorry I have 5 buttons ( so 5 cases), and each button creates a person cluster with the 2 numbers, and whenever a button is pressed a person is added to the first array then they start to move on to the next arrays. 

 

And again I only started with LabView 4 weeks ago, so my code isn't going to be the best and I can't ask you for help with my entire project which still has a lot more than what's in my VI currently, so if I can just get assistance with this one array and making it take only a max of 2 elements and hold each element for 5 seconds, then pass it on to an another initialize array function, and ill try to figure out how to do the rest on my own.

0 Kudos
Message 18 of 84
(1,031 Views)

I really think that if this is giving you problems, the entire project will give you even more problems. Looking at your earlier code tells me that you don't understand dataflow at all yet.

 

Still, here's a quick draft that solves how I understood the problem. Study it carefully and try to fully understand the reason for each and every code element. Feel free to ask questions and modify as needed.

 

You still have not explained how the buttons are encoded in the boolean array. Most likely "boolean array to number" is NOT the correct tool.

.

(All case structures only have two cases. The other case (false or zero, resp.) is just wired across)

 

altenbach_0-1645650814168.png

 

0 Kudos
Message 19 of 84
(1,017 Views)

How can I make it take input from physical buttons connected to a DAQ

0 Kudos
Message 20 of 84
(997 Views)