LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re-initializing my array with reset button

Solved!
Go to solution

Hi Jeff, 

I implemented the same diagram as you taught me. Just like you taught, my "Temp Time Log" displayed the same data as my previous set of codes.

 

Next step, I tried to implement the same diagram for my "Temp Data Log" but the outcome is different. Care to advice me where went wrong?

Attached is my diagram and my set of codes(I have tidied it up a little so it doesn't look too messy, hopefully it helps)

0 Kudos
Message 11 of 93
(894 Views)

Hi there cbutcher, 

Can you teach me how do you create your reference array? I can't seem to be able to create thus I am not able to practice your set of codes. Would really appreciate if you can guide me.

 

Looking forward to your prompt replies ! 🙂

 

Regards,

Jarrold

0 Kudos
Message 12 of 93
(893 Views)

It looks like the answer to that specific question (Temp Data Log) is as simple as you're switching columns in a transposed array, but you're reversing the un-transposed array. Are they the same if you use the same input (because currently you have different inputs!)

 

As a side note - congratulations on the vastly more readable VI! (Edit: Ok, so there's still some readability problems, like wires under cases and lots of bends and so on, but still.. now it more or less fits on my screen 🙂 )


GCentral
0 Kudos
Message 13 of 93
(893 Views)

Ran out of time to edit, so here goes reproducing the message I just typed. Apologies if it no longer ties in well with what came above, I might miss bits.

 

Although it isn't the place where you should focus your efforts in cleaning the block diagram, one example of using a SubVI (or arrays) to clear up space and aid understanding/compartmentalization can be found on your Initialize case.

 

I attach an image comparing my initial (in-main-VI) work to clean it up a bit, followed by the original, followed by comparison with a subVI. The subVI is attached also (and mostly just contains what you see in the left-most pane of the image.

 

 


GCentral
Download All
0 Kudos
Message 14 of 93
(885 Views)

@Jarrold wrote:

Can you teach me how do you create your reference array? I can't seem to be able to create thus I am not able to practice your set of codes. Would really appreciate if you can guide me.


You can create an array of references (or anything else) using the Build Array function. I'm betting you already knew that.

 

To get references to controls, you can either right click on the terminal on the block diagram, and go to "Create > Reference" in much the same way that you probably created the property and invoke nodes, or alternatively (and perhaps more suitable for your block diagram layout) you can create a VI Server Reference. The quick drop shortcut available in 2016 and later is Ctrl-Space (to open quick drop) and then "vsr", which highlights the entry. You can then press enter, which will place the node on the mouse-tip, or you can click in the background on the block diagram, which will place it immediately. I usually find 'enter' easier.

 

Having placed the VSR, you can left click on it, and move through the menus to the appropriate control, under the "Pane" entry. So for the L1-L2 Voltage reference, use "Pane > Tab Control > L1-L2 Voltage (V) > L1-L2 Voltage (V)".

 

You should keep these references around if you use the same group often (for example in the init and reset cases) so that you don't have to take up BD space creating them twice.


GCentral
0 Kudos
Message 15 of 93
(882 Views)

@cbutcher wrote:

Ran out of time to edit, so here goes reproducing the message I just typed. Apologies if it no longer ties in well with what came above, I might miss bits.

 

Although it isn't the place where you should focus your efforts in cleaning the block diagram, one example of using a SubVI (or arrays) to clear up space and aid understanding/compartmentalization can be found on your Initialize case.

 

I attach an image comparing my initial (in-main-VI) work to clean it up a bit, followed by the original, followed by comparison with a subVI. The subVI is attached also (and mostly just contains what you see in the left-most pane of the image.

 

 



This is beautiful,cbutcher !

Now my initialization works beautifully and it looks really neat ! I really appreciate your help ! This really works perfectly ! 

0 Kudos
Message 16 of 93
(878 Views)
@cbutcher wrote:

@Jarrold wrote:

Can you teach me how do you create your reference array? I can't seem to be able to create thus I am not able to practice your set of codes. Would really appreciate if you can guide me.


You can create an array of references (or anything else) using the Build Array function. I'm betting you already knew that.

 

To get references to controls, you can either right click on the terminal on the block diagram, and go to "Create > Reference" in much the same way that you probably created the property and invoke nodes, or alternatively (and perhaps more suitable for your block diagram layout) you can create a VI Server Reference. The quick drop shortcut available in 2016 and later is Ctrl-Space (to open quick drop) and then "vsr", which highlights the entry. You can then press enter, which will place the node on the mouse-tip, or you can click in the background on the block diagram, which will place it immediately. I usually find 'enter' easier.

 

Having placed the VSR, you can left click on it, and move through the menus to the appropriate control, under the "Pane" entry. So for the L1-L2 Voltage reference, use "Pane > Tab Control > L1-L2 Voltage (V) > L1-L2 Voltage (V)".

 

You should keep these references around if you use the same group often (for example in the init and reset cases) so that you don't have to take up BD space creating them twice.


Hey cbutcher,

 

I've practised the whole day and tried to tidy up a little more. Although these are baby steps but its better than no steps at all. Mind taking a look at them? Anyway, the purpose of this post was to create a reset button for my program. As of now, I am unable to work on the reset button because of one issue.

 

Under "Logging Temp", my "Temperature Data Log" does not display the same details after I simplified my diagram with the help previously. Attached below is the outcome and the block diagram of that part of the program. 

 

I believe it has something to do with the 2D array and 1D array difference. Please provide me with some advice. After solving this issue, I believe we can finally start on how to create a reset button. Which was my initial issue. Hahahhaa.

Download All
0 Kudos
Message 17 of 93
(864 Views)
0 Kudos
Message 18 of 93
(863 Views)

I think maybe you missed my post describing your transposition usage.

I'm attaching a VI which demonstrates the equivalence of the two methods, but you can't give them different inputs and expect the same output 😉

 

You have one of the inputs transposed (your more complicated loop) and the other takes the string array before it is passed through Transpose 2D Array.

 

You can play with this VI and check how you want the output to look (I think the input should match your system - A, B, C are different sensors and 1,2,3,4 should be like different times). Transposing before and after doesn't have the same effect.


GCentral
0 Kudos
Message 19 of 93
(854 Views)

Moving back to your real, original problem (sorry for the enormous detours) the issue is that the feedback node is still holding the values. The next time you press start, it goes through the Logging Temp case again (I assume?) and then the feedback node still holds all the previous data.

 

The normal solution to this kind of problem is to use Shift Registers, rather than Feedback Nodes. With a shift register, you can write the register from the Initialization or Reset cases, and just wire an empty 2D array (or whatever your shift array datatype is). The problem you face with that approach at the moment is you have quite a lot of feedback nodes, and a shift register must always be wired - in the case where you're not using the data and you don't want to delete it, you still have to connect the left side to the right side with no changes.

 

This would, for you, result in a lot of wires going all the way across your diagram, which you might not want (especially because it is still quite wide). In this case, you should probably consider a Cluster containing all of your arrays, which you can then use on the Shift Register. When you want to write the values, use Bundle By Name, and when you want to access the data, use Unbundle by Name. You can use simply Bundle and Unbundle if you want, but it's less clear what you're doing, and then if you change the order of the elements of your cluster, you can silently break code. If you use .. By Name, then they will move around for you. As a side note, you should make the cluster a typedef!

 

Once you have a cluster full of values, you're halfway to an Object Oriented version of your code. I have no idea if that's something you'd want to consider, but maybe focusing on the smaller steps first is a good plan!


GCentral
Message 20 of 93
(850 Views)