示例#1
0
        public void CheckFunctionMix2()
        {
            string test =
                @"<?xml version=""1.0""?>
                  <?xml-stylesheet href=""JSBSim.xsl"" type=""application/xml""?>
                    <function>
                      <quotient>
                        <difference>
                          <value>25.70</value>
                          <quotient>
                            <property>aero/coefficient/CLDf2R</property>
                            <value>833.33</value>
                          </quotient>
                        </difference>
                        <value>100.0</value>
                      </quotient>
                    </function>";

            FDMExecutive fdmex = new FDMExecutive();
            ClassWithPropertiesForFunctions class1 = new ClassWithPropertiesForFunctions("", fdmex.PropertyManager);

            XmlElement elem = BuildXmlConfig(test);
            Function   func = new Function(fdmex, elem);

            if (log.IsDebugEnabled)
            {
                log.Debug("Testing JSBSim Functions: Products with difference");
            }

            //Checks values
            class1.CLDf2R = 0.3491;
            class1.CLDf2L = 1.0000;
            Assert.AreEqual((25.70 - class1.CLDf2R / 833.33) / (100.0), func.GetValue());
        }
示例#2
0
        public void CheckFunctionSin()
        {
            string test =
                @"<?xml version=""1.0""?>
                  <?xml-stylesheet href=""JSBSim.xsl"" type=""application/xml""?>
                    <function name=""aero/coefficient/ClDf2"">
                        <sin>
                          <property>aero/coefficient/CLDf2R</property>
                        </sin>
                    </function>";

            FDMExecutive fdmex = new FDMExecutive();
            ClassWithPropertiesForFunctions class1 = new ClassWithPropertiesForFunctions("", fdmex.PropertyManager);

            XmlElement elem = BuildXmlConfig(test);
            Function   func = new Function(fdmex, elem);

            if (log.IsDebugEnabled)
            {
                log.Debug("Testing JSBSim Functions: Sin");
            }

            //Checks values
            class1.aeroCLDf2R = 0.1;
            Assert.AreEqual(Math.Sin(0.1), func.GetValue());

            //Checks values
            class1.aeroCLDf2R = 0.0;
            Assert.AreEqual(Math.Sin(0.0), func.GetValue());
        }
示例#3
0
        public void CheckFunctionQuotient()
        {
            string test =
                @"<?xml version=""1.0""?>
                  <?xml-stylesheet href=""JSBSim.xsl"" type=""application/xml""?>
                    <function NAME=""aero/coefficient/ClDf2"">
                        <quotient>
                          <property>aero/coefficient/CLDf2R</property>
                          <value>833.33</value>
                        </quotient>
                    </function>";

            PropertyManager propMngr = new PropertyManager();
            ClassWithPropertiesForFunctions class1 = new ClassWithPropertiesForFunctions("", propMngr);

            XmlElement elem = BuildXmlConfig(test);
            Function   func = new Function(propMngr, elem);

            if (log.IsDebugEnabled)
            {
                log.Debug("Testing JSBSim Functions: quotient");
            }

            //Checks values
            class1.aeroCLDf2R = 1000.0;
            Assert.AreEqual(1000.0 / 833.33, func.GetValue());

            //Checks values
            class1.aeroCLDf2R = 0.0;
            Assert.AreEqual(0.0 / 833.33, func.GetValue());
        }
示例#4
0
        public void CheckFunctionDifference()
        {
            string test =
                @"<?xml version=""1.0""?>
                  <?xml-stylesheet href=""JSBSim.xsl"" type=""application/xml""?>
                    <function name=""aero/coefficient/ClDf2"">
                        <description>
                           Airbus A380 SYMETRIC Trailing Edge Flaps                                   
                           Roll Moment Coefficient due to Asymetrical Single Slotted Flap Deflection
                           calculated as difference between left and right flap lift coef,
                           times distance from centerline to MAC of surface
                        </description>
                        <difference>
                          <property>aero/coefficient/CLDf2R</property>
                          <property>aero/coefficient/CLDf2L</property>
                        </difference>
                    </function>";

            FDMExecutive fdmex = new FDMExecutive();
            ClassWithPropertiesForFunctions class1 = new ClassWithPropertiesForFunctions("", fdmex.PropertyManager);

            XmlElement elem = BuildXmlConfig(test);
            Function   func = new Function(fdmex, elem);

            if (log.IsDebugEnabled)
            {
                log.Debug("Testing JSBSim Functions: Difference");
            }

            //Checks values
            class1.aeroCLDf2R = 0.1;
            class1.aeroCLDf2L = 0.2;
            Assert.AreEqual(0.1 - 0.2, func.GetValue());

            //Checks values
            class1.aeroCLDf2R = 0.2;
            class1.aeroCLDf2L = 0.1;
            Assert.AreEqual(0.2 - 0.1, func.GetValue());

            //Checks values
            class1.aeroCLDf2R = 1;
            class1.aeroCLDf2L = 2;
            Assert.AreEqual(1 - 2, func.GetValue());

            //Checks values
            class1.aeroCLDf2R = 2;
            class1.aeroCLDf2L = 1;
            Assert.AreEqual(2 - 1, func.GetValue());
        }
示例#5
0
        public void CheckFunctionProduct()
        {
            string test =
                @"<?xml version=""1.0""?>
                  <?xml-stylesheet href=""JSBSim.xsl"" type=""application/xml""?>
                  <function name=""aero/coefficient/CnDr"">
                <description>
                   Yaw Coefficient due to rudder(DATCOM does not calculate)
                   High value for controllablity, low value
                   for good dynamic stability
                </description>
                <product>
                   <property>aero/qbar-area</property>
                   <property>metrics/bw-ft</property>
                   <property>fcs/rudder-pos-deg</property>
                   <value>  -.1047E-02</value>
                </product>
                </function>";

            FDMExecutive fdmex = new FDMExecutive();
            ClassWithPropertiesForFunctions class1 = new ClassWithPropertiesForFunctions("", fdmex.PropertyManager);

            XmlElement elem = BuildXmlConfig(test);
            Function   func = new Function(fdmex, elem);

            if (log.IsDebugEnabled)
            {
                log.Debug("Testing JSBSim Functions: Products");
            }

            //Checks values
            class1.QbarArea     = 0.3491;
            class1.BwFt         = 1.0000;
            class1.RudderPosDeg = 1.0;
            Assert.AreEqual(0.3491 * 1.0000 * 1.0 * -.1047E-02, func.GetValue());

            class1.QbarArea     = 0.1;
            class1.BwFt         = 0.2;
            class1.RudderPosDeg = 0.3;
            Assert.AreEqual(0.1 * 0.2 * 0.3 * -.1047E-02, func.GetValue());

            class1.QbarArea     = 1;
            class1.BwFt         = 2;
            class1.RudderPosDeg = 3;
            Assert.AreEqual(1 * 2 * 3 * -.1047E-02, func.GetValue());
        }
示例#6
0
        public void CheckFunctionPow()
        {
            string test =
                @"<?xml version=""1.0""?>
                  <?xml-stylesheet href=""JSBSim.xsl"" type=""application/xml""?>
                    <function NAME=""aero/coefficient/ClDf2"">
                        <pow>
                          <property>aero/coefficient/CLDf2R</property>
                          <property>aero/coefficient/CLDf2L</property>
                        </pow>
                    </function>";

            PropertyManager propMngr = new PropertyManager();
            ClassWithPropertiesForFunctions class1 = new ClassWithPropertiesForFunctions("", propMngr);

            XmlElement elem = BuildXmlConfig(test);
            Function   func = new Function(propMngr, elem);

            if (log.IsDebugEnabled)
            {
                log.Debug("Testing JSBSim Functions: Pow");
            }

            //Checks values
            class1.aeroCLDf2R = 0.1;
            class1.aeroCLDf2L = 0.2;
            Assert.AreEqual(Math.Pow(0.1, 0.2), func.GetValue());

            //Checks values
            class1.aeroCLDf2R = 0.2;
            class1.aeroCLDf2L = 0.1;
            Assert.AreEqual(Math.Pow(0.2, 0.1), func.GetValue());

            //Checks values
            class1.aeroCLDf2R = 1;
            class1.aeroCLDf2L = 2;
            Assert.AreEqual(Math.Pow(1, 2), func.GetValue());

            //Checks values
            class1.aeroCLDf2R = 2;
            class1.aeroCLDf2L = 1;
            Assert.AreEqual(Math.Pow(2, 1), func.GetValue());
        }
示例#7
0
        public void CheckFunctionMixProductDifference()
        {
            string test =
                @"<?xml version=""1.0""?>
                  <?xml-stylesheet href=""JSBSim.xsl"" type=""application/xml""?>
                    <function NAME=""aero/coefficient/ClDf2"">
                    <description>
                       Airbus A380 SYMETRIC Trailing Edge Flaps                                   
                       Roll Moment Coefficient due to Asymetrical Single Slotted Flap Deflection
                       calculated as difference between left and right flap lift coef,
                       times distance from centerline to MAC of surface
                    </description>
                    <product>
                       <value>     33.74</value>
                       <difference>
                          <property>aero/coefficient/CLDf2R</property>
                          <property>aero/coefficient/CLDf2L</property>
                       </difference>
                    </product>
                    </function>";

            PropertyManager propMngr = new PropertyManager();
            ClassWithPropertiesForFunctions class1 = new ClassWithPropertiesForFunctions("", propMngr);

            XmlElement elem = BuildXmlConfig(test);
            Function   func = new Function(propMngr, elem);

            if (log.IsDebugEnabled)
            {
                log.Debug("Testing JSBSim Functions: Products with difference");
            }

            //Checks values
            class1.CLDf2R = 0.3491;
            class1.CLDf2L = 1.0000;
            Assert.AreEqual(33.74 * (0.3491 - 1.0), func.GetValue());
        }