-
Notifications
You must be signed in to change notification settings - Fork 11
MAF Data
When using thee MAF sensor to measure flow the mass flow data is calculated by using a 6th order polynomial calculation. This is implemented within the code using a transfer function. In order for the transfer function to work it must be provided with the 6 polynomial coefficients.
flowRateKGH = config.mafCoeff0 + (config.mafCoeff1 * mafMilliVolts) + (config.mafCoeff2 * pow(mafMilliVolts, 2)) + (config.mafCoeff3 * pow(mafMilliVolts, 3)) + (config.mafCoeff4 * pow(mafMilliVolts, 4)) + (config.mafCoeff5 * pow(mafMilliVolts, 5)) + (config.mafCoeff6 * pow(mafMilliVolts, 6));
or simplified...
flow (kg/h) = a + bx + cx^2 + dx^3 + ex^4 + fx^5 + gx^6
Where: a-g are the coefficients and x is the sensor voltage
The coefficients used in the calculation above can be derived from a MAF lookup table. The MAF lookup table should comprise of a table of values in the following format:
millivolt : mass flow (KG/h)
All MAF data is stored within the MafData class within MafData.h To add support for an additional MAF sensor the following data is required.
- MAF Manufacturer and part number
- MAF Output type (voltage / frequency) NOTE only voltage currently supported.
- MAF coefficients or a valid MAF data table that can be used to generate the coefficients
- Original MAF diameter
- Maximum flow value in kg/h
- Discussion thread URL (https://github.com/DeeEmm/DIY-Flow-Bench/discussions)
If you are scaling your output from OEM data sheets you may need to translate the output from lbs/hr into kg/hr. To convert from lbs/h to kg/h you can use the following formula:
1 kg/h = 2.20462 lb/h
Other conversions that you may need to undertake are
1 mg/s = 0.0036 kg/h
1 g/m = 0.06 kg/h
You may also need to convert from volts to millivolts:
millivolts = volts x 1000
Once you have created your data file, the mafTransferFunctionGenerator.py file, which can be found in the tools folder can be used to generate the coefficients. The MAF Data must be placed in a file called mafData.json within the tools folder and it must be in JSON format.
![Screenshot BOSCH_0280218067](https://private-user-images.githubusercontent.com/3038710/404489790-3cc60a81-cf54-47f0-8b2c-988ccb09b4f8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5NTk2NTAsIm5iZiI6MTczOTk1OTM1MCwicGF0aCI6Ii8zMDM4NzEwLzQwNDQ4OTc5MC0zY2M2MGE4MS1jZjU0LTQ3ZjAtOGIyYy05ODhjY2IwOWI0ZjgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTlUMTAwMjMwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NzU3ZWQyYjIzY2Y2NDA4ZTNmYTIyNDExNmM4MWVlZGFmNTQ0NzkyODQyNzE0MDg3ZGQzZTcyZmVhNmMzYWQ3MiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.olPZjuS1mdiyfJIwGAP7Rl3Gsz4k0-MsPcBGlBeOcmM)
When you run the mafTransferFunctionGenerator.py file, the generated coefficients will be displayed in the terminal and a transfer function graph will be generated that plots the transfer function data against the generated values in the mafData.json file.
Note the R value - this is an indication of the match to the source data. 1 = perfect match.
Once you have the required data you can add it to the MafData class in mafdata.h
![Screenshot 2025-01-18 at 1 18 22 pm](https://private-user-images.githubusercontent.com/3038710/404490039-baefafd0-672c-4b14-b8b7-d1c1215195fa.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5NTk2NTAsIm5iZiI6MTczOTk1OTM1MCwicGF0aCI6Ii8zMDM4NzEwLzQwNDQ5MDAzOS1iYWVmYWZkMC02NzJjLTRiMTQtYjhiNy1kMWMxMjE1MTk1ZmEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTlUMTAwMjMwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OThmMjA0YjBiMTQ0N2JjNzFjYzI5OWU0MTQ5NmZmNmYyYjVjYmRkMGExOTE1M2IzZmJhMTE1N2FjMWVlMWY5ZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.7utQEvP7RN1_EwSzbUyBtT8uzfSzSmKQDPw6RUH9sFc)
Please also create a discussion thread in the forums for the MAF file and post your data. You can then use this URL when you add the data to the MafData class. The 'Info' icon in the GUI next to the MAF name links directly to this url, so that anyone using your MAF in the future can get help / submit discussions by following this link.
Further help / discussions on MAF data file creation can be found in the forums - https://github.com/DeeEmm/DIY-Flow-Bench/discussions/51
Frequency based sensors are currently not supported but will follow the same principle of using a 6th order polynomial calculation and the same transfer function format.
{ frequency, mass-flow-rate }
When creating a lookup table for a frequency based sensor note that you need to set the MAFoutputType variable to FREQUENCY
. This variable determines how the software processes the raw signal data.
NOTE: Frequency based sensors are currently not working in the beta releases but will be included in a future release
Slot style MAF sensors can be used in custom diameter housings. This allows the flow capabilities of the sensor to be increased by increasing the housing diameter.
The MAF data diameter is the MAF housing inner diameter that the flow data relates to. This is generally the OEM housing size.
On the System Settings page in the WebUI the MAF Diameter (mm) setting specifies the size of the installed housing.
The code uses the default MAF diameter value stored in the MafData class and the diameter of the installed housing to automatically scale the flow value based on the difference in housing diameters.
OEM housing area : Installed housing area
This will work for both larger and smaller than original MAF housings
If either value is set to zero or the two values are the same the calculation is not performed and the original MAF flow data is used. This means that the scaling is only applied if the original diameter is listed in the MAF Data file AND a positive non-standard diameter is entered into the GUI.
For help and assistance converting or including MAF data, please post in the official discussion thread