Using RotorLib and FixedWingLib with your own control systems

FixedWingLib FDM and RotorLib FDM respectively model fixed wing and rotary wing aircraft. They also include control system building blocks and ready to use control systems within the aircraft models (GenAirplane100 and GenHeli500).

Those models (both C++ classes indeed) are ready to use models which simulate generic aircraft. They can be used as they are for general purpose simulations or they can be customized with the XML files to simulate a type specific aircraft. You can go even more and change the models to simulate non-conventional aircraft configurations.

Some of our users however need just the aircraft model, just a model of the aircraft without any control system or stability augmentation system for their own control algorithm development.

This is pretty straight forward with FixedWingLib FDM and RotorLib FDM. Below we describe the most common 3 steps of this modeling effort.

In this article, we focus on the FDM products (flight dynamics models) such as RotorLib FDM and FixedWingLib FDM. Unlike the CGF products, FDMs are designed to deliver as high fidelity as possible so they are ideal for engineering use. CGFs focus on easy to use maneuvers for C++ developers.

1. Remove the control systems

The control systems are described in the XML files. Here is the XML part for GenHeli500:

    <ControlSystem>
        <FCSComponent type="FCSHelicopterAutoTrim100" >
            <YawRateAndSideslipController printDebugInfo="false">
                <YawRatePID P="0.03"  I="0.1" D="0.0" offset="0.0" integralMin="-10" integralMax="10" />
                <SideslipPID P="0.08"  I="0.1" D="0.05" offset="0.0" integralMin="-10" integralMax="10" />

                <Transition speedLow="10" speedHigh="29" />
                <Maximums maxYawRate="30" maxSideslip="30" />
                <InputMapping nonlinearity="2" />
            </YawRateAndSideslipController>

            <PitchRateController printDebugInfo="false">
                <PID P="0.01"  I="0.2" D="0.0" offset="0.0" integralMin="-5" integralMax="5" />
                <MaxPitchRate maxPitchRate="35" />
                <InputMapping nonlinearity="4" />
            </PitchRateController>


            <RollRateController printDebugInfo="false">
                <PID P="0.015"  I="0.05" D="0.0" offset="0.0" integralMin="-20" integralMax="20" />
                <MaxRollRate maxRollRate="70" />
                <InputMapping nonlinearity="3" />
            </RollRateController>

        </FCSComponent>

    <FCSComponent type="FCSRotationDamper">
      <YawController P="2" D="0"/>
      <PitchController P="2.0" D="0"/>
      <RollController P="0.4" D="0.01"/>
    </FCSComponent>

  </ControlSystem>
  

Now all you need to do is to replace the lines above with:

    <ControlSystem>
    </ControlSystem>
  

This XML will practically tell RotorLib FDM to create the helicopter with no control systems.

2. Change configuration to match your aircraft

The aircraft configuration is defined in the XML file. By configuration, we mean parameter values such as mass, moments of inertia, fuselage drag coefficient curves, engine RPM, blade twist etc.

The modeling of your own specific aircraft requires you to find and type in these values. This effort requires understanding of the airplane configuration values. This can be done best by an aerospace engineer. However our FDM products such as RotorLib FDM and FixedWingLib FDM documentation include extensive
information about the parameters as well as drawings describing how all those systems (control system, main rotor, engines etc.).

RTDynamics support is glad to assist you to configure your own airplane and helicopters. Please also note that RTDynamics also provides airplane modeling services.

3. Connect your control algorithms with C++

Now that we have an airplane or helicopter model, now you can use it with your own control algoritms. This requires to integrate RotorLib or FixedWingLib using the C++ SDK. Depending on how you model and code the control algorithms, the integration effort is slightly different.

Again, RTDynamics support would be glad to assist you here.

Other notes

a. In addition to the simulation models, RotorLib FDM includes a very fast trim solver which find steady state conditions for your helicopter models.

b. RotorLib FDM is also available for MATLAB and Simulink and supports trim finding and linearization with MATLAB and Simulink.

Leave a Reply

Your email address will not be published. Required fields are marked *