a python library for internal combustion engine
Project description
pysmartengine-A simple python package for internal combustion engine simulation
[TOC]
To install the pysmartengine python package, type:
pip install pysmartengine
a simple guide
pysmartengine is a simple python package for internal combustion engine write in C++ and python. it has obviously advantages compared to commercial engine simulation tools like:
- Open source, all the code can be seen at gitee or github, you are welcome to fork and modified it any way you want
- Object based. All the components are a substance of class, Valve,cylinder,pipe,compressor and so on, you can create each components using python scripts, thus, you modelling process can be record in a .py file.
- Database based. we chose python as the model build language because of its powerful data processing ability. By using database, you can build you model faster. For example you can build a cylinder Geometry object using CylinderGeometry("WP7") where "WP7" is a engine existing in the database.
- Quick, all the time consuming computing process will be writing in C++ and using python to call the .pyd dynamic link library. pybind 11 was used to compile the C++ source code.
- Powerful visualization. Almost all the object has a plot fun for visualizing the data. you can see it at components part .
what you can do with pysmartengine?
there are many things you can do with pysmartengine, the typical things is to build model
- build filing and emptying engine model
- build mean value model
1 dimensional model and 3 dimensional model have not be developed yet. It will be supported later on.
Cylinder part
Cylinder geometry
Cylinder pressure
To specified a Cylinder pressure object, using:
Geo=CylinderGeometry("SC7H")
T=ArrayTable(2,0)
T.read_CSV("cylinder curve.csv")
T.fromPandas(data25)
pre=CylinderPressure(T,Geo,move=0)
you can plot the cylinder pressure using:
pre.plot()
In order to filter the high frequency noise of cylinder pressure curve, a FFT filter can be used:
pre.FFTFilter(0.5e7,speed).plot([1,2])
then a comparison between original curve and the curve after smooth can be seen:
Heat Release
The hierarchy of heat release object are show in the following picture:
pysmartengine can easily get a diesel engine net heat release rate show in test file:
from Engine.Cylinder import CylinderPressure,CylinderGeometry
from Engine.Table import ArrayTable
from Engine.Algorithm.FileManipulate import get_pakage_dir
Geo=CylinderGeometry("WP7")
table = ArrayTable()
table.readCSVFile(get_pakage_dir("Engine") + "\\data\\CylinderPressure.csv")
Pre=CylinderPressure(table,Geo)
Pre.netHeatReleaseRate(plot=True)
then you can get a ArrayTable type data,which can be plotted like:
if you want to get a pure heat release table for further proccessing, you can pass the result to a heat release data class, it is inherited from the Heat release abstract class.
hr,soc,eoc=Pre.netHeatReleaseRate(plot=True)
HRR=HeatReleaseData(hr.selectColumns([0,5]),soc,eoc)
HRR.nomalization()
HRR.plot()
then you can get the following heat release pic:
if you want to regression the heat release profile using single wiebe or double wiebe function, you can simpliy type:
HRR.regressWithSingleWiebe()
or:
HRR.regressWithSingleWiebe()
ideal cycle
to be writen
Valve part
to be writen
Compressor
Simple compressor
Compressor based on map
pysmartengine is easy to generate compressor map using compressor map data, the sample compressor map data can be seen in Compressor Map. you can plot the map in three steps:
- read the map file
- interpolate map
- plot the map
Map = Compressor("./CompressorMap.xlsx")
Map.interpolate(5) #generate 5 lines between each constant speed line
Map.plot()
then you can get the map plot seen bellow:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for pysmartengine-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 572d4aeed97a8fc2b9ced9b73f83b541818b8cfc0e37c6b2f80ce6cc90fd03c9 |
|
MD5 | 7c4d23e2d8541eb260cd03bac6bf80f5 |
|
BLAKE2b-256 | 8f16406f9a102f114b0d18456bce17ae78c3d43dc90ad55a63dfa0b137d2c000 |