LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview 2011 with TruckSim 8.01 Automated Runs

Hello,

I have been using Labview on and off for a few months so I am still fairly new.  I skimmed through the help files and various support and could not find the answer, but sorry if this is an obvious and basic question.

I am running TruckSim with Labview, changing various parameters and writing various performance measures to a file to see how the parameters effect the performance.  Currently my only option is changing certain model parameters by hand between each run.  I want to be able to let it run overnight and change parameters automatically.

Can anyone point me in the right direction as to how to make the .vi run unattended?  Specifically, the .vi has to execute and write various numbers to a text file (got that part down), then stop the run, reset everything, change certain model parameters to new values, re-run the .vi, append the new results to the same file (I know how to do that), rinse and repeat several hundred or several thousand times.

I was loosely thinking I could stuff my entire while loop inside of another larger while loop and then I could use the loop counter from the larger one as the index of an array containing the parameters I want to change.  So the 10th execution would go and grab the 10th value in my array'ed list of parameters.  I haven't thought about how to reset the time counter and everything else to zero between runs.  I see there is a 'run continuously' button.  That would be fine and dandy if, between runs, I could persuade it to automatically change those parameters I need to change.

Thats the first question.  Second question is much more straight forward.  Using the write to text function, I just want to write things at the END of the entire simulation.  Not every execution of the loop.  This must be slowing it down tremendously as it has to write ~a dozen numbers to a file 1000 times a second.

Thanks for your time!  Much appreciated.

I attached a screenshot of the default base file that I built into.

0 Kudos
Message 1 of 7
(3,095 Views)

It sounds like you’re on the right track with the nested while loops, but one suggestion I would make is that instead of adding another while loop to your current VI, set up this VI as a subVI, and build the “outer loop” as a second VI that calls it.  This would have basically the same functionality as the setup you mentioned, but you would also be able to maintain the functionality of your current VI, so you could still run tests manually.

 

As far as writing at the end of the simulation goes, you can move your Write to Text function outside of the while loop, right click on the tunnel where the data exits the loop and select “Enable Indexing,” and  LabVIEW will build an array of the data as the loop iterates, but will not write it to file until the loop is stopped.  There is a lot of information about this if you search LabVIEW help for “Passing Elements in an Array through a Loop.”

 

 

Jayme W.

Applications Engineer

National Instruments

Jayme W.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 7
(3,061 Views)

I am trying to do the same thing. How are you able to change parameters from labview to TruckSim? Are you using the VS API commands?

 

Most of the Labview examples provide with TruckSim seem to be data wrappers but I am missing how to actually change parameters in TruckSim (blue links) from Labview.

0 Kudos
Message 3 of 7
(3,040 Views)

Hi Rogefeller,

 

You can find information in this article about using CarSim and TruckSim with LabVIEW.

Jayme W.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 7
(3,019 Views)

Hi Jayme and thanks for the help.

Apparently my 'thread subscription' thing wasn't working.  I thought this would be a dead thread forever.  I did manage to figure out most of my problems.  Trucksim is able to run unattended, however, I can only make it run random values for different control parameters.  I want to run something like a design of experiments, but a BIG ONE with massive array.

I'm sorry to say that the link you provided is interesting but only of moderate value.  I am actually using PXI for HIL testing with trucksim.  I have many other issues and questions if you would be willing to help or point me the right direction!   (another time)

Thanks,

0 Kudos
Message 5 of 7
(3,015 Views)

I think you are after the same thing I am, and I was finally able to accomplish it using "VS COM Interface" commands

 

(in TruckSim, go to Help > Reference Manuals > VI COM Interface)

 

This documents provides a list of all of the commands you can use to control TruckSim from another application. There are examples for Matlab and VB, but nothing for Labview so I basically figured it out. You can use Labview to control just about anything in Truck from changing bluelinks to running the simulation. I built severals arrays in Labview for the different brakes, suspension, wheelbase, etc then Labview chugs through each simulation, changing one thing at a time (or whatever I want changed) and then in the end I have a mound of data from all of the various runs.

 

Attached is a very basic example of how to use the VS COM commands in Labview.

 

0 Kudos
Message 6 of 7
(3,009 Views)

Yes it sounds like we had the same goals almost.  I will try that VS COMM interface as soon as i get in there tomorrow.  I did find that PDF help file and I saw the same thing that you did: pretty much all the examples were VB and Simulink.  I was not as savvy as you were, nor did I have the time, to self learn it.  I was having a hard enough time basically teaching myself Trucksim and Labview.

I've had to take a break from the project but it's getting back into full swing and going onto the next level.  I'm sure I will have more questions to ask!  It sounds like you are not running real-time.  I have some small but nagging issues with that as well.

Thanks again

0 Kudos
Message 7 of 7
(3,002 Views)