# Offline JSBSim Environment Setup This folder contains the offline files needed to run the service JSBSim backend on a Windows x64 machine. ## Included Files ```text offline-deps/ installers/ python-3.13.12-amd64.exe wheels/ jsbsim-1.3.0-cp313-cp313-win_amd64.whl numpy-2.4.4-cp313-cp313-win_amd64.whl checksums/ SHA256SUMS.txt python-runtime/ ... venv/ Scripts/ python.exe ``` `python-runtime/` is a project-local Python installation used to create `venv/`. `venv/` is the runtime environment used by the Node service. ## Fresh Offline Install Run these commands from the repository root: ```powershell cd D:\Coding\AS_Test powershell.exe -ExecutionPolicy Bypass -File .\offline-deps\setup-jsbsim-offline.ps1 ``` The script will: - install the bundled Python runtime into `offline-deps\python-runtime` - create `venv` - install JSBSim from `offline-deps\wheels` - write `service\.env.local` To force-create `venv` again: ```powershell powershell.exe -ExecutionPolicy Bypass -File .\offline-deps\setup-jsbsim-offline.ps1 -Force ``` ## Manual Install Run these commands from the repository root: ```powershell cd D:\Coding\AS_Test offline-deps\installers\python-3.13.12-amd64.exe /quiet InstallAllUsers=0 TargetDir="%CD%\offline-deps\python-runtime" Include_launcher=0 PrependPath=0 Include_test=0 Include_doc=0 Include_tcltk=0 Include_pip=1 offline-deps\python-runtime\python.exe -m venv venv .\venv\Scripts\python.exe -m pip install --no-index --find-links offline-deps\wheels jsbsim==1.3.0 ``` ## Verify Python Packages ```powershell .\venv\Scripts\python.exe -c "import jsbsim, numpy; print('jsbsim', jsbsim.__version__); print('numpy', numpy.__version__)" ``` Expected versions: ```text jsbsim 1.3.0 numpy 2.4.4 ``` ## Run Service With JSBSim Backend If you used the one-click setup script, it already created `service\.env.local`. You can start the service directly: ```powershell cd D:\Coding\AS_Test\service npm.cmd run start ``` Manual environment setup: ```powershell cd D:\Coding\AS_Test\service $env:SIM_BACKEND='jsbsim' $env:JSBSIM_PYTHON='D:\Coding\AS_Test\venv\Scripts\python.exe' npm.cmd run start ``` The service URL remains: ```text http://127.0.0.1:4317 ``` ## Smoke Test In a second PowerShell window: ```powershell Invoke-RestMethod -Uri http://127.0.0.1:4317/health ``` Then test trim: ```powershell $body = @{ aircraftId = 'c172p-jsbsim' altitudeM = 1000 speedMps = 50 headingDeg = 0 flightPathAngleDeg = 0 } | ConvertTo-Json -Depth 8 Invoke-RestMethod -Uri http://127.0.0.1:4317/trim -Method Post -ContentType 'application/json' -Body $body ``` Then test straight simulation: ```powershell $body = @{ aircraftId = 'c172p-jsbsim' sampleRateHz = 5 durationSec = 1 initialState = @{ position = @(0, 1000, 0) velocityMps = 50 headingDeg = 0 } maneuver = @{ type = 'straight' parameters = @{ flightPathAngleDeg = 0 } } } | ConvertTo-Json -Depth 8 Invoke-RestMethod -Uri http://127.0.0.1:4317/simulate -Method Post -ContentType 'application/json' -Body $body ``` ## Notes - The current JSBSim backend supports `straight`, `climb`, and `descent` only. - `level-turn` is still handled by the mock backend until JSBSim control input scripting is added. - The current smoke-test aircraft is `c172p-jsbsim`. - If deploying to a different path, update `JSBSIM_PYTHON` to point at that machine's `venv\Scripts\python.exe`. - If using custom JSBSim aircraft data instead of the data bundled with the Python wheel, set `JSBSIM_ROOT`.