Jump to content
The simFlight Network Forums

Export several Data from P3Dv3 to a XML File


Recommended Posts

Hello,

before i decide to buy a Licence for FSUIPC4, i want to ask a Question.

I will try to design a more specific Logbook for P3Dv3, that is working for every Aircraft, AddOn or BuiltIn. To do a further Work with this logged Data, i will save them at the End of the Flight as a XML-File or CSV-File. What i want to read out is i.E. Fuel in the Tanks at several Flight Stages, TakeOff Time, Landing Time, Vertical Speed and some others. 

My Question also is, if this is possible with the newest FSUIPC and P3Dv3? If so, is there maybe any Tutorial, how to do that, i.E. with LUA?

Thanks in Advance for your Answers and Greetings

Joachim

Link to comment
Share on other sites

14 minutes ago, Airbuspilot said:

is there no Chance for an Answer to my Question?

I've moved your thread to the proper place!

If you had posted to the support forum, instead of to the FAQ subforum, you would have got a pretty fast response. FAQ means "Frequently Asked Questions" and is a reference place for such. New questions must always be posted in the main Forum first. You are lucky I spotted your message while checking something else there!

 

Quote

I will try to design a more specific Logbook for P3Dv3, that is working for every Aircraft, AddOn or BuiltIn. To do a further Work with this logged Data, i will save them at the End of the Flight as a XML-File or CSV-File. What i want to read out is i.E. Fuel in the Tanks at several Flight Stages, TakeOff Time, Landing Time, Vertical Speed and some others. 

My Question also is, if this is possible with the newest FSUIPC and P3Dv3? If so, is there maybe any Tutorial, how to do that, i.E. with LUA?

Yes, it is all possible, and no, there is no specific tutorial on how to do that -- it is one of an almost infinite number of things you can do with a tool like FSUIPC, and it is always going to be very unlikely that someone has written one just for your specific need!

However, there are lots of examples in Lua installed when you install FSUIPC. You do NOT have to purchase before reading the documentation available and the examples provided, so why not do a bit of research yourself? You might also find something useful in the User Contributions subforum.

Pete

 

Link to comment
Share on other sites

Sorry, for posting in the wrong Forum. Thanks for moving it to the right one.

Think, i expressed my self the wrong Way. Sure, that there is no special Tutorial for my special Needs. My Question refers to a small Example for putting a Data Value to the special Forming of a XML-File. But you are right, i will try to search by my self.

Joachim  

Link to comment
Share on other sites

23 minutes ago, Airbuspilot said:

My Question refers to a small Example for putting a Data Value to the special Forming of a XML-File. But you are right, i will try to search by my self.

Getting data values from FS involves finding the correct 'offsets', from the Offset list you will find in your FSUIPC Documents folder, then using one or other of the reading functions supplied in the Lua libraries -- again, the Lua Library documentation is provided in your FSUIPC Documents folder. The actual function to use depends on the type of value, from 8-bit bytes to ASCII strings.

There is an example in the example Lua zip called record to csv.lua which you will find useful, though it does use rather more advanced features than just simple "read byte" etc -- for efficiency it reads groups of variables which happen to be consecutive in the Offsets as a group in "ipc.readStruct" functions.

Of course, that example creates a CSV file, not XML. The latter merely involves a lot more formatting in the output, with appropriate tags and so on.

For learning more about Lua itself you'd need to refer to the books on it, or the tutorials and reference text on the Lua webiste as linked in my documents. I have several text books on Lua.

Pete

 

Link to comment
Share on other sites

45 minutes ago, Luke Kolin said:

Joachim, I've built a product similar to what you are looking at doing. Right now it's still in a free beta - https://www.simfdr.com/

Apologies in advance for the plug, Pete.

 

You are most welcome!

Actually, I would be very interested in that too, but when I try to download it I either get a Network Error, or my Virus checker blocks it saying is it really bad!

Pete

 

Link to comment
Share on other sites

2 hours ago, Pete Dowson said:

Actually, I would be very interested in that too, but when I try to download it I either get a Network Error, or my Virus checker blocks it saying is it really bad!

The network error is a shame - although it is going half-way around the world from Oregon. I suspect the virus alert is a false alarm, but what specifically is it warning about? It's a relatively straight NSIS installer.

Cheers!

Luke

Link to comment
Share on other sites

@Pete

Thanks for your comprehensive Answer about LUA, Offsets and the Abilitys of FSUIPC. Made my Purchase today and will try to understand the Examples and Documentation included in FSUIPC. With some LUA Experience, it should be Possible, to form the CSV-Output to a XML-Output. Think, there is much to learn in the near Future.

@Luke Kolin

Thanks for your Offer. Will try it and see, if it fits my Needs. Hope, i can contact you via Mail. 

Link to comment
Share on other sites

On 5/24/2016 at 11:19 AM, Airbuspilot said:

Thanks for your Offer. Will try it and see, if it fits my Needs. Hope, i can contact you via Mail. 

I tried to respond but your e-mail provider is blocking my response. You can export your data from simFDR in a variety of formats.

Cheers!

Luke

Link to comment
Share on other sites

  • 1 month later...

Luke, i wondered why there is no Response from you. So i thought, it is not possible, to save the DataFiles from your Logbook to my own Cloud? As far as i understand, it is only saving the Data to your Servers in the States or somewhere else available, right?

Pete, think, the Time has come, to request your Help. Attached to this Post, i had my FlightLog.lua and the corresponding Log-File. Something in here is from your record to csv.lua. Especially the File Command "f = assert(io.open(........" Could you please take a short look into the Files? I would highly appreciate, if you could please give me a Hint, where my Fault with the File is. It will not be created. By the Way: Is it possible, to print a VariableName like DienstBeginn to the File without a string.format Command? The Variable DienstBeginn holds the LocalTime when the Sim is ready to Fly.

 Thanks in Advance and Greetings, Joachim

 

Modules.zip

Link to comment
Share on other sites

The xml-File would be created. Seems it is not possible to write into the Documents Folder. Use the FlightSim\Modules Folder and it went well.

So, now i have to know, how to the write the Value in my Variable DienstBeginn to the File.

The Variable will be set with this Command     DienstBeginn = (string.format("%02d:%02d\n", hour, min))

With this Command, i write to the File      f:write("\r\   <DienstBeginn>DienstBeginn</DienstBeginn>

The Result of this Command in the xml-File is    <DienstBeginn>DienstBeginn</DienstBeginn>

but it should be    <DienstBeginn>16:30</DienstBeginn>

Do you have any Suggestion, how to resolve this Problem?

Thanks, Joachim

Link to comment
Share on other sites

Maybe ?? - 
f:write("\r\   <DienstBeginn>" .. DienstBeginn .. "</DienstBeginn>" )
As a full string you would write the xml tag followed by the contents (as already a formatted string) of the variable "DienstBeginn" followed by the string of the ending xml tag.
Concatenate command for strings = .. 

 

Link to comment
Share on other sites

Thank you so much. The .. was the missing Part. Your Code leads to the following Result.

   <DienstBeginn>16:53

</DienstBeginn>

in the XML-File. But it should be in one Line and look like this: <DienstBeginn>16:53</DienstBeginn>

Do you have any Suggestion, how to get this Result? Thanks in Advance

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.