You are on page 1of 23

Active Sky

Application Programming Interface (API)


Active Sky API

Contents

Introduction ............................................................................................................................................ 3
Ambient Icing ......................................................................................................................................... 4
Other Ambient Parameters..................................................................................................................... 5
Wind Shear Information .......................................................................................................................... 6
Radar Information................................................................................................................................... 7
Parameters:..................................................................................................................................... 7
Using the Callback ........................................................................................................................... 8
Notes and Restrictions .................................................................................................................... 8
Weather Information ............................................................................................................................ 10
File-Based (Text) Weather Information ............................................................................................. 10
In-Process API Weather Information ................................................................................................. 10
HTTP-Based Weather Information .................................................................................................... 13
Getting the Active Runways (either current or forecast) at an Airport ................................................... 15
Getting or Setting the Weather Mode of Active Sky ............................................................................. 16
Setting Custom Weather .......................................................................................................................17
Adding Custom Effects ......................................................................................................................... 19
Loading a Flight Plan ............................................................................................................................ 23

Copyright © 2016-2017 HiFi Technologies, Inc. Page 2


Active Sky API

Introduction

The Active Sky API has been designed to allow 3rd-party developers of FSX/P3D add-ons to interface
with ACTIVE SKY (Since ASNext SP3) and obtain data including weather, ambient and radar
information.

Some of the possibilities using this API include: Ability to read active weather conditions, integrated
weather radar, integrated icing simulation and more.

Note that we are actively seeking requests for further integration possibilities. If you have specific
requests please forward them to us via our helpdesk.

P3Dv4 NOTICE: For P3Dv4 and ASP4, the ASConnect module name has been renamed from
as_btstrp.dll to as_connect_64.dll. Radar and other API integration using exported functions will
need to be updated to identify the appropriate module. Pointer variables/handles will also need to
be updated with 64-bit-compatible types i.e. UINT_PTR and cannot be stored in long/INT types.

Further, if you need technical assistance in implementing integration using this API, feel free to contact
us via our helpdesk.

Our helpdesk is available at http://support.hifitechinc.com.

Copyright © 2016-2017 HiFi Technologies, Inc. Page 3


Active Sky API

Ambient Icing

ACTIVE SKY controls (in real time) the ambient icing level applied to the aircraft. The ambient icing
experienced is more realistic than default FSX/P3D implementation as it actively considers actual cloud
positions. Icing will only accrue when within visible moisture (clouds and certain precipitation) at
freezing temperatures and below according to realistic icing reference parameters.

To access ambient icing information, import the global exported variable (from
as_btstrp.dll/as_connect_64.dll) as follows:

int AmbientIcing; (ordinal 14)

The AmbientIcing variable will be a value from 0 to 4:

0: No icing
1: Light icing
2: Moderate icing
3: Heavy icing
4: Severe icing

Note: This imported variable will be a pointer to the actual value.

Copyright © 2016-2017 HiFi Technologies, Inc. Page 4


Active Sky API

Other Ambient Parameters

ACTIVE SKY controls (in real time) also other ambient parameters that may be directly accessed
through global exported variables in as_bstrp.dll (AS16) or as_connect_64.dll (ASP4):

float AmbientTurbulence = 0; // This is a value from 0.0 to 1.0 representing the ambient
turbulence intensity currently applied to the aircraft

byte AmbientTurbEnum = 0; // The ambient turbulence enum before applying turbulence scale
correction (0=None, 1=Light, 2=Moderate, 3=Heavy, 4=Severe)

float AmbientWindDir = 0; // The ambient wind direction currently injected from ActiveSky
into the sim

float AmbientWindSpeed = 0; // The ambient wind speed currently injected from ActiveSky
into the sim

byte ExportedPrecipType = 0; // This is a value representing the precipitation type


currently applied to the aircraft. Possible values: 0=None, 1=rain, 2=snow, 3=hail

byte ExportedPrecipRate = 0; // This is a value representing the current ambient


precipitation rate (a value 0-4)

float ExportedAmbientVisibility = -1; // in meters. If negative, then ACTIVE SKY does not
control it

byte InCloud = 0; // A flag, that is true when the aircraft is in a cloud currently

Copyright © 2016-2017 HiFi Technologies, Inc. Page 5


Active Sky API

Wind Shear Information

ACTIVE SKY simulates wind shear and a Predictive Wind Shear system.

The associated data (wind shear objects, either active or as detected by PWS within 3nm ahead of the
aircraft) can be accessed by importing the global exported variables (from
as_btstrp.dll/as_connect_64.dll) as follows:

float WshLat; // the windshear latitude (in degrees decimal) (ordinal 15)

float WshLon; // the windshear longitude (in degrees decimal) (orderinal 16)

float WshRange; // the windshear range (diameter in meters) around the center location defined by
WshLat/WshLon (ordinal 17)

float WshMinAlt; // the minimum/lower altitude (in feet) where the wind shear is applicable (ordinal 18)

float WshMaxAlt; // the maximum/higher altitude (in feet) where the wind shear is applicable (ordinal 19)

Note: If no wind shear is present (or detected), then all the above values will be set to 0.

Note: These imported variables will be pointers to the actual values.

Copyright © 2016-2017 HiFi Technologies, Inc. Page 6


Active Sky API

Radar Information

With advanced cloud position (sprite) awareness, ACTIVE SKY includes accurate precipitation
simulation with integrated radar functionality. All relevant radar information (including associated
turbulence) can be accessed.

The advanced radar functionality includes multiscanning (2 simultaneous radar beams, each with
different range and tilt).

To access data, use the exported SetRdrParams function (ordinal 20) as follows:

void SetRdrParams(long aircraftHeading, long range1, float tilt1, long range2, float tilt2,
RadarDataComplete callBack, void* pCaller, long optionsFlag);

Parameters:

aizrcraftHeading: The aircraft heading (a value 0-359) in degrees

range1: This will be the "main" radar beam range in meters (that will also help determine the size of the
returned radar byte array). If set to 0, then the radar functionality is disabled. This should also be set
to zero, on finalization (e.g. unloading the aircraft)

tilt1: This is the tilt value (in degrees) for the "main" radar beam. A positive value means an "up" tilt, while
a negative value is a "down" tilt.

range2: This is the "secondary" beam range in meters. If set to zero, then only the first (main) beam will be
used (simulating manual mode).

tilt2: This is the tilt value (in degrees) for the "secondary" radar beam.

callback: is a function pointer that should have this signature:

typedef void (CALLBACK *RadarDataComplete)(long rdrSmallDimSize,


void* rdrData, void* pContext);

pContext: is meant to be a class pointer to the instance of the class using the radar functionality

optionsFlagContext: By default this value should be zero. This will give a chance to clients to request
somewhat altered behavior in particular in relation to the data returned by ACTIVE SKY. This will be
provided by additional documentation and a set of possible defined values. At the moment these are:

#define ACTIVE SKY_RDR_PARAMS_UNUSED_1 0x00000001


#define ACTIVE SKY_RDR_PARAMS_UNUSED_2 0x00000002
#define ACTIVE SKY_RDR_PARAMS_UNUSED_3 0x00000004
#define ACTIVE SKY_RDR_PARAMS_UNUSED_4 0x00000008

Copyright © 2016-2017 HiFi Technologies, Inc. Page 7


Active Sky API

Using the Callback


 Once ACTIVE SKY completes the cloud sprite enumeration (taking into account the range1,
tilt1, etc. parameters), it will create a 2-d array of bytes containing the precipitation intensity (a
value from 0-255) and will invoke a call to the callback.
 A pointer to this byte array is contained in the rdrData parameter. Memory management for
this array is done by ACTIVE SKY. It will keep writing to this (and invoking the callback) even if
SetRdrParams is not called again. In this case it assumes the same parameters (including
aircraft heading and pContext) and the "image" will only be updated based on the aircraft
position and any changes in the weather. Specifically, if the range1 parameter changes then a
new memory allocation will occur, making the old pointer invalid (since the array size will have
to change in this case).
 The "area" represented by this array is with the aircraft assumed to be to the bottom center.
This "area" starts from the left of the aircraft, goes right first and then "line by line" to the area
in front of the aircraft.
 The actual array size can be calculated based on the rdrSmallDimSize parameter of the
callback function. Depending on the range1 parameter, the size of the array will be:

2*rdrSmallDimSize*rdrSmallDimSize

So for example if the range1 parameter is set to 80 nm, then the 2-d array will be 640x320 and the
rdrSmallDimSize value will be 320.

 The resolution of the "image" is always (up to cloud draw distance) 1 pixel per ~450 meters. So
increased range1 values, will lead to an increased byte array size. So if the range1 parameter is
30nm, then the byte array will be 240x120. If the requested range is 80nm, then the array is
640x320.
 The values indicating the precipitation intensity are from 0-255. To map to approximate dbz
values divide by 4 (dbz= 0.25*byteValue). Any byte value > 200 is considered to be producing
significant turbulence. If it is needed (or is adequately demanded), this can be changed (so for
example the precipitation intensity is stored directly as a dbz value 0-128, taking 7 bits and the
remaining bit could explicitly signal turbulence presence).

Notes and Restrictions


 The implementer has to run "inprocess" (as an fsx/p3d dll), so that the pointer in memory can be
shared properly.
 ACTIVE SKY doesn't simulate ground cluttering
 ACTIVE SKY doesn't simulate echo signal "shadows". It will return the precipitation "load"
related to the detected (by the radar beam) cloud sprites even if a significant signal "obscures"
it.
 ACTIVE SKY counts aggregate precipitation intensity produced by each cloud sprite (down to
the defined precipitation base). So in effect this means that the "thicker" a cloud and the lower

Copyright © 2016-2017 HiFi Technologies, Inc. Page 8


Active Sky API

the beam intersects it, then the stronger the precipitation (as the real radar works). In the case
multiscan mode is in effect, then the stronger of the two signals at a given location is used.
 ACTIVE SKY will take into account the earth curvature for significant ranges (at least more than
50nm). So if the tilt value (in "manual mode") is zero, the aircraft is at FL300 and a
thunderstorm top reaches 32000, but is 150 miles away, then it will not be detected, unless the
tilt value is set to a "lower" (negative) value (since the earth curvature related drop will lead the
cloud to be about 9000 feet lower).
 Ranges (the range1 value) more than the actual cloud draw distance (cdd) inside the sim, will
result in much lower resolution images/data (for 320nm range, it will be 32x32 with a resolution
of ~10nm per pixel). This is not implemented yet (in progress) and at this point ranges of more
than the cdd will not give any returns.

Copyright © 2016-2017 HiFi Technologies, Inc. Page 9


Active Sky API

Weather Information

Weather information is available from ACTIVE SKY and can be used to determine active conditions that
the user will experience. This information is can be useful for flight planning software, ATC software,
etc.

File-Based (Text) Weather Information

The following files are accessible (in text form) in the [AppData]\Roaming\HiFi\ACTIVE SKYFSX (or
ACTIVE SKYP3D) folder:

activeflightplanwx.txt – Provides specific flightplan-related weather information. This requires that the
user has activated a flight plan within ACTIVE SKY.

current_wx_snapshot.txt – Provides the entire global weather data in use including METARs, TAFs and
Winds Aloft. Winds aloft data is provided per-altitude block which follows the altitude blocks listed in the
“Conditions” screen of ACTIVE SKY.

wx_station_list.txt – Provides a list of wx station locations that are found within


current_wx_snapshot.txt (Latitude, Longitude and Elevation in meters).

In-Process API Weather Information

Weather information at specified locations can also be obtained directly through API function
GetAtmoshere that is exported by as_btstrp.dll/as_connect_64.dll This is meant to be used by aircraft
Flight Management Computers a way to get "live" (or forecast) weather information at specified way
points at various flying altitudes. By design it only contains information that may be useful for such
functionality as winds, pressure and temperature and not for example precipitation or other
information. Here's the declaration of the function:

bool GetAtmosphere(RequestPoint* requestPoints, int pointCount);

Parameters:
- requestPoints: An array of RequestPoint structures representing the waypoints weather information
is requested for
- pointCount: The number of way points in the array

The definition of RequestPoint is:

Copyright © 2016-2017 HiFi Technologies, Inc. Page 10


Active Sky API
#pragma pack(4)
struct RequestPoint
{
double lat; // The latitude in degrees of the waypoint
double lon; // The longitude in degrees of the waypoint
unsigned time_offset; // The time offset (in seconds) from current base ASN active
// time. For example if this has value 240*60 (and ASN is in
// live real time mode), forecast weather conditions at the
// specified way point 4 hours from now are requested
WxData* data; // an array of WxData structs
unsigned data_size; // the length of the data array

};

The WxData definition is :

#pragma pack(4)
struct WxData
{
int AltFt; // (In) The requested altitude (MSL in feet)
double Pressure; // (Out) The returned pressure (in hectoPascals)
double Temperature; // (Out) The returned temperature (in Celsius)
double WindDirection; // (Out) The returned wind direction (in degrees)
double WindSpeed; // (Out) The returned wind speed (in knots)
};

The allocation of the memory (and memory management) for the main array and the various altitudes
is the responsibility of the caller. The caller sets the AltFt value for each instance of WxData and then
once the function returns, the values for temperature, winds and pressure will be populated at the
specified fields.

Example:

RequestPoint requestedPoints[2];

// LogMessage(TEXT("LGTS"));
requestedPoints[0].lat = 40.520843;
requestedPoints[0].lon = 22.971601;
requestedPoints[0].time_offset = 0;
requestedPoints[0].data_size = 2;
requestedPoints[0].data = new WxData[requestedPoints[0].data_size];
requestedPoints[0].data[0].AltFt = 6000;
requestedPoints[0].data[1].AltFt = 34000;

// LogMessage(TEXT("LGAV"));
requestedPoints[1].lat = 37.935905;
requestedPoints[1].lon = 23.948480;
requestedPoints[1].time_offset = 0;
requestedPoints[1].data_size = 4;
requestedPoints[1].data = new WxData[requestedPoints[1].data_size];
requestedPoints[1].data[0].AltFt = -9999; // Request surface data

Copyright © 2016-2017 HiFi Technologies, Inc. Page 11


Active Sky API
requestedPoints[1].data[1].AltFt = 3000;
requestedPoints[1].data[2].AltFt = 6000;
requestedPoints[1].data[3].AltFt = 27500;

if (GetAtmosphere(requestedPoints, 2))
{
TCHAR buffer[255];
for (unsigned i = 0;i < requestedPoints[0].data_size;i++)
{
// requestedPoints[0].data[i].AltFt) 6000 and 34000 feet
// requestedPoints[0].data[i].Pressure
// requestedPoints[0].data[i].WindDirection)
// requestedPoints[0].data[i].WindSpeed)
// requestedPoints[0].data[i].Temperature)
}
delete[] requestedPoints[0].data;
for (unsigned i = 0; i < requestedPoints[1].data_size; i++)
{
// requestedPoints[1].data[i].AltFt) -9999, 3000, 6000 and 34000 feet
// requestedPoints[1].data[i].Pressure
// requestedPoints[1].data[i].WindDirection)
// requestedPoints[1].data[i].WindSpeed)
// requestedPoints[1].data[i].Temperature)
}
delete[] requestedPoints[1].data;
}
else
LogMessage(TEXT("ExternalFailed"));

Notes:
- The call to GetAtmosphere is blocking the calling thread. It may take some seconds for the function to
return as it needs to communicate with ASN main application to retrieve the requested data. For
performance reasons the number of requested waypoints (per call) is restricted to 10 (if each of them
requests weather information for 4 altitudes). The function will return false otherwise.
- To get surface weather data, the AltFt should be negative or zero (even if the airport elevation is non
zero). In this case the function will contain information about surface winds, surface temperature and
QNH (surface pressure) for the specified lat/lon

Copyright © 2016-2017 HiFi Technologies, Inc. Page 12


Active Sky API

HTTP-Based Weather Information

Weather information at specified locations can also be obtained directly through using the new http-
based access.

 GetAtmoshere: This is used in a similar way the exported through the dll function1 is used and is meant
to provide access for any application needs a way to get "live" (or forecast) weather information at a
specified way point at various flying altitudes. By design it only contains information that may be useful
for such functionality as winds, pressure and temperature and not for example precipitation or other
information (this is provided by the GetMetarInfoAt function). The way it's used is through an http GET
command like this:
 http://localhost:19285/ActiveSky/API/GetAtmosphere?lat=37.25&lon=21.35&altitudes=-
1000|3000|12000&timeoffset=288002
The above example requests forecast weather data for a point with the specified lat/lon for altitudes -
1000 (i.e. surface data), 3000 and 12000 feet MSL. The data requested are the forecast weather for 8
hours after the current active AS time). That is 28800=8*60*60 seconds

Note that all the floating point data use invariant culture (that is the decimal separator is always '.'
regardless of the Active Sky machine windows regional settings). The returned data are in JSON format
like this:

"WeatherData": [
{
"Altitude": "-1000",
"WindDirection": "343.0",
"WindSpeed": "4.0",
"Temperature": "16.8",
"Pressure": "1021.6"
},
{
"Altitude": "3000",
"WindDirection": "95.0",
"WindSpeed": "10.0",
"Temperature": "15.2",
"Pressure": "915.7"
},
{
"Altitude": "12000",

1
In contrast to the dll method, it can only contain one request point per call
2
Replace localhost with the IP address of the machine where Active sky is running (if on a network
configuration). In addition, the port number used (19285 in the example) can be changed through Active sky
settings. An application can actually find the IP address of the machine ActiveSky is running (and the http port
in use), by reading the log file called "btstrp.txt" located at [SimFolder]\as_srv. Alternatively, if running in the sim
process these are provide through ActiveSkyIPAddress and ActiveSkyHttpPort global exported variables.
Note that ActiveSkyIPAddress is provided as a raw unsigned integer and the application has to wait until Active
Sky dll connection is established in order for the values to be populated

Copyright © 2016-2017 HiFi Technologies, Inc. Page 13


Active Sky API
"WindDirection": "323.0",
"WindSpeed": "17.0",
"Temperature": "0.9",
"Pressure": "650.1"
}
]
}

 GetMetarInfoAt: This function provides a way to directly get either the current or forecast
weather at a specified weather station or airport. The way it's used is through an http GET
COMMAND like e.g. this:

http://localhost:19285/ActiveSky/API/GetMetarInfoAt?ICAO=KJFK
or
http://localhost:19285/ActiveSky/API/GetMetarInfoAt?ICAO=KJFK&timeoffset=0

This will return the current METAR at KJFK. Alternatively, using this:

http://localhost:19285/ActiveSky/API/GetMetarInfoAt?ICAOID=KJFK&timeoffset=14400

the API will return the METAR representing the forecast weather conditions 4 hours from the current
ActiveSky active time (4*60*60=14400 seconds). In this case Active Sky uses info from the current
METAR and TAF to generate a METAR from the estimated forecast weather conditions at the
requested time.

 GetCurrentConditions: This function gets the current interpolated weather conditions at the
aircraft position. Example usage: http://localhost:19285/ActiveSky/API/GetCurrentConditions

 GetClosestStationWeather: This function gets the weather conditions at the weather station
closest to the current aircraft position. Example usage:
http://localhost:19285/ActiveSky/API/GetClosestStationWeather

Copyright © 2016-2017 HiFi Technologies, Inc. Page 14


Active Sky API

Getting the Active Runways (either current or forecast) at an Airport

GetActiveRunwaysAt: This function provides a way to directly get the list of active runways at the
specified airport. The way it's used is through an http GET command like e.g. this:

http://localhost:19285/ActiveSky/API/GetActiveRunwaysAt?ICAO=KJFK
or
http://localhost:19285/ActiveSky/API/GetActiveRunwaysAt?ICAO=KJFK&timeoffset=0

This will return the current list of active runways (in a comma delimited string) at KJFK. Alternatively,
using this:

http://localhost:19285/ActiveSky/API/GetActiveRunwaysAt?ICAOID=KJFK&timeoffset=14400

it will return the possible active runways 4 hours from the current ActiveSky active time
(4*60*60=14400 seconds). This is based on the forecast weather conditions. In this case ActiveSky
uses info from the current metar and taf to figure out the possible active runways at the estimated time
of arrival.

Note: This function uses the exact same logic the internal simulator (fsx/p3d) ATC uses to select the
runway in use (and is subsequently used by AI aircraft). This logic takes into account not only the winds,
but also if the runway e.g. is closed (in the scenery bgl specification), the runway length etc.
The runway selection by the simulator ATC however occurs in most cases too late (once inside the
reality/AI bubble). In contrast, in reality the active runway is known much earlier (at the Top of Descent
or even earlier when STAR selection is made and this may happen in certain cases even when 200nm
out from the destination). So, this function gives a way to the pilot to accurately plan his arrival. Still, as
happens in reality, if the winds/weather conditions change significantly in the meantime, the active
runway may change. If the user needs to have 100% consistency, then the windLock option needs to be
enabled in Active sky settings

Copyright © 2016-2017 HiFi Technologies, Inc. Page 15


Active Sky API

Getting or Setting the Weather Mode of Active Sky

HTTP-provided functionality also gives a chance to an external application to query the current mode of
Active Sky, or to change the mode. To get the current mode, the following HTTP GET COMMAND can
be used:

http://localhost:19285/ActiveSky/API/GetMode

This will return one of the following:


Live Real time mode (2016/8/22 1715z)
Locked to sim time (2016/8/22 1715z)
Historic dynamic mode (2016/8/22 1715z)
Custom static mode (2016/8/22 1715z)

(in the parenthesis is the current active time in Active Sky)

Alternatively if an application wants to change the current mode it can use one of the following HTTP
GET commands:

 http://localhost:19285/ActiveSky/API/SetMode?mode=Live : This will change the mode to live


 http://localhost:19285/ActiveSky/API/SetMode?mode=Custom : This will change the mode to
custom static (offline)
 http://localhost:19285/ActiveSky/API/SetMode?mode=SimTime : This will change the mode
locked to sim time
 http://localhost:19285/ActiveSky/API/SetMode?mode=Historic&year=2016&month=8&day=3&ho
ur=17&minute=15 : This will change the mode to historic dynamic mode and will set the active
date to August 3rd, 2016, 1715z

Copyright © 2016-2017 HiFi Technologies, Inc. Page 16


Active Sky API

Setting Custom Weather

There are several ways the weather can be programmatically customized using Active Sky API:

METAR-based: An external application can use the same http GET as an end user when using the
functionality provided in http://localhost:19285/ActiveSkyRemoteWeatherControl.html page. An
example follows:

http://localhost:19285/ActiveSkyRemoteWeatherControl.html/?metar=EDDF+161820Z+08003KT+330V09
0+9999+NSC+10%2F10+Q1021+NOSIG&windDir3K=215&windSpeed3K=12&temp3K=13.13&turb3K=Ligh
t&windDir6K=185&windSpeed6K=12&temp6K=9.66&turb6K=Light&windDir9K=196&windSpeed9K=12&t
emp9K=6.79&turb9K=None&windDir12K=226&windSpeed12K=18&temp12K=-
2.87&turb12K=None&windDir18K=215&windSpeed18K=25&temp18K=-
18.00&turb18K=None&windDir24K=212&windSpeed24K=27&temp24K=-
31.83&turb24K=None&windDir30K=239&windSpeed30K=33&temp30K=-
46.04&turb30K=Light&windDir34K=246&windSpeed34K=37&temp34K=-
54.11&turb34K=None&windDir39K=250&windSpeed39K=37&temp39K=-
59.00&turb39K=None&windDir44K=241&windSpeed44K=30&temp44K=-
57.94&turb44K=None&windDir49K=234&windSpeed49K=19&temp49K=-
58.94&turb49K=None&windDir56K=266&windSpeed56K=11&temp56K=-
61.00&turb56K=None&radius=100&submit=Submit

Using details: Detailed custom weather areas (non METAR based) can also be defined using an xml file.
Details about the format used (with various comments documenting the details) are included in the file
CustomWeather.xml that can be found at Active Sky installation directory. To activate such an xml file:
- Copy it to %appdata%\HiFi\AS16_P3D\Weather (where " AS16_P3D" is the target Active Sky version)
- Activate it using this http GET command:
http://localhost:19285/ActiveSkyRemoteWeatherControl.html/?file=CustomWeather
(note, that the file can have any name and the 'xml' extension should not be included)

Alternatively, you can directly include the xml as part of the http GET like this:

http://localhost:19285/ActiveSkyRemoteWeatherControl.html/?XmlData=<WeatherData> <Weather
StationID="EDDF" RadiusNM="100"><WindLayers><SurfaceLayer WindDirection="205" WindSpeed="15"
Turbulence="0" Temp="15" Gust="25" Variance="0" DewPoint="5" /><Layer AltFeet="3000"
WindDirection="205" WindSpeed="15" Turbulence="0" Temp="15"></Layer><Layer AltFeet="6000"
WindDirection="205" WindSpeed="15" Turbulence="0" Temp="15" /><Layer AltFeet="9000"
WindDirection="205" WindSpeed="15" Turbulence="0" Temp="15" /><Layer AltFeet="12000"
WindDirection="205" WindSpeed="15" Turbulence="0" Temp="15" /><Layer AltFeet="18000"
WindDirection="205" WindSpeed="15" Turbulence="0" Temp="15" /><Layer AltFeet="24000"
WindDirection="205" WindSpeed="15" Turbulence="0" Temp="15" /><Layer AltFeet="30000"
WindDirection="205" WindSpeed="15" Turbulence="0" Temp="15"></Layer><Layer AltFeet="34000"
WindDirection="205" WindSpeed="15" Turbulence="0" Temp="15" /><Layer AltFeet="39000"
WindDirection="205" WindSpeed="15" Turbulence="0" Temp="15" /><Layer AltFeet="44000"
WindDirection="205" WindSpeed="15" Turbulence="0" Temp="15" /><Layer AltFeet="49000"

Copyright © 2016-2017 HiFi Technologies, Inc. Page 17


Active Sky API

WindDirection="205" WindSpeed="15" Turbulence="0" Temp="15" /><Layer AltFeet="56000"


WindDirection="205" WindSpeed="15" Turbulence="0" Temp="15" /></WindLayers><SurfaceVisibility
VisMeters="9999" VisBaseMeters="-450" VisTopMeters="3000" /><Clouds><Cloud CloudType="9"
CloudBaseMeters="1000" CloudTopMeters="2000" Coverage="5" CloudTurbulence="2" PrecipType="1"
PrecipRate="2" Icing="1" /></Clouds><QNH ValueHectoPascal="1015" ReportsAsQNH="1"
/></Weather></WeatherData>

NOTE: Using the above methods of setting a custom weather area will automatically set Active Sky
weather mode to "custom" (manual). In addition, any previously set, custom weather areas or edits will be
cleared, so the user should be warned/notified by the integrating add-on first, to avoid unexpected deletion
of custom user weather parameters. None of these custom weather definitions however is persisted (in
contrast to the custom weather areas defined through the Active Sky user interface).

Copyright © 2016-2017 HiFi Technologies, Inc. Page 18


Active Sky API

Adding Custom Effects

Active Sky is able to generate various weather related effects (windshear, turbulence, updrafts,
downdrafts and thermals) automatically by reading various parameters such as surface temperature,
ground elevation changes, surface type etc. Still, however there are cases where in the sim, due to e.g.
terrain resolution/accuracy issues, some effects are not generated as they come up in real life. A new
addition to Active Sky 2016 SP1 gives users (and developers) a way of adding localized effects in certain
areas if certain conditions are met. In addition in a flight instructor setup, it's now possible for a flight
instructor to generate live such effects for training reasons:.

Live weather effect injection: To inject a live weather effect a http GET command as follows can be
used:

http://localhost:19285/ActiveSky/API/AddUserEffect?ID=Test_WS&Type=WindShear&Lat=15.0&Lon=25.0
&Altitude=1000&Range=3000&AltitudeRange=2000&Intensity=4

 ID is a unique identifier (required ) and is used so that duplicates are avoided and this effect can
be removed at a later point (look at RemoveUserEffect for more info)
 Type is the type of the effect and can be one of the following values (required):
o Thermal,
o Downdraft,
o Updraft,
o Turbulence,
o Windshear
 Lat/Lon and Altitude (in feet) determine the center location of the effect, while the Range (in
meters) and the AltitudeRange (in feet) determine the active area.
 Intensity is a value from 1-5 determining how strong the effect will be. If the effect type is
thermal/updraft/downdraft, this can be set directly to the absolute effect value (in feet/min). If
omitted, or set to -1, then the intensity of the effect is calculated based on current weather
conditions.

An alternative way is to set it relative to the current aircraft position like this:

http://localhost:19285/ActiveSky/API/AddUserEffect?ID=Test_WS&Type=WindShear&Bearing=350&Dista
nce=2&Altitude=1000&Range=3000&AltitudeRange=2000&Intensity=4

 ID and Type and Intensity are the same as above


 Bearing is the bearing of the current aircraft position to the center of the effect (if omitted, the
current aircraft heading is used)
 Distance is the distance of the center of the effect from the current aircraft position (if omitted,
then a default 1nm distance is used).

Copyright © 2016-2017 HiFi Technologies, Inc. Page 19


Active Sky API

 Altitude is the altitude of the center of the effect (in feet). If omitted, then the current aircraft
altitude is used.
 Range (in meters) is the radius of the area where the effect will be active. If omitted, then it is
considered equal to the Distance (this way activating the effect directly after it is injected).
 AltitudeRange is the altitude range (in feet) that the effect will be active. If omitted, then this
defaults to 2000 feet.

Example: If you want to create a "default" e.g. moderate turbulence effect at the aircraft position and
being active for 2nm ahead of the aircraft, then you can use this command:

http://localhost:19285/ActiveSky/API/AddUserEffect?ID=Test_Effect&Type=Turbulence&Intensity=2

To remove the injected effect, you have to use the RemoveUserEffect command and set the ID of the
user effect you want to remove, like this:

http://localhost:19285/ActiveSky/API/RemoveUserEffect?ID=Test_Effect

Location based effects: Such effects may be added by adding a new xml file inside the folder
%appdata%\HiFi\AS16_P3D\LocalizedEffects 3. Active Sky will parse all xml files inside this
folder so that location based effects are triggered. The file UserEffects.xml located there is
provided as a sample and will contain effects added by the development team (either directly
or after validating user additions).

The way to do this is best described by example. Let's consider the relevant part of the chart
for DIAGORAS airport (LGRP) :

"1) Exercise extreme caution when South or Southeasterly winds of more than 10-15 KT prevail as
moderate or severe turbulence and wind shear may be encountered in the final apch and/or initial
climb out areas (mainly RWY 07). More specifically the following phenomena affecting seriously
the flight safety are observed:
 The wind direction and speed at a given time vary along the runway (horizontal wind shear).
 The wind direction and speed, at a given point of the runway, are continuously changing
 (turbulent wind shear).
 Severe turbulence in the final apch, take-off and initial climb out areas.

2) When the South or Southeasterly wind speed increases over 15 KT, landing and/or take-off are not recommended since
a severe horizontal and turbulent wind shear may prevail at some intermediate point of the final apch and/or take-off and
initial climb out areas

3) Pilots are urged to volunteer reports of wind shear to DIAGORAS Tower or Approach controllers as
soon as possible, so that the pilots of following aircraft can be warned. It is suggested that pilots

3
"AS16_p3D may be replaced by for example AS16_FSX or the current "active" Active Sky version

Copyright © 2016-2017 HiFi Technologies, Inc. Page 20


Active Sky API
should report wind shear in the following format:
a) A simple warning of the presence of the wind shear, even if no further information can be given.
b) The altitude or altitude band, where the wind shear was encountered.
c) Details of the effects of the wind shear on the acft, i.e. airspeed gain or loss, vertical speed tendency etc."

This air instability is caused by the mountain that is directly south of the airport. In default FSX
/P3D however scenery the mountain is located too far away from the runway, so the way AS16
samples ground elevation to determine air instability is not enough. So, in order to simulate
this, we have to edit the file UserEffects.xml (or create a new e.g. LGRP.xml file) and add to the
WindShearEffects section this:

<WindshearEffects>
<WindShear ID="DIAGORAS_WS" Lat="36.409988173496423" Lon="28.101949002398484"
Range="2000" Altitude="500" AltitudeRange="1000" Intensity="-1">
<TriggeringConditions>
<Condition MinWindSpeed="15" MinWindDirection="150" MaxWindDirection="180" />
</TriggeringConditions>
</WindShear>
</WindshearEffects>

This way we define the following:

 ID: We have to give the effect a unique identifier (for reporting reasons and to avoid
duplicates ), otherwise it will be ignored
 Lat/Lon and the Altitude (feet) of the center of the location of the effect
 Range (meters) is the lateral radius of the active area of the effect, while
AltitudeRange (feet) is the vertical range. In this example the effect will be active for
2Km around the center location and from ground up to 1000 feet MSL.
 Intensity is a value from 1-5 determining how strong the effect will be. If the effect type
is thermal/updraft/downdraft, this can be set directly to the absolute effect value (in
feet/min). If omitted, or set to -1, then the intensity of the effect is calculated based on
current weather conditions. In this particular example, the strength of the wind shear
will depend on the actual wind speed.
 The TriggeringConditions element contains a set of conditions. Each Condition
describes the needed weather conditions that have to exist so that the effect is
triggered. In this particular example, the wind speed should be more than 15knots and
the wind direction between 150-180 degrees. The attributes that are possible to be set
in a Condition element are MinWindSpeed, MaxWinSpeed, MinWindDirection,
MaxWindDirection, MinTemperature, MaxTemperature like in the following example:

Copyright © 2016-2017 HiFi Technologies, Inc. Page 21


Active Sky API

<Condition MinWindSpeed="10" MaxWindSpeed="25" MinWindDirection="320"


MaxWindDirection="359" MinTemperature="5" MaxTemperature="9" />

 If we want to define conditions, that either one should be enough to trigger the effect,
then a new line has to be added, for example:

<TriggeringConditions>
<Condition MaxTemperature="2" />
<Condition MinWindSpeed="9"/>
</TriggeringConditions>

In this example the effect will trigger if either the temperature is less than 2 degrees Celsius or
the wind speed is equal or more than 9 knots
 If the TriggeringConditions section is empty (or omitted), then the effect will always
trigger when the aircraft gets inside the activation area of the effect

At the same airport, we could also add some moderate turbulence if the winds are from the
south and the wind speed is even less (e.g. >5 knots). The way to do it is to add to the
TurbulenceEffects section an entry like this:

<TurbulenceEffects>
<Turbulence ID="DIAGORAS_TRB" Lat="36.409988173496423" Lon="28.101949002398484"
Range="2000" Altitude="500" AltitudeRange="1000" Intensity="2">
<TriggeringConditions>
<Condition MinWindSpeed="5" MinWindDirection="150" MaxWindDirection="180" />
</TriggeringConditions>
</Turbulence>
</TurbulenceEffects>

NOTE: An Active Sky restart is required for any effect file changes to be activated (if for example a new
LPMA.xml file is added to the LocalizedEffects folder)

Copyright © 2016-2017 HiFi Technologies, Inc. Page 22


Active Sky API

Loading a Flight Plan

An external application is able to load a flight plan into AS16 directly by using the following command:
(e.g):

http://localhost:19285/ActiveSky/API/LoadFlightPlan?FileName=C:\Flight%20Plans\KBOS-KJFK.pln

(Note the use of %20 for white spaces which is mandatory for http GET commands)

The logic this uses to discover the file location is similar to the way auto loading through SimConnect is
used. If Active Sky is installed on the same machine then the filename parameter can contain the full
path to the flight plan file. If Active Sky is installed on a network then the plan file should be on the
dedicated flight plan folder Active Sky uses (this is defined as the last one used when manually
importing a flight plan through the user interface). Example:

http://192.168.137.1:19285/ActiveSky/API/LoadFlightPlan?FileName=IFR%20Miami%20Intl%20to%20Ex
ecutive.PLN

In this case, the file "IFR Miami Int to Executive.PLN" should be in e.g. MyDocuments\Flight Simulator X
Files on the sim machine (assuming this was the last folder used by the Import Flight Plan button inside
Active Sky user interface

Copyright © 2016-2017 HiFi Technologies, Inc. Page 23

You might also like