Eliminate manual bit packing errors with compile-time validation and code generation — full C++ implementation included.
The tool below calculates and plots an ideal gas cycle given the type of each state change and enough known variables. It was originally built for FSAE rules quiz usage.
Similar to Everything Aero, this tool uses SymPy in the browser to solve the resulting system of equations symbolically.
How to use it:
type1-2 = isobaric). Supported types are isobaric, isochoric, isothermal, and adiabatic. States are numbered 1, 2, ... and the cycle closes when the last state change returns to state 1.p1=100000, v1=1, t1=300. The index corresponds to the state number.gammaA-B=1.4 where A and B are the state indices of that leg (e.g. gamma1-2=1.4).bar and C can be used (multiplied) to convert units. E.g. p1=2*bar, t1=37*C. Scientific notation is also supported (e.g. p1=2e5).The solver determines which equations to use and solves for all unknowns. Results are rendered with Plotly as a P-V and a T-V diagram.
The calculator runs a full Python environment in the browser. It needs a few seconds to start up and install packages with pip (in the browser environment only). SymPy and Plotly are lazily loaded on the first Solve press, so that first solve takes a few seconds.
If the tool fails to load, reload the page and check the console (press F12).
Let's take a look at how to use the calculator for different FS rules quiz questions. Both examples below use the same four-state cycle (alternating isothermal and isochoric transitions), but ask for a different unknown. The original problem statements are linked from each example.
FS-Quiz Question 66 states \(p_1 = 7\) bar, \(V_1 = 0.6\) m³, \(V_2 = 3.3\) m³, \(T_2 = 800\)°C, and \(p_3 = 0.6\) bar along with the type of state change for each point. We need to find the pressure in point 4 (\(p_4\)).
The input therefore becomes the information given in the question.
type1-2 = isothermal
type2-3 = isochoric
type3-4 = isothermal
type4-1 = isochoric
p1=7*bar
v1=.6
v2=3.3
t2=800*C
p3=.6*bar
Hovering over point 4 on the P-V diagram shows \(p_4 = 3.3 \cdot 10^5\) Pa, i.e. \(p_4 = 3.3\) bar. Fig. 1 shows the input and the resulting P-V and T-V plots along with the solution for \(p_4\).
FS-Quiz Question 155 gives \(p_1 = 6.5\) bar, \(V_1 = 0.7\) m³, \(V_2 = 2.1\) m³, \(p_4 = 1.2\) bar, and \(T_1 = 800\) K. We need to find \(T_3\).
Again, the input for the solver is everything stated in the exercise:
type1-2 = isothermal
type2-3 = isochoric
type3-4 = isothermal
type4-1 = isochoric
p1=6.5*bar
v1=.7
v2=2.1
p4=1.2*bar
t1=800
Note that t1=800 has no *C as it is given in Kelvin directly. Hovering point 3 on the T-V diagram shows \(T_3 \approx 147.7\) K which is the correct solution to question 155 as shown in fig. 2.
The web UI is built with ngapp and runs python entirely in the browser. Each declared state change type is mapped to a single equation in the solver. The unit suffixes (bar, C) are implemented as additional equations/knowns. SymPy assembles and solves the resulting system symbolically, and Plotly plots the cycle on a P-V and a T-V diagram. Hovering a point shows its state values in SI units in the tool-tip.
The isothermal, isobaric, and isochoric relations follow from the ideal gas law \(pV = nRT\) under one conserved quantity. The adiabatic case (no heat exchange) instead follows from \(pV^\gamma = \text{const}\), where \(\gamma\) is the heat capacity ratio. The relations between adjacent states \(i\) and \(j\) are:
This project (with exceptions) is published under the CC Attribution-ShareAlike 4.0 International License.