Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Dear Pete

Excuse me,

I work actually on a projet of application with Fsuipc.

Is it possible to write in the TAS variable ?

Or in an other speed variable : ground speed,...

I have search in the Sdk, and on this forum, but I don't find the answer.

Thanks

Iclo

Sorry for the mistakes, but i speak english a little:? :?

Posted

Is it possible to write in the TAS variable ?

Or in an other speed variable : ground speed,...

I have search in the Sdk, and on this forum, but I don't find the answer.

You can try writing to anything, to see if it does anything, but I don't think you can change the aircraft's airspeed or grpondspeed like that -- the speed is a result of thrust and acceleration and is dynamically re-calculated each frame. You influence it by increasing thrust, or diving. You may be able to make a temporary effect by writing to some of the accelerations. I think this is how the catapult and braking applications work.

Regards,

Pete

  • 2 months later...
Posted

Pete and everyone,

I am attempting to set the initial position of my aircraft using FSUIPC. I read that the airspeed cannot be directly controlled (along with vertical speed as far as I can tell).

Is it possible to control the thrust or throttleusing FSUIPC to get the aircraft's airspeed set? I can do this using the FS2004 map but not using the programmer's interface.

Thanks,

Tim

Posted

I am attempting to set the initial position of my aircraft using FSUIPC. I read that the airspeed cannot be directly controlled (along with vertical speed as far as I can tell).

This is because those values are results of other things -- i.e. effects not causes.

Is it possible to control the thrust or throttleusing FSUIPC to get the aircraft's airspeed set? I can do this using the FS2004 map but not using the programmer's interface.

Of course you can change the thorttle setting. Many of the 3rd party A/Ps use thrust setting->speed feedback type loops to operate the auto-throttle, just as real aircraft controls do.

I am afraid I do not understand what you mean by "I can do this using the FS2004 map". What's the "FS2004 map"?

Throttle values can be written directly, and have the same effect as joystick throttle inputs -- however, if your joystick throttles are still connected they will likely interfere. There are facilities in the FSUIPC interface for disconnecting the throttles so you can take over. In fact you can disconnect all the flight controls, but still read those inputs, and thus program a "fly-by-wire" system as used in the Airbus.

Regards,

Pete

Posted

Pete,

Thanks for your response. I am now specifically looking at a stationary aircraft on a runway. I perform the following actions to set the altitude and throttle to full power.

//Write Altitude

int Val1 = 1000; unsigned int Val2 = 0;

Sim.Write(0x0574, 4, &Val1);

Sim.Write(0x0570, 4, &Val2);

//Set Throttle

unsigned char ThrottleBit = pow(2,3) || pow(2,4);

Sim.Write(0x310A, 1, &ThrottleBit);

unsigned short Thottle = 16384; //-4096 to +16384

Sim.Write(0x088C, 2, &Thottle);

Sim.Process();

After this the aircraft falls out of the sky! The aircraft initially has zero speed. The throttle value does not seem to have any initial effect athough they eventually increase the aircrafts speed (adding to the effect of the aircraft accelerating downwards).

Does the aircraft speed have to be considered an "effect" variable? I find this counter intuative as a change in latitude/longitude is caused by speed. Speed is a cause in this example. Also we can change the affected variable (latitude/longitude). Any ideas? Would it be possible to introduce speed as a writeable variable?

The FS2004 map I mentioned is the built in standard map accessed by menu - world - map. This allows entry of a position, heading and airspeed. This is the behaviour I am trying to achieve with FSUIPC.

Thanks,

Tim

Posted

Thanks for your response. I am now specifically looking at a stationary aircraft on a runway. I perform the following actions to set the altitude and throttle to full power.

...

After this the aircraft falls out of the sky! The aircraft initially has zero speed. The throttle value does not seem to have any initial effect athough they eventually increase the aircrafts speed (adding to the effect of the aircraft accelerating downwards).

Yes, of course. Thrust accelerates the aircraft but cannot instantly make a stationary object fly -- you have to gain airspeed.

Does the aircraft speed have to be considered an "effect" variable?

It is in FS2004, certainly. You could write a simulator which didn't simulate real flight but merely obeyed commands to "go at x knots, turn left, turn right" and so on, but FS isn't like that, at least certainly not in recent versions.

I find this counter intuative as a change in latitude/longitude is caused by speed.

Well, by movement resulting from speed, yes, but FS also allows the aircraft to be "placed" by changing those values. Maybe that won't be possible either in future versions.

Your best bet is to set the aircraft into Slew mode, then position it, then release Slew mode. FS2002 and FS2004 (but not earlier releases I think) automatically provide airspeed for an aircraft released from slew in the air -- try it manually and you will see. The speed you get isn't adjustable though, as far as I know.

Would it be possible to introduce speed as a writeable variable?

I have no idea how to do that -- check the many velocity and acceleration values at 3060-30B8 and 3178-31D0. These are all relevant to what you are a little simplistically calling "speed". Maybe you can get all these set correctly to achieve what you want, but I doubt it. I know the carrier operations catapult and hooking systems make use of some of the accelerations here to achieve their object, but I really cannot advise on this. It's all a matter of trial and error.

The simulation engine in FS (in SIM1.DLL as it happens) computes the flight characterstics taking in lots of inputs and producing these many outputs. The result is flight simulation. Some of the inputs are directly accessible, most all of the outputs CAN be changed, but would be overwritten on the very next computation cycle.

The FS2004 map I mentioned is the built in standard map accessed by menu - world - map. This allows entry of a position, heading and airspeed. This is the behaviour I am trying to achieve with FSUIPC.

Right. Maybe investigating how that option manages to set the airspeed may show a way to do it through FSUIPC too. It could involve some considerable extra code disassembly and debugging, however, as it is an area I've never investigated before. But I will make a note and have a look when and if time permits.

Regards,

Pete

Posted

I think I cracked it (with a little help from you!). I was looking through the documentation for the memory areas you mentioned (3060-30B8 and 3178-31D0) and spotted 3090 which is exactly what I want!

Hi1 = 1080252200;

Lo1 = 3942658706;

Sim.Write(0x3090, 4, &Lo1);

Sim.Write(0x3094, 4, &Hi1);

Sim.Process();

So it is possible to initialise the aircraft's speed, or to be exact its forward velocity.

Thanks,

Tim

Posted

I used this code in my catault gauge. Seemed to work pretty well:

FSUIPC_Write(0x3070, 8, &z_acceleration, &Result);

FSUIPC_Write(0x3090, 8, &z_speed, &ResultR);

FSUIPC_Process(&Result);

I had to write both the acceleration and speed values to get it to work, but work it does...

Cheers,

Doug Dawson

  • 4 years later...
Posted

Sorry to resurect such an old topic but I would like to quickly ask... from Knots, how do I convert this into these "Hi" and "Lo" numbers?

I'm programming this in Delphi, in which I have a bit of experience, but I'm just not entirely sure how all these integers, bits and hi/lo bits work!

Thanks very much

Jags

Posted
Sorry to resurect such an old topic but I would like to quickly ask... from Knots, how do I convert this into these "Hi" and "Lo" numbers?

For what purpose, exactly? You cannot change the True Air Speed (TAS) directly in FS in any case, and the TAS value provided in only a normal 32-bit integer in any case. What's all this about "Hi" and "Lo" numbers?

If you really mean the Z (longitudinal) GS velocity relative to the body axes, in offset 3090, then, as documented this is a standard 64-bit (8 byte) double floating point value. Don't deal in "Hi" and "Lo" or anything like that. Just use standard floating point, supported by all languages.

This velocity is in feet/sec so you obviously need to convert knots to feet/sec, that's all. 1 knot = 1 nautical mile per hour. There are 3600 seconds in an hour and an easily-look-uppable number of feet in a Nautical Mile (try Wikipedia), so the arithmetic is easy enough.

Regards

Pete

Posted

I am trying to write a procedure that will set the speed of the aircraft (I call it after I have slewed the aircraft to a certain position and altitude, then released slew).

Using the example by "timsc" I manage to get the speed of the aircraft to change to a value other than the default slew-release value, but could not identify any positive relationship between these numbers and the airspeed (or Z-Velocity).

I have written the following code now, but this seems to have no effect on the speed at all - no matter what numbers I enter:

Procedure FSUIPCCalls.SetSpeed(aIAS : Integer);
var
  ErrorNumber : Cardinal;
  pIAS : PInteger;
begin
  New(pIAS);
  pIAS^ := aIAS;
  FSUIPC_Write($3090,4,pIAS,ErrorNumber);
  FSUIPC_Process(ErrorNumber);
  Dispose(pIAS);
end;

I'm just a tad confused about how I can get a reliable procedure to change the speed.

Thanks very much!!

Jags

Posted
I am trying to write a procedure that will set the speed of the aircraft (I call it after I have slewed the aircraft to a certain position and altitude, then released slew).

Not so easy in FS9 of course. In FSX SimConnect provides it via the "INIT POSITION" facility, which is also driveable via the FSUIPC IPC offsets interface. In fact there is a demonstration of this in one of the Lua plug-ins provided in the Lua package (see announcements).

Using the example by "timsc" I manage to get the speed of the aircraft to change to a value other than the default slew-release value, but could not identify any positive relationship between these numbers and the airspeed (or Z-Velocity).

I'm not surprised! They are just two halves of a double (64-bit) floating point value. Working out what they mean is no easy task -- do you even know the Intel 64-bit floating point representation standard? I don't offhand. And even then it isn't easy.

Why not use the actual number you want, in floating point, and write that? I don't know why you are messing with weird hexadecimal strings instead of proper easy-to-compute numbers (nor do I understand why timsc posted such an example).

I have written the following code now, but this seems to have no effect on the speed at all - no matter what numbers I enter:

Procedure FSUIPCCalls.SetSpeed(aIAS : Integer);
var
  ErrorNumber : Cardinal;
  pIAS : PInteger;
begin
  New(pIAS);
  pIAS^ := aIAS;
  FSUIPC_Write($3090,4,pIAS,ErrorNumber);
  FSUIPC_Process(ErrorNumber);
  Dispose(pIAS);
end;

Well that's obviously because you are writing some integer (why?) into the lowest (i.e. LEAST SIGNIFICANT) 32 bits of a 64-bit floating point number. So you will certainly be influencing it, but by a very very small fraction of a knot! You are evidently not checking the result accurately enough to see the difference! ;-)

Change your pIAS integer into a double floating point value (however that might be declared in Delphi) and write 8 bytes not 4.

Then you can work on the knots to ft/sec conversion.

Pete

Posted

That works an absolute treat!! Thank you SO much!!! :D

And I also apologise for my apparent inability to understand the basic concepts of numbers :oops: !!

I've certainly learned something from that!

James

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.