Showing posts with label X-Plane Plug-In. Show all posts
Showing posts with label X-Plane Plug-In. Show all posts

Friday, October 11, 2013

L-1011 Simulator System Architecture

L-1011 System Architecture 


Had a good conversation with Premek Truksa today and realized that I had not blogged about the revised computer and interface architecture for the L-1011 sim. Well, as they always say in engineering and innovation ... "the first idea is always wrong". With that in mind, over the last few months the systems architecture of the L-1011 sim has changed a few times and as we work through iterations of the model it gets more and more refined. As you can see in the high-level topology drawing above, as of today, October 2013, we are planning on running the L-1011 simulator with the following components:
  1. Three Apple OSX systems running the visual rendering engines and one running the core physics and systems engine. These three systems (depicted in blue) will be tied together by a dedicated 1Gbit Ethernet network. 
  2. The OSX systems running the physics model will also connect to the primary systems network through a second ethernet connection. This will be a 10/100T Ethernet network and all components in the physical simulator will be controlled via this network link. 
  3. The systems network connects a series of ARINC 429 interfaces that will receive and deliver information directly to the physics engine or will send and receive data from a Linux system that handles analog input and output.
  4. Besides the ARINC 429 interfaces there will also an interface (or a set of) that can produce tachometer signals for engine instruments. 
  5. Lastly, all of the analog switch and annunciator I/O will be handled via INTERBUS. The INTERBUS master is the Analog System Linux server. 
For now, this is the systems architecture we are building towards. It could, of course change over time. 

Friday, March 22, 2013

L-1011 CPT Installation - Avionics Simulation Computers

OSX Systems for L-1011 Simulator

It's been quiet around the project for a few days while I have been out for some business travel. While there has not been much motion on the action device at the Museum, I have been busy working on preparing the two computers that will run all the avionics hardware used in the L-1011 simulator.

Two MacPro 8-Core Servers

These two computing power houses, they have 8 cores each, will drive both the PCI expansion drawer with the National Instruments adapters as well the Ethernet attached ARINC 429 interfaces. The systems will run a combination of my own software as well as the X-Plane Simulator platform.

A third system will be used for audio and video generation. Once the two system are fully configured we will install them at the Museum into the Avionics rack. 

Sunday, January 20, 2013

Simulator Integration Planning: ATA 21 - Air Conditioning and Pressurization (Label Assignments - Part 1)

To integrate the L-1011 pressurization panels with Lamina Research x-plane we are able to us a number of datarefs that are already in place for aircraft pressurization. The datarefs are:

sim/cockpit2/pressurization/actuators/cabin_altitude_ft sim/cockpit2/pressurization/actuators/cabin_vvi_fpm sim/cockpit2/pressurization/actuators/dump_all_on sim/cockpit2/pressurization/actuators/dump_to_altitude_on
sim/cockpit2/pressurization/indicators/cabin_altitude_ft sim/cockpit2/pressurization/indicators/cabin_vvi_fpm sim/cockpit2/pressurization/indicators/pressure_diffential_psi


While the datarefs are not complete for the pressurization implementation they are a good starting point.   Lets take a closer look how each dataref that is already present in x-plane can be used and which system elements have to be created as a separate code element for the Air Conditioning and Pressurization subsystem:


1. actuators/cabin_altitude_ft

This dataref sets the cabin altitude that is command in feet. On the L-1011 pressurization panel we have an analog dial that computes the commanded altitude for a given flight level. 

L-1011 Pressurization Panel

The flight level is set with the ALT SET knob and the the cabin altitude is read on the right hand side of the dial. For example, we set FL330 and the L-1011 is capable of safely holing a cabin altitude of 5000ft. In order to set the commanded altitude in x-plane we need to read the analog value from a potentiometer attached to the dial and translate it into a flight level. 

2. actuators/cabin_vvi_fpm

The pressurization module on the L-1011 has several ways of setting the vertical speed for the cabin pressurization. typically any pressurization of 500ft/min in ascent and 300ft/min in descent will be experienced as uncomfortable by passengers. The L-1011 differentiates between a NORMAL and STBY MODE for pressurization. Normal is a fully automated mode and STBY is a somewhat manual mode. 

L-1011 Pressurization Panel - Mode and VVI Select

The mode is selected by the rotary switch on the left and. When the pressurization system is in NORMal mode the preset rates of 500fpm up and 300fpm down can be increased by moving the middle rotary switch to the right. When the system is switched to STBY then both the ascent as well as the descent rate for the system is set with the rotary switch on the right. In order to associate the VVI speeds of the L-1011 to the cabin_vvi_fpm dataref in x-plane we need to convert the analog data represented by a potentiometer in the device for either the NORM or the STBY switch to a number value. X-Plane does not understand VVI for NORM or for STBY ... so I need to create a piece of code that will read the switch position of the MODE SEL switch and then send the respective selected VVI rate from either the NORM RATE or the STBY RATE rotary switch to x-plane. 

3. indicators/cabin_altitude_ft

Depending on the panel configuration, the L-1011 has either two or three gauges relate to aircraft pressurization. Regardless of the number of instruments, the gauges show a) differential pressure, b) cabin vertical speed and c) cabin altitude. The first label to look at is the cabin altitude in feet:

L-1011 Cabin Altitude

Delta used the configuration of gauges as seen above, TWA used a 3 instrument configuration as seen below:

L-1011 Pressurization Panel - TWA

The altitude data needs to be send from x-plane to an ARINC 429 compatible altimeter or output as fine/coarse synchro signals. 

4. indicators/cabin_vvi_fpm

Typically the VVI for the pressurization system on the L-1011 is an actual pressure rate change instrument. In other words, it is fully analog. I will not be able to simulate an actual rate of pressure change with air and therefor will substitute this instrument with a servoed vertical speed indicator.

L-1011 Cabin Vertical Speed - TWA

Depending on the type of servoed instrument the x-plane computed Cabin Vertical Speed needs to be output as analog value between -10VDC to +10VDC.

5. indicators/pressure_diffential_psi


The third and last instrument for the pressurization system of the L-1011 is the Pressure differential indicator. The Laminar Research x-plane simulator computes pressure differential for the hull. 

L-1011 Differential Pressure - TWA

Just as with the Cabin Vertical Speed Indicator the Cabin Pressure Differential gauges is fully analog and will need to be replaced with a servoed version. The x-plane computed pressure differential the needs to be output as an analog value between -10VDC and 10VDC. 

The data value of the pressure differential will also drive a number of additional indicators on the L-1011 pressurization panel that are not covered by the x-plane and/or a x-plane dataref. When pressurization exceeds that maximum permissible pressure differential the SAFETY VALVEs on the aircraft will open to prevent he hull from over pressurizing. There are two annunciators on the L-1011 panel that will illuminate when the safety valves are open. 

L-1011 Pressurization - Alert Annunciators

Safety valve opening is also accompanied by an alarm sound that can be silenced with the HORN CUTOUT momentary switch. The SAFTEY VALVE annunciators are 24VDC relay outputs and the HORN CUTOUT momentary switch is a digtial I/O port. The HORN CUTOUT switch will also be used for an alert that sounds when rapid de-pressurization is sensed. 

Sunday, December 30, 2012

Avionics Bending: Inertial Navigation System (INS) - Part 4

First Litton LTN-72RL CDU  Integration with X-Plane 

So far all of the data you have seen on the Litton LTN-72RL CDU was test data. Today I finally got around to integrate the Litton CDU with X-Plane. For this first setup i chose the data that is displayed on the POSITION DATA page of the CDU; this data is Latitude, Longitude and time in GMT (or Zulu).

Here are the X-Plane data refs that I feed to the CDU via the ARINC 429 interface using ARINC 575 data words:

gLongitude = XPLMFindDataRef("sim/flightmodel/position/longitude");
gLatitude = XPLMFindDataRef("sim/flightmodel/position/latitude");
gZuluHR = XPLMFindDataRef("sim/cockpit2/clock_timer/zulu_time_hours");
gZuluMIN = XPLMFindDataRef("sim/cockpit2/clock_timer/zulu_time_minutes");
gZuluSEC = XPLMFindDataRef("sim/cockpit2/clock_timer/zulu_time_seconds");

While X-Plane does not directly talk to the CDU (it talks to a CDU device driver that does the ARINC formatting and data transfer via UDP) I still chose to implement the data extraction out of X-Plane following the ARINC 429 label standard. The labels are 0310, 0311 and 0150. Below is the code snipped from the X-Plane plugin that builds the extract data:

    // Label 310 - Present Position Latitude
    sbuf.label = 0310;
    sbuf.value = XPLMGetDatad(gLatitude);
    msgsnd( msqidOut, &sbuf, 9,0);
    
    // Label 311 - Present Position Longitude
    sbuf.label = 0311;
    sbuf.value = XPLMGetDatad(gLongitude);
    msgsnd( msqidOut, &sbuf, 9, 0);
    
    // Label 150 - UTC
    sbuf.label = 0150;
    sbuf.value = XPLMGetDatai(gZuluHR)*10000 + XPLMGetDatai(gZuluMIN)*100 + XPLMGetDatai(gZuluSEC);
    msgsnd( msqidOut, &sbuf, 9, 0);    


Lets put all this in motion. Watch the short video below to see the LTN-72RL CDU display the LAT, LNG and GMT data from X-Plane in real time via the ARINC 429/575 data stream:

Thursday, December 20, 2012

ARINC 429/575 Interface Development - Kickstarter

Commercial ARINC 429 interfaces tend to be be very expensive, therefore, myself and my team mates Javier and Himar in Spain are developing an ARINC 429 interface (it will also do ARINC 575 words) for the consumer market as a Kickstarter project. Our proposal is to develop a low-cost way of connecting ARINC 429 devices such as the ones you saw in many of my postings throughout this year. We are lovingly calling it the "ARINC42911" interface and it connects to x-plane and FSX via Ethernet. Please visit our project link on Kickstarter and support us! The site has a short video that shows the features of the interface and how it will enable you to use real world avionics in your home simulator setup.

http://www.kickstarter.com/projects/1753938984/flight-simulator-interface-to-real-avionics-instru

Saturday, December 15, 2012

Avionics Bending: VHF/HF COM Radio Integration with X-Plane (Part 9)

Gables Radio Controller, Audio Panel and Lexicon Multi Channel Audio Interface
Up until now all the audio you heard on the previous blog postings had been live streaming ATC traffic from the Internet. While that is very cool, it is not really useful in the simulator. In the sim we want to be talking to real air traffic controllers. The good thing is that there are several large virtual flight traffic controller communities out there and VATSIM is one of them. Vatsim is a very active community, especially here around Atlanta, and you can connect to it from many different flight simulators. For this blog posting I use X-Plane as the simulator and the XSquawkbox plugin to connect to VATSIM. The video below shows a short demonstration of the end-to-end implementation of the actual flight hardware made by Gables using ARINC 429, the Laminar Research X-Plane simulator and XSquawkbox:

Wednesday, December 12, 2012

Avionics Bending: VHF/HF COM Radio Integration with X-Plane (Part 7)



The last two days I have been mostly working on the integration of the Gables radio head with x-plane. In particular the two VHF COM channels simulated on x-plane. Over the next few days this will then further control VATSIM and the respective VHF COM channels on VATSIM. The video above shows the integration between the original flight hardware and x-plane.

The integration architecture is pretty straight forward as you can see in the image below.

ARINC 429 to X-Plane Data Integration

The data flows from left to right in the diagram. The Gables multi function radio head outputs ARINC 429 data as described in the previous blog postings. The ARINC429 data is read by an ARINC 429 interface and then sent via UDP (Ethernet) to the computer running the simulator (in the video above that is my laptop). The system running the simulator (on the right hand side of the diagram above) also runs a device driver that receives the UDP packets, formats them for x-plane and sends them on to the TAP plugin running under X-Plane.

Next, the VATSIM integration and then we will get back to creating all the necessary audio channels for a radio experience that is close to the real thing as possible.

By the way, today I was asked by someone on the Internet if I modify the original flight hardware (such as the Gables radio heads) to work with my setup. The answer is no, all of the original flight hardware remains in its state as it was flown on the actual aircraft and is not modified at all.

Monday, November 19, 2012

L-1011 Avionics Bending: SFENA HSI and ARINC 429 - Part 13

The next stop on the ARINC 429 label integration between x-plane and the SFENA HSI is ARINC 429 Label 162 for the Automatic Direction Finder (ADF). The ADF is a relatively basic but very powerful instrument. What it does, in essence, is that it points to a Non-Direction Beacon (NDB). It does so, relative to the nose of the aircraft. Well, you know how an ADF and NDB works .. i don't need to go into too much detail here. From an integration perspective, it is important that the HSI shows the bearing to the NDB correct with respect to the aircraft nose ... regardless of the actual magnetic or true heading of the aircraft.

The video below shows the integration of ARINC Label 162 which is encoded as a BNR and uses the same 32bit word encoding I showed you in my blog posting a few days ago that explained BNR as a data payload in the ARINC 429 word.


NDB navigation is fun but can be a bit tricky. I promise that once the simulator is all put together we will fly some non precision approaches using an NDB! By the way, the airport code for San Francisco International is of course KSFO not KFSO as i wrongly stated in the video :)

Wednesday, November 7, 2012

L-1011 Avionics Bending: SFENA HSI and ARINC 429 - Part 6

Proposed Integration of the SFENA HSI with Laminar Research X-Plane 10

The schematic above shows my initial approach to integrating the HSI with the X-Plane software platform. There are several shared code pieces that I also use for other hardware integration efforts. The following code elements are shared:

  • The Avionics Plugin (TAP) - that is my data extraction tool for pulling X-Plane datarefs out of the simulator and storing them in a shared memory segment
  • ARINC 429  Subsystem - takes information out of the shared memory segment, does data transformation from the X-Plane data format to the ARINC 429 compatible data format (e.g. BNR and BCD) and sends it on to the receiver via UDP

On the receiver side there is a need for data being sent in the ARINC 429 Fast and Slow standard as well as a number of 24VDC discrete switches to control the HSI states. For that I will use the DDC DD-42924i5 device driver and SDK kit as well as the National Instruments DAQmx device driver SDK.

Tuesday, November 6, 2012

L-1011 Avionics Bending: SFENA HSI and ARINC 429 - Part 5


So now that we have walked through the major function blocks of the SFENA HSI it is time to think about integrating it with a flight simulator. For this device I will use X-Plane 10 by Laminar Research. As you probably know, the X-Plane platform can output data in a number of ways. Perhaps the easiest way is to simply let the software stream some data via UDP to another computer that the HSI is attached to. However, I will use a different method that will use a X-Plane plugin written in C that will offload the work of sending the data to the HSI to an external device driver ... therefor, keeping the computational demand on X-Plane as minimal as possible while preserving the maximum frame rate.

In particular we will be using at the following data points:

X-Plane 10 Screen Shot of Data Sources
In order to get to all of the parameters I need I will use the SDK for X-Plane and stream the data via the data references (aka. datarefs) exposed by the SDK. So, lets match up some SFENA HSI ARINC 429 labels with X-Plane 10 datarefs (the previous link is valid as of the time of the posting, however over time it might expire and/or change).

ARINC 429 Label: 320    
Function:  Magnetic Heading    
Dataref: sim/cockpit2/gauges/indicators/heading_electric_deg_mag_pilot

ARINC 429 Label: 321
Function: Drift
Dataref: sim/cockpit/gyros/dg_drift_ele_deg

ARINC 429 Label: 012
Function: Ground Speed IRS/AHRS
Dataref: sim/flightmodel/position/groundspeed

ARINC 429 Label: 101
Function: Heading Select
Dataref: sim/cockpit2/autopilot/heading_dial_deg_mag_pilot

ARINC 429 Label: 162
Function: ADF 1 Bearing
Dataref: sim/cockpit2/radios/indicators/adf1_relative_bearing_deg
and/or
Dataref: sim/cockpit2/radios/indicators/adf2_relative_bearing_deg

ARINC 429 Label: 222
Function: Omnibearing
Dataref: sim/cockpit2/radios/actuators/nav1_obs_deg_mag_pilot

ARINC 429 Label: 100
Function: Selected Radial
Dataref: sim/cockpit2/radios/actuators/nav1_course_deg_mag_pilot

ARINC 429 Label: 173
Function: Localizer
Dataref: sim/cockpit2/radios/actuators/nav1_course_deg_mag_pilot

ARINC 429 Label: 174
Function: Glide slope
Dataref: sim/cockpit2/radios/indicators/nav1_vdef_dots_pilot

There are additional labels to follow in the next posting. The HSI will also need a number of discrete lines that need to be switch by X-Plane via a 24V relay. 

Tuesday, July 5, 2011

Avionics Bending: Gables Radio Head ARINC 429 Words to X-Plane DataRef Mapping

The Gables Radio Head that I am using for the L-1011 project transmits and receives ARINC 429 Words. The Labels used are 030, 205 and 207. As I showed you in a previous post the three VHF Communication frequencies that can be selected are all transmitted as a Label 030 word with the SDI being used to identify the channel.


X-Plane does not by default provide a facility for the HF data words that the Gables Radio Head transmits, but they are still fun to capture and perhaps Laminar will incorporate some type of HF function in the future. The relevant HF data word consists of two words transmitted in sequence with a label of 205 and is also differentiated by the words SDI:




Here is how I map the ARINC 429 words to the x-Plane DataRef:
  • ARINC 429 Label 030 SDI 01 (0b01) maps to sim/cockpit2/radios/actuators/com1_frequency_hz
  • ARINC 429 Label 030 SDI 02 (0b10) maps to sim/cockpit2/radios/actuators/com2_frequency_hz
At current, Laminar Research's x-Plane does not provide for a 3rd COM radio. However, it would be great to create a plug-in that simulates all 3 VHF radios as well as the two HF radios using a virtual ATC client.

ARINC Word information taken from "Mark 33 Digital Information Transfer System (DITS) Specification"

Sunday, May 22, 2011

L-1011 Door Controller


Since there really is no consumer grade software, like xPlane, that provides door management controls, I went ahead and wrote myself a little controller that allows me to set the door status on the L-1011 simulator. The controller also sets the shared memory region for the physical device controller that connects to the Annunciator Panel on the Second Officer Station.

The first image above shows the door controls for the passenger doors, the emergency exits and the cockpit hatch.

The second panel allows me to control the cargo doors and the service center doors.


The the third panel I have designed to control the gear doors and the warning indicators for the S-Duct.


The code is written Obj-C and also controls a number of xPlane data refs for gear retraction and pressurization.

Wednesday, April 7, 2010

Avionics Bending - x-Plane Plugin: VHF COMM Raido


In this posting, we will connect the now modified VHF COMM Radio to the X-Plan software. This will close out this avionics bending project for my Lockheed L-1011 project. In the last posting we looked at the firmware code that we loaded on the AT90USB on on the backside of the original flight hardware.

A device driver that I wrote receives the USB data on the computer and puts it into a shared memory segment. I am not showing that code today, but if you are interested to see it, you can drop me a line and I e-mail it to you.

The image below is an output of the USB device driver (it does that in debug mode only).


My X-Plane plug-in does not directly interface with the USB software, it takes a good amount of processing and I don't want to slow down the simulator over time by loading it up with compute intensive attachments, hence, the X-Plane software simple reads the shared memory segment and inserts the code in the the simulator using an XREF. Below, you can see a screen shot that shows the frequency that we selected on the original flight hardware ... except for now it is shown on the COMM radio in X-Plane.



Here is the X-Plane plug-in code that does the magic:

/*
* RadioControl.c
* L1011_SimWare
*
* Created by Curd Zechmeister on 3/29/10.
* Copyright 2010 Area145 Corporation. All rights reserved.
*
*/

#include
#include
#include
#include
#include
#include
#include "XPLMUtilities.h"
#include "XPLMProcessing.h"
#include "XPLMDataAccess.h"

#define ECHOMAX 96

/*
* Simulator Dataword
*/
struct xplnDataWord {

int digit1;
int digit2;
int digit3;
int digit4;
int digit5;

} xplnDataInput, *xplnDataInputPtr;

/*
* X-Plane DataRefs for the L1011 Overhead Panel
*/
/* APU Control */
XPLMDataRef gCockpitRadios;


/* ********************************************************************************************
* * CALLBACK REGISTRATION
* ********************************************************************************************/

float MyFlightLoopCallback(
float inElapsedSinceLastCall,
float inElapsedTimeSinceLastFlightLoop,
int inCounter,
void * inRefcon);

/* ********************************************************************************************
* * PLUGIN STARTUP
* ********************************************************************************************/

PLUGIN_API int XPluginStart(
char * outName,
char * outSig,
char * outDesc)
{



strcpy(outName, "L1011 COM Radio Controller");
strcpy(outSig, "l1011.vhf.com1");
strcpy(outDesc, "Control the Lockheed L1011 Fight Engineer Panels");

/* Engine Start PanelData Refs */
gCockpitRadios = XPLMFindDataRef("sim/cockpit2/radios/actuators/com1_frequency_hz");

/* Register our callback for once a second. Positive intervals
* are in seconds, negative are the negative of sim frames. Zero
* registers but does not schedule a callback for time. */
XPLMRegisterFlightLoopCallback(
MyFlightLoopCallback, /* Callback */
0.3, /* Interval */
NULL); /* refcon not used. */


/* Connect to the shared memory segemtn */
/* Variables */
int iSegmentID;

// Create the shared memory segment
iSegmentID = shmget( 1234, sizeof(xplnDataInput), 0666 | IPC_CREAT );

// attach to the shared memory segment
xplnDataInputPtr = shmat( iSegmentID, 0, 0 );


return 1;
}

/* ********************************************************************************************
* * PLUGIN PAUSE/STOP
* ********************************************************************************************/

PLUGIN_API void XPluginStop(void)
{
/* Unregister the callback */
XPLMUnregisterFlightLoopCallback(MyFlightLoopCallback, NULL);

}

/* ********************************************************************************************
* * PLUGIN DISABLE
* ********************************************************************************************/

PLUGIN_API void XPluginDisable(void)
{

}

/* ********************************************************************************************
* * PLUGIN ENABLE
* ********************************************************************************************/

PLUGIN_API int XPluginEnable(void)
{
return 1;
}

/* ********************************************************************************************
* * PLUGIN RECEIVE MESSAGE
* ********************************************************************************************/

PLUGIN_API void XPluginReceiveMessage(
XPLMPluginID inFromWho,
long inMessage,
void * inParam)
{
}

/* ********************************************************************************************
* * CALLBACK LOOP
* ********************************************************************************************/

float MyFlightLoopCallback(
float inElapsedSinceLastCall,
float inElapsedTimeSinceLastFlightLoop,
int inCounter,
void * inRefcon)
{

int comFrequency;
comFrequency = 0;


/* ********************************************************
* * L1011 COM Panel -- Data Input
* ********************************************************/

comFrequency = ( xplnDataInputPtr->digit1 * 10000 +
xplnDataInputPtr->digit2 * 1000 +
xplnDataInputPtr->digit3 * 100 +
xplnDataInputPtr->digit4 * 10 +
xplnDataInputPtr->digit5 );

XPLMSetDatai( gCockpitRadios, comFrequency );


/* ********************************************************
* * L1011 COM Panel -- Data Output
* ********************************************************/




/* Return 1.0 to indicate that we want to be called again in 1 second. */
return 1.0;
}