import%20marimo%0A%0A__generated_with%20%3D%20%220.13.15%22%0Aapp%20%3D%20marimo.App(width%3D%22medium%22)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%23%20Level%20Acceleration%0A%0A%20%20%20%20This%20notebook%20demonstrates%20the%20calculation%20of%20climb%20performance%20from%20a%20level%20acceleration%20test%20using%20the%20energy%20height%20calculation.%0A%0A%20%20%20%20Load%20in%20the%20data%20from%20the%20iLevil%20based%20FTI%20system.%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20data%20%3D%20np.genfromtxt('data%2FLevelAcceleration%2FTestPoint1-iLevil.csv'%2C%20delimiter%3D'%2C'%2C%20names%3DTrue)%0A%20%20%20%20return%20(data%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22Generate%200%20based%20time%20values.%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(data)%3A%0A%20%20%20%20time%20%3D%20data%5B'GPSSecondsToday'%5D%20-%20data%5B0%5D%5B'GPSSecondsToday'%5D%0A%20%20%20%20return%20(time%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22Take%20a%20look%20at%20the%20IAS%20and%20altitude%20during%20the%20test%20point.%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(data%2C%20plt%2C%20time)%3A%0A%20%20%20%20plt.figure()%0A%20%20%20%20plt.title(%22KIAS%20vs%20Time%22)%0A%20%20%20%20plt.plot(time%2C%20data%5B'IASkt'%5D)%0A%20%20%20%20plt.ylabel('KIAS')%0A%0A%20%20%20%20plt.figure()%0A%20%20%20%20plt.title(%22Altitude%20vs%20Time%22)%0A%20%20%20%20plt.plot(time%2C%20data%5B'Altitude'%5D)%3B%0A%20%20%20%20plt.ylabel('Altitude%20(ft)')%0A%20%20%20%20plt.show()%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22Calculate%20TAS%20from%20IAS%2C%20assuming%20ISA%20standard%20day%20and%20pressure%20altitude%20of%208000ft.%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(data)%3A%0A%20%20%20%20TASData%20%3D%20data%5B%22IASkt%22%5D%20*%201.127%0A%20%20%20%20return%20(TASData%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22Let's%20create%20a%204th%20order%20polynomial%20in%20order%20to%20smooth%20out%20the%20noise%20in%20the%20TAS%20data.%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(TASData%2C%20np%2C%20time)%3A%0A%20%20%20%20TASPoly%20%3D%20np.polyfit(time%2C%20TASData%2C%204)%0A%20%20%20%20TASPoly%0A%20%20%20%20return%20(TASPoly%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22Generate%20smoothed%20TAS%20data%20from%20the%20polynomial%20coefficients.%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(TASPoly%2C%20time)%3A%0A%20%20%20%20TASSmoothedData%20%3D%20TASPoly%5B0%5D%20*%20time**4%20%2B%20TASPoly%5B1%5D%20*%20time**3%20%2B%20TASPoly%5B2%5D%20*%20time**2%20%2B%20TASPoly%5B3%5D%20*%20time%20%2B%20TASPoly%5B4%5D%0A%20%20%20%20return%20(TASSmoothedData%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22Plot%20of%20the%20TAS%20data%20including%20the%20smoothed%20polynomial%20fit.%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(TASData%2C%20TASSmoothedData%2C%20plt%2C%20time)%3A%0A%20%20%20%20plt.figure()%0A%20%20%20%20plt.title(%22KTAS%20vs%20Time%22)%0A%20%20%20%20plt.plot(time%2C%20TASData)%0A%20%20%20%20plt.plot(time%2C%20TASSmoothedData)%3B%0A%20%20%20%20plt.ylabel('KTAS')%0A%20%20%20%20plt.show()%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20Now%20calculate%20energy%20height%3A%0A%0A%20%20%20%20%24%5CLarge%20h_e%20%3D%20h%20%2B%20%5Cdfrac%7BV_t%5E2%7D%7B2g%7D%24%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(TASSmoothedData%2C%20data)%3A%0A%20%20%20%20g%20%3D%2032.2%20%20%20%20%20%20%20%20%20%20%20%23%20ft%2Fs%5E2%0A%20%20%20%20ktTofps%20%3D%201.68%20%20%20%20%20%23%20conversion%20from%20kt%20to%20ft%2Fs%0A%0A%20%20%20%20heData%20%3D%20data%5B'Altitude'%5D%20%2B%20((TASSmoothedData%20*%20ktTofps)**2)%20%2F%20(2%20*%20g)%0A%20%20%20%20return%20(heData%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22Calculate%20a%203rd%20order%20polynomial%20fit%20for%20the%20energy%20height%20data.%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(heData%2C%20np%2C%20time)%3A%0A%20%20%20%20hePoly%20%3D%20np.polyfit(time%2C%20heData%2C%203)%0A%20%20%20%20hePoly%0A%20%20%20%20return%20(hePoly%2C)%0A%0A%0A%40app.cell%0Adef%20_(hePoly%2C%20time)%3A%0A%20%20%20%20heSmoothedData%20%3D%20hePoly%5B0%5D%20*%20time**3%20%2B%20hePoly%5B1%5D%20*%20time**2%20%2B%20hePoly%5B2%5D%20*%20time%20%2B%20hePoly%5B3%5D%0A%20%20%20%20return%20(heSmoothedData%2C)%0A%0A%0A%40app.cell%0Adef%20_(heData%2C%20heSmoothedData%2C%20plt%2C%20time)%3A%0A%20%20%20%20plt.figure()%0A%20%20%20%20plt.title(%22Height%20Energy%20vs%20Time%22)%0A%20%20%20%20plt.plot(time%2C%20heData)%0A%20%20%20%20plt.plot(time%2C%20heSmoothedData)%3B%0A%20%20%20%20plt.ylabel('%24h_e%24')%0A%20%20%20%20plt.show()%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20Now%20calculate%20excess%20power%20in%20ft%2Fsec%3A%0A%0A%20%20%20%20%24%5CLarge%20P_s%20%3D%20%5Cdfrac%7B%5Cmathrm%7Bd%7D%20h_e%7D%7B%5Cmathrm%7Bd%7Dt%7D%24%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(hePoly)%3A%0A%20%20%20%20dhedtPoly%20%3D%20%5B%203*hePoly%5B0%5D%2C%202*hePoly%5B1%5D%2C%201*hePoly%5B2%5D%20%5D%0A%20%20%20%20dhedtPoly%0A%20%20%20%20return%20(dhedtPoly%2C)%0A%0A%0A%40app.cell%0Adef%20_(dhedtPoly%2C%20time)%3A%0A%20%20%20%20PsData%20%3D%20(dhedtPoly%5B0%5D%20*%20time**2%20%2B%20dhedtPoly%5B1%5D%20*%20time%20%2B%20dhedtPoly%5B2%5D)%20*%2060%20%20%23%20fps%20to%20fpm%0A%20%20%20%20return%20(PsData%2C)%0A%0A%0A%40app.cell%0Adef%20_(PsData%2C%20plt%2C%20time)%3A%0A%20%20%20%20plt.figure()%0A%20%20%20%20plt.title(%22%24P_s%24%20vs%20Time%22)%0A%20%20%20%20plt.plot(time%2C%20PsData)%0A%20%20%20%20plt.show()%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22Generate%20smoothed%20IAS%20data%20from%20the%20smoothed%20TAS%20data.%20Again%20assuming%20ISA%20standard%20day%20at%208000ft.%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(TASSmoothedData)%3A%0A%20%20%20%20IASSmoothedData%20%3D%20TASSmoothedData%20%2F%201.127%0A%20%20%20%20return%20(IASSmoothedData%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22Finally%20plot%20%24P_s%24%20vs%20KIAS%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(IASSmoothedData%2C%20PsData%2C%20plt)%3A%0A%20%20%20%20plt.figure()%0A%20%20%20%20plt.title(%22%24P_s%24%20vs%20KIAS%22)%0A%20%20%20%20plt.plot(IASSmoothedData%2C%20PsData)%3B%0A%20%20%20%20plt.show()%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(PsData%2C%20data%2C%20plt)%3A%0A%20%20%20%20plt.figure()%0A%20%20%20%20plt.title(%22%24P_s%24%20vs%20Unsmoothed%20KIAS%22)%0A%20%20%20%20plt.plot(data%5B%22IASkt%22%5D%2C%20PsData)%3B%0A%20%20%20%20plt.show()%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%0A%20%20%20%20import%20numpy%20as%20np%0A%20%20%20%20import%20matplotlib.pyplot%20as%20plt%0A%20%20%20%20return%20mo%2C%20np%2C%20plt%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
1ff3cb5d6166614d02cfae60c8693663991d539ebedcdb8ad300100f2b69ca2b