Jump to content

Engine RPM Telemetry Data


Roller25

Recommended Posts

you mean the precise RPM or just the normal RPM percentage?

 

the percentage values are two of the fields in the IFEI, which is exportable. All the code you would need is in the export script for Helios

 

https://github.com/BlueFinBima/Helios/blob/7d1aabe5a0cb72d94c616ddf5a9007e5beeb3d18/Helios/Interfaces/DCS/FA18C/ExportFunctions.lua#L38

 

and it references this (it ends up included in this file)

 

https://github.com/BlueFinBima/Helios/blob/7d1aabe5a0cb72d94c616ddf5a9007e5beeb3d18/Helios/Interfaces/DCS/Common/Export.lua#L177


Edited by derammo
Link to comment
Share on other sites

Thanks Derammo. I had a hunch it would be attainable from the IFEI. Normal RPM percentage is fine. All I need is a value to be extracted for a motion sim platform (SFX100). Do you know how I would use that information for my intended application? I would assume I wouldn't need all of that code?

Link to comment
Share on other sites

I figure its about 5 minutes work to trim down the export script to only send the two values you are interested in. I referenced the exact values in the first link.

 

That said, here's how a vanilla integration with DCS goes:

 

1) construct (in this case, just trim down) a script that grabs the values you care about at every frame and compares them to the previous value. When they change, it sends the new values to another process via a UDP message (so you don't block the DCS thread that calls the export function)

 

2) create another application that receives the UDP changes and then does whatever with them, in your case calculating the values for your motion platform and sending them to whatever API/SDK/interface you have for that thing.

Link to comment
Share on other sites

Well I've researched and experimented over and over again but for the life of me cannot get that data successfully exported. I know my lack of c++ knowledge and poor formatting is the culprit. Would you happen to know how to get this data..

 

 

 

 

 

 

local li = parse_indication(5) -- 5 for IFEI

if li then

--

-- --IFEI data

--

SendData("2061", string.format("%s",check(li.txt_FF_L)))

SendData("2062", string.format("%s",check(li.txt_FF_R)))

SendData("2067", string.format("%s",check(li.txt_RPM_L)))

SendData("2068", string.format("%s",check(li.txt_RPM_R)))

 

 

function parse_indication(indicator_id) -- Thanks to [FSF]Ian code

local ret = {}

local li = list_indication(indicator_id)

if li == "" then return nil end

local m = li:gmatch("-----------------------------------------\n([^\n]+)\n([^\n]*)\n")

while true do

local name, value = m()

if not name then break end

ret[name] = value

end

return ret

end

 

into this lua..

 

 

local udpServer = nil

 

local t0 = 0

 

local PrevExport = {}

PrevExport.LuaExportStart = LuaExportStart

PrevExport.LuaExportStop = LuaExportStop

PrevExport.LuaExportAfterNextFrame = LuaExportAfterNextFrame

 

local default_output_file = nil

 

function LuaExportStart()

default_output_file = io.open(lfs.writedir().."/Logs/SimFeedback.log", "w")

 

local version = LoGetVersionInfo()

if version and default_output_file then

default_output_file:write("ProductName: "..version.ProductName..'\n')

default_output_file:write(string.format("FileVersion: %d.%d.%d.%d\n",

version.FileVersion[1],

version.FileVersion[2],

version.FileVersion[3],

version.FileVersion[4]))

default_output_file:write(string.format("ProductVersion: %d.%d.%d.%d\n",

version.ProductVersion[1],

version.ProductVersion[2],

version.ProductVersion[3],

version.ProductVersion[4]))

end

 

-- Socket

package.path = package.path..";"..lfs.currentdir().."/LuaSocket/?.lua"

package.cpath = package.cpath..";"..lfs.currentdir().."/LuaSocket/?.dll"

socket = require("socket")

host = host or "localhost"

port = port or 6666

 

udpServer = socket.udp()

udpServer:setoption('reuseaddr',true)

udpServer:setpeername(host, port)

end

 

function LuaExportAfterNextFrame()

local curTime = LoGetModelTime()

if curTime >= t0 then

-- runs 100 times per second

t0 = curTime + .01

 

local pitch, roll, yaw = LoGetADIPitchBankYaw()

local RotationalVelocity = LoGetAngularVelocity()

local airspeed = LoGetTrueAirSpeed() * 3.6

local accel = LoGetAccelerationUnits()

 

if udpServer then

socket.try(udpServer:send(string.format("%.3f;%.3f;%.3f;%.3f;%.3f;%.3f;%.3f;%.3f;%.3f;%.3f;%f", t0, pitch, roll, yaw, RotationalVelocity.z, RotationalVelocity.x, RotationalVelocity.y, accel.z, accel.y, accel.x, airspeed)))

end

 

end

end

 

 

function LuaExportStop()

-- Works once just after mission stop.

if PrevExport.LuaExportStop then

PrevExport.LuaExportStop()

end

 

if default_output_file then

default_output_file:close()

default_output_file = nil

end

 

if udpServer then

udpServer:close()

end

end

 

 

 

 

Cheers!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...