OBDSim
Introduction
While developing OBD GPS Logger, I found a need for a software simulator, and all the ones out there kinda lacked some features I wanted. Specifically, the itches being scratched and some of the major features added since:
Command-line - I wanted it to work from the command-line [and optionally a GUI version]. Specifically I wanted something I could run on a SheevaPlug.
Works with OBD GPS Logger - Explicitly, I wanted to be able to read logfiles from obdgpslogger, and have the simulator work with that.
Pluggable - There were a couple OBDII simulators out there, but they all had single, hardcoded data sources. I wanted to be able to configure it to work with multiple, different, data sources.
Honors Elm327 AT commands - Many simulators appear to understand ELM327 AT commands [such as echo on/off], but do not actually honor them. As a tool for working on OBDII software, it seems important to support these features.
Multiple ECU support - You can use multiple data sources simultaneously, each pretends to be a different engine control unit.
Cross platform, multiple terminal types - OBDSim works on Linux, Windows, OSX and others, and the same framework is used to simulate bluetooth as well as serial connections
Multiple Protocols - there are lots of protocols that might be talked, each with a different way of presenting headers. Multiple ECU support hinges on this
Benchmarking - it's a simple thing, but it's good to know the samplerate you're getting while developing
Realising that a good OBDII simulator warrants more interest than just a side-note on another project's front page, I have created this page.
The simulator is technically also an ELM327 simulator. The current list of supported AT commands, with short descriptions, has a section dedicated to it in the manpage. There is a text version of the manpage here: obdsim manpage
Screenshots
It's worth noting that the GUI is the least interesting part of obdsim. That being said, there is a gui plugin...
Plugins
Plugins [often called "generators" in obdsim] come in two flavors. One, and most highly recommended, are plugins that are statically built into the software. A tutorial on creating generators is included in the source.
The author realises that this creates certain possibly-unwanted source requirements, since obdsim is GPLv2+. As a result, there is an optional plugin called "dlopen", statically linked with the simulator. This plugin is able to dynamically open a .so/.dylib/.dll plugin and call functions in that. The only header you need to #include to write a dynamic plugin explicitly has the copyright disavowed on it, and instead borrows a blessing from SQLite. The intention is for closed-source vendors to be able to use obdsim for their own purposes without needing to release source [although source release is still actively encouraged]
obdsim takes several parameters - the name of the generator you choose to use, and a "seed" for that generator. That seed can be any of a number of things; the dlopen plugin takes a .so, the dbus plugin takes a config file, etc. Herewith, the available generators:
Logger - Possibly the most interesting data generator, it reads a logfile generated by obdgpslogger and returns values from it. It reports that it is capable of returning any values in the database, and returns actual values logged before, interpolating as necessary.
Cycle - Cycles through values based on time. Most of the numbers simply go up linearly with time, until the end of a cycle when they reset to zero. RPM is calculated based on number of gears. Cycle length and number of gears are configurable with the seed.
Random - This generator reports that it is capable of responding to the first 25 commands in the OBD command set, and any time any of those numbers is requested it returns a random number. Users wishing to implement new plugins for this system should probably start by copying this.
DBus - Given a dbus interface-path-member 3-tuple, this listens for key/value pair messages. It caches the most recently seen version of each key/value pair, and responds to OBD requests appropriately. Mapping of keys to OBDII PIDs is done using a config file.
dlopen - Recognising that some people may not like to release the source code and statically link with a GPL product, there is a dlopen plugin. Pass it the dll/so/dylib you wish to open, and be sure that library implements all the functions in simdl_datasource.h.
Socket - For communicating with wifi OBDII dongles without network-aware OBDII software. At time of writing, obdgpslogger is not network-aware.
gui_fltk - FLTK GUI plugin - small GUI is presented that offers a few parameters modifiable using the mouse or keyboard.
Error - Purely for testing, this generator just churns out error codes.
To see a list of plugins available, run obdsim with --help
Not just a simulator, but a proxy
One possible use for obdsim is not just creating numbers from thin air, but as an easy way to proxy values from other systems.
The DBus plugin was originally written to work with fbd, a fusion brain daemon for Linux. Various people appear to be using the [very affordable] fusion brain device for running sensors in their car engine - people whose car pre-dates the OBDII standard.
There's a very large corpus of excellent tools out there [both Free and commercial] to work with OBDII, and not so many to work with, say, VAG-COM or OBDI. By using obdsim to proxy values from your older car to your OBDII software, you gain access to a lot of high quality analysis tools that you otherwise wouldn't have been able to use.
If you have a wifi OBDII dongle but your OBDII software is not network-aware, you can use the "Socket" generator to achieve the necessary bridging.
Downloading
obdsim is in the same source repository as obdgpslogger. For detailed download and installation directions, please visit the top level page for obdgpslogger
For windows users, I occasionally release builds. The most recent one is always obdsimwindows-latest.zip, or you can browse releases in this directory Contained in the zipfile is the obdsim program as well as instructions. Requires com0com or similar.
Last updated