LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re-initializing my array with reset button

Solved!
Go to solution

@cbutcher wrote:

Here's my attempt at the ClockVI with some modifications - basically I just removed the loop. Can you check to see if it does what you want? You'll also need this snippet probably 🙂

 

clockvi_mod-snippet.png

 

Edit: Depending on how your measurement works, you might need to right click on the tunnel out of the loop and change the mode to Concatenating.


I think it was a good try but it does not run continuously unless I hold on the start button. For the problem I mention to you, have you figured out how to simplify it?

0 Kudos
Message 71 of 93
(1,414 Views)

In your collection of Delete From Array, do you get values (non-zero) out for all of the indicators?

 

I think you could use either Index Array, or a For loop (possibly with shift register) or both to simplify the code, but first check that it's doing what you want it to. I tried to do the same with some example array I made and it only gave an output for the first two parts.


GCentral
0 Kudos
Message 72 of 93
(1,408 Views)

@cbutcher wrote:

In your collection of Delete From Array, do you get values (non-zero) out for all of the indicators?

 

I think you could use either Index Array, or a For loop (possibly with shift register) or both to simplify the code, but first check that it's doing what you want it to. I tried to do the same with some example array I made and it only gave an output for the first two parts.


Yeah cbutcher, I got values out of it because I am connecting to my controller that is designed to have certain values coming out of it. I got for all the values, thus I am just thinking of how cani simplify this circuit cause it doesn't look very professional and kind of silly. 😉

0 Kudos
Message 73 of 93
(1,398 Views)

Hi there cbutcher !

 

How are you ? 🙂

 

I have a new encounter here. I am trying to set my counter with 4 different modes

1. Standard 

2. 5 min logging interval

3. 10 minute logging interval

4. custom logging interval.

 

In (1,2 & 3), the intervals are preset and it has to run a total of 8 times.

For example, standard test would run the test 8 times with

the following intervals - 5,5,5,5,10,10,10,5 (mins).

 

Thus i tried to created a 1 D array, hoping to use auto indexing to solve the problem. But I am not able to do so. I am able to achieve the auto indexing part but because of the changes, my elements no longer shift to the right when new value comes in.

 

Perhaps I did somewhere wrongly and i couldn't spot my own errors. Please advice me.

 

Regards,

Jarrold

Download All
0 Kudos
Message 74 of 93
(1,385 Views)

Although I'm still not a big fan of a For loop that takes 55 minutes to run (!), I think you can fix the specific problem you're talking about by replacing the 2nd cluster input (which you unbundle to Voltage Time Log and L1-L2 Voltage) with a shift register.


GCentral
0 Kudos
Message 75 of 93
(1,380 Views)

@cbutcher wrote:

Although I'm still not a big fan of a For loop that takes 55 minutes to run (!), I think you can fix the specific problem you're talking about by replacing the 2nd cluster input (which you unbundle to Voltage Time Log and L1-L2 Voltage) with a shift register.


Hahaha. Dont worry. Because the test itself that I am doing is running for that long. Yeah. I saw that same mistake and made the necessary changes. So glad things are working really great now. 

 

Thanks again, pal!

 

Regards,

Jarrold

0 Kudos
Message 76 of 93
(1,381 Views)

Aloha ! 

 

Right now my project is reaching the end of its current phase except I have one issue that might be a of a problem now. 

Basically, when I am communicating with the Modbus, my program produces a real time wavechart as well as an array of data. The problem here is that I am only able to modify the visibility when it is not logging. Previously I am able to swap between both visibility even when it is logging, however I am not able to do it now. 

 

Attached is a URL to view a short clip of my program execution. Hope this helps you better understand my problem. 

https://www.youtube.com/watch?v=LnvXmnOVyF4&feature=youtu.be

 

0 Kudos
Message 77 of 93
(1,372 Views)

Based on your video, and the DAQ video that I also found that you uploaded to youtube (yay for Playing Next...) I saw some of what you're doing with the VI.

 

I haven't fixed the issue with the toggle not being enabled but I'll try and explain the problem and hopefully you can see the issue. You're really close to having a nice, working State Machine but several of your states take a very long time - usually people make the states take as little time as possible, and go back to themselves if necessary (for example, for 10 minute runs, you could have it start the state and check elapsed time - if elapsed time is 10 minutes, go somewhere else (like the waiting state), otherwise, go back to the same measurement state. Then you can make the loop run every 1000ms or 200ms or something to make it more responsive.

 

When you start the measurement now, the state machine you have goes into the measurement state, but only the Waiting state allows toggling the visibility. Since it never goes back through the waiting state, it can't toggle. Do you see the issue?

 

I'm attaching a slightly modified version of your code. I didn't fix any issues, but I added an additional tab control (I don't really like Tab controls, but I think it works for this situation) to your front panel to handle some of the very many visibility changes you were making. Hopefully you see how this has allowed me to tidy the block diagram quite a lot. It only supports 2 states (Load/Temp) in the current form, but you could improve it if needed (perhaps by wiring the state to the case structure).

 

You previously had two case structures in the Waiting state, both of which only did something when true, plus a 3rd case structure that made one of the other two true. I replaced these with only one case structure, and moved lots of the shared code outside of the case structure. Now, there are far fewer nodes on the block diagram.

 

Additionally, in several places you used the For loop we discussed to change visibility of controls. This is a good plan, and it's nice to see you've been able to save a lot of space with your local variable "appended array" (I would probably shorten the name, but it's fine). However, you're wiring 11 to the For loop each time, then using Index Array with the 'i' variable. Since you want to go through all of the elements, you can instead remove the 11, place the array local variable outside of the loop, and use auto-indexing. This makes the loop much smaller and saves some space/effort. You could consider making a subVI for this, but it'll only save a small amount of space so it might not be worth it. Up to you.

 

Good luck reorganising your cases if you want to make it more responsive to changes during measurements. Just remember - you need to go through whichever check you need during the iterations, and it will only read a control once per iteration. If the iterations are long, it won't be responsive. If the iterations don't check the relevant variable, it won't change anything.

 

p.s. I hope LabVIEW 2016 was OK. I forgot if that was your version or not.


GCentral
Message 78 of 93
(1,361 Views)

@cbutcher wrote:

Based on your video, and the DAQ video that I also found that you uploaded to youtube (yay for Playing Next...) I saw some of what you're doing with the VI.

 

I haven't fixed the issue with the toggle not being enabled but I'll try and explain the problem and hopefully you can see the issue. You're really close to having a nice, working State Machine but several of your states take a very long time - usually people make the states take as little time as possible, and go back to themselves if necessary (for example, for 10 minute runs, you could have it start the state and check elapsed time - if elapsed time is 10 minutes, go somewhere else (like the waiting state), otherwise, go back to the same measurement state. Then you can make the loop run every 1000ms or 200ms or something to make it more responsive.

 

When you start the measurement now, the state machine you have goes into the measurement state, but only the Waiting state allows toggling the visibility. Since it never goes back through the waiting state, it can't toggle. Do you see the issue?

 

I'm attaching a slightly modified version of your code. I didn't fix any issues, but I added an additional tab control (I don't really like Tab controls, but I think it works for this situation) to your front panel to handle some of the very many visibility changes you were making. Hopefully you see how this has allowed me to tidy the block diagram quite a lot. It only supports 2 states (Load/Temp) in the current form, but you could improve it if needed (perhaps by wiring the state to the case structure).

 

You previously had two case structures in the Waiting state, both of which only did something when true, plus a 3rd case structure that made one of the other two true. I replaced these with only one case structure, and moved lots of the shared code outside of the case structure. Now, there are far fewer nodes on the block diagram.

 

Additionally, in several places you used the For loop we discussed to change visibility of controls. This is a good plan, and it's nice to see you've been able to save a lot of space with your local variable "appended array" (I would probably shorten the name, but it's fine). However, you're wiring 11 to the For loop each time, then using Index Array with the 'i' variable. Since you want to go through all of the elements, you can instead remove the 11, place the array local variable outside of the loop, and use auto-indexing. This makes the loop much smaller and saves some space/effort. You could consider making a subVI for this, but it'll only save a small amount of space so it might not be worth it. Up to you.

 

Good luck reorganising your cases if you want to make it more responsive to changes during measurements. Just remember - you need to go through whichever check you need during the iterations, and it will only read a control once per iteration. If the iterations are long, it won't be responsive. If the iterations don't check the relevant variable, it won't change anything.

 

p.s. I hope LabVIEW 2016 was OK. I forgot if that was your version or not.


Hi there cbutcher! It is always very enlightening reading your replies ! 

I got to say you really made a lot of modification and changes to two of the states. Without a doubt it looks very neat and tidy now ! However, there is something I do not understand, what is the purpose of the "test type"? I observed that it is linked to some of my front panel controls. How did you manage to do it? (Please teach me! 🙂 )

 

And I saw you made a comment "I dont think this will ever be true", that is true. I added a silly case structure ! Thanks for being so attentive to details ! hahahahha. 

 

Anyway, I agree with that you say regarding the iterations. I guess it is because its too long. Thus I am making a little modifications to my codes. I shall show it to you when Im done 🙂

 

Cheers,

Jarrold

0 Kudos
Message 79 of 93
(1,359 Views)

Hi Jarrold, 

 

I look forward to seeing your next iteration!

 

The Test Types indicator is the tab control I mentioned - it's a little difficult to see on the front panel because I took a "classic" style tab control and then made it transparent, and hid the label and the tabs.

 

Unlike your existing tab control, which is a control, this one should probably be called a tab indicator! I input a value (I needed to use a conversion to U32 and then coercion, not sure if there's a better way to give the same type to radio buttons and a tab control - they're both effectively an enum) to the tab indicator and it changes which tab is displayed. This makes it just like all of your visibility properties.

 

Since you had two states with different controls, a tab control seemed the natural fit. 


GCentral
0 Kudos
Message 80 of 93
(1,356 Views)