EcoModder.com

EcoModder.com (https://ecomodder.com/forum/)
-   OpenGauge / MPGuino FE computer (https://ecomodder.com/forum/opengauge-mpguino-fe-computer.html)
-   -   MPH code? (https://ecomodder.com/forum/showthread.php/mph-code-19708.html)

Leviticus6432 12-07-2011 03:03 PM

MPH code?
 
Hey guys, I've been digging around on the forum in search of a working code that converts vss input to mph. I have found several attempts but all are inaccurate. My personal attempts have been inaccurate as well. You guys have appearently got a pretty accurate code for this somewhere as the Mpguino tells your mph. If anyone has a functional code could you please post it? I am trying to make a logical automatic transmission controller. Thank You

Sebastian 12-08-2011 11:10 AM

My Version of MPGuino Code uses this small code. Only change to MPGuino original should be the use of standard math functions:

Code:

unsigned long instantfuelperhour(){
  unsigned long instInjDur = instInjEnd - instInjStart;
  if (instInjDur == 0) return 0;
  return (instInjTot * 3600000000ull) * 1000ull / parms[MICRO_SECONDS_PER_LITER_IDX] / instInjDur; 
}

Works just fine.

Leviticus6432 12-08-2011 11:31 AM

Um I don't see how that code is relevant? I must have been unclear on what I am looking for. I need a standalone code to convert pps into mph. Thanks

Sebastian 12-08-2011 01:09 PM

Oh, I mixed up mph and gph :turtle:

Code:

unsigned long instantvehiclespeed(){
  if (instant.vssPulses == 0) return 0;
  return 1000000000ul / parms[VSS_PULSES_PER_KM_IDX] * 3600 / (instant.vssPulseLength / instant.vssPulses);
}

But you should have a look in the mpguino code on your own to see how vssPulseLength and vssPulses are measured! It's a lot more than a single code block..

Leviticus6432 12-08-2011 02:54 PM

is it possible to put the codes easily into a single code block?

Sebastian 12-08-2011 03:21 PM

Of course not. The code above calculates the speed from the collected data, but to collected the data you have to put other code inside interrupt service routines, you need some global volatile variables and so on. Thats not like calculating the power of a value which can be written into a single function.

I think you should invest some time in learning about coding for microcontrollers, specialy interrupts, before you continue with your project. Trying to understand to MPGuino code in Arduino language would be a good step :thumbup:

dcb 12-08-2011 10:15 PM

simple block code can be like

top:
poll for a pulse
start counting
poll for another pulse (while counting)
stop counting
compute mph from the count
do something with the mph
goto top

this won't track distance precisely, but with a hall effect vss it will give a snapshot of your speed every loop (with a reed switch you will be all over the place). This is the sort of thing arduino users do, and it has severe limitations, but is good for what you describe maybe.

Leviticus6432 12-08-2011 11:24 PM

wo wo wo... why does having a reed switch make it all over the place? My project is an 88 toyota pickup with a chevy motor and trans. The trans is a 4l60e with a relucter gear. Does this mean the trans speed sensor is hall effect? Because I had the dash out of the truck and I've just been using a toyota speedo as my signal generator. It has a 4 pulse per revolution reed switch built in for cruise control. I've just been spinning it with a drill and getting very inaccurate readings. So your saying some of the codes I have written could potentially work with the actual speed sensor even tho they are inaccurate with the reed switch test speedo? Thanks for the reply!!!

dcb 12-09-2011 07:19 AM

why?!? I don't know exactly, just from observation. I have to average out several pulse lengths to get a reasonably steady reading from a reed switch.

dcb 12-09-2011 07:33 AM

On a side note, I see you are by the wabash river, I've noticed a number of meanders that have isolated pockets of indiana in illinois and vice versa,
Lawrenceville, il - Google Maps

Given their isolation from their parent state, do people still live/use these lumps? And taxes/etc go to indiana? or do they have agreements with the host state for public services? or?

Leviticus6432 12-09-2011 12:53 PM

dcb, that is a very interesting question that I don't exactly know the answer to. I am only 20 so I haven't exactly looked into taxes and such very much. I can, however, tell you that there is prob not much value in the land there anyway. I can almost guarentee nobody lives there and it is most likely not farmed as well. Notice if you look just northwest and southeast of Lawrenceville you will see the Embrass River is relatively strait. This is where a new channel has been cut and the other small curved parts of the river that are cut off are known as "dead rivers." I know the land between the dead rivers and the new river is basically worthless. This is where my assumption about the pockets you speak of comes from. I have not personally went and looked at any of them, but I would assume they are similar to the spaces between the dead rivers and the Embrass. Notice that the pocket you linked to by Greyville is acutally surrounded by a "dead river." It is interesting that there are roads their tho. I might look into it some more.

Leviticus6432 12-09-2011 12:55 PM

So if the speed sensor on my 4l60e reads off a "relucter gear" does that make it a hall effect sensor?


All times are GMT -4. The time now is 09:04 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com