local default_output_file = nil function LuaExportStart() local myFileName="Flight-"..os.date("%Y%m%d-%H%M%S")..".txt"; --default_output_file = io.open("./Temp/Flight_data/"..myFileName, "w") default_output_file = io.open("c:/dcsw_flight_data/"..myFileName, "w") default_output_file:write(string.format("Model time,sec; LeftEngineFAN,x10; Altitude Bar,x10m; Ind.AirSpeed,x100 km/h; AoA; Vertical Velocity, m/s; Bank; Pitch; Altitude Rad,x10m; AccelerationY\n")) end function LuaExportBeforeNextFrame() end function LuaExportAfterNextFrame() end function LuaExportStop() io.close() end function LuaExportActivityNextEvent(t) local tNext = t -- Put your event code here and increase tNext for the next event -- so this function will be called automatically at your custom -- model times. -- If tNext == t then the activity will be terminated. local t = LoGetModelTime() local engine = LoGetEngineInfo() local navmode = LoGetNavigationInfo() local altBar = LoGetAltitudeAboveSeaLevel() local altRad = LoGetAltitudeAboveGroundLevel() local pitch, bank, yaw = LoGetADIPitchBankYaw() local indAirSpd = LoGetIndicatedAirSpeed() local aoa = LoGetAngleOfAttack() local vrtVel = LoGetVerticalVelocity() local acceleration = LoGetAccelerationUnits() -- Then send data to your file or to your receiving program: -- 1) File if navmode.SystemMode.submode=="LANDING" and altBar < 100 then --default_output_file:write(string.format("%.2f; %.2f; %.2f; %.2f; %.2f; %.2f; %.2f; %.2f; %.2f\n", t, 0.1*engine.RPM.left, 0.1*altBar, 0.036*indAirSpd, 57.3*aoa, vrtVel, 57.3*bank, 57.3*pitch, 0.1*altRad)) default_output_file:write(string.format("%.2f; %.2f; %.2f; %.2f; %.2f; %.2f; %.2f; %.2f; %.2f; %.2f\n", t, 0.1*engine.RPM.left, 0.1*altBar, 0.036*indAirSpd, 57.3*aoa, vrtVel, 57.3*bank, 57.3*pitch, 0.1*altRad, acceleration.y)) end tNext = tNext + 0.5 return tNext end