Implement
Engineering Unit conversion table:
The lookup dictionary takes a Block.Item name as a key and the actual
Python function as value. You can either define the conversion
functions directly in this module as regular Python functions
or use a lambda function. The function takes exactly one parameter,
the value of the item specified as the key.
E.g.:
def fEUFunction(dwData):
return dwData*2.34
This will be called as fEUFunction(TLM.Heater)
if the key in the dictionary is TLM.Heater. Most EU functions
are very simple (similar to .qlf formulas) and lambda functions
are suitable for that case:
lambda x: 3.2 * pow(x, 3) - 1.2 * pow(x,
2) + 0.3 * x
Currently only scalar items
are supported. If you need to reference an element in an array
item you have to create a scalar item in the block definition that
refers to the same memory location. The EUConversion module
is a temporary solution until this functionality gets moved into
the GSEOS kernel. The format of the configuration file will
change! Below is a sample of some EU conversion functions:
def fEUVolts(wRaw):
return wRaw*1.2 - 0.4
def fPolyTemp(wTemp):
return wTempRaw*1.2 - 0.4
ctEUFunctions
= \
{
'TLM.Heater': lambda x: x*2.3 + 0.09,
'TLM.Voltage': fEUVolts,
}
To add new EU conversions simply
add your function to the ctEUFunctions dictionary and supply the
proper Block.Item name.
This is an update release to
R186.020. If you have a version earlier than R186.020 installed
you must upgrade to R186.020 first before installing R186.028.
The updates for Gseos4.5 and Gseos5.0 are identical.
Install:
Download StolEmu.X.X.186.028.zip and extract the files into the
Messenger root directory (where the gseos.exe resides).
The EUConversionTest.prc file is a sample STOL procedure that demonstrates
the use of the EU() function.
|