Fmtest

From TargetWiki

Contents

Targetware: Flight Model Development


Flight Testing with "fmtest"

Introduction fmtest is a Targetware utility designed to help users develop and test flight models. In essence, it acts as a virtual wind tunnel. The way fmtest works is by running lua scripts, although it can also act as an interactive interpreter (executing lua commands as you type them). It can handle all the standard lua functions, plus a variety of new, Targetware-specific functions. Like "tool", fmtest is a command line utility. That means you will need to use the OS X terminal (Mac), Console (Linux), or DOS command prompt (Windows). There is no GUI for this utility.

fmtest and Mac OSX

fmtest seems not to work on Mac OSX

Running fmtest

To run fmtest, change directories to your Targetware directory, then call fmtest by either pointing it towards an existing lua script:

./fmtest -s scripts/dr1test.lua

All examples on this page show fmtest running on an OS X/linux machines; on windows, use "fmtest.exe" instead of "fmtest".

Note that fmtest assumes that it is in the same folder as the Targetware application, and looks for the "data" folder on the same level as itself. If you have put fmtest in some other location, you can use the "-r [pathToTargetware]" option to specify a different data root.

You can also have fmtest drop into interactive interpreter mode after running the specified lua script, by using the "-i" option:

fmtest -s scripts/emilTest.lua -i

FM Testing Functions for Lua

The Targetware-specific functions created for lua, available via fmtest, are as below. Parameters in <angle brackets> are required, parameters in [square brackets] are optional.

Data Setting Functions

setroot

fm.setroot( <directory> )

This changes the data root on the fly.

setmodel

fm.setmodel( <filename> )

This sets the model to be tested, for example:

fm.setmodel( "/rs/planes/camel.acm" )

It also clears all setup information, and restarts the test from scratch.

setoption

fm.setoption( <option>, <choice> )

This sets an option loadout on a model. the first number is an integer for the option slot, the second is an integer for the option choice for that slot.

setfuelload

fm.setfuelload( <number> )

This sets the fuel load on the model. the number should range from 0.0 for no fuel to 1.0 for full fuel.

setalt

fm.setalt( <meters> )

This sets the wind tunnel to a pressure and temperature equivalent to the given altitude in meters on a standard day.

setias

fm.setias( <km/h> )

This sets model's IAS in km/h.

settas

fm.settas( <km/h> )

This sets the model's TAS in km/h.

setmach

fm.setmach( <mach number> )

This sets the model's mach number.

setalpha

fm.setalpha( <degrees> )

This sets the model's angle of attack to the relative wind.

setbeta

fm.setbeta( <degrees> )

This sets the model's slip angle to the relative wind.

setpitch

fm.setpitch( <degrees> )

This sets the model's pitch angle. the relative wind is kept at the same angle, so this is mainly useful for altering the model's attitude relative to gravity.

setbank

fm.setbank( <degrees> )

This sets the model's bank angle. the relative wind is kept at the same angle, so this is mainly useful for altering the model's attitude relative to gravity.

setgear

fm.setgear( <state>, [gear] )

This deploys or retracts landing gear. <state> is either true (extend) or false (retract). if [gear] is 0 or is left off entirely, this will apply to all landing gear. otherwise, [gear] indicates the specific landing gear to be deployed.

setairbrake

fm.setairbrake( <state>, [airbrake] )

This deploys or retracts airbrakes. <state> is either true (extend) or false (retract). if [airbrake] is 0 or is left off entirely, this will apply to all airbrakes. otherwise, [airbrake] indicates the specific airbrake to be deployed.

setbombbay

fm.setbombbay( <state>, [bomb bay] )

This deploys or retracts bomb bays. <state> is either true (extend) or false (retract). if [bomb bay] is 0 or is left off entirely, this will apply to all bomb bays. otherwise, [bomb bay] indicates the specific bomb bay to be deployed.

setflap

fm.setflap( <notch>, [flap] )

This deploys flaps to the given notch. if [flap] is 0 or is left off entirely, this will apply to all flaps. otherwise, [flap] indicates the specific flap to be deployed.

setcflap

fm.setcflap( <angle>, [cflap] )

This deploys cflaps to the angle. if [cflap] is 0 or is left off entirely, this will apply to all cflaps. otherwise, [cflap] indicates the specific cflap to be deployed.

setcontrols

fm.setcontrols( <roll>, <pitch>, <yaw> )

This sets the stick and rudder. <roll>, <pitch> and <yaw> should range from -1.0 to 1.0.

settrim

fm.settrim( <roll>, <pitch>, <yaw> )

This sets the trim tabs. <roll>, <pitch> and <yaw> should range from -1.0 to 1.0.

setstart

fm.setstart( <state>, [engine] )

This starts or stops engines. <state> is either true, to start, or false, to stop. if [engine] is 0 or is left off entirely, this applies to all engines. otherwise, [engine] indicates the specific engine to be effected.

setthrottle

fm.setthrottle( <number>, [engine] )

This sets engine throttles. <number> should range from 0.0 to 1.0. if [engine] is 0 or is left off entirely, this applies to all engines. otherwise, [engine] indicates the specific engine to be effected.

setboost

fm.setboost( <state>, [engine] )

This sets engine boost. <state> is either true, for boost, or false, for no boost. if [engine] is 0 or is left off entirely, this applies to all engines. otherwise, [engine] indicates the specific engine to be effected.

setadi

fm.setadi( <state>, [engine] )

This sets engine ADI. <state> is either true, for ADI, or false, for no ADI. if [engine] is 0 or is left off entirely, this applies to all engines. otherwise, [engine] indicates the specific engine to be effected.

setnitro

fm.setnitro( <state>, [engine] )

This sets engine nitro. <state> is either true, for nitro, or false, for no nitro. if [engine] is 0 or is left off entirely, this applies to all engines. otherwise, [engine] indicates the specific engine to be effected.

setmixture

fm.setmixture( <level>, [engine] )

This sets engine mixture. <level> is 0 for shutoff, 1 for lean, and 2 for rich. if [engine] is 0 or is left off entirely, this applies to all engines. otherwise, [engine] indicates the specific engine to be effected.

setblower

fm.setblower( <setting>, [engine] )

This sets engine blowers. <setting> ranges from 0 to the maximum blower setting for that engine. if [engine] is 0 or is left off entirely, this applies to all engines. otherwise, [engine] indicates the specific engine to be effected.

setautoblower

fm.setautoblower( <state>, [engine] )

This sets engine autoblower. <state> is either true, so that the engine uses the best possible blower setting at all times, or false, for manual control over the blower setting. if [engine] is 0 or is left off entirely, This applies to all engines. otherwise, [engine] indicates the specific engine to be effected.

setrpm

fm.setrpm( <number>, [engine] )

This sets engine rpm. <number> should range from 0 to the maximum rpm for The engine. if [engine] is 0 or is left off entirely, this applies to all engines. otherwise, [engine] indicates the specific engine to be effected.

setproppitch

fm.setproppitch( <number>, [engine] )

This sets an engine's propeller pitch. <number> should range from the minimum to the maximum pitch angle on the propeller. if [engine] is 0 or is left off entirely, this applies to all engines. otherwise, [engine] indicates the specific engine to be effected.

setcoolingflaps

fm.setcoolingflaps( <number>, [engine] )

This sets engine cooling flaps. <number> should range from 0.0 to 1.0. if [engine] is 0 or is left off entirely, this applies to all engines. otherwise, [engine] indicates the specific engine to be effected.

setautocooling

fm.setautocooling( <state>, [engine] )

This sets engine automatic cooling flaps. <state> is either true, so that the engine controls cooling flap settings on its own, or false, for manual control over the cooling flaps. if [engine] is 0 or is left off entirely, This applies to all engines. otherwise, [engine] indicates the specific engine to be effected.

setfeather

fm.setfeather( <state>, [engine] )

This sets feathers or unfeathers a propeller. <state> is either true, to feather, or false, to unfeather. if [engine] is 0 or is left off entirely, this applies to all engines. otherwise, [engine] indicates the specific engine to be effected.

Data Reading Functions

The rest of the functions are used to read data from the wind tunnel, rather than to set conditions.

forces

x,y,z = fm.forces()

this returns three numbers: the X, Y and Z axis forces in Newtons on the aircraft. X being side forces, left and right, Y being axial, or front and back, Z being the normal force, or up and down.

moments

p,r,y = fm.moments()

this returns three numbers: the pitch, roll, and yaw axis moments on the aircraft.

accel

x,y,z = fm.accel()

this returns three numbers: the X, Y and Z axis accelerations.

angularaccel

p,r,y = fm.angularaccel()

this returns three numbers: the pitch, roll and yaw axis angular accelerations.

gforce

x,y,z = fm.gforce()

this returns three numbers: the lateral G's, acceleration G's, and vertical G's on the aircraft.

mass

m = fm.mass()

this returns the current mass of the aircraft in kilograms.

ias

v = fm.setias()

if called with no parameters, this returns the current indicated airspeed in km/hr

tas

v = fm.settas()

if called with no parameters, this returns the current true airspeed in km/hr

Conversions

Although 1 g = 9.80665 m/s², the relationship between fm.accel() and fm.gforce() appears to be 9.81

http://physics.nist.gov/Document/sp330.pdf page 29/39

References

Views