chromium Posted February 19, 2014 Posted February 19, 2014 Hi, i'm looking for a way to export engine rpm and, maybe, engine power to an external text file that I already prepared. What I exactly need is a function, a variable, something that I can read to print out :) Anybody can help? thanks! Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
Crash_Horror Posted February 20, 2014 Posted February 20, 2014 Paste this into your "C:\Users\user\Saved Games\DCS\Scripts\Export.lua" function LuaExportStart() -- Works once just before mission start. -- default_output_file = io.open("YOUR_ENGINE_DATA_FILE.log", "w") -- writes a file to DCS root directory -- end -------------------------------------------------------------- function LuaExportActivityNextEvent(t) local tNext = t local engine = LoGetEngineInfo() default_output_file:write(string.format("t = %.2f RPM left = %f RPM right = %f \n",t,engine.RPM.left,engine.RPM.right)) tNext = tNext + 1.0 -- data collected once every second / change this according to preference -- return tNext end -------------------------------------------------------------- function LuaExportStop() -- Works once just after mission stop -- default_output_file:close() end It creates a "YOUR_ENGINE_DATA_FILE.log" file in the DCS root folder containing data like this: t = 0.00 RPM left = 67.500000 RPM right = 67.500000 t = 1.00 RPM left = 67.500000 RPM right = 67.500000 t = 2.00 RPM left = 67.500000 RPM right = 67.500000 t = 3.00 RPM left = 67.705765 RPM right = 67.705765 t = 4.00 RPM left = 76.481903 RPM right = 76.481903 t = 5.00 RPM left = 92.065933 RPM right = 92.065933 t = 6.00 RPM left = 103.399094 RPM right = 103.399094 t = 7.00 RPM left = 100.496941 RPM right = 100.496941 You can change the formating by modifying this line: default_output_file:write(string.format("t = %.2f RPM left = %f RPM right = %f \n",t,engine.RPM.left,engine.RPM.right)) You can also change how often the values are written. I have set it to 1.0 second tNext = tNext + 1.0 The engine data that can be exported is described by ED here: LoGetEngineInfo() -- (args - 0 ,results = table) engineinfo = { RPM = {left, right},(%) Temperature = { left, right}, (Celcium degrees) HydraulicPressure = {left ,right},kg per square centimeter FuelConsumption = {left ,right},kg per sec fuel_internal -- fuel quantity internal tanks kg fuel_external -- fuel quantity external tanks kg } [sIGPIC][/sIGPIC] http://buddyspike.net/
chromium Posted February 20, 2014 Author Posted February 20, 2014 (edited) I red somewhere that this function wasn't working in Dcs world, but I'll vive that a try! Thanks :) Edited February 20, 2014 by chromium Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
AlphaOneSix Posted February 20, 2014 Posted February 20, 2014 If not you can use "mainpanel" to get the value from the gauge in the cockpit. I would go into more detail, but I have to go to work!
chromium Posted February 20, 2014 Author Posted February 20, 2014 It's ok AlphaOneSix :), If I'll have problems maybe I'll post here another time :). thanks! Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
Crash_Horror Posted February 20, 2014 Posted February 20, 2014 Of course it works, I would not have posted it without testing it. :thumbup: [sIGPIC][/sIGPIC] http://buddyspike.net/
chromium Posted February 20, 2014 Author Posted February 20, 2014 Thanks :D Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
Crash_Horror Posted February 21, 2014 Posted February 21, 2014 (edited) Actually it appears you are partially right Chromium. I tested it with FC3 planes and worked fine, but it appears it won't work with the A-10C. This must be very recent, cause I use something similar and had no problems until now. It must be the last patches? I don't own any helos to test it further, just A-10 & FC3. I am not familiar with "mainpanel", will have to look into it. Edited February 21, 2014 by Crash_Horror [sIGPIC][/sIGPIC] http://buddyspike.net/
Crash_Horror Posted February 21, 2014 Posted February 21, 2014 OK here it is. A version for the A-10C using the 'mainpanel' thingy: function LuaExportStart() -- Works once just before mission start -- default_output_file = io.open("YOUR_ENGINE_DATA_FILE.log", "w") -- writes a file to DCS root directory -- end -------------------------------------------------------------- MainPanel = GetDevice(0) function LuaExportActivityNextEvent(t) local tNext = t local engine_RPM_left = MainPanel:get_argument_value(78) * 100 local engine_RPM_right = MainPanel:get_argument_value(80) * 100 default_output_file:write(string.format("t = %.2f RPM left = %.2f RPM right = %.2f\n", t, engine_RPM_left, engine_RPM_right)) tNext = tNext + 1.0 -- data collected once every second / change this according to preference return tNext end -------------------------------------------------------------- function LuaExportStop() -- Works once just after mission stop -- default_output_file:close() end And a version that checks if you fly an A-10C or something "else": function LuaExportStart() -- Works once just before mission start -- default_output_file = io.open("YOUR_ENGINE_DATA_FILE.log", "w") -- writes a file to DCS root directory -- end -------------------------------------------------------------- aircraft = LoGetObjectById(LoGetPlayerPlaneId()) MainPanel = GetDevice(0) if (aircraft.Name == "A-10C") then -- checks for either A-10C or 'other' aircraft function LuaExportActivityNextEvent(t) local tNext = t local engine_RPM_left = MainPanel:get_argument_value(78) * 100 local engine_RPM_right = MainPanel:get_argument_value(80) * 100 default_output_file:write(string.format("t = %.2f RPM left = %.2f RPM right = %.2f Aircraft = %s\n", t, engine_RPM_left, engine_RPM_right, aircraft.Name)) tNext = tNext + 1.0 -- data collected once every second / change this according to preference -- return tNext end else function LuaExportActivityNextEvent(t) local tNext = t local engine = LoGetEngineInfo() default_output_file:write(string.format("t = %.2f RPM left = %.2f RPM right = %.2f Aircraft = %s\n",t,engine.RPM.left,engine.RPM.right, aircraft.Name)) tNext = tNext + 1.0 -- data collected once every second / change this according to preference -- return tNext end end -------------------------------------------------------------- function LuaExportStop() -- Works once just after mission stop -- default_output_file:close() end This one also writes the aircraft type at the end of each line. :noexpression: As I understand it, every DCS:level module has its own "mainpanel_init.lua" with its own IDs for different instruments so it propably won't work for others. I may be wrong. But you get the idea, you can search for "mainpanel_init.lua" in the DCS folder and add more aircraft if you need to. [sIGPIC][/sIGPIC] http://buddyspike.net/
chromium Posted February 21, 2014 Author Posted February 21, 2014 I'm actually fly KA-50 and sadly the first script prints out a void file, this evening I'll try the second script :) : I think I could handle the modification needed to use KA-50 :) PS: by modifying "aircraft = LoGetObjectById(LoGetPlayerPlaneId())" do you think it's possible to print out data from an IA flight? I'm trying to plot some thousands of flight performance data to define one or two equations to calculate fuel compsumption based on altitude, weight and airspeed... and also a function that gives me the cruise airspeed at a given weight. To do that, I'm running a file with 10-15 IA flight each time in x30 time compression to have 2h of data exported in .csv file each run in few minutes ... but it contains only the remaining fuel fraction. That's why I would like to have fan speed and istant fuel consumption: this will increase much the accuracy and simplify successive calculations. (I didn't touch export lua, I disable the sanitization module to some other reason). Thanks I'll report if I got it to works! Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
Robin_Hood Posted February 21, 2014 Posted February 21, 2014 (edited) Wouldn't instantaneous fuel flow work? Because for FC3 aircrafts at least it is possible to have it. Might be for others, with mainpanel, but gotta find the right argument. For FC3, you can have: local fuelFlow = LoGetEngineInfo().FuelConsumption.left + LoGetEngineInfo().FuelConsumption.left -- in kg/s I used that for fuel consumption determination for my Su-33. For AI aircrafts, you can try LoGetObjectById(unitId), if you know the ID of the unit you want. BTW, a lot of this is in $User\Saved Games\DCS\Scripts\Export.lua. Only "legacy" export, though, so mainly FC3 (but LoGetObjectById is there for example), there is no mention of mainpanel there. Edited February 21, 2014 by Robin_Hood 2nd French Fighter Squadron
chromium Posted February 21, 2014 Author Posted February 21, 2014 No, dasly it doesn't work for anything that is not FC3 as said in a post above :( Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
klem Posted March 25, 2014 Posted March 25, 2014 I'm interested in using this and on a wider scale for the P51D. I have two issues at the moment. I can't seem to get that Engine data to export, possibly because the Export.lua says: "-- Please, set EnableExportScript = true in the Config/Export/Config.lua file -- to activate this script!! I can't find that file and wonder if it is a leftover from FC. Is this necessary in DCSW? I would like to export a lot more flight data as a kind of Black Box. Can anyone point me to the full range of parameters that can be exported? Many thanks, klem 56 RAF 'Firebirds' ASUS ROG Strix Z390-F mobo, i7 8086A @ 5.0 GHz with Corsair H115i watercooling, Gigabyte 2080Ti GAMING OC 11Gb GPU , 32Gb DDR4 RAM, 500Gb and 256Gb SSD SATA III 6Gb/s + 2TB , Pimax 8k Plus VR, TM Warthog Throttle, TM F18 Grip on Virpil WarBRD base, Windows 10 Home 64bit
chromium Posted March 25, 2014 Author Posted March 25, 2014 In the end I used AlphaOneSix script in export.lua to gather some data, and another script written by me to get the info that the other script is missing. I had to elaborate 2 files instead of one, and that is not the best solution for sure :( Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
klem Posted March 30, 2014 Posted March 30, 2014 Of course it works, I would not have posted it without testing it. :thumbup: Hi Crash_Horror, I experimented more with Export and found some answers but I am still a little stuck and wonder if you can help. There seems to be an impression, from posts here, that Export.lua doesn't work with all DCS aircraft. I am trying to create a 'Black Box' to export a range of data for the P51-D (I have done it in another sim using C# and a/c parameters). Would you know if that is even possible for the P51-D? I tried a stripped down Export.lua, removing all the rem'd statements (which I see now includes many examples), initially with no success so I stripped it down to simply this and it worked, proving the basic function is working ok: dofile( "C:\\Users\\Administrator\\Saved Games\\DCS\\Scripts\\telemetry.lua ") function LuaExportStart() -- Works once just before mission start. -- default_output_file = io.open("YOUR_ENGINE_DATA_FILE.log", "w") -- writes a file to DCS root directory -- end -------------------------------------------------------------- function LuaExportActivityNextEvent(t) local tNext = t default_output_file:write("Test Line") tNext = tNext + 1.0 --data collected once every second / change this according to preference -- return tNext end -------------------------------------------------------------- function LuaExportStop() -- Works once just after mission stop -- default_output_file:close() end Unfortunately when I try this it doesn't dofile( "C:\\Users\\Administrator\\Saved Games\\DCS\\Scripts\\telemetry.lua ") function LuaExportStart() -- Works once just before mission start. -- default_output_file = io.open("YOUR_ENGINE_DATA_FILE.log", "w") -- writes a file to DCS root directory -- end -------------------------------------------------------------- function LuaExportActivityNextEvent(t) local tNext = t local engine = LoGetEngineInfo() default_output_file:write(string.format("t = %.2f RPM = %f \n",t,engine.RPM)) tNext = tNext + 1.0 --data collected once every second / change this according to preference -- return tNext end -------------------------------------------------------------- function LuaExportStop() -- Works once just after mission stop -- default_output_file:close() end One problem may be that the examples don't include single engine aircraft so I don't know for sure how to refer to, say, Engine RPM. I can't seem to find a comprehensive range of export parameters, even in the Help files. Any ideas please? klem 56 RAF 'Firebirds' ASUS ROG Strix Z390-F mobo, i7 8086A @ 5.0 GHz with Corsair H115i watercooling, Gigabyte 2080Ti GAMING OC 11Gb GPU , 32Gb DDR4 RAM, 500Gb and 256Gb SSD SATA III 6Gb/s + 2TB , Pimax 8k Plus VR, TM Warthog Throttle, TM F18 Grip on Virpil WarBRD base, Windows 10 Home 64bit
BR55Sevas Posted March 30, 2014 Posted March 30, 2014 Try to use this local main_panel = GetDevice(0) if main_panel then main_panel:update_arguments() EngRPM = main_panel:get_argument_value(XXX) where XXX is argument number for rotating engine RPM needle, you have to find it yourself by using modelviewer and P51 cockpit. МиГ-29 Fly by wire СДУ Su-27SM second display panel https://www.youtube.com/embed/videoseries?list=PL_2GGwNpWNp_fKXfRtDhIk8s5Jf4a9XHS http://berkuts.ru Пилотажный сервер с роботом | Aerobatic server with PhantomControl
klem Posted April 1, 2014 Posted April 1, 2014 Try to use this local main_panel = GetDevice(0) if main_panel then main_panel:update_arguments() EngRPM = main_panel:get_argument_value(XXX) where XXX is argument number for rotating engine RPM needle, you have to find it yourself by using modelviewer and P51 cockpit. Thanks, unfortunately I can only see the 3D cockpit of Cockpit_P-51D.edm with a list of textures and in the View/Dialogs/Folder Browser many other items but no instrument specific details. I opened all the folders and tried all the View and Tools options but no joy. Am I looking in the wrong place? klem 56 RAF 'Firebirds' ASUS ROG Strix Z390-F mobo, i7 8086A @ 5.0 GHz with Corsair H115i watercooling, Gigabyte 2080Ti GAMING OC 11Gb GPU , 32Gb DDR4 RAM, 500Gb and 256Gb SSD SATA III 6Gb/s + 2TB , Pimax 8k Plus VR, TM Warthog Throttle, TM F18 Grip on Virpil WarBRD base, Windows 10 Home 64bit
BR55Sevas Posted April 1, 2014 Posted April 1, 2014 Use stand alone modelviewer http://forums.eagle.ru/showthread.php?t=86205 МиГ-29 Fly by wire СДУ Su-27SM second display panel https://www.youtube.com/embed/videoseries?list=PL_2GGwNpWNp_fKXfRtDhIk8s5Jf4a9XHS http://berkuts.ru Пилотажный сервер с роботом | Aerobatic server with PhantomControl
klem Posted April 1, 2014 Posted April 1, 2014 Use stand alone modelviewer http://forums.eagle.ru/showthread.php?t=86205 I did: ftp://ftp1.files.eagle.ru/mods/model_viewer/ edModelViewer-85950.exe :( klem 56 RAF 'Firebirds' ASUS ROG Strix Z390-F mobo, i7 8086A @ 5.0 GHz with Corsair H115i watercooling, Gigabyte 2080Ti GAMING OC 11Gb GPU , 32Gb DDR4 RAM, 500Gb and 256Gb SSD SATA III 6Gb/s + 2TB , Pimax 8k Plus VR, TM Warthog Throttle, TM F18 Grip on Virpil WarBRD base, Windows 10 Home 64bit
klem Posted April 7, 2014 Posted April 7, 2014 Still no joy, I can't see any references to instrument numbers in the modelviewer. I can iterate out the panel items with a for-loop but of course I don't know what the values refer to. klem 56 RAF 'Firebirds' ASUS ROG Strix Z390-F mobo, i7 8086A @ 5.0 GHz with Corsair H115i watercooling, Gigabyte 2080Ti GAMING OC 11Gb GPU , 32Gb DDR4 RAM, 500Gb and 256Gb SSD SATA III 6Gb/s + 2TB , Pimax 8k Plus VR, TM Warthog Throttle, TM F18 Grip on Virpil WarBRD base, Windows 10 Home 64bit
algerad3 Posted June 30, 2014 Posted June 30, 2014 Not exactly sure what you are looking for but, I am under the impression you want to export the values for the various gauges so that they can be read in a different file. If so go here http://forums.eagle.ru/attachment.php?attachmentid=96974&d=1397568032 and I have many scripts ready to export most gauges for many modules. The attachments came from http://forums.eagle.ru/attachment.php?attachmentid=96974&d=1397568032 post # 267. I hope this helps. [sIGPIC][/sIGPIC] CPIAS FOR Saitek: Saitek Flight instrument panels and X-52 pro mfd scripts for Dcs http://forums.eagle.ru/showthread.php?t=94174
danvac Posted August 6, 2014 Posted August 6, 2014 The engine data that can be exported is described by ED here: LoGetEngineInfo() -- (args - 0 ,results = table) engineinfo = { RPM = {left, right},(%) Temperature = { left, right}, (Celcium degrees) HydraulicPressure = {left ,right},kg per square centimeter FuelConsumption = {left ,right},kg per sec fuel_internal -- fuel quantity internal tanks kg fuel_external -- fuel quantity external tanks kg } Hi, I am trying to get fuelconsumption data, but values does not make sense for me. Can somebody check if it is really not working or I am somehow wrong? Thanks.
Recommended Posts