### 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
```
--------------------------------
### 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
```
--------------------------------
### 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
```
--------------------------------
### 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=