I am making the program in jupyter notebook using the Python 3.7 language.

The problem must be modeled using OOP with more than one class and each class has more than one method (in addition to the constructor)

- I need to create a graph with matplotlib.
- I need to create an interactive button using ipywidggets.

An interactive graph must be created that allows the change in the output graphs to be viewed, by varying the problem parameters with the interactive button.

The general structure of the idea is already done, but I have difficulty doing the work with the programming language due to my little programming experience.

- I am having trouble getting the classes to deliver the data, for the general equation.
- I have problems with the use of
**init**, self, etc. … so that the program compiles correctly.

My native language is Spanish, so I apologize if I have bad English. so I will upload my work in English and Spanish

*#Constants* po = *#value, constant density.* hi = *#value, lower calorific value of the fuel.*

*--------------------------------------------------------------------------------*

In [ ]:

**class** **engine** : *#attributes* ns = *# value, turns per second.* vu = *#value, cylinder volume.* stroke = *# 4 or 2 stroke of the motor.* c = *#value, piston stroke* z = *#value, number of cylinders* *#method* u = 2 * ns * c *# average piston speed* s = vu / c *# piston surface* st = s * z *#total surface of the pistons* **return** st **return** u **return** stroke **return** vu

In [ ]:

help !!! I need to create an interactive button using ipywidgets, to vary the value “vu” within a range **for** example: (1-100)

In [6]:

**class** **ENERGY_BALANCE_OF_THE_CYLINDER** : *#Attributes* qt = *#value, heat input, corresponding to the total mass of fuel available in each cycle* ed = *# dissipated energy value, lost in each cycle* *#method* lu = qt - ed *# usable work generated by the cylinder in each cycle* nu = lu / qt *#usable thermal performance of the cylinder,* **return** nu

In [4]:

**class** **fuel_air_ratio** : *#attributes:* vu = *#value, cylinder volume.* po = *#value, constant density.* mat = *#value, total air mass.* qt = *#value, heat input, corresponding to the total mass of fuel available in each cycle* *#Methods* maid = po * vu *# ideal air mass per cylinder.* mbt = qt / hi *#total fuel mass.* at = mat / mbt *# total fuel air ratio.* mbid = maid / at *# ideal fuel mass* nvt = mbt / mbid *#total volumetric efficiency* **return** nvt **return** at **----------------------------------------------------------------------------------------**

In [5]:

*# POWER FORMULA: general structure of the program, which will deliver the required values.* *#combine all of the above the power is equal to* wu = nu * nvt * po * st * (hi / at) * (u / stroke) *## resulting of the engine power.*

**----------------------------------------------------------------------------------------------------------------**

In [ ]:

Help !!! I need to create a graph that shows the power of the engine based on the variation of “vu”, indicating where it **is** based on the interactive button above. the graph must be created **in** matplotlib.

Conclusion:

the conclusion of my work is, that at the same average speed of the piston, the useful power DOES NOT DEPEND ON THE CYLINDER, depends on the TOTAL SURFACE OF THE PISTONS.

Since the average speed of the pistons has a small range of variation, the true magnitude to increase or limit power is the total area of the pistons.