Jump to content
The simFlight Network Forums
Paul Henty

FSUIPC Client DLL for .NET - Version 2.0

Recommended Posts

I haven't done that flight yet, but I've checked what is going on whilst parked.

In FSX (not sure about FS9) I have to compute the ZFW from the total weight (30C0) and the total fuel weight (126C). FSX doesn't supply the ZFW.

Using logging I can see that when the aircraft is cold and dark, the Zero Fuel Weight, Fuel Weight, and Total Weight all stay firmly stable. As soon as I turn the battery on, the Total Weight is declining at about .055 pounds per second, regularly and evidently deliberately, every second. This is in the 738.

The payloads aren't changing. I checked that. So it something accounting for electric power and associated machinery, activated by the battery. I think you need to ask someone who knows more about aircraft systems. At something like 3 pounds per minute it certainly isn't completely insignificant, so if you find out before me please do let me know!

Regards

Pete

Morning Mr. Dowson,

I asked a friend, he is a very competent guy, and is studying to become a pilot of an A320.

The value ZFW includes the liquid "consumables" such as oil - water et similar.

For an A320 consume about 81 kg / h is a reliable value and realistic.

I imagine, therefore, that the dynamics are so FSX 'superfine to understand the consumption of liquid secondary ... I suppose ... because M $ is normal to wait for everything and its opposite. :)

Have a good day, bye.

Emanuele

Share this post


Link to post
Share on other sites

I asked a friend, he is a very competent guy, and is studying to become a pilot of an A320.

The value ZFW includes the liquid "consumables" such as oil - water et similar.

For an A320 consume about 81 kg / h is a reliable value and realistic.

Odd, though. I checked with the default 738 on a different system, and that doesn't have this loss at all. I'm now pretty sure that something I've installed on my main cockpit system is doing it -- yes, for realism as you say -- but I've not the foggiest notion what add-on it is doing it. It certainly isn't doing in through FSUIPC, so it's either direct, like a gauge, or via SimConnect.

But at least we can be happy that it is not unreasonable.

Regards

Pete

Share this post


Link to post
Share on other sites

Hi,

To calculate the current flaps position, I'm using this:

private Offset<int> offset_flaps = new Offset<int>(0x0bdc);

private Offset<short> offset_flapsint = new Offset<short>(0x3bfa);

private Offset<short> offset_flapsnr = new Offset<short>(0x3bf8);

flaps_pos = (offset_flaps.Value / offset_flapsint.Value);

This works fine, except with Wilco Airbus, where I got positions: "0,2,3,4,5". I only have 4 positions, and the values skip from 0 to 2.

The flaps position in Wilco are, 0, 1+F, 2,3,4

I got offset_flapsnr =5, but I only have 4 positions.

With other planes everything is ok, how can I get the correct values from wilco?

Thanks for your help.

Edited by Framac

Share this post


Link to post
Share on other sites

With other planes everything is ok, how can I get the correct values from wilco?

Hi,

Your query seems to be specific to a Wilco plane. I've never used Wilco planes so, unfortunately, I can't answer your question, sorry.

I recommend you repost in either the main FSUIPC support forum or a Wilco support forum. No one else is likely to see your question here.

Paul

Share this post


Link to post
Share on other sites

hello,

I ask you an hint (even one): Is there a method that tells me in which airport (ICAO code) my aircraft is currently allocated?

Thanks in advance

Emanuele

Share this post


Link to post
Share on other sites

I ask you an hint (even one): Is there a method that tells me in which airport (ICAO code) my aircraft is currently allocated?

No, I'm afraid not. You would have to use the Lat/Lon and look it up in a database.

Please post general support queries in the main Support Forum.

Pete

Share this post


Link to post
Share on other sites

Hello Paul and Peter,

I was developing a project that consisted of an EPOP as the Embraer that carries the letters and all other preflight data. Also have a log of everything that was done in the aircraft cabin. Unfortunately, the aircraft Feelthere not respond to all the FSUIPC offsets. In contact with them (Feelthere support), they replied that they had this "feature" implemented in their products. The course would feature the reading of data such as Light Switches, Landing Gear Drive, AP switches and the list goes on. I ask one of you to advice on how I could reach that goal. An example of how to obtain such data with or without FSUIPC or Paul's library. I read something about L: VARS but I could not understand anything. Could you give me a light?

Thanks,

Franklin

Share this post


Link to post
Share on other sites

... An example of how to obtain such data with or without FSUIPC or Paul's library. I read something about L: VARS but I could not understand anything. Could you give me a light?

Hi Franklin,

If the data is not accessible via FSUIPC offsets then my DLL cannot help.

If they have their own SDK then you need to write code to use it.

LVars are accessible via LUA script in FSUIPC I think.

The best thing to do would be to look at the User Contributions sub-forum to see if anyone has already provided a solution. If not then repost in the main support forum where Pete will see it. He may not monitor this thread very often.

Paul

Share this post


Link to post
Share on other sites

Hi to everyone using my DLL.

I have a new Beta Version 2.2. I've added new features that make it easier to use some of the more advanced FSUIPC features:

1. Trap keyboard presses and joystick button presses made inside flight sim and respond to them in your application.

2. Add your own menu items under the Modules/Add-Ons menu in flight sim and detect when the user has selected them.

3. Easy access to all payload and fuel data. Lots of calculations are done for you, e.g. Fuel Weights (lbs and Kgs) and Fuel Levels (Gallons and Litres), Aircraft Zero-Fuel weight.

There is no documentation for the new features yet but all the Intellisense is there.

If you want to try it, send me a PM.

Paul

Share this post


Link to post
Share on other sites

Hi All,

I am using DLL for C# (Paul Henty contribution)

I am using FSX

I am using windows 7

I have a question, I am trying to modify the weather offsets of the FSX and currently

I am not able to see any result.

I am programming as follows (taking into account the size indicated by

the NewWeather.h attached below):

private Offset<byte[]> weather = new Offset<byte[]>(0xc800, 1024);

short uCommand = BitConverter.ToUint16(weather.Value, 1);

short uFlag = BitConverter.ToUint16(weather.Value, 3);

...

(and so on)

Is this right? I am obtaining all values to zero and I don´t understand what

is happening. Does anybody have any example to set weather conditions using

the dll available?

Thanks in Advance.

p.s.

I am using this structure to retrieve the data from the 0xc800

// Structure mapped to FSUIPC offsets

// C000, C400, C800 and CC00

typedef struct _NewWeather

{

unsigned short uCommand; // C000 C400 C800 CC00

unsigned short uFlags; // C002 C402 C802 CC02 // Not used at present -- leave alone or set to zero

unsigned int ulSignature; // C004 C404 C804 CC04

char chICAO[4]; // C008 C408 C808 CC08

unsigned short uDynamics; // C00C C40C C80C CC0C // 0=none, 4=extreme

unsigned short uSpare; // C00E C40E C80E CC0E

double dLatitude; // C010 C410 C810 CC10 // LLA zero for GLOB or unknown ICAO

double dLongitude; // C018 C418 C818 CC18

int nElevation; // C020 C420 C820 CC20 // metres * 65536

unsigned int ulTimeStamp; // C024 C424 C824 CC24 // mSecs since start of session

NewPress Press; // C028 C428 C828 CC28

NewVis Vis; // C02C C42C C82C CC2C

int nTempCtr; // C034 C434 C834 CC34 // Number of temperature layers

NewTemp Temp[24]; // C038 C438 C838 CC38

int nWindsCtr; // C0F8 C4F8 C8F8 CCF8 // Number of wind layers

NewWind Wind[24]; // C0FC C4FC C8FC CCFC

int nCloudsCtr; // C27C C67C CA7C CE7C // Number of Cloud layers

NewCloud Cloud[24]; // C280 C680 CA80 CE80

} NewWeather;

Share this post


Link to post
Share on other sites

I have a question, I am trying to modify the weather offsets of the FSX and currently

I am not able to see any result.

....

I am using this structure to retrieve the data from the 0xc800

Sorry, I cannot help with C# or the code for the DLL -- perhaps Paul can comment on your code if you show him some -- but what exactly are you expecting to READ from C800-CBFF? That is the weather WRITING area.

If you cannot write weather successfully, you need to check that you are following the protocol laid down. Best, if you want my help, to use FSUIPC's logging facilities so I can see the results of your code, not the code itself. And of course you can use logging to compare what you are doing with, for example, WEATHERSET2.EXE, which uses the same interface.

Regards

Pete

Share this post


Link to post
Share on other sites

Any chance that this excellent library be compiled for .NET 4.0?

Sure, I've just sent you a PM with a version to try.

If anyone else wants this, PM me.

Paul

  • Upvote 1

Share this post


Link to post
Share on other sites

Hi, paul, i have a problem with FsLatLonQuadrilateral and makeRunway.exe , because it has airports with 2,3 or 4 runways, how can i know if my airplane is in a runway? tanks a lot ... Demian

Share this post


Link to post
Share on other sites

Hi, paul, i have a problem with FsLatLonQuadrilateral and makeRunway.exe , because it has airports with 2,3 or 4 runways, how can i know if my airplane is in a runway? tanks a lot ... Demian

You'll need to make FsLatLonQuadrilateral classes for each runway at that airport. The you'll need to test all of them to see if the player in inside each quad (runway).

Paul

Share this post


Link to post
Share on other sites

You'll need to make FsLatLonQuadrilateral classes for each runway at that airport. The you'll need to test all of them to see if the player in inside each quad (runway).

Paul

thanks a lot

excelent your answer, could you write a little example of use fslatlonQuadrilateral? c# or vb.net Thanks a lot!!!!!!!

Share this post


Link to post
Share on other sites

thanks a lot

excelent your answer, could you write a little example of use fslatlonQuadrilateral? c# or vb.net Thanks a lot!!!!!!!

There are examples in the UserGuide.pdf that comes with the DLL. There is also an example in the sample application. Both are in C# and VB. Have you seen these?

Paul

Share this post


Link to post
Share on other sites

I was trying to use the text scrolling facilities and got a Type Initialization Exception with message "Must set a size set for ArrayOrStringLength for Byte[], BitArray or String".

I am using C# so basically having declared the Offsets I first write the string and then the timer:


Offset<short> ofsTextMessageTimer = new Offset<short>(0x32FA);
Offset<string> ofsTextMessage = new Offset<string>(0x3380);
// scroll message or until replaced, whichever is first
if (!string.IsNullOrEmpty(msg))
{
ofsTextMessage.Value = msg.Substring(0, msg.Length > 127 ? 127 : msg.Length);
ofsTextMessageTimer.Value = -1;
}
[/CODE]

The string in question is not null and is less than 127 characters long.

Share this post


Link to post
Share on other sites

Hi,

Offset&lt;string&gt; ofsTextMessage = new Offset&lt;string&gt;(0x3380);
[/Code]


What the error message is trying to say is that when you declare an offset as a string or byte[] you need to tell it how long the offset is.  Normally this can be derived for things like short and int but it has no way of knowing the size of an offset from the type 'string' or 'byte[]'  So you need to supply the parameter 'ArrayOrStringLength'.  The simplest overload for this would be:
[code]
Offset&lt;string&gt; ofsTextMessage = new Offset&lt;string&gt;(0x3380,128);

You use the full size. The dll knows about 0 terminations etc.


ofsTextMessage.Value = msg.Substring(0, msg.Length > 127 ? 127 : msg.Length);
[/CODE]

The dll also handles truncation for you if the string supplied is over the specified size. (well the size -1 because of the 0 terminator). So no need for you to check the size. Just pass whatever's in msg.

Paul

  • Upvote 1

Share this post


Link to post
Share on other sites

I noticed that with the latest FSUIPC there are LUA facilities embedded in FSUIPC. It is not clear to me whether that is only for registered users or all. If it was for unregistered users as well, it would be nice to have access to them via your excellent C# Client DLL.

Share this post


Link to post
Share on other sites

I noticed that with the latest FSUIPC there are LUA facilities embedded in FSUIPC. It is not clear to me whether that is only for registered users or all. If it was for unregistered users as well, it would be nice to have access to them via your excellent C# Client DLL.

Lua plug-ins are only for registered users.

Pete

Share this post


Link to post
Share on other sites

Hi All

Qustion on scaling an offset. Trying to get elev.trim -16383 to 16383 to read correct in vb.net 2010 from an adruino 2560 chip..ok it outputs 0-1024 full range of pot. I thought you would say analog .value *128/16383 or something but I don't know. if I just *128 I get close but it rolls over several times and is way to sentisive. I don't konw the scaling factor to use. any help? offset is 0BC0. Ron.

Share this post


Link to post
Share on other sites

Qustion on scaling an offset. Trying to get elev.trim -16383 to 16383 to read correct in vb.net 2010 from an adruino 2560 chip..ok it outputs 0-1024 full range of pot. I thought you would say analog .value *128/16383 or something but I don't know. if I just *128 I get close but it rolls over several times and is way to sentisive. I don't konw the scaling factor to use. any help? offset is 0BC0. Ron.

Not sure why this is in this thread -- you'd be better off posting (with a new title) in the Support Forum.

Why not simply have it written to one of the offsets 3BA8-3BC6 (eg 3BBE is for elev trim)? Then FSUIPC will automatically scale it, and you can assign it and calibrate it in FSUIPC as for any other axis.

If you did want to scale it yourself, and use it without any calibration options directly to the elevator trim control, then to get -16384 to +16383 from a range of 0-1024 you'd need to do

newval = (oldval * 32) - 16384

and check for +16384 afterwards and change that to 16383.

I don't know where you get a multiplier of 128 from!?

Regards

Pete

Share this post


Link to post
Share on other sites

Hi Paul, or anyone who may know how to ::: send a BDC code to set the radio com1 freq. just from the FSUIPC code Example. Paul has shown how to READ the BDC but NOT how to send to. Any Help.

Share this post


Link to post
Share on other sites

Hi Paul, or anyone who may know how to ::: send a BDC code to set the radio com1 freq. just from the FSUIPC code Example. Paul has shown how to READ the BDC but NOT how to send to. Any Help.

Hi Ron,

You need to take the BCD string and convert it to a Short as if it was a hex string. Here is a snippit of code that shows how: I think the last line is what you're looking for...

		Dim newCom2Frequency As String = "119.45" ' Set to 119.45
		' get the freqeuncy into FS format (no . and no leading 1 = 1945)
		Dim com2FS As String = newCom2Frequency.Substring(1, 2) &amp; newCom2Frequency.Substring(4, 2)
		' set the value to the com2 offset after converting to a short as a hex string
		com2Offset.Value = Short.Parse(com2FS, Globalization.NumberStyles.AllowHexSpecifier)

Paul

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×

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.