A high-performance Python package for handling ETAS DCM(Data Conversion Format) files used in engine calibration tools like INCA, MDA, EHANDBOOK, and CANape.
fromdcmimportDCM# Read a DCM filedcm=DCM.from_file('calibration.dcm')
# Access calibration dataparameter_value=dcm.parameters['ENGINE_SPEED'].valuemap_data=dcm.maps['FUEL_MAP'].dataframecurve_data=dcm.curves['BOOST_CURVE'].series# Interpolate valuesx_points= [1000, 1500, 2000] # RPMy_points= [50, 75, 100] # Load %interpolated=dcm.maps['FUEL_MAP'].as_function(x_points, y_points)
# Visualize datadcm.maps['FUEL_MAP'].to_figure()- Easy Data Access: Directly access parameters, curves, and maps with Pandas integration
- Interpolation: Built-in 1D/2D linear interpolation for real-time value calculation
- Visualization: One-line plotting of characteristic curves and maps
- Excel Integration: Import/export calibration data from Excel spreadsheets
- Set Operations: Compare and merge DCM files with
|,-,&, and%operators - Type Support: Handle all DCM data types including fixed/group characteristics
Requires Python ≥ 3.10
pip install python-dcm# Get parameter valuerpm_limit=dcm.parameters['MAX_RPM'].value# Access map as DataFramefuel_map=dcm.maps['FUEL_MAP'].dataframefuel_map.iloc[0, 0] =14.7# Modify value# Get curve databoost_curve=dcm.curves['BOOST_CURVE'].seriesmax_boost=boost_curve.max()# Load calibration data from Exceldcm.load_from_excel(
maps_path='maps.xlsx',
curves_path='curves.xlsx',
parameters_path='params.xlsx'
)
# Each sheet name becomes the calibration object nameimportmatplotlib.pyplotasplt# Plot a map with custom settingsfig, ax=dcm.maps['FUEL_MAP'].to_figure(
cmap='viridis',
fontsize=12
)
plt.show()
# Plot multiple curvesfig, ax=plt.subplots()
dcm.curves['BOOST_LOW'].to_figure(ax=ax, label='Low')
dcm.curves['BOOST_HIGH'].to_figure(ax=ax, label='High')
plt.legend()param=dcm.parameters['CONTROL_BITS']
binary=param.as_bin() # [1, 3, 5] (bits set to 1)hex_val=param.as_hex() # [A, F, 1] (hexadecimal digits)# Find differences between calibrationsmodified=old_dcm%new_dcmprint(modified.parameters.keys()) # Changed parameters# Merge calibrationscombined=dcm1|dcm2- Parameters (FESTWERT)
- Parameter Blocks (FESTWERTEBLOCK)
- Characteristic Lines (KENNLINIE/FESTKENNLINIE/GRUPPENKENNLINIE)
- Characteristic Maps (KENNFELD/FESTKENNFELD/GRUPPENKENNFELD)
- Distributions (STUETZSTELLENVERTEILUNG)
- Text Strings (TEXTSTRING)
- NumPy ≥ 1.20.0
- Pandas ≥ 1.5.0
- Matplotlib ≥ 3.0.0
- OpenPyXL ≥ 3.1.0
MIT License
Contributions welcome! Please format code with ruff before submitting PRs.
- Author: c0sogi
- Email: dcas@naver.com or cosogi1@gmail.com
Feel free to reach out for questions or suggestions.
For detailed documentation and examples, visit our GitHub repository.