### Install Python Module Manually Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/building-the-program.md Manually install the Python module by navigating to the tests directory and running the setup script. ```bash > cd tests > python setup.py install ``` -------------------------------- ### Install JSBSim Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/building-the-program.md Install the C++ headers and library platform-wide by invoking GNU make from the build directory. ```bash > make install ``` -------------------------------- ### 1D Interpolation Example Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/user/concepts/math.md This example demonstrates the structure for 1D interpolation. The tables are only executed when needed for lookup. ```xml 65

velocities/mach

0.00 ... table 1 definition ...
0.80 ... table 2 definition ...
0.90 ... table 3 definition ...
90

velocities/mach

0.00 ... table 1 definition ...
0.80 ... table 2 definition ...
0.90 ... table 3 definition ...
0 ``` -------------------------------- ### Example 3D Lookup Table with Breakpoints Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/user/concepts/math.md This example illustrates a 3D lookup table where `fcs/row-value`, `fcs/column-value`, and `fcs/table-value` are the independent variables. Each `tableData` section corresponds to a specific `breakPoint` of `fcs/table-value`, containing 2D data for row and column lookups. ```xml fcs/row-value fcs/column-value fcs/table-value -1.0 1.0 0.0 1.0000 2.0000 1.0 3.0000 4.0000 0.0 10.0 2.0 1.0000 2.0000 3.0 3.0000 4.0000 0.0 10.0 20.0 2.0 1.0000 2.0000 3.0000 3.0 4.0000 5.0000 6.0000 10.0 7.0000 8.0000 9.0000
``` -------------------------------- ### Install Python Module with CMake Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/building-the-program.md Configure CMake to install the Python module along with the C++ components, then build and install. ```bash > cmake -DINSTALL_PYTHON_MODULE=ON .. > make > make install ``` -------------------------------- ### Clone JSBSim Reference Manual Repository Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/README.md Clone the repository to contribute to the documentation. Ensure Python3 and pip are installed. ```bash git clone https://github.com/JSBSim-Team/jsbsim-reference-manual.git ``` -------------------------------- ### Run JSBSim with a Script Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/running-the-program.md Execute the JSBSim application by providing a specific simulation script file. This is a common way to start a simulation. ```bash $ JSBSim --script=scripts/c1723.xml ``` -------------------------------- ### Specify Wingspan in Meters Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/user/concepts/units.md This example demonstrates specifying the wingspan in meters, which JSBSim will convert to feet internally. ```xml 10.91 ``` -------------------------------- ### Example 2D Lookup Table for Alpha and Flap Position Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/user/concepts/math.md This example shows a 2D lookup table using `aero/alpha-rad` as the row variable and `fcs/flap-pos-deg` as the column variable. The `tableData` provides values for different combinations of angle of attack and flap deflection. ```xml aero/alpha-rad fcs/flap-pos-deg 0.0 10.0 20.0 30.0 -0.0523599 8.96747e-05 0.00231942 0.0059252 0.00835082 -0.0349066 0.000313268 0.00567451 0.0108461 0.0140545 -0.0174533 0.00201318 0.0105059 0.0172432 0.0212346 0.0 0.0051894 0.0168137 0.0251167 0.0298909 0.0174533 0.00993967 0.0247521 0.0346492 0.0402205 0.0349066 0.0162201 0.0342207 0.0457119 0.0520802 0.0523599 0.0240308 0.0452195 0.0583047 0.0654701 0.0698132 0.0333717 0.0577485 0.0724278 0.0803902 0.0872664 0.0442427 0.0718077 0.088081 0.0968405
``` -------------------------------- ### Clone JSBSim from SourceForge (SSH) Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/getting-the-source.md Use this command to clone the JSBSim repository from SourceForge using the SSH protocol. This requires SSH key setup with SourceForge. ```bash > git clone git://git.code.sf.net/p/jsbsim/code jsbsim-code ``` -------------------------------- ### Example 1D Lookup Table for Angle of Attack Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/user/concepts/math.md This example demonstrates a 1D lookup table where `aero/alpha-rad` is the independent variable. The table maps angles of attack to corresponding values, likely representing aerodynamic coefficients. ```xml aero/alpha-rad -1.57 1.500 -0.26 0.033 0.00 0.025 0.26 0.033 1.57 1.500
``` -------------------------------- ### Clone JSBSim from SourceForge (HTTPS) Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/getting-the-source.md Use this command to clone the JSBSim repository from SourceForge using the HTTPS protocol. Ensure Git is installed and accessible from your command line. ```bash > git clone https://git.code.sf.net/p/jsbsim/code jsbsim-code ``` -------------------------------- ### JSBSim Function with Shorthand Aliases Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/user/concepts/math.md Shows the same function definition as the previous example but utilizes shorthand aliases (

for , for ) for brevity within the JSBSim configuration. ```xml Roll moment due to yaw rate

aero/qbar-area

metrics/bw-ft

aero/bi2vel

velocities/r-aero-rad_sec

aero/alpha-rad 0.000 0.08 0.094 0.19 ... ...
``` -------------------------------- ### Specify Wingspan in Feet Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/user/concepts/units.md This example shows how to specify the wingspan in feet using the `unit="FT"` attribute. ```xml 35.8 ``` -------------------------------- ### Clone JSBSim from GitHub (SSH) Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/getting-the-source.md Use this command to clone the JSBSim repository from GitHub using the SSH protocol. This requires SSH key setup with GitHub. ```bash > git clone git@github.com:JSBSim-Team/jsbsim.git jsbsim-code ``` -------------------------------- ### JSBSim Sum Operation Example Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/user/concepts/math.md Demonstrates a basic sum operation in JSBSim, combining a constant value, a property, and a nested product operation. This structure allows for hierarchical mathematical definitions. ```xml 3.14159 velocities/qbar 0.125 metrics/wingarea ``` -------------------------------- ### Clone JSBSim from GitHub (HTTPS) Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/getting-the-source.md Use this command to clone the JSBSim repository from GitHub using the HTTPS protocol. Ensure Git is installed and accessible from your command line. ```bash > git clone https://github.com/JSBSim-Team/jsbsim.git jsbsim-code ``` -------------------------------- ### Example XML for Flight Control System Components Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/user/concepts/properties.md This XML snippet illustrates the definition of flight control components within a JSBSim aircraft specification file. It shows how inputs, outputs, and scaling are defined for elements like summers and gain controllers, demonstrating the structure that property names will reference. ```xml fcs/elevator-cmd-norm fcs/pitch-trim-cmd-norm -1 1 fcs/pitch-trim-sum -50 50 fcs/pitch-command-scale -0.36 ``` -------------------------------- ### Unit Conversion with Pint Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/Jupyter_Notebooks/00_test_python_packages.ipynb Performs unit conversion from meters per second to knots using the pint library. Ensure the 'pint' library is installed and imported. ```python # Unit conversions #0.82*(75*unit.inch).to(unit.m).to(unit.inch) (12*unit.m/unit.s).to(unit.knot) ``` -------------------------------- ### Initialize Notebook Environment and Imports Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/Jupyter_Notebooks/02_reading_jsbsim_config.ipynb Sets up the notebook environment and imports necessary libraries for data handling, simulation, and XML parsing. ```python %run ./python/nb_init.py %matplotlib inline import numpy as np import geography as geo import data_handling as dh from property_map import pmap from MCSim import * import lxml.etree import sys from io import StringIO import pandas as pd import urllib.request ``` -------------------------------- ### Serve JSBSim Documentation Locally Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/README.md Build and serve the documentation site locally using MkDocs. The site will be available at http://localhost:8000. ```bash mkdocs serve ``` -------------------------------- ### Build Static JSBSim Documentation Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/README.md Build the manual as a static site for offline use. The output will be in the 'site/' directory. Use 'set OFFLINE=true' on Windows. ```bash export OFFLINE=true # OR < set OFFLINE=true > on Windows export CI=false mkdocs build ``` -------------------------------- ### Initialize Notebook Environment Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/Jupyter_Notebooks/00_test_python_packages.ipynb Runs an initialization script and sets up matplotlib for inline plotting. Imports essential libraries for scientific computing. ```python %run ./python/nb_init.py % matplotlib inline import numpy as np import geography as geo import data_handling as dh from property_map import pmap from MCSim import SimFamily, PostGroup, PostData ``` -------------------------------- ### Configure and Initialize JSBSim Simulation Instance Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/Jupyter_Notebooks/01_test_jsbsim.ipynb Creates an instance of the WRSimFamily class, setting up simulation parameters such as the number of instances, script name, autopilot, and output folder. It then configures initial and waypoint positions for the simulation. ```python N = 1 script = 'c172xmod_00_temporary_test_sim' autopilot = 'c172ap_unina_mod' output_fol = '00_temporary_test_sim' # Creating instance of the class Sim_test = WRSimFamily(N, seed_name = script, autopilot_name = autopilot, out_foldername = output_fol, port_num=1026) # Initial positions Sim_test.generate_series('latitude', 'from_list', Lat0) Sim_test.generate_series('longitude', 'from_list', Lon0) # Waypoint positions Sim_test.generate_series('guidance/target-wp-latitude-rad-final', 'from_list', np.radians(Lat1)) Sim_test.generate_series('guidance/target-wp-longitude-rad-final', 'from_list', np.radians(Lon1)) # Flight parameters h_ft = Sim_test.set_value('altitude', (138*unit.m).to(unit.ft).magnitude) psi_deg = Sim_test.set_value('psi', 0) V_kts = Sim_test.set_value('vt', 50) ``` -------------------------------- ### Instantiate and Load Model with FGFDMExec Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/programmer/class-hierarchy.md Demonstrates the instantiation of FGFDMExec and loading a model. Ensure proper initialization parameters are provided. ```cpp fdmex = new FGFDMExec( /* ... */ ); // (1) Instantiation result = fdmex->LoadModel( /* ... */ ); // (2) Model loading ``` -------------------------------- ### Build Python Module with CMake Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/building-the-program.md CMake automatically detects and builds the Python module if Cython is installed. ```bash # Assumes Cython is installed and CMake is configured for Python module build. ``` -------------------------------- ### Initialize JSBSim Environment Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/Jupyter_Notebooks/01_test_jsbsim.ipynb Sets up the Python environment for JSBSim simulations by running initialization scripts and importing necessary libraries. ```python % run ./python/nb_init.py % matplotlib inline import numpy as np import geography as geo import data_handling as dh from property_map import pmap from MCSim import * ``` -------------------------------- ### Create and Activate Virtual Environment Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/README.md Create an isolated virtual environment for project dependencies and activate it. Use 'py -m venv env' on Windows. ```bash cd jsbsim-reference-manual python3 -m venv env # OR < py -m venv env > on Windows ``` ```bash source env/bin/activate # OR < .\env\Scripts\activate > on Windows python3 -m pip install -r requirements.txt # OR < py -m pip install -r requirements.txt > on Windows ``` -------------------------------- ### Navigate to JSBSim Code Directory Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/building-the-program.md Change directory to the JSBSim source code and create a build directory. ```bash > cd jsbsim-code > mkdir build > cd build ``` -------------------------------- ### Build with System Expat Library Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/building-the-program.md Configure CMake to use the system's Expat library instead of the one bundled with JSBSim. ```bash > cmake -DSYSTEM_EXPAT=ON .. > make ``` -------------------------------- ### UTM to Latitude/Longitude Conversion Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/Jupyter_Notebooks/00_test_python_packages.ipynb Converts UTM coordinates to latitude and longitude using the 'utm' library. Requires the 'utm' library to be installed. ```python # UTM to LatLon import utm utm.to_latlon(444005.64156725001521, 5889683.58956928178668+2000, 32, 'U') ``` -------------------------------- ### JSBSim Usage and Options Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/running-the-program.md Displays the usage message and lists all available command-line options for the JSBSim standalone application. Use these to configure simulation parameters. ```bash $ JSBSim Usage (items in brackets are optional): JSBSim [script name] [output directive files names] Options: --help Returns a usage message --version Returns the version number --outputlogfile= Sets/replaces the name of the data log file --logdirectivefile= Sets name of data log directives file --root= Sets the JSBSim root directory (where src/ resides) --aircraft= Sets the name of the aircraft to be modeled --script= Specifies a script to run --realtime Specifies to run in actual real world time --nice Directs JSBSim to run at low CPU usage --suspend Specifies to suspend the simulation after initialization --initfile= Specifies an initialization file to use --catalog Directs JSBSim to list all properties for this model (--catalog can be specified on the command line along with a --aircraft option, or by itself, while also specifying the aircraft name, e.g. --catalog=c172) --end-time=
... table 1 definition ...
0.80 ... table 2 definition ...
0.90 ... table 3 definition ...
``` -------------------------------- ### Open CMakeLists.txt in Visual Studio Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/building-using-visualstudio.md To build using CMake support in Visual Studio, open the root CMakeLists.txt file. ```console C:\source\JSBSim\CMakeLists.txt ``` -------------------------------- ### Default CMake Build Directory Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/building-using-visualstudio.md When using CMake support, Visual Studio defaults to building outside the source tree, often in a user-specific directory with a GUID. This path is shown in the Output window. ```console C:\Users\Sean\CMakeBuilds\3f00c6d9-d323-5a32-8a90-665138817fd4\build\x64-Release ``` -------------------------------- ### Open JSBSim Project in Visual Studio Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/building-the-program.md Open the JSBSim.vcxproj file in Visual Studio to build the executable. Note that CMake is the official build tool. ```plaintext Open the project file `JSBSim.vcxproj` to open a project for JSBSim. ``` -------------------------------- ### JSBSim Function for Lift Contribution Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/user/concepts/forces-and-moments.md An example of a JSBSim function that calculates lift contribution based on flap deflection. It uses a table lookup indexed by flap position and multiplies by dynamic pressure and wing area properties. ```xml Lift contribution due to flap deflection aero/function/ground-effect-factor-lift aero/qbar-area fcs/flap-pos-deg 0.0 0.0 10.0 0.20 20.0 0.30 30.0 0.35
``` -------------------------------- ### Read Local FDM Configuration File Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/Jupyter_Notebooks/02_reading_jsbsim_config.ipynb Loads an FDM configuration file from a local directory using the ConfigFile class and prints its path. ```python fdm_file = ConfigFile('c172x_unina_mod') print("Aircraft FDM path: {0}".format(fdm_file.folderpath)) print("Full FDM file path: {0}".format(fdm_file.path)) ``` -------------------------------- ### Intermediate and Output Directories (Project Files) Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/building-using-visualstudio.md These paths show where Visual Studio stores intermediate build files and the final output when using project files. They are configured to be outside the source tree. ```console C:\source\JSBSim\Debug\x64\JSBSim ``` ```console C:\source\JSBSim\Debug\x64\aeromatic ``` ```console C:\source\JSBSim\Debug ``` -------------------------------- ### Fetch and Parse JSBSim XML Configuration Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/Jupyter_Notebooks/02_reading_jsbsim_config.ipynb Fetches an XML configuration file from a GitHub URL and parses it using lxml. This snippet is useful for programmatically accessing JSBSim aircraft configurations. ```python import urllib.request import lxml.etree url = 'https://raw.githubusercontent.com/JSBSim-Team/jsbsim/master/aircraft/c172x/c172x.xml' with urllib.request.urlopen(url) as response: xmlSource = response.read() fdm_root = lxml.etree.fromstring(xmlSource) results = fdm_root.xpath('//function[@name="aero/function/ground-effect-factor-lift"]') print("Occurrences found: {0}".format(len(results))) node = results[0] print("Attribute: name=\"{0}\"".format(node.attrib["name"])) ``` ```python print("Searching for in node") results2 = node.xpath('.//tableData') # a dot (.) in front to make the search relative to the current element print("Occurrences found: {0}".format(len(results2))) tableData_node = results2[0] print(" content:") print("{0}\n{1}\n{0}".format("-"*30,tableData_node.text)) ``` ```python # trim white spaces from the front and the back tableData_text = tableData_node.text.strip() tableData_text.rstrip() print(" content trimmed:") print("{0}\n{1}\n{0}".format("-"*30,tableData_text)) ``` -------------------------------- ### Build Release Version with Parallel Make Source: https://github.com/jsbsim-team/jsbsim-reference-manual/blob/master/docs/quickstart/building-the-program.md Configure CMake for a Release build with optimized compiler flags and use GNU Make with 4 cores for faster compilation. ```bash > cmake -DCMAKE_CXX_FLAGS_RELEASE="-O3 -march=native -mtune=native" -DCMAKE_C_FLAGS_RELEASE="-O3 -march=native -mtune=native" -DCMAKE_BUILD_TYPE=Release .. > make -j4 ```