LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to interactively create input fields according to value from another input field

Well the other thread doesnt answer the last question i asked in this thread, so i assume you mean i better upload the VI. so i will.

Again, the problem is that when fill multiple rows of parameters in the array of clusters (bottom two - relative move) and then choose to use less rows the rows that are not shown still being executed.

So for example i fill 3 rows in the vertical segment parameters, then reduce the num of rows to 1 so only the first 1 is being shown, when i press the start relative move button all 3 rows are being executed.

 

How do i disable the rows not being shown from being executed? ideally i'd like to keep the data in case the user want to reuse those parameters in the future

0 Kudos
Message 11 of 16
(873 Views)

Hi Aqua,

 

finally you were able to attach your VI…


@Aqua- wrote:

So for example i fill 3 rows in the vertical segment parameters, then reduce the num of rows to 1 so only the first 1 is being shown, when i press the start relative move button all 3 rows are being executed.

 

How do i disable the rows not being shown from being executed? ideally i'd like to keep the data in case the user want to reuse those parameters in the future


So you reduce the number of visible array elements, but you wonder about executing loops on ALL array elements? You only hide elements, but not delete them?

What about using ArraySubset before the loop to reduce the number of elements in your array?

 

This is a THINK DATAFLOW problem: what do you need to implement between your data source (aka array control) and your data sink (aka FOR loop)?

 

I think I already told you to keep references in shift registers, but I do again: Keep references in shift registers instead of using plain (non-indexing) tunnels! Right now your VI will give problems because of invalid references!

Learn the LabVIEW basics, especially behaviour of FOR loops regarding their auto-indexing input tunnels. This is important and one of the topics when heading for the simplest CLAD test!

 

There are a lot of other problems with your VI, like the missing possibility to stop it in a graceful way…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 16
(865 Views)

@GerdW thanks for the idea of the subarray. i never used it before, seems just what i am looking for.

 

Regarding the stop button i am aware of it. i am building the code for someone, and i will meet him tomorrow to speak of the way she wants the program to behave. i might want to kill the motors on stop, maybe do something else. i prefer not work on it before i know exactly what it needs to be doing.

 

Regarding the shift registration, i will read about it. we did learn about it, but TBH i dont remember much of it and most code we built did not use it, so i will read of it and change the appropriate tunnels.

0 Kudos
Message 13 of 16
(838 Views)

@Aqua- wrote:

@GerdW thanks for the idea of the subarray. i never used it before, seems just what i am looking for.

 

Regarding the stop button i am aware of it. i am building the code for someone, and i will meet him tomorrow to speak of the way she wants the program to behave. i might want to kill the motors on stop, maybe do something else. i prefer not work on it before i know exactly what it needs to be doing.

 

Regarding the shift registration, i will read about it. we did learn about it, but TBH i dont remember much of it and most code we built did not use it, so i will read of it and change the appropriate tunnels.


 

So the subarray worked like charm. very easy and elegant.

 

Regarding the stop and general flow of the code (i.e. open session, initialization, killing the processes and closing reference) i have fixed it according to my doc's preference. It works just fine, though i've been ordered to throw the initialize button out at the moment.

 

As for the shift registry i read about it and couldn't find where exactly i will benefit from the transformation. i even tried to change it, but the motion of the stage stopped working properly. It might be because my code is crooked at the moment, but it does exactly what i ask it to do as far as i have checked.

 

I do have some more features i try to implement and i will be happy to get some more help. I will start from the easiest:

 

1) since the stage mainly doing grid shape i'd like to implement an indicator that sums up all the X motion in the Vertical segments array. So for example if i have 3 segments as follow:

X=10 ,rep=3; X= 5, rep=4, X=10, rep = 2

i want the indicator to show 10*3+5*4+10*2 = 70. now i have made the actual calculation and everything, the thing is i want it to execute dynamically as the input fields in the array changes.

I tried to use an event structure and read about it, use other people's code etc, but to no avail.

I add my attempt of adding it to the code in the file called "XY stage TRY"

 

2) I thought an evolution to the above's feature would be to draw the expected grid on an XY graph before the actual motion is executed. What troubles me is how to get each and every element in this array of clusters. basically all i found was how to refer to a specific cluster in the array. Thought this should be executed with a separate button.

 

I attach the VI that does work. It is the same as the TRY VI only without the event structure

 

Thanks for all the help so far, and for the help to come 😆

Download All
0 Kudos
Message 14 of 16
(823 Views)

Hi Aqua,

 


@Aqua- wrote:

1) since the stage mainly doing grid shape i'd like to implement an indicator that sums up all the X motion in the Vertical segments array. So for example if i have 3 segments as follow:

X=10 ,rep=3; X= 5, rep=4, X=10, rep = 2

i want the indicator to show 10*3+5*4+10*2 = 70. now i have made the actual calculation and everything, the thing is i want it to execute dynamically as the input fields in the array changes.

I tried to use an event structure and read about it, use other people's code etc, but to no avail.

I add my attempt of adding it to the code in the file called "XY stage TRY"


Why do you need an event structure at all?

The case structure is triggered by a button set to "Latched" switch mode, so the content of the TRUE case is only executed once when the button is switched:

 

 


@Aqua- wrote:

2) What troubles me is how to get each and every element in this array of clusters. basically all i found was how to refer to a specific cluster in the array.


You already know how to get elements of the cluster inside an array as can be seen in the FOR loop in the image above: Just increase the size of the UnbundleByName node to show more cluster elements!

 

Btw. the block diagram of this VI is way too big and could improve a lot by implementing a nice state machine! Do yourself a favor…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 16
(820 Views)

@GerdW wrote:

Hi Aqua,

 


@Aqua- wrote:

1) since the stage mainly doing grid shape i'd like to implement an indicator that sums up all the X motion in the Vertical segments array. So for example if i have 3 segments as follow:

X=10 ,rep=3; X= 5, rep=4, X=10, rep = 2

i want the indicator to show 10*3+5*4+10*2 = 70. now i have made the actual calculation and everything, the thing is i want it to execute dynamically as the input fields in the array changes.

I tried to use an event structure and read about it, use other people's code etc, but to no avail.

I add my attempt of adding it to the code in the file called "XY stage TRY"


Why do you need an event structure at all?

The case structure is triggered by a button set to "Latched" switch mode, so the content of the TRUE case is only executed once when the button is switched:

 

 


@Aqua- wrote:

2) What troubles me is how to get each and every element in this array of clusters. basically all i found was how to refer to a specific cluster in the array.


You already know how to get elements of the cluster inside an array as can be seen in the FOR loop in the image above: Just increase the size of the UnbundleByName node to show more cluster elements!

 

Btw. the block diagram of this VI is way too big and could improve a lot by implementing a nice state machine! Do yourself a favor…


Hi GerdW and thanks again for helping.

 

first about the state machine - i read about it and it seems just what i looked for when i tried to implement the vertical/horizontal loops. i am going to improve the code there, but as far as i understand the use of state machine the other blocks are fine the way they are are'nt they? i mean i can split the velocity and position into 2 processes, but is it better?

 

second, about the XY graph and taking elements out - i have tried to do the same as you mentioned, however that way i can access only one row at the time. using python for example i would have created a list/array of x and y according to repetition and append it so that in the end i'll have the whole array ready.

What is important to me about this feature is that it should show the graph not on pressing the button, but before (either by pressing another button or by value change on the array) since it is there to simulate the shape about to be drawn by the machine.

 

third, regarding the sum of X position - it is true that by pressing the button i can execute the value, but i want to know the sum of X before executioong motion so i can input an appropriate X value in the horizontal segment accordingly. so if we take the example in my last post i'd like to know the total X is 70 instead of having to calculate it so that my horizontal segment X parameter will cover at least 70 (as i want to make a grid and intersect each vertical line i have made before. so this is why i went for an event structure... might still be the wrong idea, but another button is not convinient for a standard user imo.

 

fourth, i'd like to have a positioner of the stage. in the code i have attached last time there is a case structure above the while loop that shows the position of the stage when called upon (at the moment it is never executes). I would like it to also show my position continuously, i.e. i would like it to execute every lets say 0.5 sec or so. i tried to put it inside a time structure, but once it got in there it was stuck inside.

We didnt cove time structure in my course, only used the wait function in a dumb way.

How can i make the position appear while the rest of the loop work as planed?

I have thought of a state machine (after you mentioned it) to make a motion, and mean while execute a position status, but it seems rigid.

 

Thanks a lot for the help so far!

0 Kudos
Message 16 of 16
(804 Views)