LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Odometer for Electric Vehicle

We have a programming question with our vi.  We are reading an rpm signal
from our electric vehicle controller.  The signal is generated every 1/10th
of a second.  We are trying to use this data to produce an odometer for the
vehicle.  The conversion for distance traveled in 1/10th second is

= ((.1)*X)/60 * (Gear ratio constant)       Where X is signal input

We need to take this distance and permanently store and add the next
distance to create a functional odometer.
-My question for you is what is the simplest way to do this so that I can
teach students this process of programming.
-Additional Code questions-Would the odometer reset back to zero each time
the program is stopped or would the data continue to be stored?
-Our code will need to be applicable on our
PDA Module

We appreciate any help that you can provide
Thanks
Chris Tolbert
0 Kudos
Message 1 of 12
(9,608 Views)

Chris,

The best way is possibly a while loop with a shift register for the data.
Read out all the engine electronic informations and add tham to the contens of the shift register within each iteration.

With kind regards

Martin Kunze

KDI Digital Instrumentation.com
e-mail: martin.kunze@digital-instrumentation.com
Tel: +49 (0)441 9490852
0 Kudos
Message 2 of 12
(9,600 Views)
The program will lose its values when stopped. Exceptio: An uninitialized shift register will retain its data between calls so long as the VI remains in memory. If the power to the processor can ever shut down over the life of the vehicle or the CPU ever reboots you need to have an alternative. Write the odometer data to a file and read that file when the program starts.

Lynn
0 Kudos
Message 3 of 12
(9,567 Views)
Can you give me some key words that I can use to find examples and tutorials to accomplish this?  I am green to labview but I want to learn.
Thanks
 
0 Kudos
Message 4 of 12
(9,552 Views)
After thinking more about what you said I have a question.  Can we save each signal to a file (or whatever) then simply create a reader that will continuously sum the data stored in the file (or whatever).  Would this be a bad way to program?  Keep in mind we are going to create a pda vi so we will have limited capabilities. 
 
0 Kudos
Message 5 of 12
(9,550 Views)
 
 Hi Chris,
 
 There are examples shipped with labview that can provide the functionality you need. You will need to modify then slightly to meet your specific need's, but they are good examples of how labview thinks. Here's the basic idea behind data acquisition/writing data/etc:
 
  1. open/create a channel  (could be a file, tcp/ip link, etc)
  2. read/write to the channel (read from text file, write to tcp/ip connection, etc)
  3. close the channel (close text file, etc)
 
 Steps 1 and 3 should be done minimally to keep execution speed high. Step 2 should be in a loop if you want a periodic type action (reading a sensor every millisecond for example).
 
These examples can be found by going to Help->Example Finder
 
 Text file reading/writing : Example Finder->Fundamentals-> File Input/Output -> Write to text file.vi or Read from text file.vi
 
 You could calculate your odometer reading while the vehicle is operating, then as part of shutdown save this to a text file. When vehicle is started up, read from the text file and load into odometer variable.
 
 Good luck, I hope this helped a little.
 
 Matthew Watkins
 
 
 
0 Kudos
Message 6 of 12
(9,544 Views)
Chris,

I think you would want to keep minimal amounts of data rather than having the file grow. The odometer reading is a single value. The raw data would accumulate large amounts of data over time. Even if you wanted to keep statistical data such as the number of times the vehicle moved and how far each time or what speeds, it would be more compact to store summaries of that data than the raw encoder data. If you do want the raw data, take a look at the storage requirements and be sure you can handle it.

Lynn
0 Kudos
Message 7 of 12
(9,531 Views)

Chris:

How are you reading the data from your odometer? Is it connected over the serial, usb, parallel ports?. I am tying to figure out which NI drivers you are using so I can make sure that you will have the proper support on your PDA. Please let me know.

Thanks,

Rudi N.

0 Kudos
Message 8 of 12
(9,507 Views)
We are reading hexadecimal code from the controller via serial com port.  We have the vi working on a laptop but we are trying to learn how to transfer the program to a pda.  We have the pda module for 8.0 but our visa will not transfer.  A labview engineer said that the labview 8.2 pda module would transfer.  We are waiting for that to arrive so we can try that next.  I don't think we can figure out the current 8.0 visa for the pda because we had a heck of a time with the visa for the laptop working.  Serial communication is not the best to learn on....
If you need more information about our vi let me know.  Your help is very much appreciated. 
0 Kudos
Message 9 of 12
(9,497 Views)

Chris:

Thank you for providing more information about your application. I double checked and you cannot build an application that uses the VISA API with LabVIEW PDA 8.0. The version 8.2 will definitely allow you to do that. Please let me know if you run into any snags.

Regards,

Rudi N.

0 Kudos
Message 10 of 12
(9,448 Views)