• 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.

Custom engine starter

Dutcheeseblend

Resource contributor
Messages
1,541
Country
netherlands
Hi everybody,

I've been working on a custom startup procedure for my Fokker T.5 bomber (Bristol Pegasus XXVI engines), which involves a starter running longer than the FSX default starter. I opted to 'fake' a starter enable the FSX starter in another way. Let me first explain that.

There are two knobs involved for starting: the starter engine knob and the booster coil knob. Both have to be pressed (more or less at the same time) in order to be able to start the engine. This also allows one to turn the engine without starting it, in fact, because the booster coil isn't enabled yet. Something that is also mentioned in the original T.5 handbook and could be used to make sure all cylinders run free.

So, from my logic, I made a variable (L:FT5_starter_L,bool) which initiates a slowly turning prop animation (L:FT5_starter_rot_L,enum).
Next, if the pilot presses the booster coil, the variable (L:FT5_bobine_L,bool) is switched on which will initiate the real FSX starter, if and only if all conditions for starting are met.

My problem is in the mentioned 'slowly turning prop animation'. This animation is applied on a dummy object, which is a parent of the prop. How can I make a running animation, which also increases in RPM (from 0 to 60 or something and then constant)?

Thank you!

Daan
 

ddawson

Resource contributor
Messages
862
Country
canada
This is one of the things that was easier with FS9... We could control both engine and prop rpm with FSUIPC.
For FSX, maybe try to separate animated parts. One, a traditional prop animation, controlled by prop rpm, but hidden when the engine combustion variable is false. The second animation would be driven by your calculated L:Var and would be hidden once the engine combustion variable became true.
 

Dutcheeseblend

Resource contributor
Messages
1,541
Country
netherlands
This is one of the things that was easier with FS9... We could control both engine and prop rpm with FSUIPC.
For FSX, maybe try to separate animated parts. One, a traditional prop animation, controlled by prop rpm, but hidden when the engine combustion variable is false. The second animation would be driven by your calculated L:Var and would be hidden once the engine combustion variable became true.

Thank you! Well, I use a parent that only could rotate when the prop rpm is lower than 500. But that's not exactly the thing I struggle with. The problem is, how should I make the L:Var that drives the fake prop animation?
 

tgibson

Resource contributor
Messages
10,768
Country
us-california
Use an animation between 0 and some number. Then add a Lag statement that will cause the prop to speed up from 0 at the rate you want.

Here is an example of an animation section using keyframes from 0 to 100 and a Lag statement:

Code:
      <animation>
       <Parameter>
       <Code>  (A:LIGHT LANDING, bool) if{ 0 } els{ 100 } </Code>
        <Lag>30</Lag>
       </Parameter>
    </animation>
 
Messages
945
Country
australia
I use an L var called prop offset which is from 0 to 100. The following code is always "on" so to speak and controls the prop speed. The slow, fast etc animations of the prop are children of this part and are actually attachpoint visibility parts rather than animations.

Check if is user sim to avoid any prop problems with other aircraft in multiplayer. Convert prop rotation angle to 0 to 100 by multiplying by 0.1592. 100 % takes modulo so this always returns 0 to 100.

You then need to feed values into Prop_Offset to get a slowly starting animation. You would do this with another variable which you could call prop_rate.

Start at 0 and slowly increase prop_rate when your custom starter starts.

If prop_rate is less than steady rate and custom starter has started but FSX starter is not running or engine is not running increase the prop_rate

Decrease prop_rate to zero if the engine has stopped and the starter is not running to simulate the custom starter stopping before the FSX starter cuts in.

Then prop_offset = prop_offset + prop_rate. Use modulo to limit prop_offset to 0 to 100 to avoid a possible overflow as prop_offset must constantly change to simulate a turning prop.

TLDR; You need two L: variables, one is the rate of rotation and the other is an offset to the A prop rotation angle variable.

Code:
<Animation name="propeller_axle_anim" guid="F3D60BD1-F3AF-4482-8360-FE53C6DECB51" type="Sim" typeParam2="propeller_axle_anim" length="100" typeParam="AutoPlay" />
<PartInfo>
    <Name>propeller_axle_anim</Name>
    <AnimLength>100</AnimLength>
    <Animation>
        <Parameter>
              <Code>
            (A:IS USER SIM,bool)
            if{
                (A:PROP ROTATION ANGLE:1,percent) 0.1592 * (L:Prop_Offset,number) + 100 %
            }
            els{
                (A:PROP ROTATION ANGLE:1,percent) 0.1592 *
            }
            </Code>
        </Parameter>
    </Animation>
</PartInfo>
 

Dutcheeseblend

Resource contributor
Messages
1,541
Country
netherlands
I use an L var called prop offset which is from 0 to 100. The following code is always "on" so to speak and controls the prop speed. The slow, fast etc animations of the prop are children of this part and are actually attachpoint visibility parts rather than animations.

Check if is user sim to avoid any prop problems with other aircraft in multiplayer. Convert prop rotation angle to 0 to 100 by multiplying by 0.1592. 100 % takes modulo so this always returns 0 to 100.

You then need to feed values into Prop_Offset to get a slowly starting animation. You would do this with another variable which you could call prop_rate.

Start at 0 and slowly increase prop_rate when your custom starter starts.

If prop_rate is less than steady rate and custom starter has started but FSX starter is not running or engine is not running increase the prop_rate

Decrease prop_rate to zero if the engine has stopped and the starter is not running to simulate the custom starter stopping before the FSX starter cuts in.

Then prop_offset = prop_offset + prop_rate. Use modulo to limit prop_offset to 0 to 100 to avoid a possible overflow as prop_offset must constantly change to simulate a turning prop.

TLDR; You need two L: variables, one is the rate of rotation and the other is an offset to the A prop rotation angle variable.

Code:
<Animation name="propeller_axle_anim" guid="F3D60BD1-F3AF-4482-8360-FE53C6DECB51" type="Sim" typeParam2="propeller_axle_anim" length="100" typeParam="AutoPlay" />
<PartInfo>
    <Name>propeller_axle_anim</Name>
    <AnimLength>100</AnimLength>
    <Animation>
        <Parameter>
              <Code>
            (A:IS USER SIM,bool)
            if{
                (A:PROP ROTATION ANGLE:1,percent) 0.1592 * (L:Prop_Offset,number) + 100 %
            }
            els{
                (A:PROP ROTATION ANGLE:1,percent) 0.1592 *
            }
            </Code>
        </Parameter>
    </Animation>
</PartInfo>

Ok, thank you Anthony! What I still wonder, how do you create this prop_rate variable? If it is constant, there's no problem, prop_rate is then just a constant number. But how to increase/decrease this variable gradually? That's where I get stuck...

I was working to let the prop be controlled by a 0 - 1 bool (so the anim would be 0 -360 degrees), while the animation itself has a Lag which is controlled (based on a time variable*). This gives a speed control, but apparently the sim didn't like this 'controlled lag' (so, is it possible or not, a controlled lag?).

*
Code:
<Lag>L:Var</Lag>
 

Heretic

Resource contributor
Messages
6,828
Country
germany
Too tired to be elablorate, so...

R1830, which uses an energized starter that makes the crew count blades.

Prop animation variable:
Code:
(L:DC3 Prop Rotation L, number)

Model animation controller:
Code:
(L:DC3 Starter, number) 1 ==
(A:GENERAL ENG STARTER:1, bool) ! and
(A:GENERAL ENG COMBUSTION:1, bool) ! and
if{ (L:DC3 Prop Rotation L, number) (L:DC3 Prop Rotation Speed, number) + 100 % (>L:DC3 Prop Rotation L, number) }

(L:DC3 Starter, number) 0 ==
(A:GENERAL ENG COMBUSTION:1, bool) or
(A:GENERAL ENG STARTER:1, bool) or
if{ (A:PROP ROTATION ANGLE:1, radians) 15.92 * (>L:DC3 Prop Rotation L, number) }

2D system gauge:
Code:
(L:DC3 Energizer L, bool)
(L:DC3 Starter, number) 1 == and
(A:GENERAL ENG STARTER:1, bool) ! and
if{ (>K:TOGGLE_STARTER1) }

<!-- Auto-disengage starter when engine has fired up -->
(L:DC3 Energizer L, bool)
(A:GENERAL ENG COMBUSTION:1, bool) and
(L:DC3 Starter, number) 1 == and
(A:GENERAL ENG STARTER:1, bool) and
if{ (>K:TOGGLE_STARTER1) 0 (&gt;L:DC3 Energizer L, bool) 0 (>L:DC3 Starter, number) }

Throw a custom, looped sound file (playback via DSD's XML sound gauge) into the mix and you get a semi-convincing startup.
 
Messages
945
Country
australia
Ok, thank you Anthony! What I still wonder, how do you create this prop_rate variable? If it is constant, there's no problem, prop_rate is then just a constant number. But how to increase/decrease this variable gradually? That's where I get stuck...

I was working to let the prop be controlled by a 0 - 1 bool (so the anim would be 0 -360 degrees), while the animation itself has a Lag which is controlled (based on a time variable*). This gives a speed control, but apparently the sim didn't like this 'controlled lag' (so, is it possible or not, a controlled lag?).

*
Code:
<Lag>L:Var</Lag>

Prop_rate cannot be a constant. It is the speed at which your prop is rotating. So it will start at 0, go up to the maximum speed that you want your starter to spin the prop and then back down to zero again if you turn off the starter.

This is what I do in C++. starter_prop_rate is the prop_rate speed and goes from 0 to 0.3. This is rather complex for xml as it does some things you can't really do in xml. For one thing this is done one a per frame basis which is why I use a frametime variable to account for varying framerates.

Code:
    // Calculate prop motions
    if ( starter_counter == 0 )
    {
        // Starter is off so slow down the prop_offset
        if ( starter_prop_rate > 0 )
        {
            starter_prop_rate = starter_prop_rate - double(frametime) / 18000;
            if ( starter_prop_rate < 0 )
            {
                starter_prop_rate = 0;
            }
            prop_offset = ( prop_offset + starter_prop_rate * ( frametime * rate_scaling ) ) - floor ( ( prop_offset + starter_prop_rate * ( frametime * rate_scaling ) ) / 100 ) * 100;
            //set_named_variable_value(prop_offset_id, FLOAT64(prop_offset));
        }
    }
    else
    {
        // Starter is on so increase prop_offset ( 0 to 100 = 360 degrees )
        starter_prop_rate = starter_prop_rate + double(frametime * rate_scaling) / 3000;
        if ( starter_prop_rate > 0.3 )
        {
            starter_prop_rate = 0.3;
        }
        prop_offset = ( prop_offset + starter_prop_rate * ( frametime * rate_scaling ) ) - floor ( ( prop_offset + starter_prop_rate * ( frametime * rate_scaling ) ) / 100 ) * 100;
    }

For XML I would do something like this:

If custom starter is on:
- prop_rate = prop_rate + 1 (1 is the acceleration rate, you can adjust this as you like)
- if prop_rate > 20 then prop_rate = 20 (sets your maximum, you'd need to adjust this depending on how fast you want the prop to spin )
If custom starter is off:
- prop_rate = prop_rate - 0.5 (0.5 is the deceleration rate, again adjustable)
- if prop_rate < 0 then prop_rate = 0 (stops the prop)
prop_offset = prop_offset + prop_rate 100 % (modulus 100 to limit range to 0 to 100)
 

Dutcheeseblend

Resource contributor
Messages
1,541
Country
netherlands
Spot on Anthony! Er, haven't tried it yet, but it is very likely what I need.

Thank you, Daan
 

Dutcheeseblend

Resource contributor
Messages
1,541
Country
netherlands
Ok, thanks to you guys I got this code:

Code:
<!-- Starter animation -->
(L:FT5_starter_L,bool)
if{ (L:FT5_starter_rate_L,enum) 0.0625 + (>L:FT5_starter_rate_L,enum) }
els{ (L:FT5_starter_rate_L,enum) 0.03125 - (>L:FT5_starter_rate_L,enum) }

(A:GENERAL ENG COMBUSTION:1,bool) (A:GENERAL ENG STARTER:1, bool) and
if{ 0 (>L:FT5_starter_L,bool) 0 (>L:FT5_starter_rate_L,enum) }

(L:FT5_starter_rate_L,enum) 0 >
if{ (L:FT5_starter_rot_L,enum) (L:FT5_starter_rate_L,enum) + 100 % (>L:FT5_starter_rot_L,enum) }
els{ (L:FT5_starter_rot_L,enum) (>L:FT5_starter_rot_L,enum) }

(L:FT5_starter_rate_L,enum) 5 >= if{ 5 (>L:FT5_starter_rate_L,enum) }
0 (L:FT5_starter_rate_L,enum) >= if{ 0 (>L:FT5_starter_rate_L,enum) }
(same code for RH engine, of course)

And it works beautiful! :D

Keeping the rate at a constant of 5 means an RPM of 90 (5*18Hz), which looks comfortable.

Thank you all guys!
 

n4gix

Resource contributor
Messages
11,662
Country
unitedstates
I've managed to get the non-combustion animation and sound working. My problem is that the bloody engines won't start!

  1. Battery Master on
  2. Set mixture(s) to full rich
  3. Both Mag1 (labeled Battery) and Mag2 (labeled Mag) off
  4. L-Click on starter toggle switch, left engine rotates allowing one to 'count the props' and distribute oil in the radial's cylinders.
  5. Release starter toggle
  6. Set either or both Mags on
  7. L-Click to trigger (>K:TOGGLE_STARTER1)
Unfortunately, the starter 'whines' briefly and then stops. Engine will not start at all. Plenty of fuel in tanks.

Ctrl-E works of course. BTW, nothing is 'painted' yet so I temporarily made the switches 'white' so I could see the silly things! There's a neat "crash bar" that will instantly kill all four mag switches.
r4yge.jpg
 

tgibson

Resource contributor
Messages
10,768
Country
us-california
For most radial piston engines, you do not release the starter before throwing the mags to ON. You release the starter after the engine catches and starts accelerating. Perhaps the engine RPM goes too low by the time you throw the mags?
 

n4gix

Resource contributor
Messages
11,662
Country
unitedstates
Is there fuel pressure, or even fuel selectors open?
Full tanks, fuel valves are open (else autostart wouldn't be working), fuel pumps on, no start...

SOLVED: I had to increase the starter torque in the aircraft.cfg file:

normalized_starter_torque= 0.235 // was 0.035
 

tgibson

Resource contributor
Messages
10,768
Country
us-california
Are you using a slow rotation gauge like Doug Dawson's? It does make the startup ever so realistic. Fs9 only, though. Of course, if you don't roll your own you'd probably have to pay for Doug's (assuming a commercial product).
 

n4gix

Resource contributor
Messages
11,662
Country
unitedstates
Tom, I scripted custom stuff for each of the three prop conditions. I could easily add as many as I want, but for now three is sufficient!
Code:
(L:Prop0_still,enum) (L:Prop0_still_value,enum) + 100 % (>L:Prop0_still,enum)
(L:Prop0_slow,enum) (L:Prop0_slow_value,enum) + 100 % (>L:Prop0_slow,enum)
(L:Prop0_blurred,enum) (L:Prop0_blurred_value,enum) + 100 % (>L:Prop0_blurred,enum)

(A:RECIP ENG LEFT MAGNETO:1,bool) !
(A:RECIP ENG RIGHT MAGNETO:1,bool) ! and
(L:StarterLeft,bool) and
(L:SW_Master_Battery,bool) and
if{ 4 (>L:Prop0_still_value,enum) 2 (>L:XMLSND20,enum) } els{ 0 (>L:Prop0_still_value,enum) 3 (>L:XMLSND20,enum) }

(A:RECIP ENG LEFT MAGNETO:1,bool)
(A:RECIP ENG RIGHT MAGNETO:1,bool) or
(L:StarterLeft,bool) and
(L:SW_Master_Battery,bool) and
(A:GENERAL ENG STARTER:1, bool) ! and
if{ (>K:TOGGLE_STARTER1) }
The above is how it is scripted at the moment. I still need to add a condition for fuel pressure, because the real T-50 requires one to use the primer pump a few strokes to build up around 3 to 5 lbs of pressure in the fuel line.

This 4 (>L: Prop0_still_value,enum) swings the prop slowly while playing XMLSND20 (engine cranking sound). I am going to replace the constant 4 with a modulated variable that will swing the prop more realistically. I'm also going to add a counter such that one has to make at least four full revs (count 8 prop blades!) to ensure that oil is properly distributed prior to attempting a start.
 
Last edited:
Top