Skip to main content

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:

  1. Open source, all the code can be seen at gitee or github, you are welcome to fork and modified it any way you want
  2. 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.
  3. 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.
  4. 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.
  5. 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

  1. build filing and emptying engine model
  2. 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:

heat release class

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:

  1. read the map file
  2. interpolate map
  3. 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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pysmartengine-0.0.4-py3-none-any.whl (1.5 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page