• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Controlling pitch and altitude

Messages
40
Country
unitedstates
Hello:

I am flying a supersonic airplane and have some problems controlling it, even when using AP.

I would like that if the airplane reaches some altitude, it does not climb anymore. Also, I want to avoid the airplane pitch exceeds 40 deg, since it easily enters in lost.

For that, I am using this in my autopilot:

Code:
<update id="UpdateAP">
<script>
        (A:PLANE PITCH DEGREES, radians) -0.61 &lt;= if{ -0.61 (&gt;K:AXIS_PAN_PITCH, radians) }			
	(A:PLANE ALTITUDE, feet) 40000 &gt;= 
		if{ 
				0 (&gt;L:AtFr,bool)
				1 (&gt;K:FREEZE_ALTITUDE_TOGGLE, bool)
				40000 (&gt;K:FREEZE_ALTITUDE_SET, feet) 
				(A:VERTICAL SPEED, feet) 0 &lt;= if{ 0 (&gt;K:FREEZE_ALTITUDE_TOGGLE, bool) }
				1 (&gt;L:AtFr,bool)
			}			
<script>
</update>

The above code checks pitch, and if it is less than -40 deg ( -0.61 rad ), it would set the pitch to the limit: -0.61 rad (note that less pitch would be -45, -50 deg... it's measured in negative numbers when pitch points upwards)
This part of code does not work.
Next segment checks altitude, when 40000 feet are reached, FSX does freeze altitude: airplane does not climb anymore. But it won't descend, I can't unfreeze it. Maybe I could use pitch indicator, but... I am confused!

Thanks!
 
Code:
0 (&gt;K:FREEZE_ALTITUDE_TOGGLE, bool)

That won't work because the key_event is already a toggle. If it is off, it will be turned on. If it is on, it will be turned off.

Also, it's unnecessary to include a units with toggle or on/off key_events.

Try:

Code:
(A:VERTICAL SPEED, feet) 0 &lt;= if{ (>K:FREEZE_ALTITUDE_TOGGLE) }
 
Code:
0 (&gt;K:FREEZE_ALTITUDE_TOGGLE, bool)

That won't work because the key_event is already a toggle. If it is off, it will be turned on. If it is on, it will be turned off.

Also, it's unnecessary to include a units with toggle or on/off key_events.

Try:

Code:
(A:VERTICAL SPEED, feet) 0 &lt;= if{ (>K:FREEZE_ALTITUDE_TOGGLE) }

Thanks... I will try it later
And do you have something for pitch?
 
Code:
0 (&gt;K:FREEZE_ALTITUDE_TOGGLE, bool)

That won't work because the key_event is already a toggle. If it is off, it will be turned on. If it is on, it will be turned off.

Also, it's unnecessary to include a units with toggle or on/off key_events.

Try:

Code:
(A:VERTICAL SPEED, feet) 0 &lt;= if{ (>K:FREEZE_ALTITUDE_TOGGLE) }

Hi n4gix:

Seems first I have to work on attitude (pitch) issue. My problem is that I can't change it!

Here is the code:

Code:
1 (&gt;K:FREEZE_ATTITUDE_SET) 
-0.25 (&gt;A:PLANE PITCH DEGREES, radians)  			
-0.25 (&gt;K:AXIS_PAN_PITCH, radians)

Attitude is frozen, but I can't change the pitch (it is kept the pitch at the moment of freezing it)
 
You are barking up the wrong tree...

"Freeze" means simply what it implies. Once "frozen" no other inputs will be accepted!

Try using:
AP_ATT_HOLD_OFF
AP_ATT_HOLD_ON
AP_ATT_HOLD (toggles on/off)
 
You are barking up the wrong tree...

"Freeze" means simply what it implies. Once "frozen" no other inputs will be accepted!

Try using:

But those Events work for auto pilot, don't they? My problem is that when airplane exceeds some speed (~2.1 Mach) it will climb up despite AP is trying to keep some altitude. That is because pitch degree turns too small (<-30°)

What I want to do is make FSX correct pitch, even though I have to violate physics laws!
 
You are barking up the wrong tree...

"Freeze" means simply what it implies. Once "frozen" no other inputs will be accepted!

Try using:

No, they don't. That was my entire point! This entire group of events are intended for use by a SimConnect module for custom AI interaction.


Ok, so maybe I am not using them properly. This is my code for Pitch<-0.25 rads:

1 (&gt;K:AP_ATT_HOLD_OFF)
-0.25 (&gt;A:PLANE PITCH DEGREES, radians)

I tested it unconditionally but It did not work. ( I expected my plane to keep a constant pitch of -0.25)

BTW, I have realized there is another problem: AP only accepts holding speed <990knots (~1.6Mach), despite FSX can handle up to 3.0mach. Do you know how can I change the upper limit? There is nothing in the xml files that states it.
 
Ok, so maybe I am not using them properly. This is my code for Pitch<-0.25 rads:

1 (&gt;K:AP_ATT_HOLD_OFF)
-0.25 (&gt;A:PLANE PITCH DEGREES, radians)

I tested it unconditionally but It did not work. ( I expected my plane to keep a constant pitch of -0.25)

You cannot "write a value" to a "read-only variable!" (except via a SimConnect module)

A:var_name is "Aircraft_read-only"
K:command is "Key_command"

In the FSX SDK, there are two separate lists:

1. Event IDs = Key_commands = (>K:command)

2. Simulation Variables = read-only = (A:var_name,units)

There is no Key_event for setting your pitch directly, unfortunately. There are only three Key_events available:

AP_PITCH_REF_INC_UP
AP_PITCH_REF_INC_DN
AP_PITCH_REF_INC_SELECT (works only with +/- keyboard commands)

(A:PLANE PITCH DEGREES, radians) returns the current pitch of the a/c in radians.

You would need to write your controller using that A:var as a conditional referent

Code:
(A:PLANE PITCH DEGREES, radians) 0.25 &lt;= if{ (>K:AP_PITCH_REF_INC_UP) }

*not tested!
 
Hi Folks

BTW, I have realized there is another problem:
AP only accepts holding speed <990knots (~1.6Mach),
despite FSX can handle up to 3.0mach.
webmailusr-msn -
Your auto-pilot probably trips out
because your aircraft's .cfg is improperly configured,
i.e. insufficiently stable at high speed.

HTH
ATB
Paul
 
Hi Folks


webmailusr-msn -
Your auto-pilot probably trips out
because your aircraft's .cfg is improperly configured,
i.e. insufficiently stable at high speed.

HTH
ATB
Paul
I don't think it is necessarily the cause: if you choose the cessna 172sp, (fsx included, so .cfg should be ok) you could set AP to keep altitude of 99900 ft! of course the airplane is not designed for that, so there should be a way to limit the altitude. As well as to increase the limit of speed of my concorde.
 
Hi Folks

webmailusr-msn -
If your aircraft's .cfg is improperly configured,
i.e. insufficiently stable at high speed
then your AP will trip out.

Until you fix the porpoising,
your AP will not stay engaged.



Altitude and max speed are controlled by various parameters in the aircraft.cfg.
See the SDK - Aircraft Configuration.

For maxspeed,
if thrust is already correctly set
you'll then need to tweak the [flight_tuning] section



Suggest setting up as AI
and observing performance externally,
thus without interference from user-inputs,
or even better, approach the aircraft's developer.



HTH
ATB
Paul
 
Last edited:
Back
Top