Im trying to build a model where you have a precompressed spring, a mass and a pneumatic piston chamber. When the simulation starts, the spring acts on the mass and the piston, making the system vibrate. This works really well, but what i really need is to find out how much energy every part of the system has at the different times.
The energy on the spring is E= 0.5*K*x^2 The energy on the mass is kinetic energy E= 0.5*m*V^2
But i have struggled a lot to find the energy in the pneumatic chamber, and i couldnt. tried E = cv m (T-T0) , E= (P*V / (1-k) *((P/P0)^((1-k)/k)-1) ) and many many others and still cant find the correct one.
The sum of all the energies does not stays constant, it oscillates and this oscilations make it go up the initial energy, which shouldnt be possible.
Its like a thermodynamics and simscape question all in one, sorry if its offtopic!