LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re-initializing my array with reset button

Solved!
Go to solution

@cbutcher wrote:

Aha! So I was trying to look through your wires regarding the problem you're describing - I'm guessing you're now talking about the "Logging Volt" case and the DBL Graphs?

 

I noticed (can't believe I didn't look closely earlier!) that you have a large number of charts all overlapping one another. You definitely don't need to do this! I was trying to work out how to read around all of the many wires you have connected to "ModBus Data VI.vi" (side note - generally people try to avoid having more than the 5-3-3-5 connector pane as it becomes very hard to work out what's going on once you have so many wires. 4-2-2-4 is the good default! 🙂 ) and I noticed your Control Panel radio button controls which chart to display.

 

All you need to do here is plot ALL of the data to one Waveform Chart, and then adjust which plot is visible (assuming you only want one visible at a time). You can also adjust the label or caption of the Chart if you want to have it display like it does now, with a label describing what is being plotted.

 

This will allow you to output only one wire with all of the data from the ModBus Data VI.vi which will be another leap forward for your VI (again, congrats on progressive improvements - it all fits on one monitor nicely now. Just the overlapping that really still hurts!!).

 

The relevant section of the Detailed Help that you would want to create a multi-plot Waveform Chart is pasted below. I have made some parts bold - I'm not certain if you get equally spaced data for each wire at present:

 

To pass data for multiple plots to a waveform chart, you can bundle the data together into a cluster of scalar numeric values, where each numeric represents a single point for each of the plots.

If you want to pass multiple points per plot in a single update, wire an array of clusters of numeric values to the chart. Each numeric represents a single y value point for each of the plots.

You can use the waveform data type to create multiple plots on a waveform chart. Use the Build Waveform function to plot time on the x-axis of the chart and automatically use the correct interval between markers on the x-scale of the chart. A 1D array of waveforms that each specify t0 and a single-element Y array is useful for plotting data that is not evenly sampled because each data point has its own time stamp.

If you cannot determine the number of plots you want to display until run time, or you want to pass multiple points for multiple plots in a single update, wire a 2D array of numeric values or waveforms to the chart. By default, the waveform chart treats each column in the array as a single plot. Wire a 2D array data type to the chart, right-click the chart, and select Transpose Array from the shortcut menu to treat each row in the array as a single plot.

 

This lists all of the ways to plot multiple plots in one chart.

To select which is visible, use the property nodes:

 

Here you choose the plot index and wire it to ActPlot, then the boolean for Visible. You could consider using a For loop and an Equals node, along with your control loop, if you wire the data in the appropriate order. You'd need to also wire the iteration count, this should be a constant equal to the number of plots you have.

 

loopVis.png

 

To address your actual question, I can't see why the charts wouldn't be updated each time the ModBus VI finishes, but maybe that's what you see and you meant you wanted something else?

 

Perhaps you can upload the ModBus VI (preferably after reducing the number of inputs and outputs!) and we could take a look at that?


Hi there cbutcher,

 

Once again thanks for your very prompt reply.

 

I do not know how to get this out

visible.png

 Please teach me. 😞

0 Kudos
Message 41 of 93
(1,302 Views)

You wire a reference to a waveform chart into a Property Node. The ActPlot should be called "Active Plot", and the Visible is under "Plot > Visible". You can avoid using the reference if it is in the same VI, by creating a Property Node, then right clicking on it and selecting Link To, then Pane, then the waveform chart you need.


GCentral
0 Kudos
Message 42 of 93
(1,296 Views)

Hi cbutcher,

 

I am kind of lost right now. 

Here are a few questions that I have.

1. Where do I insert this? In my mainVI or subVI?loopVis.png

2. As you mentioned previously, I created a cluster(attached below) and I am not sure if this is the right way to do it. If yes, what is the next step ? Cause I am a little lost and do not know how to proceed. Perhaps you can give me a little help so I can understand better. 

 

Among all the ways to create a multi plot wavechart, I am not really clear between the differences. What I want is to see real time updates on my wavechart and I am able to change between different plots while data is coming in concurrently. I hope you understand what I am trying to do. 

0 Kudos
Message 43 of 93
(1,288 Views)

What my previous (long, not the short ones) post was suggesting is that you have a large number of separate charts. These mean that you need to pass a single input (for example, L1 Current) to a single chart. That results in a large number of separate wires. These clutter up your block diagram, and especially, the outputs of your "ModBus Data VI.vi".

 

If you instead take all of the data you read in ModBus Data VI.vi and put it in a format that can be wired to a single chart, and choose to only display whichever plot you want, that might be easier to read and understand. Does that make sense?

 

Attached is an example with 3 charts and a radio button selector that changes the plot and the caption.

 

exampleCharts.png

 


GCentral
0 Kudos
Message 44 of 93
(1,282 Views)

@cbutcher wrote:

What my previous (long, not the short ones) post was suggesting is that you have a large number of separate charts. These mean that you need to pass a single input (for example, L1 Current) to a single chart. That results in a large number of separate wires. These clutter up your block diagram, and especially, the outputs of your "ModBus Data VI.vi".

 

If you instead take all of the data you read in ModBus Data VI.vi and put it in a format that can be wired to a single chart, and choose to only display whichever plot you want, that might be easier to read and understand. Does that make sense?

 

Attached is an example with 3 charts and a radio button selector that changes the plot and the caption.

 

exampleCharts.png

 


Yes cbutcher, I totally agree with that you are saying. On my side, my information is a 1D array of DBL. How do I bundle it and wire it to a wavechart? I tried but I do not really understand and how to connect up this part of the connection 😞 😞 😞 Attached is how i connected it up but I do not know where is wrong 😞 

0 Kudos
Message 45 of 93
(1,279 Views)

If I understand what the picture is showing correctly, you should replace the Bundle node with Build Array. This should output a 2D array of doubles.

 

Edit: It's worth noting this will only work if the arrays have equal length. Otherwise, you'll need to work on one of the other input forms.


GCentral
0 Kudos
Message 46 of 93
(1,275 Views)

@cbutcher wrote:

If I understand what the picture is showing correctly, you should replace the Bundle node with Build Array. This should output a 2D array of doubles.

 

Edit: It's worth noting this will only work if the arrays have equal length. Otherwise, you'll need to work on one of the other input forms.


Hey there cbutcher, 

I am still unable to workout the codes with the help you provided and I am knocking off work soon. Guess I am exhausted from all of these, thus I am unable to figure it out. I will try again tomorrow 😞 😞 😞

Thanks for your help tho... I will get back to you tomorrow. 

0 Kudos
Message 47 of 93
(1,270 Views)

Hi there cbutcher,

 

I manage to get my Modbus to work like it suppose to and I am using only one wavechart as of now. However, I am not able to get the data into my MainVI. Do you know where the problem could be?

 

Attached is my VI 🙂

0 Kudos
Message 48 of 93
(1,255 Views)

Some quick comments:

  • You have a stop value change event that will never trigger, unless you're manually opening the subVI front panel. When you call the subVI, it has some value of stop. This won't change - the next time you call the subVI, it might be different, but it won't change during the subVI.
  • The control panel doesn't need to be involved in the read - you can put that code section in the main VI. Sorry for not replying about this earlier
  • I'm not certain, but I don't think you need the While loop or the Event Structure. It looks like you're just reading something, and the main VI does the looping
  • It looks like several cases in the timeout case (DEC 3000, DEC 3500, DEC 550 and DEC 6000 at least) are the same. You can make one case handle multiple values and delete the rest. Just separate them by commas.
  • You have a repeating block with only one value changing - create a subVI that calls MB Serial Master Query (by the way - I can't find this VI. I installed NI Modbus Library from VIPM. Which library are you using?) and takes an address input. Use bundle by name to change the address of a constant cluster and then just call that subVI in a for loop, with an array of addresses being autoindexed from 0 to 8, and with 10728 as an additional element. You can put them in whatever order is convenient. The divide of registers (I don't understand this - what does it do?) can also be in the subVI, since it seems to be constant. You can alternatively place it inside the for loop you create.

GCentral
0 Kudos
Message 49 of 93
(1,252 Views)

@cbutcher wrote:

Some quick comments:

  • You have a stop value change event that will never trigger, unless you're manually opening the subVI front panel. When you call the subVI, it has some value of stop. This won't change - the next time you call the subVI, it might be different, but it won't change during the subVI.
  • The control panel doesn't need to be involved in the read - you can put that code section in the main VI. Sorry for not replying about this earlier
  • I'm not certain, but I don't think you need the While loop or the Event Structure. It looks like you're just reading something, and the main VI does the looping
  • It looks like several cases in the timeout case (DEC 3000, DEC 3500, DEC 550 and DEC 6000 at least) are the same. You can make one case handle multiple values and delete the rest. Just separate them by commas.
  • You have a repeating block with only one value changing - create a subVI that calls MB Serial Master Query (by the way - I can't find this VI. I installed NI Modbus Library from VIPM. Which library are you using?) and takes an address input. Use bundle by name to change the address of a constant cluster and then just call that subVI in a for loop, with an array of addresses being autoindexed from 0 to 8, and with 10728 as an additional element. You can put them in whatever order is convenient. The divide of registers (I don't understand this - what does it do?) can also be in the subVI, since it seems to be constant. You can alternatively place it inside the for loop you create.

Hi there cbutcher, 

Firstly, I would like to thank you for being here to help me once again. 

 

1. Moving on, I figured out the stop button issue and wired all three cases to the stop button. So that when my timer is up, no matter which case it is currently in, it will exit the subVI. Is this method okay?

 

2. I placed this set of codes in my mainVI 🙂

 

3. This is true, I have tried remove the loops but it appears that my control panel is stuck after i clicked on it once. Im not really sure what is going on. Mind taking a look at my codes? (Sorry its all over the place again because I was trying to implement the codes, thus I havent tidy it up)

 

4. As for all these DEC(s), actually all of these are individual controllers that have their individual datasheets. I am told that these controllers have different registers thus right now, I am only working on the 3500XT. After it can work, I will change all their address respectively because they are not the same. (Sorry for the misunderstanding on this part).

 

I have attached the modbus library that I downloaded. 

 

 

0 Kudos
Message 50 of 93
(1,246 Views)