<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.luntti.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mol</id>
	<title>wikiluntti - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.luntti.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mol"/>
	<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Special:Contributions/Mol"/>
	<updated>2026-04-09T02:33:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15666</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15666"/>
		<updated>2026-04-06T13:46:00Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
https://www.norgeskart.no/?backgroundLayer=toporaster&amp;amp;lon=822368.0472314445&amp;amp;lat=7767892.806770398&amp;amp;rotation=0&amp;amp;zoom=7&amp;amp;printTool=hiking&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
*DEM Digital elevation model&lt;br /&gt;
*DSM Digital surface model&lt;br /&gt;
*DTM Digital terrain model&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
* folium&lt;br /&gt;
* geopy&lt;br /&gt;
* GeoPandas&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
DEM files (likes SRTM data) with&lt;br /&gt;
* Rasterio&lt;br /&gt;
* GDAL&lt;br /&gt;
&lt;br /&gt;
Norwegian national DEM (Kartverket). The Norwegian Mapping Authority provides very high-resolution DEM data (down to 1 meter). https://hoydedata.no. The files in the .zip package&lt;br /&gt;
* .tif: pixel = elevation value&lt;br /&gt;
* .tfw (world file). Georeferencing info (pixel size, rotation, coordinates)&lt;br /&gt;
* .tif.aux.xml. May include Statistics (min/max elevation), Pyramid layers (for faster display), Projection overrides&lt;br /&gt;
* .prj Defines the coordinate reference system (CRS)&lt;br /&gt;
* .cpg. character encoding&lt;br /&gt;
* .shp. Contains shapes (points, lines, or polygons)&lt;br /&gt;
* .shx. Shape index file&lt;br /&gt;
* .dbf. Attribute table (like a spreadsheet) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Global DEMs (digital elevation model). No need super high resolution. Common datasets:&lt;br /&gt;
* SRTM (~30 m resolution)&lt;br /&gt;
* ASTER GDEM (~30 m)&lt;br /&gt;
&lt;br /&gt;
Open portals. You can use&lt;br /&gt;
* OpenTopography&lt;br /&gt;
* OpenDEM&lt;br /&gt;
* NASA EarthData&lt;br /&gt;
which gives eg GeoTIFF.&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== Open-Elevation.com ==&lt;br /&gt;
&lt;br /&gt;
== Python and GeoTIFF ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import rasterio&lt;br /&gt;
&lt;br /&gt;
with rasterio.open(&amp;quot;dem.tif&amp;quot;) as dem:&lt;br /&gt;
    for lon, lat in track:&lt;br /&gt;
        row, col = dem.index(lon, lat)&lt;br /&gt;
        elevation = dem.read(1)[row, col]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Downsampling the GeoTIFF&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from rasterio.enums import Resampling&lt;br /&gt;
&lt;br /&gt;
data = src.read(&lt;br /&gt;
    out_shape=(&lt;br /&gt;
        src.count,&lt;br /&gt;
        src.height // 10,&lt;br /&gt;
        src.width // 10&lt;br /&gt;
    ),&lt;br /&gt;
    resampling=Resampling.average&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Path-finding ==&lt;br /&gt;
&lt;br /&gt;
A depression filling algorithm, such as:&lt;br /&gt;
* Planchon–Darboux algorithm&lt;br /&gt;
* Wang &amp;amp; Liu algorithm&lt;br /&gt;
* Priority-flood (modern, very efficient). Overflow-hydro or RichDEM, WhoteboxTools. &lt;br /&gt;
&lt;br /&gt;
Flow direction using:&lt;br /&gt;
* D8 flow direction (simplest, most common)&lt;br /&gt;
* D∞ (more accurate, distributes flow)&lt;br /&gt;
* MFD (multiple flow direction)&lt;br /&gt;
&lt;br /&gt;
Treat the DEM as a graph. Nodes are raster cells and edges neighbor connections. The Cost function can be &lt;br /&gt;
# Elevation drop (prefer downhill)&lt;br /&gt;
# Slope&lt;br /&gt;
# Accumulated flow (prefer existing rivers)&lt;br /&gt;
And use Dijkstra’s algorithm or A* (if you know destination).&lt;br /&gt;
&lt;br /&gt;
=== Tools ===&lt;br /&gt;
&lt;br /&gt;
GDAL (basic raster ops)&lt;br /&gt;
TauDEM (excellent for hydrology)&lt;br /&gt;
WhiteboxTools (very strong, modern)&lt;br /&gt;
GRASS GIS (r.watershed, r.fill.dir)&lt;br /&gt;
&lt;br /&gt;
=== Priority-flood  Python ===&lt;br /&gt;
&lt;br /&gt;
#Start from the edges (they always drain outward)&lt;br /&gt;
#Use a priority queue (min-heap) ordered by elevation&lt;br /&gt;
#Expand inward&lt;br /&gt;
#If a neighbor is lower → raise it (fill the sink)&lt;br /&gt;
#Otherwise → keep it as-is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import heapq&lt;br /&gt;
import numpy as np&lt;br /&gt;
&lt;br /&gt;
def priority_flood(dem):&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Fill depressions in a DEM using Priority-Flood.&lt;br /&gt;
    &lt;br /&gt;
    Parameters:&lt;br /&gt;
        dem (2D numpy array): elevation grid&lt;br /&gt;
        &lt;br /&gt;
    Returns:&lt;br /&gt;
        filled_dem (2D numpy array)&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    rows, cols = dem.shape&lt;br /&gt;
    filled = dem.copy()&lt;br /&gt;
    visited = np.zeros((rows, cols), dtype=bool)&lt;br /&gt;
    &lt;br /&gt;
    heap = []&lt;br /&gt;
&lt;br /&gt;
    # Step 1: push all edge cells into heap&lt;br /&gt;
    for r in range(rows):&lt;br /&gt;
        for c in [0, cols - 1]:&lt;br /&gt;
            heapq.heappush(heap, (filled[r, c], r, c))&lt;br /&gt;
            visited[r, c] = True&lt;br /&gt;
&lt;br /&gt;
    for c in range(cols):&lt;br /&gt;
        for r in [0, rows - 1]:&lt;br /&gt;
            if not visited[r, c]:&lt;br /&gt;
                heapq.heappush(heap, (filled[r, c], r, c))&lt;br /&gt;
                visited[r, c] = True&lt;br /&gt;
&lt;br /&gt;
    # 4-neighborhood (can switch to 8 if needed)&lt;br /&gt;
    neighbors = [(-1, 0), (1, 0), (0, -1), (0, 1)]&lt;br /&gt;
&lt;br /&gt;
    # Step 2: process cells&lt;br /&gt;
    while heap:&lt;br /&gt;
        elev, r, c = heapq.heappop(heap)&lt;br /&gt;
&lt;br /&gt;
        for dr, dc in neighbors:&lt;br /&gt;
            nr, nc = r + dr, c + dc&lt;br /&gt;
&lt;br /&gt;
            if 0 &amp;lt;= nr &amp;lt; rows and 0 &amp;lt;= nc &amp;lt; cols and not visited[nr, nc]:&lt;br /&gt;
                visited[nr, nc] = True&lt;br /&gt;
&lt;br /&gt;
                # If neighbor is lower → fill it&lt;br /&gt;
                if filled[nr, nc] &amp;lt; elev:&lt;br /&gt;
                    filled[nr, nc] = elev&lt;br /&gt;
&lt;br /&gt;
                heapq.heappush(heap, (filled[nr, nc], nr, nc))&lt;br /&gt;
&lt;br /&gt;
    return filled&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15665</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15665"/>
		<updated>2026-04-05T17:14:50Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Earth Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
*DEM Digital elevation model&lt;br /&gt;
*DSM Digital surface model&lt;br /&gt;
*DTM Digital terrain model&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
* folium&lt;br /&gt;
* geopy&lt;br /&gt;
* GeoPandas&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
DEM files (likes SRTM data) with&lt;br /&gt;
* Rasterio&lt;br /&gt;
* GDAL&lt;br /&gt;
&lt;br /&gt;
Norwegian national DEM (Kartverket). The Norwegian Mapping Authority provides very high-resolution DEM data (down to 1 meter). https://hoydedata.no. The files in the .zip package&lt;br /&gt;
* .tif: pixel = elevation value&lt;br /&gt;
* .tfw (world file). Georeferencing info (pixel size, rotation, coordinates)&lt;br /&gt;
* .tif.aux.xml. May include Statistics (min/max elevation), Pyramid layers (for faster display), Projection overrides&lt;br /&gt;
* .prj Defines the coordinate reference system (CRS)&lt;br /&gt;
* .cpg. character encoding&lt;br /&gt;
* .shp. Contains shapes (points, lines, or polygons)&lt;br /&gt;
* .shx. Shape index file&lt;br /&gt;
* .dbf. Attribute table (like a spreadsheet) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Global DEMs (digital elevation model). No need super high resolution. Common datasets:&lt;br /&gt;
* SRTM (~30 m resolution)&lt;br /&gt;
* ASTER GDEM (~30 m)&lt;br /&gt;
&lt;br /&gt;
Open portals. You can use&lt;br /&gt;
* OpenTopography&lt;br /&gt;
* OpenDEM&lt;br /&gt;
* NASA EarthData&lt;br /&gt;
which gives eg GeoTIFF.&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== Open-Elevation.com ==&lt;br /&gt;
&lt;br /&gt;
== Python and GeoTIFF ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import rasterio&lt;br /&gt;
&lt;br /&gt;
with rasterio.open(&amp;quot;dem.tif&amp;quot;) as dem:&lt;br /&gt;
    for lon, lat in track:&lt;br /&gt;
        row, col = dem.index(lon, lat)&lt;br /&gt;
        elevation = dem.read(1)[row, col]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Downsampling the GeoTIFF&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from rasterio.enums import Resampling&lt;br /&gt;
&lt;br /&gt;
data = src.read(&lt;br /&gt;
    out_shape=(&lt;br /&gt;
        src.count,&lt;br /&gt;
        src.height // 10,&lt;br /&gt;
        src.width // 10&lt;br /&gt;
    ),&lt;br /&gt;
    resampling=Resampling.average&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Path-finding ==&lt;br /&gt;
&lt;br /&gt;
A depression filling algorithm, such as:&lt;br /&gt;
* Planchon–Darboux algorithm&lt;br /&gt;
* Wang &amp;amp; Liu algorithm&lt;br /&gt;
* Priority-flood (modern, very efficient). Overflow-hydro or RichDEM, WhoteboxTools. &lt;br /&gt;
&lt;br /&gt;
Flow direction using:&lt;br /&gt;
* D8 flow direction (simplest, most common)&lt;br /&gt;
* D∞ (more accurate, distributes flow)&lt;br /&gt;
* MFD (multiple flow direction)&lt;br /&gt;
&lt;br /&gt;
Treat the DEM as a graph. Nodes are raster cells and edges neighbor connections. The Cost function can be &lt;br /&gt;
# Elevation drop (prefer downhill)&lt;br /&gt;
# Slope&lt;br /&gt;
# Accumulated flow (prefer existing rivers)&lt;br /&gt;
And use Dijkstra’s algorithm or A* (if you know destination).&lt;br /&gt;
&lt;br /&gt;
=== Tools ===&lt;br /&gt;
&lt;br /&gt;
GDAL (basic raster ops)&lt;br /&gt;
TauDEM (excellent for hydrology)&lt;br /&gt;
WhiteboxTools (very strong, modern)&lt;br /&gt;
GRASS GIS (r.watershed, r.fill.dir)&lt;br /&gt;
&lt;br /&gt;
=== Priority-flood  Python ===&lt;br /&gt;
&lt;br /&gt;
#Start from the edges (they always drain outward)&lt;br /&gt;
#Use a priority queue (min-heap) ordered by elevation&lt;br /&gt;
#Expand inward&lt;br /&gt;
#If a neighbor is lower → raise it (fill the sink)&lt;br /&gt;
#Otherwise → keep it as-is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import heapq&lt;br /&gt;
import numpy as np&lt;br /&gt;
&lt;br /&gt;
def priority_flood(dem):&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Fill depressions in a DEM using Priority-Flood.&lt;br /&gt;
    &lt;br /&gt;
    Parameters:&lt;br /&gt;
        dem (2D numpy array): elevation grid&lt;br /&gt;
        &lt;br /&gt;
    Returns:&lt;br /&gt;
        filled_dem (2D numpy array)&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    rows, cols = dem.shape&lt;br /&gt;
    filled = dem.copy()&lt;br /&gt;
    visited = np.zeros((rows, cols), dtype=bool)&lt;br /&gt;
    &lt;br /&gt;
    heap = []&lt;br /&gt;
&lt;br /&gt;
    # Step 1: push all edge cells into heap&lt;br /&gt;
    for r in range(rows):&lt;br /&gt;
        for c in [0, cols - 1]:&lt;br /&gt;
            heapq.heappush(heap, (filled[r, c], r, c))&lt;br /&gt;
            visited[r, c] = True&lt;br /&gt;
&lt;br /&gt;
    for c in range(cols):&lt;br /&gt;
        for r in [0, rows - 1]:&lt;br /&gt;
            if not visited[r, c]:&lt;br /&gt;
                heapq.heappush(heap, (filled[r, c], r, c))&lt;br /&gt;
                visited[r, c] = True&lt;br /&gt;
&lt;br /&gt;
    # 4-neighborhood (can switch to 8 if needed)&lt;br /&gt;
    neighbors = [(-1, 0), (1, 0), (0, -1), (0, 1)]&lt;br /&gt;
&lt;br /&gt;
    # Step 2: process cells&lt;br /&gt;
    while heap:&lt;br /&gt;
        elev, r, c = heapq.heappop(heap)&lt;br /&gt;
&lt;br /&gt;
        for dr, dc in neighbors:&lt;br /&gt;
            nr, nc = r + dr, c + dc&lt;br /&gt;
&lt;br /&gt;
            if 0 &amp;lt;= nr &amp;lt; rows and 0 &amp;lt;= nc &amp;lt; cols and not visited[nr, nc]:&lt;br /&gt;
                visited[nr, nc] = True&lt;br /&gt;
&lt;br /&gt;
                # If neighbor is lower → fill it&lt;br /&gt;
                if filled[nr, nc] &amp;lt; elev:&lt;br /&gt;
                    filled[nr, nc] = elev&lt;br /&gt;
&lt;br /&gt;
                heapq.heappush(heap, (filled[nr, nc], nr, nc))&lt;br /&gt;
&lt;br /&gt;
    return filled&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15664</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15664"/>
		<updated>2026-04-05T13:04:42Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Priority-flood  Python */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
*DEM Digital elevation model&lt;br /&gt;
*DSM Digital surface model&lt;br /&gt;
*DTM Digital terrain model&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
* folium&lt;br /&gt;
* geopy&lt;br /&gt;
* GeoPandas&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
DEM files (likes SRTM data) with&lt;br /&gt;
* Rasterio&lt;br /&gt;
* GDAL&lt;br /&gt;
&lt;br /&gt;
Norwegian national DEM (Kartverket). The Norwegian Mapping Authority provides very high-resolution DEM data (down to 1 meter).&lt;br /&gt;
* https://hoydedata.no&lt;br /&gt;
&lt;br /&gt;
Global DEMs (digital elevation model). No need super high resolution. Common datasets:&lt;br /&gt;
* SRTM (~30 m resolution)&lt;br /&gt;
* ASTER GDEM (~30 m)&lt;br /&gt;
&lt;br /&gt;
Open portals. You can use&lt;br /&gt;
* OpenTopography&lt;br /&gt;
* OpenDEM&lt;br /&gt;
* NASA EarthData&lt;br /&gt;
which gives eg GeoTIFF.&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== Open-Elevation.com ==&lt;br /&gt;
&lt;br /&gt;
== Python and GeoTIFF ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import rasterio&lt;br /&gt;
&lt;br /&gt;
with rasterio.open(&amp;quot;dem.tif&amp;quot;) as dem:&lt;br /&gt;
    for lon, lat in track:&lt;br /&gt;
        row, col = dem.index(lon, lat)&lt;br /&gt;
        elevation = dem.read(1)[row, col]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Downsampling the GeoTIFF&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from rasterio.enums import Resampling&lt;br /&gt;
&lt;br /&gt;
data = src.read(&lt;br /&gt;
    out_shape=(&lt;br /&gt;
        src.count,&lt;br /&gt;
        src.height // 10,&lt;br /&gt;
        src.width // 10&lt;br /&gt;
    ),&lt;br /&gt;
    resampling=Resampling.average&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Path-finding ==&lt;br /&gt;
&lt;br /&gt;
A depression filling algorithm, such as:&lt;br /&gt;
* Planchon–Darboux algorithm&lt;br /&gt;
* Wang &amp;amp; Liu algorithm&lt;br /&gt;
* Priority-flood (modern, very efficient). Overflow-hydro or RichDEM, WhoteboxTools. &lt;br /&gt;
&lt;br /&gt;
Flow direction using:&lt;br /&gt;
* D8 flow direction (simplest, most common)&lt;br /&gt;
* D∞ (more accurate, distributes flow)&lt;br /&gt;
* MFD (multiple flow direction)&lt;br /&gt;
&lt;br /&gt;
Treat the DEM as a graph. Nodes are raster cells and edges neighbor connections. The Cost function can be &lt;br /&gt;
# Elevation drop (prefer downhill)&lt;br /&gt;
# Slope&lt;br /&gt;
# Accumulated flow (prefer existing rivers)&lt;br /&gt;
And use Dijkstra’s algorithm or A* (if you know destination).&lt;br /&gt;
&lt;br /&gt;
=== Tools ===&lt;br /&gt;
&lt;br /&gt;
GDAL (basic raster ops)&lt;br /&gt;
TauDEM (excellent for hydrology)&lt;br /&gt;
WhiteboxTools (very strong, modern)&lt;br /&gt;
GRASS GIS (r.watershed, r.fill.dir)&lt;br /&gt;
&lt;br /&gt;
=== Priority-flood  Python ===&lt;br /&gt;
&lt;br /&gt;
#Start from the edges (they always drain outward)&lt;br /&gt;
#Use a priority queue (min-heap) ordered by elevation&lt;br /&gt;
#Expand inward&lt;br /&gt;
#If a neighbor is lower → raise it (fill the sink)&lt;br /&gt;
#Otherwise → keep it as-is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import heapq&lt;br /&gt;
import numpy as np&lt;br /&gt;
&lt;br /&gt;
def priority_flood(dem):&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Fill depressions in a DEM using Priority-Flood.&lt;br /&gt;
    &lt;br /&gt;
    Parameters:&lt;br /&gt;
        dem (2D numpy array): elevation grid&lt;br /&gt;
        &lt;br /&gt;
    Returns:&lt;br /&gt;
        filled_dem (2D numpy array)&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    rows, cols = dem.shape&lt;br /&gt;
    filled = dem.copy()&lt;br /&gt;
    visited = np.zeros((rows, cols), dtype=bool)&lt;br /&gt;
    &lt;br /&gt;
    heap = []&lt;br /&gt;
&lt;br /&gt;
    # Step 1: push all edge cells into heap&lt;br /&gt;
    for r in range(rows):&lt;br /&gt;
        for c in [0, cols - 1]:&lt;br /&gt;
            heapq.heappush(heap, (filled[r, c], r, c))&lt;br /&gt;
            visited[r, c] = True&lt;br /&gt;
&lt;br /&gt;
    for c in range(cols):&lt;br /&gt;
        for r in [0, rows - 1]:&lt;br /&gt;
            if not visited[r, c]:&lt;br /&gt;
                heapq.heappush(heap, (filled[r, c], r, c))&lt;br /&gt;
                visited[r, c] = True&lt;br /&gt;
&lt;br /&gt;
    # 4-neighborhood (can switch to 8 if needed)&lt;br /&gt;
    neighbors = [(-1, 0), (1, 0), (0, -1), (0, 1)]&lt;br /&gt;
&lt;br /&gt;
    # Step 2: process cells&lt;br /&gt;
    while heap:&lt;br /&gt;
        elev, r, c = heapq.heappop(heap)&lt;br /&gt;
&lt;br /&gt;
        for dr, dc in neighbors:&lt;br /&gt;
            nr, nc = r + dr, c + dc&lt;br /&gt;
&lt;br /&gt;
            if 0 &amp;lt;= nr &amp;lt; rows and 0 &amp;lt;= nc &amp;lt; cols and not visited[nr, nc]:&lt;br /&gt;
                visited[nr, nc] = True&lt;br /&gt;
&lt;br /&gt;
                # If neighbor is lower → fill it&lt;br /&gt;
                if filled[nr, nc] &amp;lt; elev:&lt;br /&gt;
                    filled[nr, nc] = elev&lt;br /&gt;
&lt;br /&gt;
                heapq.heappush(heap, (filled[nr, nc], nr, nc))&lt;br /&gt;
&lt;br /&gt;
    return filled&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15663</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15663"/>
		<updated>2026-04-05T13:03:47Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* 11 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
*DEM Digital elevation model&lt;br /&gt;
*DSM Digital surface model&lt;br /&gt;
*DTM Digital terrain model&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
* folium&lt;br /&gt;
* geopy&lt;br /&gt;
* GeoPandas&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
DEM files (likes SRTM data) with&lt;br /&gt;
* Rasterio&lt;br /&gt;
* GDAL&lt;br /&gt;
&lt;br /&gt;
Norwegian national DEM (Kartverket). The Norwegian Mapping Authority provides very high-resolution DEM data (down to 1 meter).&lt;br /&gt;
* https://hoydedata.no&lt;br /&gt;
&lt;br /&gt;
Global DEMs (digital elevation model). No need super high resolution. Common datasets:&lt;br /&gt;
* SRTM (~30 m resolution)&lt;br /&gt;
* ASTER GDEM (~30 m)&lt;br /&gt;
&lt;br /&gt;
Open portals. You can use&lt;br /&gt;
* OpenTopography&lt;br /&gt;
* OpenDEM&lt;br /&gt;
* NASA EarthData&lt;br /&gt;
which gives eg GeoTIFF.&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== Open-Elevation.com ==&lt;br /&gt;
&lt;br /&gt;
== Python and GeoTIFF ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import rasterio&lt;br /&gt;
&lt;br /&gt;
with rasterio.open(&amp;quot;dem.tif&amp;quot;) as dem:&lt;br /&gt;
    for lon, lat in track:&lt;br /&gt;
        row, col = dem.index(lon, lat)&lt;br /&gt;
        elevation = dem.read(1)[row, col]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Downsampling the GeoTIFF&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from rasterio.enums import Resampling&lt;br /&gt;
&lt;br /&gt;
data = src.read(&lt;br /&gt;
    out_shape=(&lt;br /&gt;
        src.count,&lt;br /&gt;
        src.height // 10,&lt;br /&gt;
        src.width // 10&lt;br /&gt;
    ),&lt;br /&gt;
    resampling=Resampling.average&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Path-finding ==&lt;br /&gt;
&lt;br /&gt;
A depression filling algorithm, such as:&lt;br /&gt;
* Planchon–Darboux algorithm&lt;br /&gt;
* Wang &amp;amp; Liu algorithm&lt;br /&gt;
* Priority-flood (modern, very efficient). Overflow-hydro or RichDEM, WhoteboxTools. &lt;br /&gt;
&lt;br /&gt;
Flow direction using:&lt;br /&gt;
* D8 flow direction (simplest, most common)&lt;br /&gt;
* D∞ (more accurate, distributes flow)&lt;br /&gt;
* MFD (multiple flow direction)&lt;br /&gt;
&lt;br /&gt;
Treat the DEM as a graph. Nodes are raster cells and edges neighbor connections. The Cost function can be &lt;br /&gt;
# Elevation drop (prefer downhill)&lt;br /&gt;
# Slope&lt;br /&gt;
# Accumulated flow (prefer existing rivers)&lt;br /&gt;
And use Dijkstra’s algorithm or A* (if you know destination).&lt;br /&gt;
&lt;br /&gt;
=== Tools ===&lt;br /&gt;
&lt;br /&gt;
GDAL (basic raster ops)&lt;br /&gt;
TauDEM (excellent for hydrology)&lt;br /&gt;
WhiteboxTools (very strong, modern)&lt;br /&gt;
GRASS GIS (r.watershed, r.fill.dir)&lt;br /&gt;
&lt;br /&gt;
=== Priority-flood  Python ===&lt;br /&gt;
&lt;br /&gt;
#Start from the edges (they always drain outward)&lt;br /&gt;
#Use a priority queue (min-heap) ordered by elevation&lt;br /&gt;
#Expand inward&lt;br /&gt;
#If a neighbor is lower → raise it (fill the sink)&lt;br /&gt;
#Otherwise → keep it as-is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import heapq&lt;br /&gt;
import numpy as np&lt;br /&gt;
&lt;br /&gt;
def priority_flood(dem):&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Fill depressions in a DEM using Priority-Flood.&lt;br /&gt;
    &lt;br /&gt;
    Parameters:&lt;br /&gt;
        dem (2D numpy array): elevation grid&lt;br /&gt;
        &lt;br /&gt;
    Returns:&lt;br /&gt;
        filled_dem (2D numpy array)&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    rows, cols = dem.shape&lt;br /&gt;
    filled = dem.copy()&lt;br /&gt;
    visited = np.zeros((rows, cols), dtype=bool)&lt;br /&gt;
    &lt;br /&gt;
    heap = []&lt;br /&gt;
&lt;br /&gt;
    # Step 1: push all edge cells into heap&lt;br /&gt;
    for r in range(rows):&lt;br /&gt;
        for c in [0, cols - 1]:&lt;br /&gt;
            heapq.heappush(heap, (filled[r, c], r, c))&lt;br /&gt;
            visited[r, c] = True&lt;br /&gt;
&lt;br /&gt;
    for c in range(cols):&lt;br /&gt;
        for r in [0, rows - 1]:&lt;br /&gt;
            if not visited[r, c]:&lt;br /&gt;
                heapq.heappush(heap, (filled[r, c], r, c))&lt;br /&gt;
                visited[r, c] = True&lt;br /&gt;
&lt;br /&gt;
    # 4-neighborhood (can switch to 8 if needed)&lt;br /&gt;
    neighbors = [(-1, 0), (1, 0), (0, -1), (0, 1)]&lt;br /&gt;
&lt;br /&gt;
    # Step 2: process cells&lt;br /&gt;
    while heap:&lt;br /&gt;
        elev, r, c = heapq.heappop(heap)&lt;br /&gt;
&lt;br /&gt;
        for dr, dc in neighbors:&lt;br /&gt;
            nr, nc = r + dr, c + dc&lt;br /&gt;
&lt;br /&gt;
            if 0 &amp;lt;= nr &amp;lt; rows and 0 &amp;lt;= nc &amp;lt; cols and not visited[nr, nc]:&lt;br /&gt;
                visited[nr, nc] = True&lt;br /&gt;
&lt;br /&gt;
                # If neighbor is lower → fill it&lt;br /&gt;
                if filled[nr, nc] &amp;lt; elev:&lt;br /&gt;
                    filled[nr, nc] = elev&lt;br /&gt;
&lt;br /&gt;
                heapq.heappush(heap, (filled[nr, nc], nr, nc))&lt;br /&gt;
&lt;br /&gt;
    return filled&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15662</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15662"/>
		<updated>2026-04-05T12:56:36Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* 11 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
*DEM Digital elevation model&lt;br /&gt;
*DSM Digital surface model&lt;br /&gt;
*DTM Digital terrain model&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
* folium&lt;br /&gt;
* geopy&lt;br /&gt;
* GeoPandas&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
DEM files (likes SRTM data) with&lt;br /&gt;
* Rasterio&lt;br /&gt;
* GDAL&lt;br /&gt;
&lt;br /&gt;
Norwegian national DEM (Kartverket). The Norwegian Mapping Authority provides very high-resolution DEM data (down to 1 meter).&lt;br /&gt;
* https://hoydedata.no&lt;br /&gt;
&lt;br /&gt;
Global DEMs (digital elevation model). No need super high resolution. Common datasets:&lt;br /&gt;
* SRTM (~30 m resolution)&lt;br /&gt;
* ASTER GDEM (~30 m)&lt;br /&gt;
&lt;br /&gt;
Open portals. You can use&lt;br /&gt;
* OpenTopography&lt;br /&gt;
* OpenDEM&lt;br /&gt;
* NASA EarthData&lt;br /&gt;
which gives eg GeoTIFF.&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== Open-Elevation.com ==&lt;br /&gt;
&lt;br /&gt;
== Python and GeoTIFF ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import rasterio&lt;br /&gt;
&lt;br /&gt;
with rasterio.open(&amp;quot;dem.tif&amp;quot;) as dem:&lt;br /&gt;
    for lon, lat in track:&lt;br /&gt;
        row, col = dem.index(lon, lat)&lt;br /&gt;
        elevation = dem.read(1)[row, col]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Downsampling the GeoTIFF&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from rasterio.enums import Resampling&lt;br /&gt;
&lt;br /&gt;
data = src.read(&lt;br /&gt;
    out_shape=(&lt;br /&gt;
        src.count,&lt;br /&gt;
        src.height // 10,&lt;br /&gt;
        src.width // 10&lt;br /&gt;
    ),&lt;br /&gt;
    resampling=Resampling.average&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Maze_Solving_Algorithms&amp;diff=15661</id>
		<title>Maze Solving Algorithms</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Maze_Solving_Algorithms&amp;diff=15661"/>
		<updated>2026-04-05T12:52:52Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
# Random movement algorithm&lt;br /&gt;
# Hand-on-Wall rule (works If the maze is simply connected)&lt;br /&gt;
# Pledge algorithm&lt;br /&gt;
# Trémaux&#039;s algorithm. A junction may have multiple entrances, and a passage has an entrance at both ends. Dead-end.&lt;br /&gt;
# Dead-end filling&lt;br /&gt;
# Maze-routing algorithm&lt;br /&gt;
# Shortest path algorithm&lt;br /&gt;
## breadth-first search (BFS)&lt;br /&gt;
## the A* algorithm&lt;br /&gt;
## Depth-First Search (DFS).&lt;br /&gt;
## Dijkstra’s Algorithm &lt;br /&gt;
# Multi-agent maze-solving&lt;br /&gt;
&lt;br /&gt;
== Dead-end filling ==&lt;br /&gt;
&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Maze_Solving_Algorithms&amp;diff=15660</id>
		<title>Maze Solving Algorithms</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Maze_Solving_Algorithms&amp;diff=15660"/>
		<updated>2026-04-05T12:43:34Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
# Random movement algorithm&lt;br /&gt;
# Hand-on-Wall rule (works If the maze is simply connected)&lt;br /&gt;
# Pledge algorithm&lt;br /&gt;
# Trémaux&#039;s algorithm. A junction may have multiple entrances, and a passage has an entrance at both ends. Dead-end.&lt;br /&gt;
# Dead-end filling&lt;br /&gt;
# Maze-routing algorithm&lt;br /&gt;
# Shortest path algorithm&lt;br /&gt;
## breadth-first search&lt;br /&gt;
## the A* algorithm&lt;br /&gt;
# Multi-agent maze-solving&lt;br /&gt;
&lt;br /&gt;
== Dead-end filling ==&lt;br /&gt;
&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Maze_Solving_Algorithms&amp;diff=15659</id>
		<title>Maze Solving Algorithms</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Maze_Solving_Algorithms&amp;diff=15659"/>
		<updated>2026-04-05T12:41:28Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
# Random movement algorithm&lt;br /&gt;
# Hand-on-Wall rule (works If the maze is simply connected)&lt;br /&gt;
# Pledge algorithm&lt;br /&gt;
# Trémaux&#039;s algorithm. A junction may have multiple entrances, and a passage has an entrance at both ends. Dead-end.&lt;br /&gt;
# Dead-end filling&lt;br /&gt;
# Maze-routing algorithm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Dead-end filling ==&lt;br /&gt;
&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Maze_Solving_Algorithms&amp;diff=15658</id>
		<title>Maze Solving Algorithms</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Maze_Solving_Algorithms&amp;diff=15658"/>
		<updated>2026-04-05T12:39:13Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
# Random movement algorithm&lt;br /&gt;
# Hand-on-Wall rule (works If the maze is simply connected)&lt;br /&gt;
# Pledge algorithm&lt;br /&gt;
# Trémaux&#039;s algorithm. A junction may have multiple entrances, and a passage has an entrance at both ends. Dead-end.&lt;br /&gt;
# Dead-end filling&lt;br /&gt;
&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Maze_Solving_Algorithms&amp;diff=15657</id>
		<title>Maze Solving Algorithms</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Maze_Solving_Algorithms&amp;diff=15657"/>
		<updated>2026-04-05T12:37:01Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
# Random movement algorithm&lt;br /&gt;
# Hand-on-Wall rule (works If the maze is simply connected)&lt;br /&gt;
# Pledge algorithm&lt;br /&gt;
# Trémaux&#039;s algorithm&lt;br /&gt;
# Dead-end filling&lt;br /&gt;
&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Maze_Solving_Algorithms&amp;diff=15656</id>
		<title>Maze Solving Algorithms</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Maze_Solving_Algorithms&amp;diff=15656"/>
		<updated>2026-04-05T12:34:56Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
# Random movement algorithm&lt;br /&gt;
# Hand-on-Wall rule (works If the maze is simply connected)&lt;br /&gt;
# Pledge algorithm&lt;br /&gt;
# Trémaux&#039;s algorithm&lt;br /&gt;
&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Maze_Solving_Algorithms&amp;diff=15655</id>
		<title>Maze Solving Algorithms</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Maze_Solving_Algorithms&amp;diff=15655"/>
		<updated>2026-04-05T12:21:15Z</updated>

		<summary type="html">&lt;p&gt;Mol: Created page with &amp;quot;== Introduction ==  # Random movement algorithm # Hand-on-Wall rule (works If the maze is simply connected) # Pledge algorithm #    == == == == == == == ==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
# Random movement algorithm&lt;br /&gt;
# Hand-on-Wall rule (works If the maze is simply connected)&lt;br /&gt;
# Pledge algorithm&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;br /&gt;
== ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15654</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15654"/>
		<updated>2026-04-04T10:44:59Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* 11 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
*DEM Digital elevation model&lt;br /&gt;
*DSM Digital surface model&lt;br /&gt;
*DTM Digital terrain model&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
* folium&lt;br /&gt;
* geopy&lt;br /&gt;
* GeoPandas&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
DEM files (likes SRTM data) with&lt;br /&gt;
* Rasterio&lt;br /&gt;
* GDAL&lt;br /&gt;
&lt;br /&gt;
Norwegian national DEM (Kartverket). The Norwegian Mapping Authority provides very high-resolution DEM data (down to 1 meter).&lt;br /&gt;
* https://hoydedata.no&lt;br /&gt;
&lt;br /&gt;
Global DEMs (digital elevation model). No need super high resolution. Common datasets:&lt;br /&gt;
* SRTM (~30 m resolution)&lt;br /&gt;
* ASTER GDEM (~30 m)&lt;br /&gt;
&lt;br /&gt;
Open portals. You can use&lt;br /&gt;
* OpenTopography&lt;br /&gt;
* OpenDEM&lt;br /&gt;
* NASA EarthData&lt;br /&gt;
which gives eg GeoTIFF.&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== Open-Elevation.com ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import rasterio&lt;br /&gt;
&lt;br /&gt;
with rasterio.open(&amp;quot;dem.tif&amp;quot;) as dem:&lt;br /&gt;
    for lon, lat in track:&lt;br /&gt;
        row, col = dem.index(lon, lat)&lt;br /&gt;
        elevation = dem.read(1)[row, col]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Downsampling the GeoTIFF&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from rasterio.enums import Resampling&lt;br /&gt;
&lt;br /&gt;
data = src.read(&lt;br /&gt;
    out_shape=(&lt;br /&gt;
        src.count,&lt;br /&gt;
        src.height // 10,&lt;br /&gt;
        src.width // 10&lt;br /&gt;
    ),&lt;br /&gt;
    resampling=Resampling.average&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15653</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15653"/>
		<updated>2026-04-04T10:42:24Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* 11 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
*DEM Digital elevation model&lt;br /&gt;
*DSM Digital surface model&lt;br /&gt;
*DTM Digital terrain model&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
* folium&lt;br /&gt;
* geopy&lt;br /&gt;
* GeoPandas&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
DEM files (likes SRTM data) with&lt;br /&gt;
* Rasterio&lt;br /&gt;
* GDAL&lt;br /&gt;
&lt;br /&gt;
Norwegian national DEM (Kartverket). The Norwegian Mapping Authority provides very high-resolution DEM data (down to 1 meter).&lt;br /&gt;
* https://hoydedata.no&lt;br /&gt;
&lt;br /&gt;
Global DEMs (digital elevation model). No need super high resolution. Common datasets:&lt;br /&gt;
* SRTM (~30 m resolution)&lt;br /&gt;
* ASTER GDEM (~30 m)&lt;br /&gt;
&lt;br /&gt;
Open portals. You can use&lt;br /&gt;
* OpenTopography&lt;br /&gt;
* OpenDEM&lt;br /&gt;
* NASA EarthData&lt;br /&gt;
which gives eg GeoTIFF.&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== Open-Elevation.com ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import rasterio&lt;br /&gt;
&lt;br /&gt;
with rasterio.open(&amp;quot;dem.tif&amp;quot;) as dem:&lt;br /&gt;
    for lon, lat in track:&lt;br /&gt;
        row, col = dem.index(lon, lat)&lt;br /&gt;
        elevation = dem.read(1)[row, col]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15652</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15652"/>
		<updated>2026-04-04T10:23:45Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
*DEM Digital elevation model&lt;br /&gt;
*DSM Digital surface model&lt;br /&gt;
*DTM Digital terrain model&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
* folium&lt;br /&gt;
* geopy&lt;br /&gt;
* GeoPandas&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
DEM files (likes SRTM data) with&lt;br /&gt;
* Rasterio&lt;br /&gt;
* GDAL&lt;br /&gt;
&lt;br /&gt;
Norwegian national DEM (Kartverket). The Norwegian Mapping Authority provides very high-resolution DEM data (down to 1 meter).&lt;br /&gt;
* https://hoydedata.no&lt;br /&gt;
&lt;br /&gt;
Global DEMs (digital elevation model). No need super high resolution. Common datasets:&lt;br /&gt;
* SRTM (~30 m resolution)&lt;br /&gt;
* ASTER GDEM (~30 m)&lt;br /&gt;
&lt;br /&gt;
Open portals. You can use&lt;br /&gt;
* OpenTopography&lt;br /&gt;
* OpenDEM&lt;br /&gt;
* NASA EarthData&lt;br /&gt;
which gives eg GeoTIFF.&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== Open-Elevation.com ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15651</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15651"/>
		<updated>2026-04-04T10:18:19Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Earth Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
* folium&lt;br /&gt;
* geopy&lt;br /&gt;
* GeoPandas&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
DEM files (likes SRTM data) with&lt;br /&gt;
* Rasterio&lt;br /&gt;
* GDAL&lt;br /&gt;
&lt;br /&gt;
Norwegian national DEM (Kartverket). The Norwegian Mapping Authority provides very high-resolution DEM data (down to 1 meter).&lt;br /&gt;
* https://hoydedata.no&lt;br /&gt;
&lt;br /&gt;
Global DEMs (digital elevation model). No need super high resolution. Common datasets:&lt;br /&gt;
* SRTM (~30 m resolution)&lt;br /&gt;
* ASTER GDEM (~30 m)&lt;br /&gt;
&lt;br /&gt;
Open portals. You can use&lt;br /&gt;
* OpenTopography&lt;br /&gt;
* OpenDEM&lt;br /&gt;
* NASA EarthData&lt;br /&gt;
which gives eg GeoTIFF.&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== Open-Elevation.com ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15650</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15650"/>
		<updated>2026-04-04T10:16:02Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Earth Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
* folium&lt;br /&gt;
* geopy&lt;br /&gt;
* GeoPandas&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
DEM files (likes SRTM data) with&lt;br /&gt;
* Rasterio&lt;br /&gt;
* GDAL&lt;br /&gt;
&lt;br /&gt;
Norwegian national DEM (Kartverket). The Norwegian Mapping Authority provides very high-resolution DEM data (down to 1 meter).&lt;br /&gt;
* https://hoydedata.no&lt;br /&gt;
&lt;br /&gt;
Global DEMs (quick + easy). No need super high resolution. Common datasets:&lt;br /&gt;
* SRTM (~30 m resolution)&lt;br /&gt;
* ASTER GDEM (~30 m)&lt;br /&gt;
&lt;br /&gt;
Open portals. You can use&lt;br /&gt;
* OpenTopography&lt;br /&gt;
* OpenDEM&lt;br /&gt;
* NASA EarthData&lt;br /&gt;
which gives eg GeoTIFF.&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== Open-Elevation.com ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15649</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15649"/>
		<updated>2026-04-04T10:12:50Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Earth Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
* folium&lt;br /&gt;
* geopy&lt;br /&gt;
* GeoPandas&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
DEM files (likes SRTM data) with&lt;br /&gt;
* Rasterio&lt;br /&gt;
* GDAL&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== Open-Elevation.com ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15648</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15648"/>
		<updated>2026-04-04T10:10:40Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Python GIS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
* folium&lt;br /&gt;
* geopy&lt;br /&gt;
* GeoPandas&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== Open-Elevation.com ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15647</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15647"/>
		<updated>2026-04-04T10:06:18Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Open-Elevation.con */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
geopy&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== Open-Elevation.com ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15646</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15646"/>
		<updated>2026-04-04T10:06:07Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* 11 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
geopy&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== Open-Elevation.con ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15645</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15645"/>
		<updated>2026-04-04T10:04:43Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Python GIS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
geopy&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15644</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15644"/>
		<updated>2026-04-04T10:04:29Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
An example of Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
Mostly needs an API.&lt;br /&gt;
&lt;br /&gt;
=== Python GIS ===&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15643</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15643"/>
		<updated>2026-04-04T09:57:35Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* 11 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
== Open Topo Data ==&lt;br /&gt;
&lt;br /&gt;
https://www.opentopodata.org/&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15642</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15642"/>
		<updated>2026-04-04T09:53:29Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Alta-joki Alta river.&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15641</id>
		<title>Topography of a region - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Topography_of_a_region_-_Python&amp;diff=15641"/>
		<updated>2026-04-04T09:53:06Z</updated>

		<summary type="html">&lt;p&gt;Mol: Created page with &amp;quot;== Introduction ==  https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt  == Earth Model ==  == 11 ==  == 11 ==  == 11 ==  == 11 ==  == 11 ==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
https://caltopo.com/map.html#ll=68.8546,23.64807&amp;amp;z=8&amp;amp;b=mbt&lt;br /&gt;
&lt;br /&gt;
== Earth Model ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;br /&gt;
&lt;br /&gt;
== 11 ==&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15640</id>
		<title>Mercedes Benz diagnostics obd</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15640"/>
		<updated>2026-04-02T05:54:57Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Mercedes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
XTOOLS D5S&lt;br /&gt;
* https://www.youtube.com/watch?v=gDwrVYJ0tow&lt;br /&gt;
&lt;br /&gt;
Samsara and Verizon&lt;br /&gt;
&lt;br /&gt;
OBD2, OBD2 (MB W211, 2003-). OBD2 from 1996. Connectors: Type A or Type B. &lt;br /&gt;
* https://obdplanet.com/obd2-protocol/&lt;br /&gt;
* https://en.wikipedia.org/wiki/ELM327&lt;br /&gt;
* https://en.wikipedia.org/wiki/OBD-II_PIDs&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OdxTools.&lt;br /&gt;
* https://github.com/mercedes-benz/odxtools https://pypi.org/project/odxtools/&lt;br /&gt;
* https://deepwiki.com/mercedes-benz/odxtools/1-overview&lt;br /&gt;
&lt;br /&gt;
Freediag https://freediag.sourceforge.io/&lt;br /&gt;
&lt;br /&gt;
Adapter https://hackaday.com/tag/iso-15765-4-can/&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== Mercedes ==&lt;br /&gt;
&lt;br /&gt;
Mercedes FOSS. https://opensource.mercedes-benz.com/projects/ https://github.com/mercedes-benz&lt;br /&gt;
&lt;br /&gt;
https://www.forum-mercedes.com/img/members/34569/schema-W211-CAN_59-end.pdf&lt;br /&gt;
* CAN B, CAN C, CAN D (X11/4)&lt;br /&gt;
&lt;br /&gt;
ISO 15765-4&lt;br /&gt;
&lt;br /&gt;
W211 https://pinoutguide.com/CarElectronics/mercedes_obd2_diag_pinout.shtml&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;vertical-align:middle;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Pin Number&lt;br /&gt;
! Pin Name&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| K-Line&lt;br /&gt;
| Ignition control (EZS), air-conditioner (KLA), PTS, safety systems (Airbag, SRS, AB) and some other&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| TNA&lt;br /&gt;
| TD engine rotation speed&lt;br /&gt;
|-&lt;br /&gt;
| 4,5&lt;br /&gt;
| GND&lt;br /&gt;
| Ground&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| CAN-high&lt;br /&gt;
| CAN-High (including AirBag system in W203, W209, W220, W240, R230, С215 after 2004y)&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| K-Line&lt;br /&gt;
| Engine control diagnostic (ME/MSM/CDI)&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| &lt;br /&gt;
| Ignition,...&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| K-Line&lt;br /&gt;
| ABS, ASR, ESP, ETS, BAS diagnostic&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| K-Line&lt;br /&gt;
| Gearbox and other transmission components (EGS, ETC, FTC)&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| K-Line&lt;br /&gt;
| All activity module (AAM), Radio (RD), ICS, ...&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| K-Line&lt;br /&gt;
| AB diagnostic - safety systems&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| CAN-Low&lt;br /&gt;
| CAN&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| K-Line&lt;br /&gt;
| IC, KI, TAU, LWR diagnostic&lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| +12V&lt;br /&gt;
| Power&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15639</id>
		<title>Mercedes Benz diagnostics obd</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15639"/>
		<updated>2026-04-02T05:52:04Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
XTOOLS D5S&lt;br /&gt;
* https://www.youtube.com/watch?v=gDwrVYJ0tow&lt;br /&gt;
&lt;br /&gt;
Samsara and Verizon&lt;br /&gt;
&lt;br /&gt;
OBD2, OBD2 (MB W211, 2003-). OBD2 from 1996. Connectors: Type A or Type B. &lt;br /&gt;
* https://obdplanet.com/obd2-protocol/&lt;br /&gt;
* https://en.wikipedia.org/wiki/ELM327&lt;br /&gt;
* https://en.wikipedia.org/wiki/OBD-II_PIDs&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OdxTools.&lt;br /&gt;
* https://github.com/mercedes-benz/odxtools https://pypi.org/project/odxtools/&lt;br /&gt;
* https://deepwiki.com/mercedes-benz/odxtools/1-overview&lt;br /&gt;
&lt;br /&gt;
Freediag https://freediag.sourceforge.io/&lt;br /&gt;
&lt;br /&gt;
Adapter https://hackaday.com/tag/iso-15765-4-can/&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== Mercedes ==&lt;br /&gt;
&lt;br /&gt;
Mercedes FOSS. https://opensource.mercedes-benz.com/projects/&lt;br /&gt;
&lt;br /&gt;
https://www.forum-mercedes.com/img/members/34569/schema-W211-CAN_59-end.pdf&lt;br /&gt;
* CAN B, CAN C, CAN D (X11/4)&lt;br /&gt;
&lt;br /&gt;
ISO 15765-4&lt;br /&gt;
&lt;br /&gt;
W211 https://pinoutguide.com/CarElectronics/mercedes_obd2_diag_pinout.shtml&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;vertical-align:middle;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Pin Number&lt;br /&gt;
! Pin Name&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| K-Line&lt;br /&gt;
| Ignition control (EZS), air-conditioner (KLA), PTS, safety systems (Airbag, SRS, AB) and some other&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| TNA&lt;br /&gt;
| TD engine rotation speed&lt;br /&gt;
|-&lt;br /&gt;
| 4,5&lt;br /&gt;
| GND&lt;br /&gt;
| Ground&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| CAN-high&lt;br /&gt;
| CAN-High (including AirBag system in W203, W209, W220, W240, R230, С215 after 2004y)&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| K-Line&lt;br /&gt;
| Engine control diagnostic (ME/MSM/CDI)&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| &lt;br /&gt;
| Ignition,...&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| K-Line&lt;br /&gt;
| ABS, ASR, ESP, ETS, BAS diagnostic&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| K-Line&lt;br /&gt;
| Gearbox and other transmission components (EGS, ETC, FTC)&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| K-Line&lt;br /&gt;
| All activity module (AAM), Radio (RD), ICS, ...&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| K-Line&lt;br /&gt;
| AB diagnostic - safety systems&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| CAN-Low&lt;br /&gt;
| CAN&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| K-Line&lt;br /&gt;
| IC, KI, TAU, LWR diagnostic&lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| +12V&lt;br /&gt;
| Power&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15638</id>
		<title>Mercedes Benz diagnostics obd</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15638"/>
		<updated>2026-04-02T05:50:36Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
XTOOLS D5S&lt;br /&gt;
* https://www.youtube.com/watch?v=gDwrVYJ0tow&lt;br /&gt;
&lt;br /&gt;
Samsara and Verizon&lt;br /&gt;
&lt;br /&gt;
OBD2, OBD2 (MB W211, 2003-). OBD2 from 1996. Connectors: Type A or Type B. &lt;br /&gt;
* https://obdplanet.com/obd2-protocol/&lt;br /&gt;
* https://en.wikipedia.org/wiki/ELM327&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OdxTools.&lt;br /&gt;
* https://github.com/mercedes-benz/odxtools https://pypi.org/project/odxtools/&lt;br /&gt;
* https://deepwiki.com/mercedes-benz/odxtools/1-overview&lt;br /&gt;
&lt;br /&gt;
Freediag https://freediag.sourceforge.io/&lt;br /&gt;
&lt;br /&gt;
Adapter https://hackaday.com/tag/iso-15765-4-can/&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== Mercedes ==&lt;br /&gt;
&lt;br /&gt;
Mercedes FOSS. https://opensource.mercedes-benz.com/projects/&lt;br /&gt;
&lt;br /&gt;
https://www.forum-mercedes.com/img/members/34569/schema-W211-CAN_59-end.pdf&lt;br /&gt;
* CAN B, CAN C, CAN D (X11/4)&lt;br /&gt;
&lt;br /&gt;
ISO 15765-4&lt;br /&gt;
&lt;br /&gt;
W211 https://pinoutguide.com/CarElectronics/mercedes_obd2_diag_pinout.shtml&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;vertical-align:middle;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Pin Number&lt;br /&gt;
! Pin Name&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| K-Line&lt;br /&gt;
| Ignition control (EZS), air-conditioner (KLA), PTS, safety systems (Airbag, SRS, AB) and some other&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| TNA&lt;br /&gt;
| TD engine rotation speed&lt;br /&gt;
|-&lt;br /&gt;
| 4,5&lt;br /&gt;
| GND&lt;br /&gt;
| Ground&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| CAN-high&lt;br /&gt;
| CAN-High (including AirBag system in W203, W209, W220, W240, R230, С215 after 2004y)&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| K-Line&lt;br /&gt;
| Engine control diagnostic (ME/MSM/CDI)&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| &lt;br /&gt;
| Ignition,...&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| K-Line&lt;br /&gt;
| ABS, ASR, ESP, ETS, BAS diagnostic&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| K-Line&lt;br /&gt;
| Gearbox and other transmission components (EGS, ETC, FTC)&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| K-Line&lt;br /&gt;
| All activity module (AAM), Radio (RD), ICS, ...&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| K-Line&lt;br /&gt;
| AB diagnostic - safety systems&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| CAN-Low&lt;br /&gt;
| CAN&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| K-Line&lt;br /&gt;
| IC, KI, TAU, LWR diagnostic&lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| +12V&lt;br /&gt;
| Power&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15637</id>
		<title>Mercedes Benz diagnostics obd</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15637"/>
		<updated>2026-04-02T05:37:56Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Mercedes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
XTOOLS D5S&lt;br /&gt;
* https://www.youtube.com/watch?v=gDwrVYJ0tow&lt;br /&gt;
&lt;br /&gt;
Samsara and Verizon&lt;br /&gt;
&lt;br /&gt;
OBD2, OBD2 (MB W211, 2003-). OBD2 from 1996. Connectors: Type A or Type B. &lt;br /&gt;
* https://obdplanet.com/obd2-protocol/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OdxTools.&lt;br /&gt;
* https://github.com/mercedes-benz/odxtools https://pypi.org/project/odxtools/&lt;br /&gt;
* https://deepwiki.com/mercedes-benz/odxtools/1-overview&lt;br /&gt;
&lt;br /&gt;
Freediag https://freediag.sourceforge.io/&lt;br /&gt;
&lt;br /&gt;
== Mercedes ==&lt;br /&gt;
&lt;br /&gt;
Mercedes FOSS. https://opensource.mercedes-benz.com/projects/&lt;br /&gt;
&lt;br /&gt;
https://www.forum-mercedes.com/img/members/34569/schema-W211-CAN_59-end.pdf&lt;br /&gt;
* CAN B, CAN C, CAN D (X11/4)&lt;br /&gt;
&lt;br /&gt;
ISO 15765-4&lt;br /&gt;
&lt;br /&gt;
W211 https://pinoutguide.com/CarElectronics/mercedes_obd2_diag_pinout.shtml&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;vertical-align:middle;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Pin Number&lt;br /&gt;
! Pin Name&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| K-Line&lt;br /&gt;
| Ignition control (EZS), air-conditioner (KLA), PTS, safety systems (Airbag, SRS, AB) and some other&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| TNA&lt;br /&gt;
| TD engine rotation speed&lt;br /&gt;
|-&lt;br /&gt;
| 4,5&lt;br /&gt;
| GND&lt;br /&gt;
| Ground&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| CAN-high&lt;br /&gt;
| CAN-High (including AirBag system in W203, W209, W220, W240, R230, С215 after 2004y)&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| K-Line&lt;br /&gt;
| Engine control diagnostic (ME/MSM/CDI)&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| &lt;br /&gt;
| Ignition,...&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| K-Line&lt;br /&gt;
| ABS, ASR, ESP, ETS, BAS diagnostic&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| K-Line&lt;br /&gt;
| Gearbox and other transmission components (EGS, ETC, FTC)&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| K-Line&lt;br /&gt;
| All activity module (AAM), Radio (RD), ICS, ...&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| K-Line&lt;br /&gt;
| AB diagnostic - safety systems&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| CAN-Low&lt;br /&gt;
| CAN&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| K-Line&lt;br /&gt;
| IC, KI, TAU, LWR diagnostic&lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| +12V&lt;br /&gt;
| Power&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15636</id>
		<title>Mercedes Benz diagnostics obd</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15636"/>
		<updated>2026-04-02T05:35:20Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Mercedes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
XTOOLS D5S&lt;br /&gt;
* https://www.youtube.com/watch?v=gDwrVYJ0tow&lt;br /&gt;
&lt;br /&gt;
Samsara and Verizon&lt;br /&gt;
&lt;br /&gt;
OBD2, OBD2 (MB W211, 2003-). OBD2 from 1996. Connectors: Type A or Type B. &lt;br /&gt;
* https://obdplanet.com/obd2-protocol/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OdxTools.&lt;br /&gt;
* https://github.com/mercedes-benz/odxtools https://pypi.org/project/odxtools/&lt;br /&gt;
* https://deepwiki.com/mercedes-benz/odxtools/1-overview&lt;br /&gt;
&lt;br /&gt;
Freediag https://freediag.sourceforge.io/&lt;br /&gt;
&lt;br /&gt;
== Mercedes ==&lt;br /&gt;
&lt;br /&gt;
Mercedes FOSS. https://opensource.mercedes-benz.com/projects/&lt;br /&gt;
&lt;br /&gt;
https://www.forum-mercedes.com/img/members/34569/schema-W211-CAN_59-end.pdf&lt;br /&gt;
* CAN B, CAN C, CAN D (X11/4)&lt;br /&gt;
&lt;br /&gt;
ISO 15765-4&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15635</id>
		<title>Mercedes Benz diagnostics obd</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15635"/>
		<updated>2026-04-02T05:28:39Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Mercedes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
XTOOLS D5S&lt;br /&gt;
* https://www.youtube.com/watch?v=gDwrVYJ0tow&lt;br /&gt;
&lt;br /&gt;
Samsara and Verizon&lt;br /&gt;
&lt;br /&gt;
OBD2, OBD2 (MB W211, 2003-). OBD2 from 1996. Connectors: Type A or Type B. &lt;br /&gt;
* https://obdplanet.com/obd2-protocol/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OdxTools.&lt;br /&gt;
* https://github.com/mercedes-benz/odxtools https://pypi.org/project/odxtools/&lt;br /&gt;
* https://deepwiki.com/mercedes-benz/odxtools/1-overview&lt;br /&gt;
&lt;br /&gt;
Freediag https://freediag.sourceforge.io/&lt;br /&gt;
&lt;br /&gt;
== Mercedes ==&lt;br /&gt;
&lt;br /&gt;
Mercedes FOSS. https://opensource.mercedes-benz.com/projects/&lt;br /&gt;
&lt;br /&gt;
https://www.forum-mercedes.com/img/members/34569/schema-W211-CAN_59-end.pdf&lt;br /&gt;
* CAN B, CAN C, CAN D (X11/4)&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15634</id>
		<title>Mercedes Benz diagnostics obd</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15634"/>
		<updated>2026-04-02T05:24:46Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
XTOOLS D5S&lt;br /&gt;
* https://www.youtube.com/watch?v=gDwrVYJ0tow&lt;br /&gt;
&lt;br /&gt;
Samsara and Verizon&lt;br /&gt;
&lt;br /&gt;
OBD2, OBD2 (MB W211, 2003-). OBD2 from 1996. Connectors: Type A or Type B. &lt;br /&gt;
* https://obdplanet.com/obd2-protocol/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OdxTools.&lt;br /&gt;
* https://github.com/mercedes-benz/odxtools https://pypi.org/project/odxtools/&lt;br /&gt;
* https://deepwiki.com/mercedes-benz/odxtools/1-overview&lt;br /&gt;
&lt;br /&gt;
Freediag https://freediag.sourceforge.io/&lt;br /&gt;
&lt;br /&gt;
== Mercedes ==&lt;br /&gt;
&lt;br /&gt;
Mercedes FOSS. https://opensource.mercedes-benz.com/projects/&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15633</id>
		<title>Mercedes Benz diagnostics obd</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15633"/>
		<updated>2026-04-02T05:19:55Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
XTOOLS D5S&lt;br /&gt;
* https://www.youtube.com/watch?v=gDwrVYJ0tow&lt;br /&gt;
&lt;br /&gt;
Samsara and Verizon&lt;br /&gt;
&lt;br /&gt;
OBD2, OBD2 (MB W211, 2003-)&lt;br /&gt;
&lt;br /&gt;
OdxTools.&lt;br /&gt;
* https://github.com/mercedes-benz/odxtools https://pypi.org/project/odxtools/&lt;br /&gt;
* https://deepwiki.com/mercedes-benz/odxtools/1-overview&lt;br /&gt;
&lt;br /&gt;
Freediag https://freediag.sourceforge.io/&lt;br /&gt;
&lt;br /&gt;
== Mercedes ==&lt;br /&gt;
&lt;br /&gt;
Mercedes FOSS. https://opensource.mercedes-benz.com/projects/&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15632</id>
		<title>Mercedes Benz diagnostics obd</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15632"/>
		<updated>2026-04-02T05:19:09Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
XTOOLS D5S&lt;br /&gt;
* https://www.youtube.com/watch?v=gDwrVYJ0tow&lt;br /&gt;
&lt;br /&gt;
Samsara and Verizon&lt;br /&gt;
&lt;br /&gt;
OBD2, OBD2 (MB W211, 2003-)&lt;br /&gt;
&lt;br /&gt;
OdxTools.&lt;br /&gt;
* https://github.com/mercedes-benz/odxtools https://pypi.org/project/odxtools/&lt;br /&gt;
* https://deepwiki.com/mercedes-benz/odxtools/1-overview&lt;br /&gt;
&lt;br /&gt;
== Mercedes ==&lt;br /&gt;
&lt;br /&gt;
Mercedes FOSS. https://opensource.mercedes-benz.com/projects/&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15631</id>
		<title>Mercedes Benz diagnostics obd</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15631"/>
		<updated>2026-04-02T05:18:25Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
XTOOLS D5S&lt;br /&gt;
* https://www.youtube.com/watch?v=gDwrVYJ0tow&lt;br /&gt;
&lt;br /&gt;
Samsara and Verizon&lt;br /&gt;
&lt;br /&gt;
OBD2, OBD2 (MB W211, 2003-)&lt;br /&gt;
&lt;br /&gt;
OdxTools.&lt;br /&gt;
* https://github.com/mercedes-benz/odxtools&lt;br /&gt;
* https://deepwiki.com/mercedes-benz/odxtools/1-overview&lt;br /&gt;
&lt;br /&gt;
== Mercedes ==&lt;br /&gt;
&lt;br /&gt;
Mercedes FOSS. https://opensource.mercedes-benz.com/projects/&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15630</id>
		<title>Mercedes Benz diagnostics obd</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15630"/>
		<updated>2026-04-02T05:15:12Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
XTOOLS D5S&lt;br /&gt;
* https://www.youtube.com/watch?v=gDwrVYJ0tow&lt;br /&gt;
&lt;br /&gt;
Samsara and Verizon&lt;br /&gt;
&lt;br /&gt;
OBD2, OBD2 (MB W211, 2003-)&lt;br /&gt;
&lt;br /&gt;
OdxTools.&lt;br /&gt;
* https://github.com/mercedes-benz/odxtools&lt;br /&gt;
&lt;br /&gt;
== Mercedes ==&lt;br /&gt;
&lt;br /&gt;
Mercedes FOSS. https://opensource.mercedes-benz.com/projects/&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15629</id>
		<title>Mercedes Benz diagnostics obd</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15629"/>
		<updated>2026-04-02T05:14:05Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
XTOOLS D5S&lt;br /&gt;
* https://www.youtube.com/watch?v=gDwrVYJ0tow&lt;br /&gt;
&lt;br /&gt;
Samsara and Verizon&lt;br /&gt;
&lt;br /&gt;
OBD2, OBD2 (MB W211, 2003-)&lt;br /&gt;
&lt;br /&gt;
OdxTools.&lt;br /&gt;
* https://github.com/mercedes-benz/odxtools&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15628</id>
		<title>Mercedes Benz diagnostics obd</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Mercedes_Benz_diagnostics_obd&amp;diff=15628"/>
		<updated>2026-04-02T05:13:11Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
XTOOLS D5S&lt;br /&gt;
* https://www.youtube.com/watch?v=gDwrVYJ0tow&lt;br /&gt;
&lt;br /&gt;
Samsara and Verizon&lt;br /&gt;
&lt;br /&gt;
OBD2, OBD2 (MB W211, 2003-)&lt;br /&gt;
&lt;br /&gt;
OdxTools.&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15627</id>
		<title>Diesel Cycle</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15627"/>
		<updated>2026-03-30T18:36:15Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Diesel Cycle and Ideal Gas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
DieselCycle pvDiagram simple.png|Diesel Cycle&lt;br /&gt;
DieselCycle.gif|Diesel Cycle&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ratio of specific heats (heat capacity ratio) is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ C_p }{ C_v }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pV diagram ===&lt;br /&gt;
&lt;br /&gt;
# Isentropic (adiabatic) expansion&lt;br /&gt;
# Isochoric cooling (Qout): Heat rejection. Power stroke ends, heat rejection starts.&lt;br /&gt;
# Isobaric compression: Exhaust&lt;br /&gt;
# Isobaric expansion: Intake&lt;br /&gt;
# Isentropic (adiabatic) compression&lt;br /&gt;
# Isobaric heating (Qin):  Combustion of fuel (heat is added in a constant pressure;)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Engine displacement&#039;&#039;&#039; is the cylinder volume swept by all of the pistons of a piston engine, excluding the combustion chambers. A &#039;&#039;&#039;combustion chamber&#039;&#039;&#039; is part of an internal combustion engine in which the fuel/air mix is burned.&lt;br /&gt;
&lt;br /&gt;
Only air is compressed, and then diesel fuel is injected directly into that hot, high-pressure air.&lt;br /&gt;
* Cylinder pressure: ~30–80 bar&lt;br /&gt;
* Injection pressure: ~1,000–2,500+ bar&lt;br /&gt;
&lt;br /&gt;
=== Diesel Cycle and Ideal Gas ===&lt;br /&gt;
&lt;br /&gt;
There are three (3) different processes:&lt;br /&gt;
# Isentropic &amp;lt;math&amp;gt;dU = nC_v dT = -pdV&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isobaric &amp;lt;math&amp;gt;Q = \Delta U + p \Delta V&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isochoric &amp;lt;math&amp;gt;\Delta Q = m c_v \Delta T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where the specific heat capacity at constant volume is &amp;lt;math&amp;gt;c_v = \frac{dQ/dT}{m}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For a closed system, the total change in energy of a system is the sum of the work done and the heat added &amp;lt;math&amp;gt;dU = \delta W + \delta Q&amp;lt;/math&amp;gt;, and the reversible work done on a system by changing the volume is &amp;lt;math&amp;gt;\delta W = - p dV&amp;lt;/math&amp;gt;. Furthermore, for any transformation of an ideal gas, it is always true that &amp;lt;math&amp;gt;dU = nC_v dT&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the system is reversible and adiabatic (&#039;&#039;&#039;isentropic&#039;&#039;&#039;) &amp;lt;math&amp;gt;\delta Q = 0&amp;lt;/math&amp;gt;, which gives &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = \delta W + \delta Q = -pdV + 0&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = nC_v dT = -pdV &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the constant pressure (&#039;&#039;&#039;isobaric process&#039;&#039;&#039;) &amp;lt;math&amp;gt;\Delta p = 0&amp;lt;/math&amp;gt; we have &amp;lt;math&amp;gt;W = \int p dV = p \Delta V&amp;lt;/math&amp;gt;, and by applying the ideal gas law, we get &amp;lt;math&amp;gt;W = n R \Delta T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
For the &#039;&#039;&#039;Isochoric process&#039;&#039;&#039; &amp;lt;math&amp;gt;\Delta V=0&amp;lt;/math&amp;gt;, and thus we have &amp;lt;math&amp;gt;dQ = dU = mc_v dT&amp;lt;/math&amp;gt; which gives &amp;lt;math&amp;gt;\Delta Q = m c_v\Delta T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Real gas: Air ===&lt;br /&gt;
&lt;br /&gt;
Basic ideal gas model (good first approximation). Air is usually approximated as an ideal gas with:&lt;br /&gt;
* Gas constant:&lt;br /&gt;
** R≈287 J/(kg\cdotpK)&lt;br /&gt;
** R≈287J/(kg\cdotpK)&lt;br /&gt;
* Equation of state:&lt;br /&gt;
* p=ρRT&lt;br /&gt;
This works well at:&lt;br /&gt;
* pressures near atmospheric&lt;br /&gt;
* temperatures roughly 200–500 K&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“Generalized” ideal gas → temperature-dependent properties. To go beyond the simple model, you allow properties like heat capacity to vary with temperature:&lt;br /&gt;
&lt;br /&gt;
Heat capacity. For air, a common approximation is a polynomial&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
c_p(T)=a+bT. &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Typical coefficients (for dry air, ~200–1000 K range):&lt;br /&gt;
* a≈1005&lt;br /&gt;
* b≈0.1&lt;br /&gt;
More accurate forms come from NASA polynomials:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{c_p}R=a_1+a_2T+a_3T^2+a_4T^3+a_5T^4&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Which are widely used in CFD and thermodynamics.&lt;br /&gt;
&lt;br /&gt;
Compressibility factor Z (real gas correction). If you want a generalized ideal gas, you often introduce &amp;lt;math&amp;gt;p=Z\rho RT&amp;lt;/math&amp;gt;. Where&lt;br /&gt;
* Z=1 → ideal gas&lt;br /&gt;
* Z≠1 → real gas behavior&lt;br /&gt;
For air:&lt;br /&gt;
* At normal conditions:  Z≈1&lt;br /&gt;
* At high pressure: use virial expansion &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Z=1+\frac{B(T)}V+\frac{C(T)}{V^2}+ \cdots&lt;br /&gt;
\approx 1+ \frac{B(T)}{RT}p.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mixture-based formulation (more fundamental). Air is a mixture mainly of:&lt;br /&gt;
* N₂ (~78%)&lt;br /&gt;
* O₂ (~21%)&lt;br /&gt;
* Ar (~1%)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
R &amp;amp;=\sum_i y_i R_i \\&lt;br /&gt;
c_p &amp;amp; = \sum_i y_ i c_{p,i}(T)&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Realistic Diesel Cycle ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Cylinder.png| The size of the combustion chamber of MB W211. &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ratio of specific heats γ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ \sum y_1 c_{p,i} }{ \sum y_1 ( c_{p,i} -R_u ) }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Caption text&lt;br /&gt;
|-&lt;br /&gt;
! Condition	 !! γ (approx.)&lt;br /&gt;
|-&lt;br /&gt;
| Stoichiometric || ~1.30–1.33&lt;br /&gt;
|-&lt;br /&gt;
| Moderate lean || ~1.33–1.37&lt;br /&gt;
|-&lt;br /&gt;
| Very lean (diesel) || ~1.37–1.40&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Injection pressures ===&lt;br /&gt;
&lt;br /&gt;
* Older systems: 200–500 bar&lt;br /&gt;
* Modern common-rail: 1,000–2,500 bar&lt;br /&gt;
* Latest systems: up to ~3,000 bar&lt;br /&gt;
&lt;br /&gt;
* Air pressure in cylinder:  ~30–80 bar, which is the pressure of the combustion chamber.&lt;br /&gt;
* Temperature: ~700–1000 K&lt;br /&gt;
&lt;br /&gt;
=== Diesel-air Mixture ===&lt;br /&gt;
&lt;br /&gt;
Only diesel is ejected into the cylinder. Clean air comes in during the intake stroke.&lt;br /&gt;
&lt;br /&gt;
The heat capacity ratio (known as the adiabatic index) for a diesel-air mixture is typically around 1.4. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Air-fuel ratio &lt;br /&gt;
|-&lt;br /&gt;
| 14.5:1 || Near-stoichiometric; good combustion efficiency but higher emissions.&lt;br /&gt;
|-&lt;br /&gt;
| 16:1 || Balanced performance; good power output and efficiency.&lt;br /&gt;
|-&lt;br /&gt;
| 18:1 || Lean burn; improved fuel economy but potential for higher NOx emissions.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Diesel is a complicated compound, but it’s commonly approximated as a hydrocarbon like C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt; (or C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;26&amp;lt;/sub&amp;gt;). Air is about 21% O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; and 79% N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;. Without nitrogen, the stoichiometric ratio is about&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O&lt;br /&gt;
&lt;br /&gt;
and by including nitrogen, we get&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75( O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + 3.76 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; )​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O + 66.74 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The molar masses&lt;br /&gt;
* Fuel: 167 g/mol&lt;br /&gt;
* Air: 137.28 g/mol&lt;br /&gt;
And the total air needed is 17.72 x 137.28 = 2436 g, which gives air-to-fuel-ratio to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
AFR = \frac{2436}{167} = 14.6:1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MB data ===&lt;br /&gt;
&lt;br /&gt;
Motor: OM648.&lt;br /&gt;
&lt;br /&gt;
Mercedes Benz W211 (2003)&lt;br /&gt;
* Engine displacement: 3222 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 0.003222 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Bore x Stroke: 88.0 x 88.4 mm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Compression Ratio: 18.0&lt;br /&gt;
&lt;br /&gt;
Bore x stroke gives V = 6xπ(8.8/2)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; x 8.84 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 3225.95cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;, which is rather close.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
p_1 V_1^\gamma = \text{constant}_1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15626</id>
		<title>Diesel Cycle</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15626"/>
		<updated>2026-03-30T18:35:41Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Diesel Cycle and Ideal Gas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
DieselCycle pvDiagram simple.png|Diesel Cycle&lt;br /&gt;
DieselCycle.gif|Diesel Cycle&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ratio of specific heats (heat capacity ratio) is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ C_p }{ C_v }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pV diagram ===&lt;br /&gt;
&lt;br /&gt;
# Isentropic (adiabatic) expansion&lt;br /&gt;
# Isochoric cooling (Qout): Heat rejection. Power stroke ends, heat rejection starts.&lt;br /&gt;
# Isobaric compression: Exhaust&lt;br /&gt;
# Isobaric expansion: Intake&lt;br /&gt;
# Isentropic (adiabatic) compression&lt;br /&gt;
# Isobaric heating (Qin):  Combustion of fuel (heat is added in a constant pressure;)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Engine displacement&#039;&#039;&#039; is the cylinder volume swept by all of the pistons of a piston engine, excluding the combustion chambers. A &#039;&#039;&#039;combustion chamber&#039;&#039;&#039; is part of an internal combustion engine in which the fuel/air mix is burned.&lt;br /&gt;
&lt;br /&gt;
Only air is compressed, and then diesel fuel is injected directly into that hot, high-pressure air.&lt;br /&gt;
* Cylinder pressure: ~30–80 bar&lt;br /&gt;
* Injection pressure: ~1,000–2,500+ bar&lt;br /&gt;
&lt;br /&gt;
=== Diesel Cycle and Ideal Gas ===&lt;br /&gt;
&lt;br /&gt;
There are three (3) different processes:&lt;br /&gt;
# Isentropic &amp;lt;math&amp;gt;dU = nC_v dT = -pdV&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isobaric &amp;lt;math&amp;gt;Q = \Delta U + p \Delta V&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isochoric &amp;lt;math&amp;gt;\Delta Q = m c_v \Delta T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where the specific heat capacity at constant volume is &amp;lt;math&amp;gt;c_v = \frac{dQ/dT}{m}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For a closed system, the total change in energy of a system is the sum of the work done and the heat added &amp;lt;math&amp;gt;dU = \delta W + \delta Q&amp;lt;/math&amp;gt;, and the reversible work done on a system by changing the volume is &amp;lt;math&amp;gt;\delta W = - p dV&amp;lt;/math&amp;gt;. Furthermore, for any transformation of an ideal gas, it is always true that &amp;lt;math&amp;gt;dU = nC_v dT&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the system is reversible and adiabatic (&#039;&#039;&#039;isentropic&#039;&#039;&#039;) &amp;lt;math&amp;gt;\delta Q = 0&amp;lt;/math&amp;gt;, which gives &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = \delta W + \delta Q = -pdV + 0&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = nC_v dT = -pdV &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the constant pressure (&#039;&#039;&#039;isobaric process&#039;&#039;&#039;) &amp;lt;math&amp;gt;\Delta p = 0&amp;lt;/math&amp;gt; we have &amp;lt;math&amp;gt;W = \int p dV = p \Delta V&amp;lt;/math&amp;gt;, and by applying the ideal gas law, we get &amp;lt;math&amp;gt;W = n R \Delta T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
For the &#039;&#039;&#039;Isochoric process&#039;&#039;&#039; &amp;lt;math&amp;gt;\Delta V=0&amp;lt;/math&amp;gt;, and thus we have &amp;lt;math&amp;gt;dU = dQ = mc_v dT&amp;lt;/math&amp;gt; which gives &amp;lt;math&amp;gt;\Delta Q = m c_v\Delta T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Real gas: Air ===&lt;br /&gt;
&lt;br /&gt;
Basic ideal gas model (good first approximation). Air is usually approximated as an ideal gas with:&lt;br /&gt;
* Gas constant:&lt;br /&gt;
** R≈287 J/(kg\cdotpK)&lt;br /&gt;
** R≈287J/(kg\cdotpK)&lt;br /&gt;
* Equation of state:&lt;br /&gt;
* p=ρRT&lt;br /&gt;
This works well at:&lt;br /&gt;
* pressures near atmospheric&lt;br /&gt;
* temperatures roughly 200–500 K&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“Generalized” ideal gas → temperature-dependent properties. To go beyond the simple model, you allow properties like heat capacity to vary with temperature:&lt;br /&gt;
&lt;br /&gt;
Heat capacity. For air, a common approximation is a polynomial&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
c_p(T)=a+bT. &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Typical coefficients (for dry air, ~200–1000 K range):&lt;br /&gt;
* a≈1005&lt;br /&gt;
* b≈0.1&lt;br /&gt;
More accurate forms come from NASA polynomials:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{c_p}R=a_1+a_2T+a_3T^2+a_4T^3+a_5T^4&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Which are widely used in CFD and thermodynamics.&lt;br /&gt;
&lt;br /&gt;
Compressibility factor Z (real gas correction). If you want a generalized ideal gas, you often introduce &amp;lt;math&amp;gt;p=Z\rho RT&amp;lt;/math&amp;gt;. Where&lt;br /&gt;
* Z=1 → ideal gas&lt;br /&gt;
* Z≠1 → real gas behavior&lt;br /&gt;
For air:&lt;br /&gt;
* At normal conditions:  Z≈1&lt;br /&gt;
* At high pressure: use virial expansion &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Z=1+\frac{B(T)}V+\frac{C(T)}{V^2}+ \cdots&lt;br /&gt;
\approx 1+ \frac{B(T)}{RT}p.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mixture-based formulation (more fundamental). Air is a mixture mainly of:&lt;br /&gt;
* N₂ (~78%)&lt;br /&gt;
* O₂ (~21%)&lt;br /&gt;
* Ar (~1%)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
R &amp;amp;=\sum_i y_i R_i \\&lt;br /&gt;
c_p &amp;amp; = \sum_i y_ i c_{p,i}(T)&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Realistic Diesel Cycle ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Cylinder.png| The size of the combustion chamber of MB W211. &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ratio of specific heats γ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ \sum y_1 c_{p,i} }{ \sum y_1 ( c_{p,i} -R_u ) }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Caption text&lt;br /&gt;
|-&lt;br /&gt;
! Condition	 !! γ (approx.)&lt;br /&gt;
|-&lt;br /&gt;
| Stoichiometric || ~1.30–1.33&lt;br /&gt;
|-&lt;br /&gt;
| Moderate lean || ~1.33–1.37&lt;br /&gt;
|-&lt;br /&gt;
| Very lean (diesel) || ~1.37–1.40&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Injection pressures ===&lt;br /&gt;
&lt;br /&gt;
* Older systems: 200–500 bar&lt;br /&gt;
* Modern common-rail: 1,000–2,500 bar&lt;br /&gt;
* Latest systems: up to ~3,000 bar&lt;br /&gt;
&lt;br /&gt;
* Air pressure in cylinder:  ~30–80 bar, which is the pressure of the combustion chamber.&lt;br /&gt;
* Temperature: ~700–1000 K&lt;br /&gt;
&lt;br /&gt;
=== Diesel-air Mixture ===&lt;br /&gt;
&lt;br /&gt;
Only diesel is ejected into the cylinder. Clean air comes in during the intake stroke.&lt;br /&gt;
&lt;br /&gt;
The heat capacity ratio (known as the adiabatic index) for a diesel-air mixture is typically around 1.4. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Air-fuel ratio &lt;br /&gt;
|-&lt;br /&gt;
| 14.5:1 || Near-stoichiometric; good combustion efficiency but higher emissions.&lt;br /&gt;
|-&lt;br /&gt;
| 16:1 || Balanced performance; good power output and efficiency.&lt;br /&gt;
|-&lt;br /&gt;
| 18:1 || Lean burn; improved fuel economy but potential for higher NOx emissions.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Diesel is a complicated compound, but it’s commonly approximated as a hydrocarbon like C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt; (or C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;26&amp;lt;/sub&amp;gt;). Air is about 21% O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; and 79% N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;. Without nitrogen, the stoichiometric ratio is about&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O&lt;br /&gt;
&lt;br /&gt;
and by including nitrogen, we get&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75( O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + 3.76 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; )​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O + 66.74 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The molar masses&lt;br /&gt;
* Fuel: 167 g/mol&lt;br /&gt;
* Air: 137.28 g/mol&lt;br /&gt;
And the total air needed is 17.72 x 137.28 = 2436 g, which gives air-to-fuel-ratio to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
AFR = \frac{2436}{167} = 14.6:1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MB data ===&lt;br /&gt;
&lt;br /&gt;
Motor: OM648.&lt;br /&gt;
&lt;br /&gt;
Mercedes Benz W211 (2003)&lt;br /&gt;
* Engine displacement: 3222 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 0.003222 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Bore x Stroke: 88.0 x 88.4 mm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Compression Ratio: 18.0&lt;br /&gt;
&lt;br /&gt;
Bore x stroke gives V = 6xπ(8.8/2)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; x 8.84 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 3225.95cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;, which is rather close.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
p_1 V_1^\gamma = \text{constant}_1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15625</id>
		<title>Diesel Cycle</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15625"/>
		<updated>2026-03-30T18:28:31Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Diesel Cycle and Ideal Gas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
DieselCycle pvDiagram simple.png|Diesel Cycle&lt;br /&gt;
DieselCycle.gif|Diesel Cycle&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ratio of specific heats (heat capacity ratio) is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ C_p }{ C_v }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pV diagram ===&lt;br /&gt;
&lt;br /&gt;
# Isentropic (adiabatic) expansion&lt;br /&gt;
# Isochoric cooling (Qout): Heat rejection. Power stroke ends, heat rejection starts.&lt;br /&gt;
# Isobaric compression: Exhaust&lt;br /&gt;
# Isobaric expansion: Intake&lt;br /&gt;
# Isentropic (adiabatic) compression&lt;br /&gt;
# Isobaric heating (Qin):  Combustion of fuel (heat is added in a constant pressure;)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Engine displacement&#039;&#039;&#039; is the cylinder volume swept by all of the pistons of a piston engine, excluding the combustion chambers. A &#039;&#039;&#039;combustion chamber&#039;&#039;&#039; is part of an internal combustion engine in which the fuel/air mix is burned.&lt;br /&gt;
&lt;br /&gt;
Only air is compressed, and then diesel fuel is injected directly into that hot, high-pressure air.&lt;br /&gt;
* Cylinder pressure: ~30–80 bar&lt;br /&gt;
* Injection pressure: ~1,000–2,500+ bar&lt;br /&gt;
&lt;br /&gt;
=== Diesel Cycle and Ideal Gas ===&lt;br /&gt;
&lt;br /&gt;
There are three (3) different processes:&lt;br /&gt;
# Isentropic &amp;lt;math&amp;gt;dU = nC_v dT = -pdV&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isobaric &amp;lt;math&amp;gt;Q = \Delta U + p \Delta V&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isochoric &amp;lt;math&amp;gt;\Delta Q = m c_v \Delta T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where the specific heat capacity at constant volume is &amp;lt;math&amp;gt;c_v = \frac{dQ/dT}{m}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For a closed system, the total change in energy of a system is the sum of the work done and the heat added &amp;lt;math&amp;gt;dU = \delta W + \delta Q&amp;lt;/math&amp;gt;, and the reversible work done on a system by changing the volume is &amp;lt;math&amp;gt;\delta W = - p dV&amp;lt;/math&amp;gt;. Furthermore, for any transformation of an ideal gas, it is always true that &amp;lt;math&amp;gt;dU = nC_v dT&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the system is reversible and adiabatic (&#039;&#039;&#039;isentropic&#039;&#039;&#039;) &amp;lt;math&amp;gt;\delta Q = 0&amp;lt;/math&amp;gt;, which gives &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = \delta W + \delta Q = -pdV + 0&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = nC_v dT = -pdV &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the constant pressure (&#039;&#039;&#039;isobaric process&#039;&#039;&#039;) &amp;lt;math&amp;gt;\Delta p = 0&amp;lt;/math&amp;gt; we have &amp;lt;math&amp;gt;W = \int p dV = p \Delta V&amp;lt;/math&amp;gt;, and by applying the ideal gas law, we get &amp;lt;math&amp;gt;W = n R \Delta T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
For the &#039;&#039;&#039;Isochoric process&#039;&#039;&#039; &amp;lt;math&amp;gt;\Delta V=0&amp;lt;/math&amp;gt;, and thus we have &amp;lt;math&amp;gt;dU = dQ&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Real gas: Air ===&lt;br /&gt;
&lt;br /&gt;
Basic ideal gas model (good first approximation). Air is usually approximated as an ideal gas with:&lt;br /&gt;
* Gas constant:&lt;br /&gt;
** R≈287 J/(kg\cdotpK)&lt;br /&gt;
** R≈287J/(kg\cdotpK)&lt;br /&gt;
* Equation of state:&lt;br /&gt;
* p=ρRT&lt;br /&gt;
This works well at:&lt;br /&gt;
* pressures near atmospheric&lt;br /&gt;
* temperatures roughly 200–500 K&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“Generalized” ideal gas → temperature-dependent properties. To go beyond the simple model, you allow properties like heat capacity to vary with temperature:&lt;br /&gt;
&lt;br /&gt;
Heat capacity. For air, a common approximation is a polynomial&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
c_p(T)=a+bT. &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Typical coefficients (for dry air, ~200–1000 K range):&lt;br /&gt;
* a≈1005&lt;br /&gt;
* b≈0.1&lt;br /&gt;
More accurate forms come from NASA polynomials:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{c_p}R=a_1+a_2T+a_3T^2+a_4T^3+a_5T^4&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Which are widely used in CFD and thermodynamics.&lt;br /&gt;
&lt;br /&gt;
Compressibility factor Z (real gas correction). If you want a generalized ideal gas, you often introduce &amp;lt;math&amp;gt;p=Z\rho RT&amp;lt;/math&amp;gt;. Where&lt;br /&gt;
* Z=1 → ideal gas&lt;br /&gt;
* Z≠1 → real gas behavior&lt;br /&gt;
For air:&lt;br /&gt;
* At normal conditions:  Z≈1&lt;br /&gt;
* At high pressure: use virial expansion &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Z=1+\frac{B(T)}V+\frac{C(T)}{V^2}+ \cdots&lt;br /&gt;
\approx 1+ \frac{B(T)}{RT}p.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mixture-based formulation (more fundamental). Air is a mixture mainly of:&lt;br /&gt;
* N₂ (~78%)&lt;br /&gt;
* O₂ (~21%)&lt;br /&gt;
* Ar (~1%)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
R &amp;amp;=\sum_i y_i R_i \\&lt;br /&gt;
c_p &amp;amp; = \sum_i y_ i c_{p,i}(T)&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Realistic Diesel Cycle ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Cylinder.png| The size of the combustion chamber of MB W211. &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ratio of specific heats γ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ \sum y_1 c_{p,i} }{ \sum y_1 ( c_{p,i} -R_u ) }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Caption text&lt;br /&gt;
|-&lt;br /&gt;
! Condition	 !! γ (approx.)&lt;br /&gt;
|-&lt;br /&gt;
| Stoichiometric || ~1.30–1.33&lt;br /&gt;
|-&lt;br /&gt;
| Moderate lean || ~1.33–1.37&lt;br /&gt;
|-&lt;br /&gt;
| Very lean (diesel) || ~1.37–1.40&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Injection pressures ===&lt;br /&gt;
&lt;br /&gt;
* Older systems: 200–500 bar&lt;br /&gt;
* Modern common-rail: 1,000–2,500 bar&lt;br /&gt;
* Latest systems: up to ~3,000 bar&lt;br /&gt;
&lt;br /&gt;
* Air pressure in cylinder:  ~30–80 bar, which is the pressure of the combustion chamber.&lt;br /&gt;
* Temperature: ~700–1000 K&lt;br /&gt;
&lt;br /&gt;
=== Diesel-air Mixture ===&lt;br /&gt;
&lt;br /&gt;
Only diesel is ejected into the cylinder. Clean air comes in during the intake stroke.&lt;br /&gt;
&lt;br /&gt;
The heat capacity ratio (known as the adiabatic index) for a diesel-air mixture is typically around 1.4. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Air-fuel ratio &lt;br /&gt;
|-&lt;br /&gt;
| 14.5:1 || Near-stoichiometric; good combustion efficiency but higher emissions.&lt;br /&gt;
|-&lt;br /&gt;
| 16:1 || Balanced performance; good power output and efficiency.&lt;br /&gt;
|-&lt;br /&gt;
| 18:1 || Lean burn; improved fuel economy but potential for higher NOx emissions.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Diesel is a complicated compound, but it’s commonly approximated as a hydrocarbon like C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt; (or C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;26&amp;lt;/sub&amp;gt;). Air is about 21% O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; and 79% N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;. Without nitrogen, the stoichiometric ratio is about&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O&lt;br /&gt;
&lt;br /&gt;
and by including nitrogen, we get&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75( O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + 3.76 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; )​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O + 66.74 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The molar masses&lt;br /&gt;
* Fuel: 167 g/mol&lt;br /&gt;
* Air: 137.28 g/mol&lt;br /&gt;
And the total air needed is 17.72 x 137.28 = 2436 g, which gives air-to-fuel-ratio to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
AFR = \frac{2436}{167} = 14.6:1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MB data ===&lt;br /&gt;
&lt;br /&gt;
Motor: OM648.&lt;br /&gt;
&lt;br /&gt;
Mercedes Benz W211 (2003)&lt;br /&gt;
* Engine displacement: 3222 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 0.003222 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Bore x Stroke: 88.0 x 88.4 mm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Compression Ratio: 18.0&lt;br /&gt;
&lt;br /&gt;
Bore x stroke gives V = 6xπ(8.8/2)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; x 8.84 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 3225.95cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;, which is rather close.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
p_1 V_1^\gamma = \text{constant}_1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15624</id>
		<title>Diesel Cycle</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15624"/>
		<updated>2026-03-30T18:28:15Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Diesel Cycle and Ideal Gas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
DieselCycle pvDiagram simple.png|Diesel Cycle&lt;br /&gt;
DieselCycle.gif|Diesel Cycle&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ratio of specific heats (heat capacity ratio) is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ C_p }{ C_v }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pV diagram ===&lt;br /&gt;
&lt;br /&gt;
# Isentropic (adiabatic) expansion&lt;br /&gt;
# Isochoric cooling (Qout): Heat rejection. Power stroke ends, heat rejection starts.&lt;br /&gt;
# Isobaric compression: Exhaust&lt;br /&gt;
# Isobaric expansion: Intake&lt;br /&gt;
# Isentropic (adiabatic) compression&lt;br /&gt;
# Isobaric heating (Qin):  Combustion of fuel (heat is added in a constant pressure;)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Engine displacement&#039;&#039;&#039; is the cylinder volume swept by all of the pistons of a piston engine, excluding the combustion chambers. A &#039;&#039;&#039;combustion chamber&#039;&#039;&#039; is part of an internal combustion engine in which the fuel/air mix is burned.&lt;br /&gt;
&lt;br /&gt;
Only air is compressed, and then diesel fuel is injected directly into that hot, high-pressure air.&lt;br /&gt;
* Cylinder pressure: ~30–80 bar&lt;br /&gt;
* Injection pressure: ~1,000–2,500+ bar&lt;br /&gt;
&lt;br /&gt;
=== Diesel Cycle and Ideal Gas ===&lt;br /&gt;
&lt;br /&gt;
There are three (3) different processes:&lt;br /&gt;
# Isentropic &amp;lt;math&amp;gt;dU = nC_v dT = -pdV&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isobaric &amp;lt;math&amp;gt;Q = \Delta U + p \Delta V&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isochoric &amp;lt;math&amp;gt;\Delta Q = m c_v \Delta T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The specific heat capacity at constant volume is &amp;lt;math&amp;gt;c_v = \frac{dQ/dT}{m}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For a closed system, the total change in energy of a system is the sum of the work done and the heat added &amp;lt;math&amp;gt;dU = \delta W + \delta Q&amp;lt;/math&amp;gt;, and the reversible work done on a system by changing the volume is &amp;lt;math&amp;gt;\delta W = - p dV&amp;lt;/math&amp;gt;. Furthermore, for any transformation of an ideal gas, it is always true that &amp;lt;math&amp;gt;dU = nC_v dT&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the system is reversible and adiabatic (&#039;&#039;&#039;isentropic&#039;&#039;&#039;) &amp;lt;math&amp;gt;\delta Q = 0&amp;lt;/math&amp;gt;, which gives &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = \delta W + \delta Q = -pdV + 0&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = nC_v dT = -pdV &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the constant pressure (&#039;&#039;&#039;isobaric process&#039;&#039;&#039;) &amp;lt;math&amp;gt;\Delta p = 0&amp;lt;/math&amp;gt; we have &amp;lt;math&amp;gt;W = \int p dV = p \Delta V&amp;lt;/math&amp;gt;, and by applying the ideal gas law, we get &amp;lt;math&amp;gt;W = n R \Delta T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
For the &#039;&#039;&#039;Isochoric process&#039;&#039;&#039; &amp;lt;math&amp;gt;\Delta V=0&amp;lt;/math&amp;gt;, and thus we have &amp;lt;math&amp;gt;dU = dQ&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Real gas: Air ===&lt;br /&gt;
&lt;br /&gt;
Basic ideal gas model (good first approximation). Air is usually approximated as an ideal gas with:&lt;br /&gt;
* Gas constant:&lt;br /&gt;
** R≈287 J/(kg\cdotpK)&lt;br /&gt;
** R≈287J/(kg\cdotpK)&lt;br /&gt;
* Equation of state:&lt;br /&gt;
* p=ρRT&lt;br /&gt;
This works well at:&lt;br /&gt;
* pressures near atmospheric&lt;br /&gt;
* temperatures roughly 200–500 K&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“Generalized” ideal gas → temperature-dependent properties. To go beyond the simple model, you allow properties like heat capacity to vary with temperature:&lt;br /&gt;
&lt;br /&gt;
Heat capacity. For air, a common approximation is a polynomial&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
c_p(T)=a+bT. &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Typical coefficients (for dry air, ~200–1000 K range):&lt;br /&gt;
* a≈1005&lt;br /&gt;
* b≈0.1&lt;br /&gt;
More accurate forms come from NASA polynomials:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{c_p}R=a_1+a_2T+a_3T^2+a_4T^3+a_5T^4&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Which are widely used in CFD and thermodynamics.&lt;br /&gt;
&lt;br /&gt;
Compressibility factor Z (real gas correction). If you want a generalized ideal gas, you often introduce &amp;lt;math&amp;gt;p=Z\rho RT&amp;lt;/math&amp;gt;. Where&lt;br /&gt;
* Z=1 → ideal gas&lt;br /&gt;
* Z≠1 → real gas behavior&lt;br /&gt;
For air:&lt;br /&gt;
* At normal conditions:  Z≈1&lt;br /&gt;
* At high pressure: use virial expansion &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Z=1+\frac{B(T)}V+\frac{C(T)}{V^2}+ \cdots&lt;br /&gt;
\approx 1+ \frac{B(T)}{RT}p.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mixture-based formulation (more fundamental). Air is a mixture mainly of:&lt;br /&gt;
* N₂ (~78%)&lt;br /&gt;
* O₂ (~21%)&lt;br /&gt;
* Ar (~1%)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
R &amp;amp;=\sum_i y_i R_i \\&lt;br /&gt;
c_p &amp;amp; = \sum_i y_ i c_{p,i}(T)&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Realistic Diesel Cycle ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Cylinder.png| The size of the combustion chamber of MB W211. &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ratio of specific heats γ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ \sum y_1 c_{p,i} }{ \sum y_1 ( c_{p,i} -R_u ) }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Caption text&lt;br /&gt;
|-&lt;br /&gt;
! Condition	 !! γ (approx.)&lt;br /&gt;
|-&lt;br /&gt;
| Stoichiometric || ~1.30–1.33&lt;br /&gt;
|-&lt;br /&gt;
| Moderate lean || ~1.33–1.37&lt;br /&gt;
|-&lt;br /&gt;
| Very lean (diesel) || ~1.37–1.40&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Injection pressures ===&lt;br /&gt;
&lt;br /&gt;
* Older systems: 200–500 bar&lt;br /&gt;
* Modern common-rail: 1,000–2,500 bar&lt;br /&gt;
* Latest systems: up to ~3,000 bar&lt;br /&gt;
&lt;br /&gt;
* Air pressure in cylinder:  ~30–80 bar, which is the pressure of the combustion chamber.&lt;br /&gt;
* Temperature: ~700–1000 K&lt;br /&gt;
&lt;br /&gt;
=== Diesel-air Mixture ===&lt;br /&gt;
&lt;br /&gt;
Only diesel is ejected into the cylinder. Clean air comes in during the intake stroke.&lt;br /&gt;
&lt;br /&gt;
The heat capacity ratio (known as the adiabatic index) for a diesel-air mixture is typically around 1.4. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Air-fuel ratio &lt;br /&gt;
|-&lt;br /&gt;
| 14.5:1 || Near-stoichiometric; good combustion efficiency but higher emissions.&lt;br /&gt;
|-&lt;br /&gt;
| 16:1 || Balanced performance; good power output and efficiency.&lt;br /&gt;
|-&lt;br /&gt;
| 18:1 || Lean burn; improved fuel economy but potential for higher NOx emissions.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Diesel is a complicated compound, but it’s commonly approximated as a hydrocarbon like C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt; (or C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;26&amp;lt;/sub&amp;gt;). Air is about 21% O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; and 79% N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;. Without nitrogen, the stoichiometric ratio is about&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O&lt;br /&gt;
&lt;br /&gt;
and by including nitrogen, we get&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75( O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + 3.76 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; )​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O + 66.74 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The molar masses&lt;br /&gt;
* Fuel: 167 g/mol&lt;br /&gt;
* Air: 137.28 g/mol&lt;br /&gt;
And the total air needed is 17.72 x 137.28 = 2436 g, which gives air-to-fuel-ratio to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
AFR = \frac{2436}{167} = 14.6:1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MB data ===&lt;br /&gt;
&lt;br /&gt;
Motor: OM648.&lt;br /&gt;
&lt;br /&gt;
Mercedes Benz W211 (2003)&lt;br /&gt;
* Engine displacement: 3222 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 0.003222 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Bore x Stroke: 88.0 x 88.4 mm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Compression Ratio: 18.0&lt;br /&gt;
&lt;br /&gt;
Bore x stroke gives V = 6xπ(8.8/2)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; x 8.84 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 3225.95cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;, which is rather close.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
p_1 V_1^\gamma = \text{constant}_1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15623</id>
		<title>Diesel Cycle</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15623"/>
		<updated>2026-03-30T18:26:33Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Diesel Cycle and Ideal Gas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
DieselCycle pvDiagram simple.png|Diesel Cycle&lt;br /&gt;
DieselCycle.gif|Diesel Cycle&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ratio of specific heats (heat capacity ratio) is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ C_p }{ C_v }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pV diagram ===&lt;br /&gt;
&lt;br /&gt;
# Isentropic (adiabatic) expansion&lt;br /&gt;
# Isochoric cooling (Qout): Heat rejection. Power stroke ends, heat rejection starts.&lt;br /&gt;
# Isobaric compression: Exhaust&lt;br /&gt;
# Isobaric expansion: Intake&lt;br /&gt;
# Isentropic (adiabatic) compression&lt;br /&gt;
# Isobaric heating (Qin):  Combustion of fuel (heat is added in a constant pressure;)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Engine displacement&#039;&#039;&#039; is the cylinder volume swept by all of the pistons of a piston engine, excluding the combustion chambers. A &#039;&#039;&#039;combustion chamber&#039;&#039;&#039; is part of an internal combustion engine in which the fuel/air mix is burned.&lt;br /&gt;
&lt;br /&gt;
Only air is compressed, and then diesel fuel is injected directly into that hot, high-pressure air.&lt;br /&gt;
* Cylinder pressure: ~30–80 bar&lt;br /&gt;
* Injection pressure: ~1,000–2,500+ bar&lt;br /&gt;
&lt;br /&gt;
=== Diesel Cycle and Ideal Gas ===&lt;br /&gt;
&lt;br /&gt;
There are three (3) different processes:&lt;br /&gt;
# Isentropic &amp;lt;math&amp;gt;dU = nC_v dT = -pdV&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isobaric &amp;lt;math&amp;gt;Q = \Delta U + p \Delta V&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isochoric &amp;lt;math&amp;gt;\Delta Q = m c_v \Delta T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For a closed system, the total change in energy of a system is the sum of the work done and the heat added &amp;lt;math&amp;gt;dU = \delta W + \delta Q&amp;lt;/math&amp;gt;, and the reversible work done on a system by changing the volume is &amp;lt;math&amp;gt;\delta W = - p dV&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the system is reversible and adiabatic (&#039;&#039;&#039;isentropic&#039;&#039;&#039;) &amp;lt;math&amp;gt;\delta Q = 0&amp;lt;/math&amp;gt;, which gives &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = \delta W + \delta Q = -pdV + 0&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Furthermore, for any transformation of an ideal gas, it is always true that &amp;lt;math&amp;gt;dU = nC_v dT&amp;lt;/math&amp;gt;, giving&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = nC_v dT = -pdV &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the constant pressure (&#039;&#039;&#039;isobaric process&#039;&#039;&#039;) &amp;lt;math&amp;gt;\Delta p = 0&amp;lt;/math&amp;gt; we have &amp;lt;math&amp;gt;W = \int p dV = p \Delta V&amp;lt;/math&amp;gt;, and by applying the ideal gas law, we get &amp;lt;math&amp;gt;W = n R \Delta T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
For the &#039;&#039;&#039;Isochoric process&#039;&#039;&#039; &amp;lt;math&amp;gt;\Delta V=0&amp;lt;/math&amp;gt;, and thus we have &amp;lt;math&amp;gt;dU = dQ&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Real gas: Air ===&lt;br /&gt;
&lt;br /&gt;
Basic ideal gas model (good first approximation). Air is usually approximated as an ideal gas with:&lt;br /&gt;
* Gas constant:&lt;br /&gt;
** R≈287 J/(kg\cdotpK)&lt;br /&gt;
** R≈287J/(kg\cdotpK)&lt;br /&gt;
* Equation of state:&lt;br /&gt;
* p=ρRT&lt;br /&gt;
This works well at:&lt;br /&gt;
* pressures near atmospheric&lt;br /&gt;
* temperatures roughly 200–500 K&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“Generalized” ideal gas → temperature-dependent properties. To go beyond the simple model, you allow properties like heat capacity to vary with temperature:&lt;br /&gt;
&lt;br /&gt;
Heat capacity. For air, a common approximation is a polynomial&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
c_p(T)=a+bT. &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Typical coefficients (for dry air, ~200–1000 K range):&lt;br /&gt;
* a≈1005&lt;br /&gt;
* b≈0.1&lt;br /&gt;
More accurate forms come from NASA polynomials:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{c_p}R=a_1+a_2T+a_3T^2+a_4T^3+a_5T^4&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Which are widely used in CFD and thermodynamics.&lt;br /&gt;
&lt;br /&gt;
Compressibility factor Z (real gas correction). If you want a generalized ideal gas, you often introduce &amp;lt;math&amp;gt;p=Z\rho RT&amp;lt;/math&amp;gt;. Where&lt;br /&gt;
* Z=1 → ideal gas&lt;br /&gt;
* Z≠1 → real gas behavior&lt;br /&gt;
For air:&lt;br /&gt;
* At normal conditions:  Z≈1&lt;br /&gt;
* At high pressure: use virial expansion &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Z=1+\frac{B(T)}V+\frac{C(T)}{V^2}+ \cdots&lt;br /&gt;
\approx 1+ \frac{B(T)}{RT}p.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mixture-based formulation (more fundamental). Air is a mixture mainly of:&lt;br /&gt;
* N₂ (~78%)&lt;br /&gt;
* O₂ (~21%)&lt;br /&gt;
* Ar (~1%)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
R &amp;amp;=\sum_i y_i R_i \\&lt;br /&gt;
c_p &amp;amp; = \sum_i y_ i c_{p,i}(T)&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Realistic Diesel Cycle ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Cylinder.png| The size of the combustion chamber of MB W211. &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ratio of specific heats γ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ \sum y_1 c_{p,i} }{ \sum y_1 ( c_{p,i} -R_u ) }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Caption text&lt;br /&gt;
|-&lt;br /&gt;
! Condition	 !! γ (approx.)&lt;br /&gt;
|-&lt;br /&gt;
| Stoichiometric || ~1.30–1.33&lt;br /&gt;
|-&lt;br /&gt;
| Moderate lean || ~1.33–1.37&lt;br /&gt;
|-&lt;br /&gt;
| Very lean (diesel) || ~1.37–1.40&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Injection pressures ===&lt;br /&gt;
&lt;br /&gt;
* Older systems: 200–500 bar&lt;br /&gt;
* Modern common-rail: 1,000–2,500 bar&lt;br /&gt;
* Latest systems: up to ~3,000 bar&lt;br /&gt;
&lt;br /&gt;
* Air pressure in cylinder:  ~30–80 bar, which is the pressure of the combustion chamber.&lt;br /&gt;
* Temperature: ~700–1000 K&lt;br /&gt;
&lt;br /&gt;
=== Diesel-air Mixture ===&lt;br /&gt;
&lt;br /&gt;
Only diesel is ejected into the cylinder. Clean air comes in during the intake stroke.&lt;br /&gt;
&lt;br /&gt;
The heat capacity ratio (known as the adiabatic index) for a diesel-air mixture is typically around 1.4. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Air-fuel ratio &lt;br /&gt;
|-&lt;br /&gt;
| 14.5:1 || Near-stoichiometric; good combustion efficiency but higher emissions.&lt;br /&gt;
|-&lt;br /&gt;
| 16:1 || Balanced performance; good power output and efficiency.&lt;br /&gt;
|-&lt;br /&gt;
| 18:1 || Lean burn; improved fuel economy but potential for higher NOx emissions.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Diesel is a complicated compound, but it’s commonly approximated as a hydrocarbon like C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt; (or C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;26&amp;lt;/sub&amp;gt;). Air is about 21% O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; and 79% N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;. Without nitrogen, the stoichiometric ratio is about&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O&lt;br /&gt;
&lt;br /&gt;
and by including nitrogen, we get&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75( O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + 3.76 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; )​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O + 66.74 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The molar masses&lt;br /&gt;
* Fuel: 167 g/mol&lt;br /&gt;
* Air: 137.28 g/mol&lt;br /&gt;
And the total air needed is 17.72 x 137.28 = 2436 g, which gives air-to-fuel-ratio to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
AFR = \frac{2436}{167} = 14.6:1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MB data ===&lt;br /&gt;
&lt;br /&gt;
Motor: OM648.&lt;br /&gt;
&lt;br /&gt;
Mercedes Benz W211 (2003)&lt;br /&gt;
* Engine displacement: 3222 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 0.003222 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Bore x Stroke: 88.0 x 88.4 mm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Compression Ratio: 18.0&lt;br /&gt;
&lt;br /&gt;
Bore x stroke gives V = 6xπ(8.8/2)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; x 8.84 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 3225.95cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;, which is rather close.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
p_1 V_1^\gamma = \text{constant}_1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15622</id>
		<title>Diesel Cycle</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15622"/>
		<updated>2026-03-30T18:15:26Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Diesel Cycle and Ideal Gas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
DieselCycle pvDiagram simple.png|Diesel Cycle&lt;br /&gt;
DieselCycle.gif|Diesel Cycle&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ratio of specific heats (heat capacity ratio) is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ C_p }{ C_v }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pV diagram ===&lt;br /&gt;
&lt;br /&gt;
# Isentropic (adiabatic) expansion&lt;br /&gt;
# Isochoric cooling (Qout): Heat rejection. Power stroke ends, heat rejection starts.&lt;br /&gt;
# Isobaric compression: Exhaust&lt;br /&gt;
# Isobaric expansion: Intake&lt;br /&gt;
# Isentropic (adiabatic) compression&lt;br /&gt;
# Isobaric heating (Qin):  Combustion of fuel (heat is added in a constant pressure;)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Engine displacement&#039;&#039;&#039; is the cylinder volume swept by all of the pistons of a piston engine, excluding the combustion chambers. A &#039;&#039;&#039;combustion chamber&#039;&#039;&#039; is part of an internal combustion engine in which the fuel/air mix is burned.&lt;br /&gt;
&lt;br /&gt;
Only air is compressed, and then diesel fuel is injected directly into that hot, high-pressure air.&lt;br /&gt;
* Cylinder pressure: ~30–80 bar&lt;br /&gt;
* Injection pressure: ~1,000–2,500+ bar&lt;br /&gt;
&lt;br /&gt;
=== Diesel Cycle and Ideal Gas ===&lt;br /&gt;
&lt;br /&gt;
There are three (3) different processes:&lt;br /&gt;
# Isentropic &amp;lt;math&amp;gt;dU = nC_v dT = -pdV&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isobaric &amp;lt;math&amp;gt;Q = \Delta U + p \Delta V&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isochoric &amp;lt;math&amp;gt;\Delta Q = m c_v \Delta T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For a closed system, the total change in energy of a system is the sum of the work done and the heat added &amp;lt;math&amp;gt;dU = \delta W + \delta Q&amp;lt;/math&amp;gt;, and the reversible work done on a system by changing the volume is &amp;lt;math&amp;gt;\delta W = - p dV&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the system is reversible and adiabatic (&#039;&#039;&#039;isentropic&#039;&#039;&#039;) &amp;lt;math&amp;gt;\delta Q = 0&amp;lt;/math&amp;gt;, which gives &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = \delta W + \delta Q = -pdV + 0&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Furthermore, for any transformation of an ideal gas, it is always true that &amp;lt;math&amp;gt;dU = nC_v dT&amp;lt;/math&amp;gt;, giving&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = nC_v dT = -pdV &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the constant pressure (&#039;&#039;&#039;isobaric process&#039;&#039;&#039;) &amp;lt;math&amp;gt;\Delta p = 0&amp;lt;/math&amp;gt; we have &amp;lt;math&amp;gt;W = \int p dV = p \Delta V&amp;lt;/math&amp;gt;, and by applying the ideal gas law, we get &amp;lt;math&amp;gt;W = n R \Delta T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Real gas: Air ===&lt;br /&gt;
&lt;br /&gt;
Basic ideal gas model (good first approximation). Air is usually approximated as an ideal gas with:&lt;br /&gt;
* Gas constant:&lt;br /&gt;
** R≈287 J/(kg\cdotpK)&lt;br /&gt;
** R≈287J/(kg\cdotpK)&lt;br /&gt;
* Equation of state:&lt;br /&gt;
* p=ρRT&lt;br /&gt;
This works well at:&lt;br /&gt;
* pressures near atmospheric&lt;br /&gt;
* temperatures roughly 200–500 K&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“Generalized” ideal gas → temperature-dependent properties. To go beyond the simple model, you allow properties like heat capacity to vary with temperature:&lt;br /&gt;
&lt;br /&gt;
Heat capacity. For air, a common approximation is a polynomial&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
c_p(T)=a+bT. &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Typical coefficients (for dry air, ~200–1000 K range):&lt;br /&gt;
* a≈1005&lt;br /&gt;
* b≈0.1&lt;br /&gt;
More accurate forms come from NASA polynomials:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{c_p}R=a_1+a_2T+a_3T^2+a_4T^3+a_5T^4&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Which are widely used in CFD and thermodynamics.&lt;br /&gt;
&lt;br /&gt;
Compressibility factor Z (real gas correction). If you want a generalized ideal gas, you often introduce &amp;lt;math&amp;gt;p=Z\rho RT&amp;lt;/math&amp;gt;. Where&lt;br /&gt;
* Z=1 → ideal gas&lt;br /&gt;
* Z≠1 → real gas behavior&lt;br /&gt;
For air:&lt;br /&gt;
* At normal conditions:  Z≈1&lt;br /&gt;
* At high pressure: use virial expansion &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Z=1+\frac{B(T)}V+\frac{C(T)}{V^2}+ \cdots&lt;br /&gt;
\approx 1+ \frac{B(T)}{RT}p.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mixture-based formulation (more fundamental). Air is a mixture mainly of:&lt;br /&gt;
* N₂ (~78%)&lt;br /&gt;
* O₂ (~21%)&lt;br /&gt;
* Ar (~1%)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
R &amp;amp;=\sum_i y_i R_i \\&lt;br /&gt;
c_p &amp;amp; = \sum_i y_ i c_{p,i}(T)&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Realistic Diesel Cycle ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Cylinder.png| The size of the combustion chamber of MB W211. &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ratio of specific heats γ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ \sum y_1 c_{p,i} }{ \sum y_1 ( c_{p,i} -R_u ) }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Caption text&lt;br /&gt;
|-&lt;br /&gt;
! Condition	 !! γ (approx.)&lt;br /&gt;
|-&lt;br /&gt;
| Stoichiometric || ~1.30–1.33&lt;br /&gt;
|-&lt;br /&gt;
| Moderate lean || ~1.33–1.37&lt;br /&gt;
|-&lt;br /&gt;
| Very lean (diesel) || ~1.37–1.40&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Injection pressures ===&lt;br /&gt;
&lt;br /&gt;
* Older systems: 200–500 bar&lt;br /&gt;
* Modern common-rail: 1,000–2,500 bar&lt;br /&gt;
* Latest systems: up to ~3,000 bar&lt;br /&gt;
&lt;br /&gt;
* Air pressure in cylinder:  ~30–80 bar, which is the pressure of the combustion chamber.&lt;br /&gt;
* Temperature: ~700–1000 K&lt;br /&gt;
&lt;br /&gt;
=== Diesel-air Mixture ===&lt;br /&gt;
&lt;br /&gt;
Only diesel is ejected into the cylinder. Clean air comes in during the intake stroke.&lt;br /&gt;
&lt;br /&gt;
The heat capacity ratio (known as the adiabatic index) for a diesel-air mixture is typically around 1.4. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Air-fuel ratio &lt;br /&gt;
|-&lt;br /&gt;
| 14.5:1 || Near-stoichiometric; good combustion efficiency but higher emissions.&lt;br /&gt;
|-&lt;br /&gt;
| 16:1 || Balanced performance; good power output and efficiency.&lt;br /&gt;
|-&lt;br /&gt;
| 18:1 || Lean burn; improved fuel economy but potential for higher NOx emissions.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Diesel is a complicated compound, but it’s commonly approximated as a hydrocarbon like C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt; (or C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;26&amp;lt;/sub&amp;gt;). Air is about 21% O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; and 79% N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;. Without nitrogen, the stoichiometric ratio is about&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O&lt;br /&gt;
&lt;br /&gt;
and by including nitrogen, we get&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75( O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + 3.76 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; )​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O + 66.74 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The molar masses&lt;br /&gt;
* Fuel: 167 g/mol&lt;br /&gt;
* Air: 137.28 g/mol&lt;br /&gt;
And the total air needed is 17.72 x 137.28 = 2436 g, which gives air-to-fuel-ratio to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
AFR = \frac{2436}{167} = 14.6:1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MB data ===&lt;br /&gt;
&lt;br /&gt;
Motor: OM648.&lt;br /&gt;
&lt;br /&gt;
Mercedes Benz W211 (2003)&lt;br /&gt;
* Engine displacement: 3222 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 0.003222 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Bore x Stroke: 88.0 x 88.4 mm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Compression Ratio: 18.0&lt;br /&gt;
&lt;br /&gt;
Bore x stroke gives V = 6xπ(8.8/2)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; x 8.84 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 3225.95cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;, which is rather close.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
p_1 V_1^\gamma = \text{constant}_1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15621</id>
		<title>Diesel Cycle</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15621"/>
		<updated>2026-03-30T18:15:01Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Diesel Cycle and Ideal Gas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
DieselCycle pvDiagram simple.png|Diesel Cycle&lt;br /&gt;
DieselCycle.gif|Diesel Cycle&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ratio of specific heats (heat capacity ratio) is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ C_p }{ C_v }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pV diagram ===&lt;br /&gt;
&lt;br /&gt;
# Isentropic (adiabatic) expansion&lt;br /&gt;
# Isochoric cooling (Qout): Heat rejection. Power stroke ends, heat rejection starts.&lt;br /&gt;
# Isobaric compression: Exhaust&lt;br /&gt;
# Isobaric expansion: Intake&lt;br /&gt;
# Isentropic (adiabatic) compression&lt;br /&gt;
# Isobaric heating (Qin):  Combustion of fuel (heat is added in a constant pressure;)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Engine displacement&#039;&#039;&#039; is the cylinder volume swept by all of the pistons of a piston engine, excluding the combustion chambers. A &#039;&#039;&#039;combustion chamber&#039;&#039;&#039; is part of an internal combustion engine in which the fuel/air mix is burned.&lt;br /&gt;
&lt;br /&gt;
Only air is compressed, and then diesel fuel is injected directly into that hot, high-pressure air.&lt;br /&gt;
* Cylinder pressure: ~30–80 bar&lt;br /&gt;
* Injection pressure: ~1,000–2,500+ bar&lt;br /&gt;
&lt;br /&gt;
=== Diesel Cycle and Ideal Gas ===&lt;br /&gt;
&lt;br /&gt;
There are three (3) different processes:&lt;br /&gt;
# Isentropic &amp;lt;math&amp;gt;dU = nC_v dT = -pdV&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isobaric &amp;lt;math&amp;gt;Q = \Delta U + \int p dV&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isochoric &amp;lt;math&amp;gt;\Delta Q = m c_v \Delta T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For a closed system, the total change in energy of a system is the sum of the work done and the heat added &amp;lt;math&amp;gt;dU = \delta W + \delta Q&amp;lt;/math&amp;gt;, and the reversible work done on a system by changing the volume is &amp;lt;math&amp;gt;\delta W = - p dV&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the system is reversible and adiabatic (&#039;&#039;&#039;isentropic&#039;&#039;&#039;) &amp;lt;math&amp;gt;\delta Q = 0&amp;lt;/math&amp;gt;, which gives &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = \delta W + \delta Q = -pdV + 0&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Furthermore, for any transformation of an ideal gas, it is always true that &amp;lt;math&amp;gt;dU = nC_v dT&amp;lt;/math&amp;gt;, giving&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = nC_v dT = -pdV &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the constant pressure (&#039;&#039;&#039;isobaric process&#039;&#039;&#039;) &amp;lt;math&amp;gt;\Delta p = 0&amp;lt;/math&amp;gt; we have &amp;lt;math&amp;gt;W = \int p dV = p \Delta V&amp;lt;/math&amp;gt;, and by applying the ideal gas law, we get &amp;lt;math&amp;gt;W = n R \Delta T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Real gas: Air ===&lt;br /&gt;
&lt;br /&gt;
Basic ideal gas model (good first approximation). Air is usually approximated as an ideal gas with:&lt;br /&gt;
* Gas constant:&lt;br /&gt;
** R≈287 J/(kg\cdotpK)&lt;br /&gt;
** R≈287J/(kg\cdotpK)&lt;br /&gt;
* Equation of state:&lt;br /&gt;
* p=ρRT&lt;br /&gt;
This works well at:&lt;br /&gt;
* pressures near atmospheric&lt;br /&gt;
* temperatures roughly 200–500 K&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“Generalized” ideal gas → temperature-dependent properties. To go beyond the simple model, you allow properties like heat capacity to vary with temperature:&lt;br /&gt;
&lt;br /&gt;
Heat capacity. For air, a common approximation is a polynomial&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
c_p(T)=a+bT. &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Typical coefficients (for dry air, ~200–1000 K range):&lt;br /&gt;
* a≈1005&lt;br /&gt;
* b≈0.1&lt;br /&gt;
More accurate forms come from NASA polynomials:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{c_p}R=a_1+a_2T+a_3T^2+a_4T^3+a_5T^4&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Which are widely used in CFD and thermodynamics.&lt;br /&gt;
&lt;br /&gt;
Compressibility factor Z (real gas correction). If you want a generalized ideal gas, you often introduce &amp;lt;math&amp;gt;p=Z\rho RT&amp;lt;/math&amp;gt;. Where&lt;br /&gt;
* Z=1 → ideal gas&lt;br /&gt;
* Z≠1 → real gas behavior&lt;br /&gt;
For air:&lt;br /&gt;
* At normal conditions:  Z≈1&lt;br /&gt;
* At high pressure: use virial expansion &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Z=1+\frac{B(T)}V+\frac{C(T)}{V^2}+ \cdots&lt;br /&gt;
\approx 1+ \frac{B(T)}{RT}p.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mixture-based formulation (more fundamental). Air is a mixture mainly of:&lt;br /&gt;
* N₂ (~78%)&lt;br /&gt;
* O₂ (~21%)&lt;br /&gt;
* Ar (~1%)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
R &amp;amp;=\sum_i y_i R_i \\&lt;br /&gt;
c_p &amp;amp; = \sum_i y_ i c_{p,i}(T)&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Realistic Diesel Cycle ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Cylinder.png| The size of the combustion chamber of MB W211. &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ratio of specific heats γ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ \sum y_1 c_{p,i} }{ \sum y_1 ( c_{p,i} -R_u ) }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Caption text&lt;br /&gt;
|-&lt;br /&gt;
! Condition	 !! γ (approx.)&lt;br /&gt;
|-&lt;br /&gt;
| Stoichiometric || ~1.30–1.33&lt;br /&gt;
|-&lt;br /&gt;
| Moderate lean || ~1.33–1.37&lt;br /&gt;
|-&lt;br /&gt;
| Very lean (diesel) || ~1.37–1.40&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Injection pressures ===&lt;br /&gt;
&lt;br /&gt;
* Older systems: 200–500 bar&lt;br /&gt;
* Modern common-rail: 1,000–2,500 bar&lt;br /&gt;
* Latest systems: up to ~3,000 bar&lt;br /&gt;
&lt;br /&gt;
* Air pressure in cylinder:  ~30–80 bar, which is the pressure of the combustion chamber.&lt;br /&gt;
* Temperature: ~700–1000 K&lt;br /&gt;
&lt;br /&gt;
=== Diesel-air Mixture ===&lt;br /&gt;
&lt;br /&gt;
Only diesel is ejected into the cylinder. Clean air comes in during the intake stroke.&lt;br /&gt;
&lt;br /&gt;
The heat capacity ratio (known as the adiabatic index) for a diesel-air mixture is typically around 1.4. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Air-fuel ratio &lt;br /&gt;
|-&lt;br /&gt;
| 14.5:1 || Near-stoichiometric; good combustion efficiency but higher emissions.&lt;br /&gt;
|-&lt;br /&gt;
| 16:1 || Balanced performance; good power output and efficiency.&lt;br /&gt;
|-&lt;br /&gt;
| 18:1 || Lean burn; improved fuel economy but potential for higher NOx emissions.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Diesel is a complicated compound, but it’s commonly approximated as a hydrocarbon like C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt; (or C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;26&amp;lt;/sub&amp;gt;). Air is about 21% O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; and 79% N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;. Without nitrogen, the stoichiometric ratio is about&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O&lt;br /&gt;
&lt;br /&gt;
and by including nitrogen, we get&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75( O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + 3.76 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; )​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O + 66.74 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The molar masses&lt;br /&gt;
* Fuel: 167 g/mol&lt;br /&gt;
* Air: 137.28 g/mol&lt;br /&gt;
And the total air needed is 17.72 x 137.28 = 2436 g, which gives air-to-fuel-ratio to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
AFR = \frac{2436}{167} = 14.6:1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MB data ===&lt;br /&gt;
&lt;br /&gt;
Motor: OM648.&lt;br /&gt;
&lt;br /&gt;
Mercedes Benz W211 (2003)&lt;br /&gt;
* Engine displacement: 3222 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 0.003222 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Bore x Stroke: 88.0 x 88.4 mm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Compression Ratio: 18.0&lt;br /&gt;
&lt;br /&gt;
Bore x stroke gives V = 6xπ(8.8/2)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; x 8.84 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 3225.95cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;, which is rather close.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
p_1 V_1^\gamma = \text{constant}_1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15620</id>
		<title>Diesel Cycle</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15620"/>
		<updated>2026-03-30T18:06:20Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Diesel Cycle and Ideal Gas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
DieselCycle pvDiagram simple.png|Diesel Cycle&lt;br /&gt;
DieselCycle.gif|Diesel Cycle&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ratio of specific heats (heat capacity ratio) is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ C_p }{ C_v }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pV diagram ===&lt;br /&gt;
&lt;br /&gt;
# Isentropic (adiabatic) expansion&lt;br /&gt;
# Isochoric cooling (Qout): Heat rejection. Power stroke ends, heat rejection starts.&lt;br /&gt;
# Isobaric compression: Exhaust&lt;br /&gt;
# Isobaric expansion: Intake&lt;br /&gt;
# Isentropic (adiabatic) compression&lt;br /&gt;
# Isobaric heating (Qin):  Combustion of fuel (heat is added in a constant pressure;)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Engine displacement&#039;&#039;&#039; is the cylinder volume swept by all of the pistons of a piston engine, excluding the combustion chambers. A &#039;&#039;&#039;combustion chamber&#039;&#039;&#039; is part of an internal combustion engine in which the fuel/air mix is burned.&lt;br /&gt;
&lt;br /&gt;
Only air is compressed, and then diesel fuel is injected directly into that hot, high-pressure air.&lt;br /&gt;
* Cylinder pressure: ~30–80 bar&lt;br /&gt;
* Injection pressure: ~1,000–2,500+ bar&lt;br /&gt;
&lt;br /&gt;
=== Diesel Cycle and Ideal Gas ===&lt;br /&gt;
&lt;br /&gt;
There are three (3) different processes:&lt;br /&gt;
# Isentropic &amp;lt;math&amp;gt;dU = nC_v dT = -pdV&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isobaric &amp;lt;math&amp;gt;Q = \Delta U + \int p dV&amp;lt;/math&amp;gt;&lt;br /&gt;
# Isochoric &amp;lt;math&amp;gt;\Delta Q = m c_v \Delta T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For a closed system, the total change in energy of a system is the sum of the work done and the heat added &amp;lt;math&amp;gt;dU = \delta W + \delta Q&amp;lt;/math&amp;gt;, and the reversible work done on a system by changing the volume is &amp;lt;math&amp;gt;\delta W = - p dV&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the system is reversible and adiabatic (&#039;&#039;&#039;isentropic&#039;&#039;&#039;) &amp;lt;math&amp;gt;\delta Q = 0&amp;lt;/math&amp;gt;, which gives &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = \delta W + \delta Q = -pdV + 0&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Furthermore, for any transformation of an ideal gas, it is always true that &amp;lt;math&amp;gt;dU = nC_v dT&amp;lt;/math&amp;gt;, giving&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = nC_v dT = -pdV &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the constant pressure (&#039;&#039;&#039;isobaric process&#039;&#039;&#039;) &amp;lt;math&amp;gt;\Delta p = 0&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Real gas: Air ===&lt;br /&gt;
&lt;br /&gt;
Basic ideal gas model (good first approximation). Air is usually approximated as an ideal gas with:&lt;br /&gt;
* Gas constant:&lt;br /&gt;
** R≈287 J/(kg\cdotpK)&lt;br /&gt;
** R≈287J/(kg\cdotpK)&lt;br /&gt;
* Equation of state:&lt;br /&gt;
* p=ρRT&lt;br /&gt;
This works well at:&lt;br /&gt;
* pressures near atmospheric&lt;br /&gt;
* temperatures roughly 200–500 K&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“Generalized” ideal gas → temperature-dependent properties. To go beyond the simple model, you allow properties like heat capacity to vary with temperature:&lt;br /&gt;
&lt;br /&gt;
Heat capacity. For air, a common approximation is a polynomial&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
c_p(T)=a+bT. &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Typical coefficients (for dry air, ~200–1000 K range):&lt;br /&gt;
* a≈1005&lt;br /&gt;
* b≈0.1&lt;br /&gt;
More accurate forms come from NASA polynomials:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{c_p}R=a_1+a_2T+a_3T^2+a_4T^3+a_5T^4&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Which are widely used in CFD and thermodynamics.&lt;br /&gt;
&lt;br /&gt;
Compressibility factor Z (real gas correction). If you want a generalized ideal gas, you often introduce &amp;lt;math&amp;gt;p=Z\rho RT&amp;lt;/math&amp;gt;. Where&lt;br /&gt;
* Z=1 → ideal gas&lt;br /&gt;
* Z≠1 → real gas behavior&lt;br /&gt;
For air:&lt;br /&gt;
* At normal conditions:  Z≈1&lt;br /&gt;
* At high pressure: use virial expansion &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Z=1+\frac{B(T)}V+\frac{C(T)}{V^2}+ \cdots&lt;br /&gt;
\approx 1+ \frac{B(T)}{RT}p.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mixture-based formulation (more fundamental). Air is a mixture mainly of:&lt;br /&gt;
* N₂ (~78%)&lt;br /&gt;
* O₂ (~21%)&lt;br /&gt;
* Ar (~1%)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
R &amp;amp;=\sum_i y_i R_i \\&lt;br /&gt;
c_p &amp;amp; = \sum_i y_ i c_{p,i}(T)&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Realistic Diesel Cycle ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Cylinder.png| The size of the combustion chamber of MB W211. &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ratio of specific heats γ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ \sum y_1 c_{p,i} }{ \sum y_1 ( c_{p,i} -R_u ) }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Caption text&lt;br /&gt;
|-&lt;br /&gt;
! Condition	 !! γ (approx.)&lt;br /&gt;
|-&lt;br /&gt;
| Stoichiometric || ~1.30–1.33&lt;br /&gt;
|-&lt;br /&gt;
| Moderate lean || ~1.33–1.37&lt;br /&gt;
|-&lt;br /&gt;
| Very lean (diesel) || ~1.37–1.40&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Injection pressures ===&lt;br /&gt;
&lt;br /&gt;
* Older systems: 200–500 bar&lt;br /&gt;
* Modern common-rail: 1,000–2,500 bar&lt;br /&gt;
* Latest systems: up to ~3,000 bar&lt;br /&gt;
&lt;br /&gt;
* Air pressure in cylinder:  ~30–80 bar, which is the pressure of the combustion chamber.&lt;br /&gt;
* Temperature: ~700–1000 K&lt;br /&gt;
&lt;br /&gt;
=== Diesel-air Mixture ===&lt;br /&gt;
&lt;br /&gt;
Only diesel is ejected into the cylinder. Clean air comes in during the intake stroke.&lt;br /&gt;
&lt;br /&gt;
The heat capacity ratio (known as the adiabatic index) for a diesel-air mixture is typically around 1.4. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Air-fuel ratio &lt;br /&gt;
|-&lt;br /&gt;
| 14.5:1 || Near-stoichiometric; good combustion efficiency but higher emissions.&lt;br /&gt;
|-&lt;br /&gt;
| 16:1 || Balanced performance; good power output and efficiency.&lt;br /&gt;
|-&lt;br /&gt;
| 18:1 || Lean burn; improved fuel economy but potential for higher NOx emissions.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Diesel is a complicated compound, but it’s commonly approximated as a hydrocarbon like C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt; (or C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;26&amp;lt;/sub&amp;gt;). Air is about 21% O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; and 79% N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;. Without nitrogen, the stoichiometric ratio is about&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O&lt;br /&gt;
&lt;br /&gt;
and by including nitrogen, we get&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75( O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + 3.76 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; )​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O + 66.74 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The molar masses&lt;br /&gt;
* Fuel: 167 g/mol&lt;br /&gt;
* Air: 137.28 g/mol&lt;br /&gt;
And the total air needed is 17.72 x 137.28 = 2436 g, which gives air-to-fuel-ratio to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
AFR = \frac{2436}{167} = 14.6:1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MB data ===&lt;br /&gt;
&lt;br /&gt;
Motor: OM648.&lt;br /&gt;
&lt;br /&gt;
Mercedes Benz W211 (2003)&lt;br /&gt;
* Engine displacement: 3222 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 0.003222 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Bore x Stroke: 88.0 x 88.4 mm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Compression Ratio: 18.0&lt;br /&gt;
&lt;br /&gt;
Bore x stroke gives V = 6xπ(8.8/2)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; x 8.84 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 3225.95cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;, which is rather close.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
p_1 V_1^\gamma = \text{constant}_1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15619</id>
		<title>Diesel Cycle</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15619"/>
		<updated>2026-03-30T17:59:36Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Real gas: Air */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
DieselCycle pvDiagram simple.png|Diesel Cycle&lt;br /&gt;
DieselCycle.gif|Diesel Cycle&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ratio of specific heats (heat capacity ratio) is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ C_p }{ C_v }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pV diagram ===&lt;br /&gt;
&lt;br /&gt;
# Isentropic (adiabatic) expansion&lt;br /&gt;
# Isochoric cooling (Qout): Heat rejection. Power stroke ends, heat rejection starts.&lt;br /&gt;
# Isobaric compression: Exhaust&lt;br /&gt;
# Isobaric expansion: Intake&lt;br /&gt;
# Isentropic (adiabatic) compression&lt;br /&gt;
# Isobaric heating (Qin):  Combustion of fuel (heat is added in a constant pressure;)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Engine displacement&#039;&#039;&#039; is the cylinder volume swept by all of the pistons of a piston engine, excluding the combustion chambers. A &#039;&#039;&#039;combustion chamber&#039;&#039;&#039; is part of an internal combustion engine in which the fuel/air mix is burned.&lt;br /&gt;
&lt;br /&gt;
Only air is compressed, and then diesel fuel is injected directly into that hot, high-pressure air.&lt;br /&gt;
* Cylinder pressure: ~30–80 bar&lt;br /&gt;
* Injection pressure: ~1,000–2,500+ bar&lt;br /&gt;
&lt;br /&gt;
=== Diesel Cycle and Ideal Gas ===&lt;br /&gt;
&lt;br /&gt;
For a closed system, the total change in energy of a system is the sum of the work done and the heat added &amp;lt;math&amp;gt;dU = \delta W + \delta Q&amp;lt;/math&amp;gt;, and the reversible work done on a system by changing the volume is &amp;lt;math&amp;gt;\delta W = - p dV&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the system is reversible and adiabatic (isentropic) &amp;lt;math&amp;gt;\delta Q = 0&amp;lt;/math&amp;gt;, which gives &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = \delta W + \delta Q = -pdV + 0&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Furthermore, for any transformation of an ideal gas, it is always true that &amp;lt;math&amp;gt;dU = nC_v dT&amp;lt;/math&amp;gt;, giving&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = nC_v dT =  -pdV &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Real gas: Air ===&lt;br /&gt;
&lt;br /&gt;
Basic ideal gas model (good first approximation). Air is usually approximated as an ideal gas with:&lt;br /&gt;
* Gas constant:&lt;br /&gt;
** R≈287 J/(kg\cdotpK)&lt;br /&gt;
** R≈287J/(kg\cdotpK)&lt;br /&gt;
* Equation of state:&lt;br /&gt;
* p=ρRT&lt;br /&gt;
This works well at:&lt;br /&gt;
* pressures near atmospheric&lt;br /&gt;
* temperatures roughly 200–500 K&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“Generalized” ideal gas → temperature-dependent properties. To go beyond the simple model, you allow properties like heat capacity to vary with temperature:&lt;br /&gt;
&lt;br /&gt;
Heat capacity. For air, a common approximation is a polynomial&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
c_p(T)=a+bT. &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Typical coefficients (for dry air, ~200–1000 K range):&lt;br /&gt;
* a≈1005&lt;br /&gt;
* b≈0.1&lt;br /&gt;
More accurate forms come from NASA polynomials:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{c_p}R=a_1+a_2T+a_3T^2+a_4T^3+a_5T^4&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Which are widely used in CFD and thermodynamics.&lt;br /&gt;
&lt;br /&gt;
Compressibility factor Z (real gas correction). If you want a generalized ideal gas, you often introduce &amp;lt;math&amp;gt;p=Z\rho RT&amp;lt;/math&amp;gt;. Where&lt;br /&gt;
* Z=1 → ideal gas&lt;br /&gt;
* Z≠1 → real gas behavior&lt;br /&gt;
For air:&lt;br /&gt;
* At normal conditions:  Z≈1&lt;br /&gt;
* At high pressure: use virial expansion &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Z=1+\frac{B(T)}V+\frac{C(T)}{V^2}+ \cdots&lt;br /&gt;
\approx 1+ \frac{B(T)}{RT}p.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mixture-based formulation (more fundamental). Air is a mixture mainly of:&lt;br /&gt;
* N₂ (~78%)&lt;br /&gt;
* O₂ (~21%)&lt;br /&gt;
* Ar (~1%)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
R &amp;amp;=\sum_i y_i R_i \\&lt;br /&gt;
c_p &amp;amp; = \sum_i y_ i c_{p,i}(T)&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Realistic Diesel Cycle ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Cylinder.png| The size of the combustion chamber of MB W211. &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ratio of specific heats γ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ \sum y_1 c_{p,i} }{ \sum y_1 ( c_{p,i} -R_u ) }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Caption text&lt;br /&gt;
|-&lt;br /&gt;
! Condition	 !! γ (approx.)&lt;br /&gt;
|-&lt;br /&gt;
| Stoichiometric || ~1.30–1.33&lt;br /&gt;
|-&lt;br /&gt;
| Moderate lean || ~1.33–1.37&lt;br /&gt;
|-&lt;br /&gt;
| Very lean (diesel) || ~1.37–1.40&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Injection pressures ===&lt;br /&gt;
&lt;br /&gt;
* Older systems: 200–500 bar&lt;br /&gt;
* Modern common-rail: 1,000–2,500 bar&lt;br /&gt;
* Latest systems: up to ~3,000 bar&lt;br /&gt;
&lt;br /&gt;
* Air pressure in cylinder:  ~30–80 bar, which is the pressure of the combustion chamber.&lt;br /&gt;
* Temperature: ~700–1000 K&lt;br /&gt;
&lt;br /&gt;
=== Diesel-air Mixture ===&lt;br /&gt;
&lt;br /&gt;
Only diesel is ejected into the cylinder. Clean air comes in during the intake stroke.&lt;br /&gt;
&lt;br /&gt;
The heat capacity ratio (known as the adiabatic index) for a diesel-air mixture is typically around 1.4. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Air-fuel ratio &lt;br /&gt;
|-&lt;br /&gt;
| 14.5:1 || Near-stoichiometric; good combustion efficiency but higher emissions.&lt;br /&gt;
|-&lt;br /&gt;
| 16:1 || Balanced performance; good power output and efficiency.&lt;br /&gt;
|-&lt;br /&gt;
| 18:1 || Lean burn; improved fuel economy but potential for higher NOx emissions.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Diesel is a complicated compound, but it’s commonly approximated as a hydrocarbon like C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt; (or C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;26&amp;lt;/sub&amp;gt;). Air is about 21% O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; and 79% N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;. Without nitrogen, the stoichiometric ratio is about&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O&lt;br /&gt;
&lt;br /&gt;
and by including nitrogen, we get&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75( O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + 3.76 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; )​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O + 66.74 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The molar masses&lt;br /&gt;
* Fuel: 167 g/mol&lt;br /&gt;
* Air: 137.28 g/mol&lt;br /&gt;
And the total air needed is 17.72 x 137.28 = 2436 g, which gives air-to-fuel-ratio to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
AFR = \frac{2436}{167} = 14.6:1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MB data ===&lt;br /&gt;
&lt;br /&gt;
Motor: OM648.&lt;br /&gt;
&lt;br /&gt;
Mercedes Benz W211 (2003)&lt;br /&gt;
* Engine displacement: 3222 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 0.003222 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Bore x Stroke: 88.0 x 88.4 mm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Compression Ratio: 18.0&lt;br /&gt;
&lt;br /&gt;
Bore x stroke gives V = 6xπ(8.8/2)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; x 8.84 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 3225.95cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;, which is rather close.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
p_1 V_1^\gamma = \text{constant}_1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15618</id>
		<title>Diesel Cycle</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15618"/>
		<updated>2026-03-30T17:58:55Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Real gas: Air */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
DieselCycle pvDiagram simple.png|Diesel Cycle&lt;br /&gt;
DieselCycle.gif|Diesel Cycle&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ratio of specific heats (heat capacity ratio) is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ C_p }{ C_v }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pV diagram ===&lt;br /&gt;
&lt;br /&gt;
# Isentropic (adiabatic) expansion&lt;br /&gt;
# Isochoric cooling (Qout): Heat rejection. Power stroke ends, heat rejection starts.&lt;br /&gt;
# Isobaric compression: Exhaust&lt;br /&gt;
# Isobaric expansion: Intake&lt;br /&gt;
# Isentropic (adiabatic) compression&lt;br /&gt;
# Isobaric heating (Qin):  Combustion of fuel (heat is added in a constant pressure;)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Engine displacement&#039;&#039;&#039; is the cylinder volume swept by all of the pistons of a piston engine, excluding the combustion chambers. A &#039;&#039;&#039;combustion chamber&#039;&#039;&#039; is part of an internal combustion engine in which the fuel/air mix is burned.&lt;br /&gt;
&lt;br /&gt;
Only air is compressed, and then diesel fuel is injected directly into that hot, high-pressure air.&lt;br /&gt;
* Cylinder pressure: ~30–80 bar&lt;br /&gt;
* Injection pressure: ~1,000–2,500+ bar&lt;br /&gt;
&lt;br /&gt;
=== Diesel Cycle and Ideal Gas ===&lt;br /&gt;
&lt;br /&gt;
For a closed system, the total change in energy of a system is the sum of the work done and the heat added &amp;lt;math&amp;gt;dU = \delta W + \delta Q&amp;lt;/math&amp;gt;, and the reversible work done on a system by changing the volume is &amp;lt;math&amp;gt;\delta W = - p dV&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the system is reversible and adiabatic (isentropic) &amp;lt;math&amp;gt;\delta Q = 0&amp;lt;/math&amp;gt;, which gives &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = \delta W + \delta Q = -pdV + 0&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Furthermore, for any transformation of an ideal gas, it is always true that &amp;lt;math&amp;gt;dU = nC_v dT&amp;lt;/math&amp;gt;, giving&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = nC_v dT =  -pdV &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Real gas: Air ===&lt;br /&gt;
&lt;br /&gt;
Basic ideal gas model (good first approximation). Air is usually approximated as an ideal gas with:&lt;br /&gt;
* Gas constant:&lt;br /&gt;
** R≈287 J/(kg\cdotpK)&lt;br /&gt;
** R≈287J/(kg\cdotpK)&lt;br /&gt;
* Equation of state:&lt;br /&gt;
* p=ρRT&lt;br /&gt;
This works well at:&lt;br /&gt;
* pressures near atmospheric&lt;br /&gt;
* temperatures roughly 200–500 K&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“Generalized” ideal gas → temperature-dependent properties. To go beyond the simple model, you allow properties like heat capacity to vary with temperature:&lt;br /&gt;
&lt;br /&gt;
Heat capacity. For air, a common approximation is a polynomial&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
c_p(T)=a+bT. &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Typical coefficients (for dry air, ~200–1000 K range):&lt;br /&gt;
* a≈1005&lt;br /&gt;
* b≈0.1&lt;br /&gt;
More accurate forms come from NASA polynomials:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{c_p}R=a_1+a_2T+a_3T^2+a_4T^3+a_5T^4&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Which are widely used in CFD and thermodynamics.&lt;br /&gt;
&lt;br /&gt;
 Compressibility factor Z (real gas correction). If you want a generalized ideal gas, you often introduce &amp;lt;math&amp;gt;p=Z\rho RT&amp;lt;/math&amp;gt;. Where&lt;br /&gt;
* Z=1 → ideal gas&lt;br /&gt;
* Z≠1 → real gas behavior&lt;br /&gt;
For air:&lt;br /&gt;
* At normal conditions:  Z≈1&lt;br /&gt;
* At high pressure: use virial expansion &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Z=1+\frac{B(T)}V+\frac{C(T)}{V^2}+ \cdots&lt;br /&gt;
\approx 1+ \frac{B(T)}{RT}p &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
	​&lt;br /&gt;
Mixture-based formulation (more fundamental). Air is a mixture mainly of:&lt;br /&gt;
* N₂ (~78%)&lt;br /&gt;
* O₂ (~21%)&lt;br /&gt;
* Ar (~1%)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
R &amp;amp;=\sum_i y_i R_i \\&lt;br /&gt;
c_p &amp;amp; = \sum_i y_ i c_{p,i}(T)&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Realistic Diesel Cycle ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Cylinder.png| The size of the combustion chamber of MB W211. &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ratio of specific heats γ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ \sum y_1 c_{p,i} }{ \sum y_1 ( c_{p,i} -R_u ) }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Caption text&lt;br /&gt;
|-&lt;br /&gt;
! Condition	 !! γ (approx.)&lt;br /&gt;
|-&lt;br /&gt;
| Stoichiometric || ~1.30–1.33&lt;br /&gt;
|-&lt;br /&gt;
| Moderate lean || ~1.33–1.37&lt;br /&gt;
|-&lt;br /&gt;
| Very lean (diesel) || ~1.37–1.40&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Injection pressures ===&lt;br /&gt;
&lt;br /&gt;
* Older systems: 200–500 bar&lt;br /&gt;
* Modern common-rail: 1,000–2,500 bar&lt;br /&gt;
* Latest systems: up to ~3,000 bar&lt;br /&gt;
&lt;br /&gt;
* Air pressure in cylinder:  ~30–80 bar, which is the pressure of the combustion chamber.&lt;br /&gt;
* Temperature: ~700–1000 K&lt;br /&gt;
&lt;br /&gt;
=== Diesel-air Mixture ===&lt;br /&gt;
&lt;br /&gt;
Only diesel is ejected into the cylinder. Clean air comes in during the intake stroke.&lt;br /&gt;
&lt;br /&gt;
The heat capacity ratio (known as the adiabatic index) for a diesel-air mixture is typically around 1.4. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Air-fuel ratio &lt;br /&gt;
|-&lt;br /&gt;
| 14.5:1 || Near-stoichiometric; good combustion efficiency but higher emissions.&lt;br /&gt;
|-&lt;br /&gt;
| 16:1 || Balanced performance; good power output and efficiency.&lt;br /&gt;
|-&lt;br /&gt;
| 18:1 || Lean burn; improved fuel economy but potential for higher NOx emissions.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Diesel is a complicated compound, but it’s commonly approximated as a hydrocarbon like C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt; (or C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;26&amp;lt;/sub&amp;gt;). Air is about 21% O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; and 79% N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;. Without nitrogen, the stoichiometric ratio is about&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O&lt;br /&gt;
&lt;br /&gt;
and by including nitrogen, we get&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75( O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + 3.76 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; )​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O + 66.74 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The molar masses&lt;br /&gt;
* Fuel: 167 g/mol&lt;br /&gt;
* Air: 137.28 g/mol&lt;br /&gt;
And the total air needed is 17.72 x 137.28 = 2436 g, which gives air-to-fuel-ratio to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
AFR = \frac{2436}{167} = 14.6:1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MB data ===&lt;br /&gt;
&lt;br /&gt;
Motor: OM648.&lt;br /&gt;
&lt;br /&gt;
Mercedes Benz W211 (2003)&lt;br /&gt;
* Engine displacement: 3222 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 0.003222 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Bore x Stroke: 88.0 x 88.4 mm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Compression Ratio: 18.0&lt;br /&gt;
&lt;br /&gt;
Bore x stroke gives V = 6xπ(8.8/2)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; x 8.84 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 3225.95cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;, which is rather close.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
p_1 V_1^\gamma = \text{constant}_1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
	<entry>
		<id>https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15617</id>
		<title>Diesel Cycle</title>
		<link rel="alternate" type="text/html" href="https://wiki.luntti.net/index.php?title=Diesel_Cycle&amp;diff=15617"/>
		<updated>2026-03-30T17:58:29Z</updated>

		<summary type="html">&lt;p&gt;Mol: /* Real gas: Air */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
DieselCycle pvDiagram simple.png|Diesel Cycle&lt;br /&gt;
DieselCycle.gif|Diesel Cycle&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ratio of specific heats (heat capacity ratio) is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ C_p }{ C_v }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pV diagram ===&lt;br /&gt;
&lt;br /&gt;
# Isentropic (adiabatic) expansion&lt;br /&gt;
# Isochoric cooling (Qout): Heat rejection. Power stroke ends, heat rejection starts.&lt;br /&gt;
# Isobaric compression: Exhaust&lt;br /&gt;
# Isobaric expansion: Intake&lt;br /&gt;
# Isentropic (adiabatic) compression&lt;br /&gt;
# Isobaric heating (Qin):  Combustion of fuel (heat is added in a constant pressure;)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Engine displacement&#039;&#039;&#039; is the cylinder volume swept by all of the pistons of a piston engine, excluding the combustion chambers. A &#039;&#039;&#039;combustion chamber&#039;&#039;&#039; is part of an internal combustion engine in which the fuel/air mix is burned.&lt;br /&gt;
&lt;br /&gt;
Only air is compressed, and then diesel fuel is injected directly into that hot, high-pressure air.&lt;br /&gt;
* Cylinder pressure: ~30–80 bar&lt;br /&gt;
* Injection pressure: ~1,000–2,500+ bar&lt;br /&gt;
&lt;br /&gt;
=== Diesel Cycle and Ideal Gas ===&lt;br /&gt;
&lt;br /&gt;
For a closed system, the total change in energy of a system is the sum of the work done and the heat added &amp;lt;math&amp;gt;dU = \delta W + \delta Q&amp;lt;/math&amp;gt;, and the reversible work done on a system by changing the volume is &amp;lt;math&amp;gt;\delta W = - p dV&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the system is reversible and adiabatic (isentropic) &amp;lt;math&amp;gt;\delta Q = 0&amp;lt;/math&amp;gt;, which gives &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = \delta W + \delta Q = -pdV + 0&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Furthermore, for any transformation of an ideal gas, it is always true that &amp;lt;math&amp;gt;dU = nC_v dT&amp;lt;/math&amp;gt;, giving&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
dU = nC_v dT =  -pdV &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Real gas: Air ===&lt;br /&gt;
&lt;br /&gt;
Basic ideal gas model (good first approximation). Air is usually approximated as an ideal gas with:&lt;br /&gt;
* Gas constant:&lt;br /&gt;
** R≈287 J/(kg\cdotpK)&lt;br /&gt;
** R≈287J/(kg\cdotpK)&lt;br /&gt;
* Equation of state:&lt;br /&gt;
* p=ρRT&lt;br /&gt;
This works well at:&lt;br /&gt;
* pressures near atmospheric&lt;br /&gt;
* temperatures roughly 200–500 K&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“Generalized” ideal gas → temperature-dependent properties. To go beyond the simple model, you allow properties like heat capacity to vary with temperature:&lt;br /&gt;
&lt;br /&gt;
Heat capacity. For air, a common approximation is a polynomial&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
c_p(T)=a+bT. &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Typical coefficients (for dry air, ~200–1000 K range):&lt;br /&gt;
* a≈1005&lt;br /&gt;
* b≈0.1&lt;br /&gt;
More accurate forms come from NASA polynomials:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{c_p}R=a_1+a_2T+a_3T^2+a_4T^3+a_5T^4&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Which are widely used in CFD and thermodynamics.&lt;br /&gt;
&lt;br /&gt;
 Compressibility factor Z (real gas correction). If you want a generalized ideal gas, you often introduce &amp;lt;math&amp;gt;p=Z\rho RT&amp;lt;/math&amp;gt;. Where&lt;br /&gt;
* Z=1 → ideal gas&lt;br /&gt;
* Z≠1 → real gas behavior&lt;br /&gt;
For air:&lt;br /&gt;
* At normal conditions:  Z≈1&lt;br /&gt;
* At high pressure: use virial expansion &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Z=1+\frac{B(T)}V+\frac{C(T)}{V^2}+ \cdots&lt;br /&gt;
\approx 1+ \frac{B(T)}{RT}p &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
	​&lt;br /&gt;
Mixture-based formulation (more fundamental). Air is a mixture mainly of:&lt;br /&gt;
* N₂ (~78%)&lt;br /&gt;
* O₂ (~21%)&lt;br /&gt;
* Ar (~1%)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align*}&lt;br /&gt;
R &amp;amp;=\sum_i y_i R_i \\&lt;br /&gt;
c_p &amp;amp; = \sum_i y_ i c_{p,i}(T)&lt;br /&gt;
\end{align*}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Realistic Diesel Cycle ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Cylinder.png| The size of the combustion chamber of MB W211. &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ratio of specific heats γ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\gamma = \frac{ \sum y_1 c_{p,i} }{ \sum y_1 ( c_{p,i} -R_u ) }&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Caption text&lt;br /&gt;
|-&lt;br /&gt;
! Condition	 !! γ (approx.)&lt;br /&gt;
|-&lt;br /&gt;
| Stoichiometric || ~1.30–1.33&lt;br /&gt;
|-&lt;br /&gt;
| Moderate lean || ~1.33–1.37&lt;br /&gt;
|-&lt;br /&gt;
| Very lean (diesel) || ~1.37–1.40&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Injection pressures ===&lt;br /&gt;
&lt;br /&gt;
* Older systems: 200–500 bar&lt;br /&gt;
* Modern common-rail: 1,000–2,500 bar&lt;br /&gt;
* Latest systems: up to ~3,000 bar&lt;br /&gt;
&lt;br /&gt;
* Air pressure in cylinder:  ~30–80 bar, which is the pressure of the combustion chamber.&lt;br /&gt;
* Temperature: ~700–1000 K&lt;br /&gt;
&lt;br /&gt;
=== Diesel-air Mixture ===&lt;br /&gt;
&lt;br /&gt;
Only diesel is ejected into the cylinder. Clean air comes in during the intake stroke.&lt;br /&gt;
&lt;br /&gt;
The heat capacity ratio (known as the adiabatic index) for a diesel-air mixture is typically around 1.4. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Air-fuel ratio &lt;br /&gt;
|-&lt;br /&gt;
| 14.5:1 || Near-stoichiometric; good combustion efficiency but higher emissions.&lt;br /&gt;
|-&lt;br /&gt;
| 16:1 || Balanced performance; good power output and efficiency.&lt;br /&gt;
|-&lt;br /&gt;
| 18:1 || Lean burn; improved fuel economy but potential for higher NOx emissions.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Diesel is a complicated compound, but it’s commonly approximated as a hydrocarbon like C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt; (or C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;H&amp;lt;sub&amp;gt;26&amp;lt;/sub&amp;gt;). Air is about 21% O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; and 79% N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;. Without nitrogen, the stoichiometric ratio is about&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O&lt;br /&gt;
&lt;br /&gt;
and by including nitrogen, we get&lt;br /&gt;
&lt;br /&gt;
C&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;​H&amp;lt;sub&amp;gt;23&amp;lt;/sub&amp;gt;​+17.75( O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + 3.76 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; )​→12CO&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​+11.5H&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;​O + 66.74 N&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The molar masses&lt;br /&gt;
* Fuel: 167 g/mol&lt;br /&gt;
* Air: 137.28 g/mol&lt;br /&gt;
And the total air needed is 17.72 x 137.28 = 2436 g, which gives air-to-fuel-ratio to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
AFR = \frac{2436}{167} = 14.6:1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MB data ===&lt;br /&gt;
&lt;br /&gt;
Motor: OM648.&lt;br /&gt;
&lt;br /&gt;
Mercedes Benz W211 (2003)&lt;br /&gt;
* Engine displacement: 3222 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 0.003222 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Bore x Stroke: 88.0 x 88.4 mm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
* Compression Ratio: 18.0&lt;br /&gt;
&lt;br /&gt;
Bore x stroke gives V = 6xπ(8.8/2)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; x 8.84 cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; = 3225.95cm&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;, which is rather close.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
p_1 V_1^\gamma = \text{constant}_1&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;br /&gt;
&lt;br /&gt;
=== 1 ===&lt;/div&gt;</summary>
		<author><name>Mol</name></author>
	</entry>
</feed>