ch¶
The ch function returns the data of a given channel as a row vector.
The data file is set outside the function. To access the data file the global
variable _fi_ncid
is used. The function should only be used inside a function
for the formula interpreter.
- values = ch(ssChannelName)
- values = ch(ssChannelName, ssBaseName)
- values = ch(ssChannelName, ssBaseName, bSIUnits)
Return Value
Is a row vector with the channel values. For MDF files only the form with two parameters should be invoked. The second parameter specifies the time group the data will be interpolated to.
Parameters
- ssChannelName
ssChannelName is a channel name.
- ssBaseName
ssBaseName is a channel name. For MDF files the data of ssChannelName is interpolated to the time group of ssBaseName.
If ssBaseName is not specified or an empty string (“”) the data is not interpolated.
- bSIUnits
bSIUnits is TRUE (1), if ssChannelName has to be converted to SI units. If bSIUnits is not specified or FALSE (0) the units are not converted.
Example
// Leistung in kW
// M*2*PI*n
// Drehzahl n in 1/min
// Moment m in Nm
def _fi_Power(bInfo)
{
ssChannels = "n_Motor, Md_Motor";
if (bInfo) {
return ["Power"; ..
"kW"; ..
"Leistung"; ..
ssChannels];
}
n_Motor = ch("n_Motor");
Md_Motor = ch("Md_Motor");
Power = (n_Motor .* Md_Motor) ./ 9549.3;
set_ch("Power", Power, ssChannels);
}
History
Version |
Description |
---|---|
R2013.11 |
Third parameter. |
R2012 (5.40.0) |
New documentation. |
5.7 |
New. |
See also
Formula Interpreter 1 - Introduction, Unit Converter, OnFormulaStartEval, set_ch, get_ncid,
id-1127067