set_chΒΆ

set_ch sets the new channel data.

The function can only be used inside a formula function. The function uses the globale variable _fi_ncid.

bool = set_ch(ssChannelName, values)
bool = set_ch(ssChannelName, values, ssDepChannels)
bool = set_ch(ssChannelName, values, ssDepChannels, bSIUnits)

Return Value

bool is TRUE (1), if the function was successful an otherwise FALSE (0).

Parameters

ssChannelName

ssChannelName is a channel name.

values

values is a vector with values.

ssDepChannels

ssDepChannels.

bSIUnits

bSIUnits must be TRUE (1), if values are in SI units and the units attribute is not in SI units. Teh units will be converted. If bSIUnits is FALSE (0) or the parameter is not specified, the units are not converted.

Example

Beispiel

// 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;
            "0"];
    }
    n_Motor = ch("n_Motor");
    Md_Motor = ch("Md_Motor");
    Power = (n_Motor .* Md_Motor) ./ 9549.3;
    set_ch("Power", Power, ssChannels);
}
// Leistung in kW
// M*2*PI*n
// Drehzahl n in 1/s
// Moment m in Nm
def _fi_Power(bInfo)
{
    bSIUnits = 1;
    ssUnit = "kW";
    ssChannels = "n_Motor, Md_Motor";
    if (bInfo) {
        return ["Power"; ..
            ssUnit; ..
            "Leistung"; ..
            ssChannels;
            "1"];
    }
    n_Motor = ch("n_Motor", "", bSIUnits);
    Md_Motor = ch("Md_Motor", "", bSIUnits);
    Power = (n_Motor .* Md_Motor) .* (2*PI);
    set_ch("Power", Power, ssChannels, bSIUnits);
}

History

Version Description
R2013.11 Unit Conversion.
R2012.0 New documentation.
5.7 New.

id-875561