取消
显示结果 
搜索替代 
您的意思是: 

moving elements from array to array

  • The circled area defines the array elements (cluster of some named scalars so we can  do "by name"). Of course it needs to match the elements of the array in e.g. "1. queue 1". we cannot tell from a picture what that is!
  • Why did your turn the 2D array constant into a 3D array constant???? Resize the index terminal back to two to make it 2D. Do you understand arrays at all? You cannot get three elements out of a row if there are only two columns.

 

Obviously, a picture can never tell most of the story that's why you need to attach your VI!!!!

0 项奖励
41 条消息(共 84 条)
990 次查看

But i added a third column to the cluster, so in one row im going to get 3 numbers,

 

I attached my VI below.

0 项奖励
42 条消息(共 84 条)
998 次查看

@dannn2020 wrote:

But i added a third column to the cluster, so in one row im going to get 3 numbers,

 

I attached my VI below.

 


  • Never attach a new VI with the same name as an earlier, very different vi!! Keep the confusion low!
  • The blue array constant only has two columns, but you are trying to read three.
  • A cluster does not have "columns", just elements.
  • The cluster constant only has two elements. you cannot wire it to an array that has three elements in the cluster. (Since that cluster occurs in many places, make it a typedef so you can change the type anywhere at once). 
0 项奖励
43 条消息(共 84 条)
993 次查看

Thank you, but I do not need to change the type at different places, I just need it to start with 3 elements, so how can I change it so that it starts with 3 elements and just continues till the end with those 3 elements

0 项奖励
44 条消息(共 84 条)
987 次查看

Your cluster constant and most of your array indicators only have two elements. Unlike arrays where the size can change, clusters are fixed.

 

You continue to get stuck with very basic concepts and I still recommend to use all the training resources offered. You don't learn to swim by diving off a cliff into the deep ocean full of sharks.

 

Back to the problem: Once you have more than one limited queue in a row, you also need to correctly deal with "backpressure", i.e. with situations where an element expires, but cannot go to the next queue because there is no room.

 

As I already said, create a typedef for your inner cluster so you can change it everywhere at once. Are you familiar with that? Then think of a scalable solution that can deal with an unlimited amount of queues without any changes in code. It's not rocket science. For the queue display, you could use a 1D array of clusters, containing a queue. Then have a 1D array of queue definitions, where each element is a cluster of min time, size, etc. The rest should fall into place.

0 项奖励
45 条消息(共 84 条)
965 次查看

I did complete the core 1 and 2 manuals, but I still find it hard to understand some of the things, so that why im here asking.

 

I know that clusters are fixed in size but I just want to know how can I rewrite it for the clusters to have 3 elements, I do not want to add an element in the middle of the simulation, I just need to edit it so that I can have 3 elements in the cluster in the first place. And then ill be able to use the bundle by name function to pass in what I need to be in the 3rd element of the cluster. ( so in each cluster ill have category, expectancy, and time)

0 项奖励
46 条消息(共 84 条)
952 次查看

Just drop a [indicator | control | constant resp.] into each cluster container and make sure it has a label (else you cannot use "by name"!).

 

As mentioned twice, learn about type definitions to make life easier! Once the cluster is a typedef, just edit the typedef and all instances will automatically follow. Better than herding cats!

0 项奖励
47 条消息(共 84 条)
943 次查看

OK, to give you something to chew on, here's a very quick attempt at a scalable solution. I am sure it can be improved.

 

All you need to do is change the typedefs to include the fields you like and fix up the display. Leave the management fields intact (queue#, tick, etc.).

 

To better trace how the queue behaves, I only add a sequence number (increments with each entry) and an iteration number (depends at what loop iteration the button was pressed) to each entry. Just replace with your fields.

 

altenbach_0-1646077195790.png

 

0 项奖励
48 条消息(共 84 条)
938 次查看

I spent all night trying to study this and from what i understood, there is a few extra things that i dont necessarily need, and for example the time elements spend in specific queues is randomly generated not selected. (but i have all that).

 

So im really sorry to ask this but can you please tell me just how to add an element in this circled area, then ill just delete all the arrays and add them again with the new clusters, which have 3 elements, because I do not need to add an element while the code is running. I just need to start with 3 elements.

 

Thank you very much for the help.

0 项奖励
49 条消息(共 84 条)
922 次查看

Place a diagram constant of the desired type (orange, blue, pink, scalar, array, etc. etc.) on the diagram, show the label, give it a useful name, then drop it into the cluster container.

 

As I already said, make it a typedef! Do you know what that means? Note that once it is a typedef, you edit the typedef to add or remove elements.

 


@dannn2020 wrote:

I spent all night trying to study this and from what i understood, there is a few extra things that i dont necessarily need, and for example the time elements spend in specific queues is randomly generated not selected. (but i have all that).

.


You don't need to study it, just fully understand it. Most of my code can be re-used for any similar problem by just changing the typedefs and making some minor adjustments. Leave the queue managements items, add what you need, remove what you don't need! Should not take you more than 5 minutes.

 

0 项奖励
50 条消息(共 84 条)
912 次查看