LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

There must be a better way of doing this

Solved!
Go to solution

Hi Aeastet, good to hear from you. I've attached the new version of the VI, i think i've done what you suggested.

 

Sorry for the confusing posts above. I still want to produce 25 separate reports, but now i only want 2 analog channels instead of three to supply the data for the report. One of the analog channels (call it AI1) will contain info on what test is being performed on the battery. The other analog input (AI2) will read the voltage across the battery.

 

When AI1 indicates that test 3 is being performed i want the data from AI2 to go to top_graph in the report. and when AI1 shows that test 4 is being performed, the data from AI2 to go to bottom_graph in the report. When AI1 shows that any other test is being performed i don't want the data to be recorded at all.

 

I thought that a case structure in the consumer loop might work, but soon realised that that left terminals unconnected. So i'm unsure as how to proceed.

 

Chris

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 21 of 46
(1,507 Views)

FOr your digital loop you did not creat the event for the exit. You can do this by right clicking on the case names and add evet. You select the control that you are trying to key on. In this case the exit button value change and click ok. Just so you know you can have multiple events onfigured to a case. THese can be tied to one control or many say for instance you want to check if a control has been changed by the operator you can add a value change for each control you want monitored and have it all go to the same event.

 

 

Second I would try to make it so that you do not show your controls and inicators as icons. This can be easily changed by right clicking on the control or indicator and unchecking the view as Icon. They icons take up too much space on your diagram.

 

Take care of this and I will start helping with getting data in the right palces.

Tim
GHSP
0 Kudos
Message 22 of 46
(1,499 Views)

Now if you could tell me what you are doing with the data? Are you taking one data point and adding it to the end of a report? How do you know what test you are running? What kind of graph are you looking for. Do you want a chart that stors data for a little while or one that stores all of the data when the test is running?

 

 

You can resize the index array if you look at the bottom of the index array and you mouse over the edge you will get and pulldown just like you do for the array. This allows you to resize the index array function see picture.

 

18219iDD71B76B359F5053

Tim
GHSP
0 Kudos
Message 23 of 46
(1,496 Views)

I've done all that you suggested, including adding a true/false constant to the while loop stop, and sorting out the stop task etc. in the exit case (just like in the producer loop)

 

Right, the data i want to collect: One voltage every minute, for as long as each test is running. I am taking these voltages from a larger piece of equipment that controls which test each battery is under. This equipment also determines if the battery passes/fails each test and sends that information via the digital input.

 

The programming in the test equipment keeps a voltage running through one of the analog inputs for each battery. The voltage running through this analog input is incremented by 100mV each time the next test in the sequence is performed. ie running test 1 - AI = 100mV then battery passes test 1, the tester moves onto test 2 and AI = 200mV etc.

 

Every minute that test 3 and test 4 are running i want to collect a single data point from each of the other AI associated with each battery. I want the data collected to be sent to two separate graphs in the report - one graph for test 3 and one for test 4. Just simple voltage vs. time graphs are fine.

 

 

 

(just to clarify: earlier in this thread i said that there would be three AI per battery - one for recording the test number (this is the one which runs into the max/min function and then into the pass/fail case structure) and two for recording different voltages across the battery. NOW however i am getting rid of one of the AI measuring voltage across the battery. Therefore there are now only two AI per battery - one for the test number and one for the voltage across the battery)

 

Cheers,

 

Chris

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 24 of 46
(1,472 Views)

Can you attache the latest program?

Tim
GHSP
0 Kudos
Message 25 of 46
(1,464 Views)

here it is

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 26 of 46
(1,457 Views)

OK we  are making progress on your program. I made a few changes to the block diagram. You should really try and keep the block diagram in one window. This really helps when you are trying to trouble shoot when there is a problem. I fixed most of that. The digital loop that you added is using the same VI as a setup. You will need to make a new one that sets up the digital channels. This loop will just error out right now. Take a swig at trying to fix that and I will help if you can not figure it out.

 

In the data logging step in the state machine. You have everything that you need to in order to send the data where you want it. It will iterate throught the tests and take the first two array points index them a to get test number and the data the goes with it. If you look at the first index you just need to do a comparison to decide if you are in the 3rd or 4th test to plot the points. Take a shot at getting this working and we can go from there too.

 

Take the VI that I am providing and replace the one in the folder that I sent you.

Tim
GHSP
0 Kudos
Message 27 of 46
(1,444 Views)

Progress is goodSmiley Happy. I'm using a laptop at the minute and whatever i do to try and arrange the loops i can't fit them all on the screen - so i don't even try!

 

I think i've got the digital input sorted out, by creating a new task set up VI and then configuring it to digital input. See what you think.

 

I see what you've done with linking the number of reports up to the channel number and changing to a 1D array. This is to record only the battery voltages and transfer them to the consumer loop right?

 

However i'm not entirely sure at the moment (and i'm emailing now!) whether there will just be one analog input for a global test number or if each battery pack (and therefore each analog channel measuring battery voltage) will have a separate test number channel.

 

If each battery pack has a separate test number analog input, then "data" will have to become a 2D array and the comparison done for each voltage separately

 

 

 

Chris

 

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 28 of 46
(1,428 Views)

I think i've got the digital input sorted out, by creating a new task set up VI and then configuring it to digital input. See what you think.

 

Are you looking for a digital input or digital output? The way you had it the first time looked more like na output. If it is to be an output then the vi need more work. You need a channel array instead of just one channel.

 

18287iF035ACBF44BA1273

 

I see what you've done with linking the number of reports up to the channel number and changing to a 1D array. This is to record only the battery voltages and transfer them to the consumer loop right?

 

This figures out how many channels that you have so that you can generate how many reports you need to make. I am assuming that is what you wanted based ont the orginal post.

 

However i'm not entirely sure at the moment (and i'm emailing now!) whether there will just be one analog input for a global test number or if each battery pack (and therefore each analog channel measuring battery voltage) will have a separate test number channel.

 

We can work with this as we move ahead. I have given you enough that you should be able to start to see what I am doing. I am going to start pushing you to get more into the code and ask questions when you get stuck.

 

If each battery pack has a separate test number analog input, then "data" will have to become a 2D array and the comparison done for each voltage separately


I do not believe that you are correct here I think there are other ways to do this. I may not be understanding what you are try to do here but I think there are other ways.

 

We can keep going here and I will hep you get this as much as time allows. I do have a full time job but I do not mind helping when I can. I like to see people get help whit the concepts that are there to make you like easier when it comes to programming.

Tim
GHSP
Message 29 of 46
(1,420 Views)

One more thing is that you need to change the digital input to digital output. Do you know how to do this?

 

18289iF2921D878003CE14

 

 

Tim
GHSP
0 Kudos
Message 30 of 46
(1,418 Views)