The online racing simulator
Fuel consumption indicator
(99 posts, started )
Fuel consumption indicator
Well, what began as a little experiment went a bit wild and this is the result.

EconoMeter is a fuel consumption meter for LFS. It tries to emulate behavior of onboard computers that can be found in standard road cars. It uses InSim and OutGauge to get data from LFS and displays fuel consumption in LFS. EconoMeter is written in C++ using MaKaKaZo's CInsim and the code should be fully multiplatform.
To run it on Windows you'll need MSVC++ 2008 Redistributable to be installed.

Features:
- Displays instant consumption in l/100 km or MPG
- Displays instant consumption in l/hr or gal/hr
- Displays average consumption and projected range

Usage:
- Edit following lines in "cfg.txt" file in LFS directory to enable OutGauge

OutGauge Mode 1 (or 2)
OutGauge IP 127.0.0.1
OutGauge Port 30000

You can set different values if you know what you're doing, but then the default settings of EconoMeter won't work.
- Launch LFS like "LFS /insim=29999" or type "/insim=29999" in LFS to enable InSim
- Launch EconoMeter, if you did everything right you should see EconoMeter running when you leave garage.

Controls:
- Click on the "Mode" button to toggle between "Instant consumption per distance", "Range", "Average consumption" and "Instant consumption per hour".
- Click on the "Reset" button to reset the average consumption counter. This button actually resets the whole application so you might try using it if you feel that the data displayed by EconoMeter is wrong. In that case you should also report a bug here
- Click on the "Config" button to open EconoMeter's configuration. You can use "U, D, L and R" buttons to change position of the interface or change units in which consumption and range are displayed by clicking on "Units". Clicking on "Back" saves these settings to "ecmeter.cfg" file and closes config mode.

The attached ZIP archive contains an .EXE file and a MSVS2008 project. Whoever wishes to use or modify the source in any way is by all means allowed to do so.

EconoMeter v0.051
-Fixes a corrupted instant consumption readout when units are set to MPG and instant conspumtion is 0.0l/100 km

EconoMeter v0.05
-Takes advantage of PLID info in OutGauge packet - it's now able to tell cars apart and the average consumption and range readings don't get messed up when you switch view to another car. Please note that EM receives data for one car at a time only, so consumption readings of not viewed cars don't get updated until you switch to one of them.
-Bunch of small fixes here and there

EconoMeter v0.04
-Added optional output to external window (somewhat experimental though)
-Code cleanup and reorganization, UDP connection tweak, increased responsiveness
Output to external window has to be enabled in the config file first

EconoMeter v0.03
-Added configuration file
-Interface can now be moved
Please note that as of now EconoMeter doesn't take any command line arguments, use the "ecmeter.cfg" file instead.

EconoMeter v0.02
-Added better WinSock error reporting
-Improved interface appearance
-Code cleanup
-Added some better code comments
-Added fuel/hour mode

EconoMeter v0.01
- First test (does it actually work for someone?)

(Thanks to MaKaKaZo for his CInSim lib and DarkTimes for useful pointers about OutGauge)
Attached images
ecmeter003_1.jpeg
ecmeter003_2.jpeg
ecmeter003_3.jpeg
ecmeter003_4.jpeg
Attached files
EconoMeter.zip - 43.1 KB - 1846 views
EconoMeter_src.zip - 150.5 KB - 1018 views
i can't get it to connect to outgauge.
Any chance of adding MPG to it ? Really good work though - can't wait to use it - well done .
There already is an MPG mode both in UK and US gallons. If it doesn't work for you, try modifying your "cfg.txt" in LFS dir so that OutGauge related lines look like this


OutGauge Mode 2
OutGauge Delay 100
OutGauge IP 127.0.0.1
OutGauge Port 30000
OutGauge ID

I've just tested these setting on a Win7 lappy and it worked...
This. Is. EPIC!
I take it that it works for you? Can you tell me what Windows version do you have? I think I might have found a little problem that I'd like to take better care of...

Anyway I'm glad you like it
It worked on the W7 64-bit lappy - about to try on a XP 32-bit desktop.
Version 0.02 uploaded, if nothing else it should at least provide some better error reporting for those who can't get it working...
Unfortunately it doesn't work for me. I get it connected and all, but only the buttons show up, nothing else. Clicking on them doesn't make any difference.
Quote from mixer13134 :Unfortunately it doesn't work for me. I get it connected and all, but only the buttons show up, nothing else. Clicking on them doesn't make any difference.

This is happening when EconoMeter doesn't recieve any data from OutGauge. Are you sure you've configured OutGauge precisely as I described in the first post? There might aslo be a problem with firewall blocking either LFS or EconoMeter network traffic.
#11 - hrc
.
Nejde mi to nevím proč když zapnu ten prográmek tak po 2 sekundách se vypne
It's possible you're launching things in the opposite order than you should. You have to start LFS and initialize InSim (type /insim=29999 to chat) first. Otherwise EconoMeter cannot establish connection to LFS and quits. I guess I should have mentioned that fact in the first post...

Možná že to spouštíš v opačném pořadí, než bys měl. Musíš jako první pustit LFS a nahodit InSim (napsat /insim=29999 do chatu). Jinak se EconoMeter nepřipojí k LFS a sám se ukončí. Možná jsem to měl v prvním příspěvku zmínit...
Where should i put these files?
It doesn't matter, as long as EconoMeter.exe and pthreadVC2.dll are in the same directory, it will work.
errorasssword doesnt matchmultipayaer admin password
??? Help here
-
(Niggo) DELETED by Niggo : problem solved - this thing is awesome :D
go to the screen of creating a multiplayer server, there you'll see that admin password
i thought i'd give the new version a try, but i can't get it to connect.

Quote :> econometer 127.0.0.1 20000 30000 mypassword
EconoMeter ver.:'0.02 PowerWolf', written by MadCat
Connecting to LFS...
InSim IP: 127.0.0.1
OutGauge data expected on: 20000
InSim port: 20000
OutGauge port: 30000
Admin pass: ((is this supposed to be blank?))
Error during initialization!
Bailing out

and on the lfs side i get the "password doesn't match multiplayer admin password", but i triple checked it, and it does.

so i blanked out the password in lfs and ran it again with the same options...

Quote :> econometer 127.0.0.1 20000 30000 mypassword
EconoMeter ver.:'0.02 PowerWolf', written by MadCat
Connecting to LFS...
InSim IP: 127.0.0.1
OutGauge data expected on: 20000
InSim port: 20000
OutGauge port: 30000
Admin pass: ((again, this is still blank))
Connected to LFS 0.5Z. InSim version 4
Attempting to connect to OutGauge
WinSock reported: 10049
Error: Could not connect to LFS
Error while initializing connection to OutGauge
Bailing out!
Error getting next TCP packet.
Bailing out

i dunno.
Well, that's certainly weird... anyway, I've temporarily reverted few changes I made in 0.02 and uploaded a sort of debug version. It should dump a bit better info about what's going on. If it works for you, I'll take a better look at it and upload a (hopefully) 100% working version. I might also add some config file instead of silly commandline arguments...
it works this time.

any chance that the info is moveable? it's partially hidden behind my fps counter.
Great, I'll see if I can find some time this weekend to make it all more customizabe. I'd like to move the configuration from the command line to some config file anyway.
#22 - pipa
Great program , but would it be possible to move it away from the top left corner? At the moment the chat is mostly overlaying it.
amazing

possible to make it a whole seperate window option or something? or at least make it not where chat is, or make it dissable-able?
Quote from pipa :Great program , but would it be possible to move it away from the top left corner? At the moment the chat is mostly overlaying it.

Yeah, +1
I've finally gotten around to make the interface position adjustable and while I was at it I added support for a configuration file. If you're interested, try it out and tell me how it works...

Fuel consumption indicator
(99 posts, started )
FGED GREDG RDFGDR GSFDG