MFl Library (Mfl)
AUTOSAR Classic Libraries-Modul MFl Library (Mfl, Spezifikation: AUTOSAR_CP_SWS_MFLLibrary.pdf, AUTOSAR_SWS_MFLLibrary.pdf).
Funktionen — Übersicht
<OutType> Mfl_Cvrt_f32_<OutTypeMn> (float32 ValFloat, sint16 ValFixedExponent);Returns the integer value of the fixed point result of the conversion, determined according to the following equation.float32 Mfl_Cvrt_<InTypeMn>_f32 (<InType> ValFixedInteger, sint16 ValFixedExponent);Returns the floating-point result of the conversion, determined according to the following equation.float32 Mfl_Trunc_f32 (float32 ValValue);Returns the integer value determined by rounding the argument toward zero.float32 Mfl_Round_f32 (float32 ValValue);Returns the integer value determined by rounding the argument toward the nearest whole number.float32 Mfl_Ceil_f32 (float32 ValValue);Returns the integer value determined by rounding the argument toward positive infinity.float32 Mfl_Floor_f32 (float32 ValValue);Returns the natural number value determined by rounding the argument toward negative infinity.void Mfl_PCalc (float32 X_f32, float32* P_pf32, float32 K_f32);Differential equation: Y = K * Xfloat32 Mfl_POut_f32 (const float32* P_pf32);This routine returns 'P' controllers output value limited by the return data typevoid Mfl_PT1Calc (float32 X_f32, Mfl_StatePT1_Type* State_cpst, float32 K_f32, float32 TeQ_f32);This routine computes PT1 controller output value using below difference equationvoid Mfl_PT1SetState (Mfl_StatePT1_Type* State_cpst, float32 X1_f32, float32 Y1_f32);The routine initialises internal state variables of a PT1 element.float32 Mfl_CalcTeQ_f32 (float32 T1rec_f32, float32 dT_f32);This routine calculates time equivalent factorfloat32 Mfl_PT1Out_f32 (const Mfl_StatePT1_Type* State_cpst);This routine returns 'PT1' controllers output valuevoid Mfl_DT1Typ1Calc (float32 X_f32, Mfl_StateDT1Typ1_Type* State_cpst, float32 K_f32, float32 TeQ_f32, float32 dT_f32);This routine computes DT1 controller output value using differential equationvoid Mfl_DT1Typ1SetState (Mfl_StateDT1Typ1_Type* State_cpst, float32 X1_f32, float32 X2_f32, float32 Y1_f32);The routine initialises internal state variables of a DT1 element.float32 Mfl_DT1Typ1Out_f32 (const Mfl_StateDT1Typ1_Type* State_cpst);This routine returns 'DT1' controller's output valuevoid Mfl_PDCalc (float32 X_f32, Mfl_StatePD_Type* State_cpst, const Mfl_ParamPD_Type* Param_cpst, float32 dT_f32);This routine computes proportional plus derivative controller output value using differential equationvoid Mfl_PDSetState (Mfl_StatePD_Type* State_cpst, float32 X1_f32, float32 Y1_f32);The routine initialises internal state variables of a PD element.void Mfl_PDSetParam (Mfl_ParamPD_Type* Param_cpst, float32 K_f32, float32 Tv_f32);The routine sets the parameter structure of a PD element.float32 Mfl_PDOut_f32 (const Mfl_StatePD_Type* State_cpst);This routine returns 'PD' controllers output value.void Mfl_ICalc (float32 X_f32, Mfl_StateI_Type* State_cpst, float32 K_f32, float32 dT_f32);This routine computes I controller output value using differential equationvoid Mfl_ISetState (Mfl_StateI_Type* State_cpst, float32 X1_f32, float32 Y1_f32);The routine initialises internal state variables of an I element.float32 Mfl_IOut_f32 (const Mfl_StateI_Type* State_cpst);This routine returns 'I' controllers output value.void Mfl_PITyp1Calc (float32 X_f32, Mfl_StatePI_Type* State_cpst, const Mfl_ParamPI_Type* Param_cpst, float32 dT_f32);This routine computes Proportional plus integral controller (implicit type) output value using differential equationvoid Mfl_PITyp2Calc (float32 X_f32, Mfl_StatePI_Type* State_cpst, const Mfl_ParamPI_Type* Param_cpst, float32 dT_f32);This routine computes Proportional plus integral controller (explicit type) output value using differential equationvoid Mfl_PISetState (Mfl_StatePI_Type* State_cpst, float32 X1_f32, float32 Y1_f32);The routine initialises internal state variables of a PI element.void Mfl_PISetParam (Mfl_ParamPI_Type* Param_cpst, float32 K_f32, float32 Tnrec_f32);The routine sets the parameter structure of a PI element.float32 Mfl_PIOut_f32 (const Mfl_StatePI_Type* State_cpst);This routine returns 'PI' controllers output value.void Mfl_PIDTyp1Calc (float32 X_f32, Mfl_StatePID_Type* State_cpst, const Mfl_ParamPID_Type* Param_cpst, float32 dT_f32);This routine computes Proportional plus integral plus derivative controller (implicit type) output value using differential...void Mfl_PIDTyp2Calc (float32 X_f32, Mfl_StatePID_Type* State_cpst, const Mfl_ParamPID_Type* Param_cpst, float32 dT_f32);This routine computes Proportional plus integral plus derivative controller (explicit type) output value using differential...void Mfl_PIDSetState (Mfl_StatePID_Type* State_cpst, float32 X1_f32, float32 X2_f32, float32 Y1_f32);The routine initialises internal state variables of a PID element.void Mfl_PIDSetParam (Mfl_ParamPID_Type* Param_cpst, float32 K_f32, float32 Tv_f32, float32 Tnrec_f32);The routine sets the parameter structure of a PID element.float32 Mfl_PIDOut_f32 (const Mfl_StatePID_Type* State_cpst);This routine returns 'PID' controllers output value.float32 Mfl_Abs_f32 (float32 ValValue);Returns the absolute value of the argument (ValAbs), determined according to the following equation.sint8 Mfl_Sign_f32 (float32 ValValue);Returns the sign of the argument (ValSign), determined according to the following equation.float32 Mfl_Max_f32 (float32 ValValue1, float32 ValValue2);Returns the value of the larger of the two arguments (ValMax), determined according to the following equation.float32 Mfl_Min_f32 (float32 Value1, float32 Value2);Returns the value of the smaller of the two arguments (Min), determined according to the following equation.float32 Mfl_RateLimiter_f32 (float32 newval, float32 oldval, float32 maxdif);An increasing value and decreasing value is rate limited by maxdiffloat32 Mfl_Limit_f32 (float32 val, float32 lowLim, float32 upLim);Returns the bounded value (newVal), determined according to the following equation.float32 Mfl_Pow_f32 (float32 ValBase, float32 ValExp);Returns the ValBase raised to ValExp power, determined according to the following equation.float32 Mfl_Sqrt_f32 (float32 ValValue);Returns the square root of the operand (ValSqrt), determined according to the following equationfloat32 Mfl_Exp_f32 (float32 ValValue);Returns the exponential of the operand (ValExp), determined according to the following equation.float32 Mfl_Log_f32 (float32 ValValue);Returns the natural (base-e) logarithm of the operand (ValLog), determined according to the following equation.float32 Mfl_Sin_f32 (float32 value);Calculates the sine of the argument.float32 Mfl_Cos_f32 (float32 value);Calculates the cosine of the argument.float32 Mfl_Tan_f32 (float32 value);Calculates the tangent of the argument.float32 Mfl_arcSin_f32 (float32 value);Returns the arc sine of an angle, in the range of -pi/2 through pi/2.float32 Mfl_arcCos_f32 (float32 value);Returns the arc cosine of an angle, in the range of 0.float32 Mfl_arcTan_f32 (float32 value);Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.float32 Mfl_arcTan2_f32 (float32 X1_f32, float32 X2_f32);Returns the arc tangent of an angle, in the range of [-pi to pi]float32 Mfl_Average_f32_f32 (float32 value1, float32 value2);The routine returns average value.float32 Mfl_ArrayAverage_f32_f32 (const float32* Array, uint32 Count);The routine returns average value of an array.float32 Mfl_Hypot_f32f32_f32 (float32 x_value, float32 y_value);This service computes the length of a vectorvoid Mfl_RampCalc (float32 X_f32, Mfl_StateRamp_Type* State_cpst, const Mfl_ParamRamp_Type* Param_cpcst, float32 dT_f32);The ramp output value increases or decreases a value with slope * dT_f32 depending if (State_ cpst->State_f32 > X_f32)...void Mfl_RampInitState (Mfl_StateRamp_Type* State_cpst, float32 Val_f32);Initializes the state, direction and switch parameters for the ramp.void Mfl_RampSetParam (Mfl_ParamRamp_Type* Param_cpst, float32 SlopePosVal_f32, float32 SlopeNegVal_f32);Sets the slope parameter for the ramp provided by the structure Mfl_ParamRamp_Type.float32 Mfl_RampOut_f32 (const Mfl_StateRamp_Type* State_cpcst);Returns the internal state of the ramp element.void Mfl_RampCalcJump (float32 X_f32, Mfl_StateRamp_Type* State_cpst);This routine works in addition to main ramp function Mfl_RampCalc to provide a faster adaption to target value.float32 Mfl_RampCalcSwitch_f32 (float32 Xa_f32, float32 Xb_f32, Mfl_StateRamp_Type* State_cpst, const Mfl_ParamRamp_Type* Param_cpcst, float32 dT_f32);This routine switches ramp between two target values based on the Switch value.boolean Mfl_RampGetSwitchPos (const Mfl_StateRamp_Type* State_cpst);Gets the current switch position of ramp switch function.boolean Mfl_RampCheckActivity (const Mfl_StateRamp_Type* State_cpst);This routine checks the status of the ramp and returns a TRUE if the ramp is active, otherwise it returns FALSE.boolean Mfl_HystCenterHalfDelta_f32_u8 (float32 X, float32 center, float32 halfDelta, uint8* State);Hysteresis with center and left and right side halfDelta switching point.boolean Mfl_HystLeftRight_f32_u8 (float32 X, float32 Lsp, float32 Rsp, uint8* State);Hysteresis with left and right switching point.boolean Mfl_HystDeltaRight_f32_u8 (float32 X, float32 Delta, float32 Rsp, uint8* State);Hysteresis with right switching point and delta to left switching pointboolean Mfl_HystLeftDelta_f32_u8 (float32 X, float32 Lsp, float32 Delta, uint8* State);Hysteresis with left switching point and delta to right switching point.float32 Mfl_DeadTime_f32_f32 (float32 X, float32 DelayTime, float32 StepTime, Mfl_DeadTimeParam_Type* Param);This routine returns input value with specified delay time.boolean Mfl_Debounce_u8_u8 (boolean X, Mfl_DebounceState_Type* State, const Mfl_DebounceParam_Type* Param, float32 dT);This routine debounces a digital input signal and returns the state of the signal as a boolean value.void Mfl_DebounceInit (Mfl_DebounceState_Type* State, boolean X);This routine call shall stop the debouncing timer.void Mfl_DebounceSetparam (Mfl_DebounceParam_Type* Param, float32 THighLow, float32 TLowHigh);This routine sets timing parameters, time for high to low transition and time for low to high for debouncing.void Mfl_SortAscend_f32 (float32* Array, uint16 Num);The sorting algorithm modifies the given input array in ascending order & returns sorted array result via pointervoid Mfl_SortDescend_f32 (float32* Array, uint16 Num);The sorting algorithm modifies the given input array in descending order & returns sorted array result via pointerfloat32 Mfl_MedianSort_f32_f32 (float32* Array, uint8 N);This routine sorts values of an array in ascending order.void Mfl_DT1Typ2Calc (float32 X_f32, Mfl_StateDT1Typ2_Type* State_cpst, float32 K_f32, float32 TeQ_f32, float32 dT_f32);This routine computes DT1 controller output value using differential equationvoid Mfl_DT1Typ2SetState (Mfl_StateDT1Typ2_Type* State_cpst, float32 X1_f32, float32 Y1_f32);The routine initialises internal state variables of a DT1 element.float32 Mfl_DT1Typ2Out_f32 (const Mfl_StateDT1Typ2_Type* State_cpst);This routine returns 'DT1' controller's output valuefloat32 Mfl_CalcTeQApp_f32 (float32 T1rec_f32, float32 dT_f32);This routine calculates time equivalent factorvoid Mfl_ILimCalc (float32 X_f32, Mfl_StateI_Type* State_cpst, float32 K_f32, const Mfl_Limits_Type* Limit_cpst, float32 dT_f32);This routine computes I controller output value using differential equationvoid Mfl_CtrlSetLimit (float32 Min_f32, float32 Max_f32, Mfl_Limits_Type* Limit_cpst);Update limit structurevoid Mfl_PITyp1LimCalc (float32 X_f32, Mfl_StatePI_Type* State_cpst, const Mfl_ParamPI_Type* Param_cpst, const Mfl_Limits_Type* Limit_cpst, float32 dT_f32);This routine computes Proportional plus integral controller (implicit type) output value using differential equationvoid Mfl_PITyp2LimCalc (float32 X_f32, Mfl_StatePI_Type* State_cpst, const Mfl_ParamPI_Type* Param_cpst, const Mfl_Limits_Type* Limit_cpst, float32 dT_f32);This routine computes Proportional plus integral controller (explicit type) output value using differential equationvoid Mfl_PIDTyp1LimCalc (float32 X_f32, Mfl_StatePID_Type* State_cpst, const Mfl_ParamPID_Type* Param_cpst, const Mfl_Limits_Type* Limit_cpst, float32 dT_f32);This routine computes Proportional plus integral plus derivative controller (implicit type) output value using differential...void Mfl_PIDTyp2LimCalc (float32 X_f32, Mfl_StatePID_Type* State_cpst, const Mfl_ParamPID_Type* Param_cpst, const Mfl_Limits_Type* Limit_cpst, float32 dT_f32);This routine computes Proportional plus integral plus derivative controller (explicit type) output value using differential...float32 Mfl_ArcSin_f32 (float32 value);Returns the arc sine of an angle, in the range of -pi/2 through pi/2.float32 Mfl_ArcCos_f32 (float32 value);Returns the arc cosine of an angle, in the range of 0.float32 Mfl_ArcTan_f32 (float32 value);Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.float32 Mfl_ArcTan2_f32 (float32 y, float32 x);Returns the arc tangent of an angle, in the range of [-pi to pi]void Mfl_DebounceSetParam (Mfl_DebounceParam_Type* Param, float32 THighLow, float32 TLowHigh);This routine sets timing parameters, time for high to low transition and time for low to high for debouncing.void Mfl_CtrlSetLimits (Mfl_Limits_Type* Limit_cpst, float32 Min_f32, float32 Max_f32);Update limit structurefloat32 Mfl_RampCalcSwitch (float32 Xa_f32, float32 Xb_f32, boolean Switch, Mfl_StateRamp_Type* State_cpst);This routine switches between two target values for a ramp service based on a Switch parameter.void Mfl_GetVersionInfo (Std_VersionInfoType* versioninfo);Returns the version information of this library.float32 Mfl_IntToFloatCvrt_<InTypeMn>_f32 (<InType> ValInteger);Returns the Float value for the corresponding Integer input.<OutType> Mfl (float32 ValFloat);Returns the Integer value for the corresponding floating point input.uint32 Mfl_Bitpat_f32_u32 (float32 Value);Return the bit representation of the single point precision float valuefloat32 Mfl_RSqrt_f32 (float32 ValValue);Fast reciprocal square root of the operand (ValSqrt)float32 Mfl_Cos_s32_f32 (sint32 x_value);Fast cosine calculationfloat32 Mfl_Sin_s32_f32 (sint32 x_value);Fast sine calculationvoid Mfl_PT1Typ1Calc (float32 X_f32, Mfl_StatePT1_Type* State_cpst, float32 K_f32, float32 TeQ_f32);This routine computes PT1 controller output value using below difference equation Yn = exp(-d T/T1) * Yn-1+ K(1 - exp(-dT/T1))...
Typen — Übersicht
struct Mfl_StatePT1_TypeSystem State Structure for PT1 controller routinestruct Mfl_ParamRamp_TypeStructure definition for Ramp routinestruct Mfl_DeadTimeParam_TypeStructure definition for Dead Time routinestruct Mfl_DebounceParam_TypeStructure definition for Debouncing parametersstruct Mfl_StateDT1Typ1_TypeSystem State Structure for DT1-Type1 controller routinestruct Mfl_StateDT1Typ2_TypeSystem State Structure for DT1-Type2 controller routinestruct Mfl_StatePD_TypeSystem State Structure for PD controller routinestruct Mfl_ParamPD_TypeSystem and Time equivalent parameter Structure for PD controller routinestruct Mfl_StateI_TypeSystem State Structure for I controller routinestruct Mfl_StatePI_TypeSystem State Structure for PI additive ( Type1 and Type 2 ) controller routinestruct Mfl_ParamPI_TypeSystem and Time equivalent parameter Structure for PI additive ( Type1 and Type 2 ) controller routinestruct Mfl_StatePID_TypeSystem State Structure for PID additive ( Type1 and Type 2 ) controller routinestruct Mfl_ParamPID_TypeSystem and Time equivalent parameter Structure for PID additive ( Type1 and Type 2 ) controller routinestruct Mfl_Limits_TypeController limit value structurestruct Mfl_StateRamp_TypeStructure definition for Ramp routinestruct Mfl_DebounceState_TypeStructure definition for Debouncing state variables
Anforderungen — Übersicht
SWS_Mfl_00001The Mfl module shall provide the following files: • C files, Mfl_.SWS_Mfl_00006Result = ValFloat * 2ValFixedExponentSWS_Mfl_00007The return value shall be saturated to the return type boundary values in the event of overflow or underflow.SWS_Mfl_00008If it is necessary to round the result of this equation, it is rounded toward zero.SWS_Mfl_00009Function ID[hex] Function prototype 0x01 uint16 Mfl_Cvrt_f32_u16(float32, sint16 ) 0x02 sint16 Mfl_Cvrt_f32_s16(float32,...SWS_Mfl_00011Result = ValFixedInteger * 2-ValFixedExponentSWS_Mfl_00012Function ID[hex] Function prototype 0x05 float32 Mfl_Cvrt_u16_f32( uint16, sint16 ) 0x06 float32 Mfl_Cvrt_s16_f32( sint16,...SWS_Mfl_00017If the argument is halfway between two integers, it is rounded away from zero.SWS_Mfl_00027Implemented difference equation: *P_pf32 = K_f32 * X_f32 1.SWS_Mfl_00031Output value = *P_pf32SWS_Mfl_00033Yn= exp(-dT/T1) * Yn-1+ K(1- exp(-dT/T1)) * Xn-1 This derives implementation: Output_value = (TeQ_f32 * State_cpst->Y1) +...SWS_Mfl_00035If (TeQ_f32 = 0) then PT1 controller follows Input value, State_cpst->Y1 = K_f32 * X_f32SWS_Mfl_00036calculated Output_value and current input value shall be stored to State_cpst->Y1 and State_cpst->X1 respectively.SWS_Mfl_00038Initialisation of output state variable Y1.SWS_Mfl_00039Initialisation of input state variable X1.SWS_Mfl_00041TeQ_f32 = exp(-T1rec_f32 * dT_f32) 1.SWS_Mfl_00043Output value = State_cpst->Y1SWS_Mfl_00045Yn= exp(-dT/T1) * Yn-1+ K * (1- exp(-dT/T1)) * ((Xn-1 - Xn-2) / dT) This derives implementation: Output_value = (TeQ_f32 *...SWS_Mfl_00047If (TeQ_f32 = 0) then DT1 controller follows Input value, Output_value = K_f32 * (X_f32 - State_cpst->X1) / dT_f32SWS_Mfl_00048Calculated Output_value shall be stored to State_cpst->Y1.SWS_Mfl_00049Old input value State_cpst->X1 shall be stored to State_cpst->X2.SWS_Mfl_00051Initialisation of output state variable Y1.SWS_Mfl_00052Initialisation of input state variables X1 and X2.SWS_Mfl_00054Output value = State_cpst->Y1 1.SWS_Mfl_00056Yn= K(1+Tv/dT) * Xn- K(Tv/dT) * Xn-1 This derives implementation: Output_value = (Param_cpst->K_C * (1+...SWS_Mfl_00057Calculated Output_value shall be stored to State_cpst->Y1.SWS_Mfl_00058Current input value X_f32 shall be stored to State_cpst->X1.SWS_Mfl_00060Initialisation of output state variable Y1.SWS_Mfl_00061Initialisation of input state variable X1.SWS_Mfl_00063Initialisation of amplification factor.SWS_Mfl_00064Initialisation of lead time state variable Param_cpst->Tv_C = Tv_f32 1.SWS_Mfl_00067Output value = State_cpst->Y1SWS_Mfl_00069Yn= Yn-1 + K * dT * Xn-1 This derives implementation: Output_value = State_cpst->Y1 + K_f32 * dT_f32 * State_cpst->X1SWS_Mfl_00070Calculated Output_value and current input value shall be stored to State_cpst->Y1 and State_cpst->X1 respectively.SWS_Mfl_00072Initialisation of output state variable Y1.SWS_Mfl_00073Initialisation of input state variable X1.SWS_Mfl_00075Output value = State_cpst->Y1SWS_Mfl_00077Yn= Yn-1+ K * Xn- K * (1 - dT/Tn) * Xn-1 This derives implementation: Output_value = State_cpst->Y1 + (Param_cpst->K_C *...SWS_Mfl_00078Calculated Output_value shall be stored to State_cpst->Y1.SWS_Mfl_00079Current input value X_f32 shall be stored to State_cpst->X1.SWS_Mfl_00081Yn= Yn-1 + K * (1 + dT/Tn) * Xn - K * Xn-1 This derives implementation: Output_value = State_cpst->Y1 + (Param_cpst->K_C...SWS_Mfl_00082Calculated Output_value shall be stored to State_cpst->Y1.SWS_Mfl_00083Current input value X_f32 shall be stored to State_cpst->X1.SWS_Mfl_00085Initialisation of output state variable Y1.SWS_Mfl_00086Initialisation of input state variable X1.SWS_Mfl_00088Initialisation of amplification factor.SWS_Mfl_00089Initialisation of reciprocal follow up time state variable Param_cpst->Tnrec_C = Tnrec_f32 1.SWS_Mfl_00091Output value = State_cpst->Y1SWS_Mfl_00093Yn=Yn-1+ K * (1 + Tv/dT) * Xn- K *(1 - dT/Tn + 2Tv/dT) * Xn-1 + K * (Tv/dT) * Xn-2 This derives implementation: calc1 =...SWS_Mfl_00094Calculated Output_value shall be stored to State_cpst->Y1.SWS_Mfl_00095Old input value State_cpst->X1 shall be stored to State_cpst->X2 State_cpst->X2 = State_cpst->X1 Current input...SWS_Mfl_00097Yn = Yn-1 + K * (1 + dT/Tn+ Tv/dT) * Xn- K *(1 + 2Tv/dT) * Xn-1+ K * (Tv/dT) * Xn-2 This derives implementation: calc1 =...SWS_Mfl_00098Calculated Output_value shall be stored to State_cpst->Y1.SWS_Mfl_00099Old input value State_cpst->X1 shall be stored to State_cpst->X2 State_cpst->X2 = State_cpst->X1 Current input...SWS_Mfl_00101Initialisation of output state variable Y1.SWS_Mfl_00102Initialisation of input state variable X1.SWS_Mfl_00104Initialisation of amplification factor.SWS_Mfl_00105Initialisation of lead time state variable Param_cpst->Tv_C = Tv_f32SWS_Mfl_00106Initialisation of reciprocal follow up time state variable Param_cpst->Tnrec_C = Tnrec_f32 1.SWS_Mfl_00108Output value = State_cpst->Y1SWS_Mfl_00111ValAbs = | ValValue |SWS_Mfl_00113ValSign = 1, ValValue > 0.SWS_Mfl_00114ValSign = 0, ValValue == 0.SWS_Mfl_00115ValSign = -1, ValValue < 0.SWS_Mfl_00117ValMax = ValValue1, ValValue1 ValValue2 ValMax = ValValue2, ValValue1 < ValValue2SWS_Mfl_00119Min = Value1, Value1 Value2 Min = Value2, Value1 > Value2SWS_Mfl_00121if ( newval > oldval ) and (( newval - oldval ) > maxdif ) Result = oldval + maxdif else if ( newval maxdif ) Result =...SWS_Mfl_00123newVal = lowLim, val lowLim newVal = upLim, val upLim newVal = val, lowLim < val < upLimSWS_Mfl_00131ValResult = ValBaseValExpSWS_Mfl_00132If ValExp = 0, and ValBase = 0, ValResult = 1, ( 00 = 1) If ValBase = 0 and ValExp <> 0, ValResult = 0, ( 0ValExp = 0)SWS_Mfl_00133If ValBase and ValExp are having maximum value of type float32, the return value will be toward positive infinity.SWS_Mfl_00136ValSqrt = ValValue1/2SWS_Mfl_00137ValValue shall be passed as positive value.SWS_Mfl_00141ValExp = eValValueSWS_Mfl_00142Call the function with input value in the range [-24PI, +24PI]SWS_Mfl_00146ValLog = loge(ValValue)SWS_Mfl_00147ValValue shall be passed as > 0 value.SWS_Mfl_00151Result: result = sine ( value )SWS_Mfl_00152Call the function with input value in the range [-24PI, +24PI]SWS_Mfl_00156Result: result = cosine ( value )SWS_Mfl_00157Call the function with input value in the range [-24PI, +24PI]SWS_Mfl_00161Result: result = tangent( value )SWS_Mfl_00163Call the function with input value in the range [-24PI, +24PI]SWS_Mfl_00167If the argument is zero, then the result is a zero.SWS_Mfl_00168Range of the value shall be [-1, +1]SWS_Mfl_00172Range of the value shall be [-1, +1]SWS_Mfl_00177If the argument is zero, then the result is a zero with the same sign as the argument.SWS_Mfl_00182If the argument is zero, then the result is a zero with the same sign as the argument.SWS_Mfl_00183Z = X2_f32 / X1_f32 if (Z > 1) Then Result = Z / (1.SWS_Mfl_00191Output = (Value1 + Value2 ) / 2SWS_Mfl_00193Output = (Array[0] + Array[1]+_ _ Array[N-1] ) / NSWS_Mfl_00196This service computes the length of a vector: Result = square_root ( x_value * x_value + y_value * y_value)SWS_Mfl_00202If ramp direction is rising then ramp increases a value with slope * dT_f32 if (State_cpst->Dir_s8 == RISING)...SWS_Mfl_00203If ramp direction is falling then ramp decreases a value with slope * dT_f32 if (State_cpst->Dir_s8 == FALLING)...SWS_Mfl_00204Direction of the ramp is stored so that a change of the target can be recognized and the output will follow immediately to the...SWS_Mfl_00205Comparison of State and Target decides ramp direction.SWS_Mfl_00209Ramp direction is initialised with END value.SWS_Mfl_00211Sets positive and negative ramp slopes.SWS_Mfl_00213Return Value = State_cpcst->State_f32SWS_Mfl_00215If target value changes to a value contrary to current ramp direction and ramp has not reached its old target value then ramp...SWS_Mfl_00217Switch decides target to select.SWS_Mfl_00218State_cpst->Dir_s8 holds direction information Ramp direction status: RISING, FALLING, ENDSWS_Mfl_00219If ramp is active then ramp will change to reach selected target with defined slope.SWS_Mfl_00220Once ramp value reaches the selected target value, the ramp direction status is switched to END.SWS_Mfl_00221If the ramp has reached its destination and no change of switch occurs, the output value follows the actual target value.SWS_Mfl_00222Calculated ramp value shall be stored to State_cpst->State_f32 variable.SWS_Mfl_00224Return value = TRUE if Switch position State_cpst->Switch_s8 = TARGET_A Return value = FALSE if Switch position...SWS_Mfl_00226return value = TRUE, if Ramp is active (State_cpst->Dir_s8 != END) return value = FALSE, if Ramp is inactive...SWS_Mfl_00237Return value is TRUE if input is greater then center plus halfDelta switching point.SWS_Mfl_00238Return value is FALSE if input is less then center minus halfDelta switching point.SWS_Mfl_00239Return value is former state value if input is in the range of halfDelta around the center switching pointSWS_Mfl_00242Return value is TRUE if input is greater then right switching point.SWS_Mfl_00243Return value is FALSE if input is less then left switching point.SWS_Mfl_00244Return value is former state value if input is between left and right switching pointsSWS_Mfl_00247Return value is TRUE if input is greater then right switching point.SWS_Mfl_00248Return value is FALSE if input is less then right switching point minus delta.SWS_Mfl_00249Return value is former state value if input is between right switching points and right minus delta.SWS_Mfl_00252Return value is TRUE if input is greater then left switching point plus delta.SWS_Mfl_00253Return value is FALSE if input is less then left switching point.SWS_Mfl_00254Return value is former state value if input is between left switching points and left plus delta.SWS_Mfl_00257Buffer data stores input samples hence reproduced output signal will reduce samples in case high delay time.SWS_Mfl_00258Buffer size shall be configured as per the delay time range requirement.SWS_Mfl_00261If(X != State->XOld) then check start debouncing.SWS_Mfl_00262If transition is from Low to High, then use Param->TimeLowHigh as debouncing time otherwise use Param->TimeHighLowSWS_Mfl_00263State->Timer is incremented with sample time for debouncing input signal.SWS_Mfl_00264Old value shall be returned as a output value.SWS_Mfl_00267State->Timer = 0SWS_Mfl_00268Sets the input state to the given init value.SWS_Mfl_00270Param-> TimeHighLow = THighLow Param-> TimeLowHigh = TLowHighSWS_Mfl_00275Initialisation of state variable State_cpst ->State_f32 = Val_f32SWS_Mfl_00276Initialisation of switch variable.SWS_Mfl_00287Returns the median value of sorted array in case of N is even.SWS_Mfl_00288Returns the median value of sorted array in case of N is odd.SWS_Mfl_00289In above calculation, N/2 shall be rounded off towards 0.SWS_Mfl_00301Yn= exp(-dT/T1) * Yn-1+ K * (1- exp(-dT/T1)) * ((Xn - Xn-1) / dT) This derives implementation: Output_value = (TeQ_f32 *...SWS_Mfl_00303If (TeQ_f32 = 0) then DT1 controller follows Input value, Output_value = K_f32 * (X_f32 - State_cpst->X1) / dT_f32SWS_Mfl_00304Calculated Output_value shall be stored to State_cpst->Y1.SWS_Mfl_00305Current input value X_f32 shall be stored to State_cpst->X1.SWS_Mfl_00307Initialisation of output state variable Y1.SWS_Mfl_00308Initialisation of input state variable X1.SWS_Mfl_00311Output value = State_cpst->Y1SWS_Mfl_00316TeQApp_f32 = 1 - (T1rec_f32 * dT_f32) 1.SWS_Mfl_00321Yn= Yn-1 + K * dT * Xn-1 This derives implementation: Output_value = State_cpst->Y1 + K_f32 * dT_f32 * State_cpst->X1SWS_Mfl_00322Limit output value with maximum and minimum controller limits.SWS_Mfl_00323Calculated Output_value and current input value shall be stored to State_cpst->Y1 and State_cpst->X1 respectively.SWS_Mfl_00325Update limit structure Limit_cpst->Min_C = Min_f32 Limit_cpst->Max_C = Max_f32SWS_Mfl_00327Yn= Yn-1+ K * Xn- K * (1 - dT/Tn) * Xn-1 This derives implementation: Output_value = State_cpst->Y1 + (Param_cpst->K_C *...SWS_Mfl_00328Limit output value with maximum and minimum controller limits.SWS_Mfl_00329Calculated Output_value shall be stored to State_cpst->Y1.SWS_Mfl_00330Current input value X_f32 shall be stored to State_cpst->X1.SWS_Mfl_00332Yn= Yn-1 + K * (1 + dT/Tn) * Xn - K * Xn-1 This derives implementation: Output_value = State_cpst->Y1 + (Param_cpst->K_C...SWS_Mfl_00333Limit output value with maximum and minimum controller limits.SWS_Mfl_00334Calculated Output_value shall be stored to State_cpst->Y1.SWS_Mfl_00335Current input value X_f32 shall be stored to State_cpst->X1.SWS_Mfl_00341Yn=Yn-1+ K * (1 + Tv/dT) * Xn- K *(1 - dT/Tn + 2Tv/dT) * Xn-1 + K * (Tv/dT) * Xn-2 This derives implementation: calc1 =...SWS_Mfl_00342Limit output value with maximum and minimum controller limits.SWS_Mfl_00343Calculated Output_value shall be stored to State_cpst->Y1.SWS_Mfl_00344Old input value State_cpst->X1 shall be stored to State_cpst->X2 State_cpst->X2 = State_cpst->X1 Current input...SWS_Mfl_00346Yn = Yn-1 + K * (1 + dT/Tn+ Tv/dT) * Xn- K *(1 + 2Tv/dT) * Xn-1+ K * (Tv/dT) * Xn-2 This derives implementation: calc1 =...SWS_Mfl_00347Limit output value with maximum and minimum controller limits.SWS_Mfl_00348Calculated Output_value shall be stored to State_cpst->Y1.SWS_Mfl_00349Old input value State_cpst->X1 shall be stored to State_cpst->X2 State_cpst->X2 = State_cpst->X1 Current input...SWS_Mfl_00352If the argument is zero, then the result is a zero.SWS_Mfl_00353Range of the value shall be [-1, +1]SWS_Mfl_00356Range of the value shall be [-1, +1]SWS_Mfl_00359If the argument is zero, then the result is a zero with the same sign as the argument.SWS_Mfl_00362If the x coordinate is zero, then check if(y > 0.SWS_Mfl_00363Z = y / x if (|Z| < 1) Then Result = Z / (1.SWS_Mfl_00366Param-> TimeHighLow = THighLow Param-> TimeLowHigh = TLowHighSWS_Mfl_00368Update limit structure Limit_cpst->Min_C = Min_f32 Limit_cpst->Max_C = Max_f32 1.SWS_Mfl_00370Parameter Switch decides which target value is selected.SWS_Mfl_00371State_cpst->Dir_s8 hold direction information State_cpst->Dir_s8 shall be set to END to reset direction information in...SWS_Mfl_00372Mfl_RampCalcSwitch has to be called before Mfl_RampCalc routineSWS_Mfl_00800Mfl library shall not require initialization phase.SWS_Mfl_00801Mfl library shall not require a shutdown operation phase.SWS_Mfl_00806The Mfl library shall be implemented in a way that the code can be shared among callers in different memory partitions.SWS_Mfl_00807Usage of macros should be avoided.SWS_Mfl_00808A library function shall not call any BSW modules functions, e.SWS_Mfl_00809The library, written in C programming language, should conform to the MISRA C Standard.SWS_Mfl_00810Each AUTOSAR library Module implementation *.SWS_Mfl_00811Each AUTOSAR library Module implementation *.SWS_Mfl_00812All AUTOSAR library Modules should use the AUTOSAR data types (integers, boolean) instead of native C data types, unless this...SWS_Mfl_00813All AUTOSAR library Modules should avoid direct use of compiler and platform specific keyword, unless this library is clearly...SWS_Mfl_00814The standardized common published parameters as required by [SRS_BSW_00402] in the General Requirements on Basic Software...SWS_Mfl_00816If source code for caller and callee of Mfl_GetVersionInfo is avail- able, the Mfl library should realize Mfl_GetVersionInfo...SWS_Mfl_00817The functions shall not call the DET for error notification.SWS_Mfl_00818The Mfl library shall not have any configuration options that may affect the functional behavior of the routines.SWS_Mfl_00819Error detection: The validity of the parameters passed to library functions must be checked at the application level, there is...SWS_Mfl_00820can be found here:[10](ISO/IEC 9899:1990 Programming Language - C) Mfl_Sin_f32(float32) sinf(float) Mfl_Cos_f32(float32) ...SWS_Mfl_00821Section 7.SWS_Mfl_00822These requirements are not applicable to this specification.SWS_Mfl_00835If the ramp state State_cpst->State_f32 has reached or crossed the target value X_ f32 while the direction of the ramp had...SWS_Mfl_00837The result shall be round ties to even.SWS_Mfl_00838Function ID[hex] Function prototype 0xD1 float32 Mfl_IntToFloatCvrt_u8_f32(uint8) 0xD2 float32...SWS_Mfl_00840The return value shall be saturated to the return type boundary values in the event of overflow or underflow.SWS_Mfl_00841The result shall be rounded toward zero.SWS_Mfl_00842Function ID[hex] Function prototype 0xCB uint8 Mfl_FloatToIntCvrt_f32_u8(float32) 0xCC sint8...SWS_Mfl_00843If the input is +/- Infinity, then the output shall be limited to target type boundaries (max/min) after the conversion.SWS_Mfl_00844Service name: Mfl_DivLim_f32 Syntax: Mfl_Div_St Mfl_DivLim_f32(float32 x_f32, float32 y_f32, float32 min_f32, float32 max_f32,...SWS_Mfl_00845Returns E_SUCCESS, in case of the following scenarios,if the dividend and divisor are finite then,Result = X_f32 / Y_f32 and...SWS_Mfl_00846Returns E_INVALID, if there is an invalid operation and the result of the IEEE754 divi- sion operation is NaN (not a number).SWS_Mfl_00847Returns E_DIVBYZERO, if the divisor is zero and the dividend is a finite non-zero num- ber, the result shall be max/min based...SWS_Mfl_00848If the input is NaN, then the output of the conversion shall be zero.SWS_Mfl_00849Service name: Mfl_Mod_f32 Syntax: Mfl_Mod_St_Type Mfl_Mod_f32(float32 x_f32, float32 y_f32, float32* Result) Service ID[hex]:...SWS_Mfl_00851Returns E_SUCCESS, in case of the following scenarios, if the dividend and divisor is finite then, *Result = x_f32 % y_f32 and...SWS_Mfl_00852Returns E_INVALID, if there is an invalid operation and the result of the operation shall be NaN (not a number).SWS_Mfl_00854Calculate an approximation of the reciprocal of the square root of ValValue (1/sqrt(ValValue)).
Funktionen & Typen — Detailansicht
função Mfl_Cvrt_f32_<OutTypeMn> [SWS_Mfl_00005] 📄 PDF
<OutType> Mfl_Cvrt_f32_<OutTypeMn>(float32 ValFloat, sint16 ValFixedExponent);
Returns the integer value of the fixed point result of the conversion, determined according to the following equation.
função Mfl_Cvrt_<InTypeMn>_f32 [SWS_Mfl_00010] 📄 PDF
float32 Mfl_Cvrt_<InTypeMn>_f32(<InType> ValFixedInteger, sint16 ValFixedExponent);
Returns the floating-point result of the conversion, determined according to the following equation.
função Mfl_Trunc_f32 [SWS_Mfl_00013] 📄 PDF
float32 Mfl_Trunc_f32(float32 ValValue);
Returns the integer value determined by rounding the argument toward zero.
função Mfl_Round_f32 [SWS_Mfl_00015] 📄 PDF
float32 Mfl_Round_f32(float32 ValValue);
Returns the integer value determined by rounding the argument toward the nearest whole number.
função Mfl_Ceil_f32 [SWS_Mfl_00018] 📄 PDF
float32 Mfl_Ceil_f32(float32 ValValue);
Returns the integer value determined by rounding the argument toward positive infinity.
função Mfl_Floor_f32 [SWS_Mfl_00020] 📄 PDF
float32 Mfl_Floor_f32(float32 ValValue);
Returns the natural number value determined by rounding the argument toward negative infinity.
função Mfl_PCalc [SWS_Mfl_00026] 📄 PDF
void Mfl_PCalc(float32 X_f32, float32* P_pf32, float32 K_f32);
Differential equation: Y = K * X
função Mfl_POut_f32 [SWS_Mfl_00030] 📄 PDF
float32 Mfl_POut_f32(const float32* P_pf32);
This routine returns 'P' controllers output value limited by the return data type
função Mfl_PT1Calc [SWS_Mfl_00032] 📄 PDF
void Mfl_PT1Calc(float32 X_f32, Mfl_StatePT1_Type* State_cpst, float32 K_f32, float32 TeQ_f32);
This routine computes PT1 controller output value using below difference equation
função Mfl_PT1SetState [SWS_Mfl_00037] 📄 PDF
void Mfl_PT1SetState(Mfl_StatePT1_Type* State_cpst, float32 X1_f32, float32 Y1_f32);
The routine initialises internal state variables of a PT1 element.
função Mfl_CalcTeQ_f32 [SWS_Mfl_00040] 📄 PDF
float32 Mfl_CalcTeQ_f32(float32 T1rec_f32, float32 dT_f32);
This routine calculates time equivalent factor
função Mfl_PT1Out_f32 [SWS_Mfl_00042] 📄 PDF
float32 Mfl_PT1Out_f32(const Mfl_StatePT1_Type* State_cpst);
This routine returns 'PT1' controllers output value
função Mfl_DT1Typ1Calc [SWS_Mfl_00044] 📄 PDF
void Mfl_DT1Typ1Calc(float32 X_f32, Mfl_StateDT1Typ1_Type* State_cpst, float32 K_f32, float32 TeQ_f32, float32 dT_f32);
This routine computes DT1 controller output value using differential equation
função Mfl_DT1Typ1SetState [SWS_Mfl_00050] 📄 PDF
void Mfl_DT1Typ1SetState(Mfl_StateDT1Typ1_Type* State_cpst, float32 X1_f32, float32 X2_f32, float32 Y1_f32);
The routine initialises internal state variables of a DT1 element.
função Mfl_DT1Typ1Out_f32 [SWS_Mfl_00053] 📄 PDF
float32 Mfl_DT1Typ1Out_f32(const Mfl_StateDT1Typ1_Type* State_cpst);
This routine returns 'DT1' controller's output value
função Mfl_PDCalc [SWS_Mfl_00055] 📄 PDF
void Mfl_PDCalc(float32 X_f32, Mfl_StatePD_Type* State_cpst, const Mfl_ParamPD_Type* Param_cpst, float32 dT_f32);
This routine computes proportional plus derivative controller output value using differential equation
função Mfl_PDSetState [SWS_Mfl_00059] 📄 PDF
void Mfl_PDSetState(Mfl_StatePD_Type* State_cpst, float32 X1_f32, float32 Y1_f32);
The routine initialises internal state variables of a PD element.
função Mfl_PDSetParam [SWS_Mfl_00062] 📄 PDF
void Mfl_PDSetParam(Mfl_ParamPD_Type* Param_cpst, float32 K_f32, float32 Tv_f32);
The routine sets the parameter structure of a PD element.
função Mfl_PDOut_f32 [SWS_Mfl_00066] 📄 PDF
float32 Mfl_PDOut_f32(const Mfl_StatePD_Type* State_cpst);
This routine returns 'PD' controllers output value.
função Mfl_ICalc [SWS_Mfl_00068] 📄 PDF
void Mfl_ICalc(float32 X_f32, Mfl_StateI_Type* State_cpst, float32 K_f32, float32 dT_f32);
This routine computes I controller output value using differential equation
função Mfl_ISetState [SWS_Mfl_00071] 📄 PDF
void Mfl_ISetState(Mfl_StateI_Type* State_cpst, float32 X1_f32, float32 Y1_f32);
The routine initialises internal state variables of an I element.
função Mfl_IOut_f32 [SWS_Mfl_00074] 📄 PDF
float32 Mfl_IOut_f32(const Mfl_StateI_Type* State_cpst);
This routine returns 'I' controllers output value.
função Mfl_PITyp1Calc [SWS_Mfl_00076] 📄 PDF
void Mfl_PITyp1Calc(float32 X_f32, Mfl_StatePI_Type* State_cpst, const Mfl_ParamPI_Type* Param_cpst, float32 dT_f32);
This routine computes Proportional plus integral controller (implicit type) output value using differential equation
função Mfl_PITyp2Calc [SWS_Mfl_00080] 📄 PDF
void Mfl_PITyp2Calc(float32 X_f32, Mfl_StatePI_Type* State_cpst, const Mfl_ParamPI_Type* Param_cpst, float32 dT_f32);
This routine computes Proportional plus integral controller (explicit type) output value using differential equation
função Mfl_PISetState [SWS_Mfl_00084] 📄 PDF
void Mfl_PISetState(Mfl_StatePI_Type* State_cpst, float32 X1_f32, float32 Y1_f32);
The routine initialises internal state variables of a PI element.
função Mfl_PISetParam [SWS_Mfl_00087] 📄 PDF
void Mfl_PISetParam(Mfl_ParamPI_Type* Param_cpst, float32 K_f32, float32 Tnrec_f32);
The routine sets the parameter structure of a PI element.
função Mfl_PIOut_f32 [SWS_Mfl_00090] 📄 PDF
float32 Mfl_PIOut_f32(const Mfl_StatePI_Type* State_cpst);
This routine returns 'PI' controllers output value.
função Mfl_PIDTyp1Calc [SWS_Mfl_00092] 📄 PDF
void Mfl_PIDTyp1Calc(float32 X_f32, Mfl_StatePID_Type* State_cpst, const Mfl_ParamPID_Type* Param_cpst, float32 dT_f32);
This routine computes Proportional plus integral plus derivative controller (implicit type) output value using differential equation
função Mfl_PIDTyp2Calc [SWS_Mfl_00096] 📄 PDF
void Mfl_PIDTyp2Calc(float32 X_f32, Mfl_StatePID_Type* State_cpst, const Mfl_ParamPID_Type* Param_cpst, float32 dT_f32);
This routine computes Proportional plus integral plus derivative controller (explicit type) output value using differential equation
função Mfl_PIDSetState [SWS_Mfl_00100] 📄 PDF
void Mfl_PIDSetState(Mfl_StatePID_Type* State_cpst, float32 X1_f32, float32 X2_f32, float32 Y1_f32);
The routine initialises internal state variables of a PID element.
função Mfl_PIDSetParam [SWS_Mfl_00103] 📄 PDF
void Mfl_PIDSetParam(Mfl_ParamPID_Type* Param_cpst, float32 K_f32, float32 Tv_f32, float32 Tnrec_f32);
The routine sets the parameter structure of a PID element.
função Mfl_PIDOut_f32 [SWS_Mfl_00107] 📄 PDF
float32 Mfl_PIDOut_f32(const Mfl_StatePID_Type* State_cpst);
This routine returns 'PID' controllers output value.
função Mfl_Abs_f32 [SWS_Mfl_00110] 📄 PDF
float32 Mfl_Abs_f32(float32 ValValue);
Returns the absolute value of the argument (ValAbs), determined according to the following equation.
função Mfl_Sign_f32 [SWS_Mfl_00112] 📄 PDF
sint8 Mfl_Sign_f32(float32 ValValue);
Returns the sign of the argument (ValSign), determined according to the following equation.
função Mfl_Max_f32 [SWS_Mfl_00116] 📄 PDF
float32 Mfl_Max_f32(float32 ValValue1, float32 ValValue2);
Returns the value of the larger of the two arguments (ValMax), determined according to the following equation.
função Mfl_Min_f32 [SWS_Mfl_00118] 📄 PDF
float32 Mfl_Min_f32(float32 Value1, float32 Value2);
Returns the value of the smaller of the two arguments (Min), determined according to the following equation.
função Mfl_RateLimiter_f32 [SWS_Mfl_00120] 📄 PDF
float32 Mfl_RateLimiter_f32(float32 newval, float32 oldval, float32 maxdif);
An increasing value and decreasing value is rate limited by maxdif
função Mfl_Limit_f32 [SWS_Mfl_00122] 📄 PDF
float32 Mfl_Limit_f32(float32 val, float32 lowLim, float32 upLim);
Returns the bounded value (newVal), determined according to the following equation.
função Mfl_Pow_f32 [SWS_Mfl_00130] 📄 PDF
float32 Mfl_Pow_f32(float32 ValBase, float32 ValExp);
Returns the ValBase raised to ValExp power, determined according to the following equation.
função Mfl_Sqrt_f32 [SWS_Mfl_00135] 📄 PDF
float32 Mfl_Sqrt_f32(float32 ValValue);
Returns the square root of the operand (ValSqrt), determined according to the following equation
função Mfl_Exp_f32 [SWS_Mfl_00140] 📄 PDF
float32 Mfl_Exp_f32(float32 ValValue);
Returns the exponential of the operand (ValExp), determined according to the following equation.
função Mfl_Log_f32 [SWS_Mfl_00145] 📄 PDF
float32 Mfl_Log_f32(float32 ValValue);
Returns the natural (base-e) logarithm of the operand (ValLog), determined according to the following equation.
função Mfl_Sin_f32 [SWS_Mfl_00150] 📄 PDF
float32 Mfl_Sin_f32(float32 value);
Calculates the sine of the argument.
função Mfl_Cos_f32 [SWS_Mfl_00155] 📄 PDF
float32 Mfl_Cos_f32(float32 value);
Calculates the cosine of the argument.
função Mfl_Tan_f32 [SWS_Mfl_00160] 📄 PDF
float32 Mfl_Tan_f32(float32 value);
Calculates the tangent of the argument.
função Mfl_arcSin_f32 [SWS_Mfl_00165] 📄 PDF
float32 Mfl_arcSin_f32(float32 value);
Returns the arc sine of an angle, in the range of -pi/2 through pi/2.
função Mfl_arcCos_f32 [SWS_Mfl_00170] 📄 PDF
float32 Mfl_arcCos_f32(float32 value);
Returns the arc cosine of an angle, in the range of 0.0 through pi.
função Mfl_arcTan_f32 [SWS_Mfl_00175] 📄 PDF
float32 Mfl_arcTan_f32(float32 value);
Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
função Mfl_arcTan2_f32 [SWS_Mfl_00180] 📄 PDF
float32 Mfl_arcTan2_f32(float32 X1_f32, float32 X2_f32);
Returns the arc tangent of an angle, in the range of [-pi to pi]
função Mfl_Average_f32_f32 [SWS_Mfl_00190] 📄 PDF
float32 Mfl_Average_f32_f32(float32 value1, float32 value2);
The routine returns average value.
função Mfl_ArrayAverage_f32_f32 [SWS_Mfl_00192] 📄 PDF
float32 Mfl_ArrayAverage_f32_f32(const float32* Array, uint32 Count);
The routine returns average value of an array.
função Mfl_Hypot_f32f32_f32 [SWS_Mfl_00195] 📄 PDF
float32 Mfl_Hypot_f32f32_f32(float32 x_value, float32 y_value);
This service computes the length of a vector
função Mfl_RampCalc [SWS_Mfl_00201] 📄 PDF
void Mfl_RampCalc(float32 X_f32, Mfl_StateRamp_Type* State_cpst, const Mfl_ParamRamp_Type* Param_cpcst, float32 dT_f32);
The ramp output value increases or decreases a value with slope * dT_f32 depending if (State_ cpst->State_f32 > X_f32) or (State_cpst->State_f32 < X_f32).
função Mfl_RampInitState [SWS_Mfl_00208] 📄 PDF
void Mfl_RampInitState(Mfl_StateRamp_Type* State_cpst, float32 Val_f32);
Initializes the state, direction and switch parameters for the ramp.
função Mfl_RampSetParam [SWS_Mfl_00210] 📄 PDF
void Mfl_RampSetParam(Mfl_ParamRamp_Type* Param_cpst, float32 SlopePosVal_f32, float32 SlopeNegVal_f32);
Sets the slope parameter for the ramp provided by the structure Mfl_ParamRamp_Type.
função Mfl_RampOut_f32 [SWS_Mfl_00212] 📄 PDF
float32 Mfl_RampOut_f32(const Mfl_StateRamp_Type* State_cpcst);
Returns the internal state of the ramp element.
função Mfl_RampCalcJump [SWS_Mfl_00214] 📄 PDF
void Mfl_RampCalcJump(float32 X_f32, Mfl_StateRamp_Type* State_cpst);
This routine works in addition to main ramp function Mfl_RampCalc to provide a faster adaption to target value. If ramp is still rising (or falling) and target value is not reached, then input value of ramp jumps to a lower (or higher) value of current ramp state, ramp will jump to that value immediately. This functionality is helpful if input target value of ramp changes its direction often and significantly and ramp should reach target value faster than without that functionality. If the target is reached or the target does not change its direction, the standard behaviour of ramp functionality is untouched. In general, this routine decides whether a jump has to be done or not, if there is a change in the target. After a call to this function, Mfl_RampCalc function shall be called to execute the standard ramp behaviour.
função Mfl_RampCalcSwitch_f32 [SWS_Mfl_00216] 📄 PDF
float32 Mfl_RampCalcSwitch_f32(float32 Xa_f32, float32 Xb_f32, Mfl_StateRamp_Type* State_cpst, const Mfl_ParamRamp_Type* Param_cpcst, float32 dT_f32);
This routine switches ramp between two target values based on the Switch value.
função Mfl_RampGetSwitchPos [SWS_Mfl_00223] 📄 PDF
boolean Mfl_RampGetSwitchPos(const Mfl_StateRamp_Type* State_cpst);
Gets the current switch position of ramp switch function.
função Mfl_RampCheckActivity [SWS_Mfl_00225] 📄 PDF
boolean Mfl_RampCheckActivity(const Mfl_StateRamp_Type* State_cpst);
This routine checks the status of the ramp and returns a TRUE if the ramp is active, otherwise it returns FALSE.
função Mfl_HystCenterHalfDelta_f32_u8 [SWS_Mfl_00236] 📄 PDF
boolean Mfl_HystCenterHalfDelta_f32_u8(float32 X, float32 center, float32 halfDelta, uint8* State);
Hysteresis with center and left and right side halfDelta switching point.
função Mfl_HystLeftRight_f32_u8 [SWS_Mfl_00241] 📄 PDF
boolean Mfl_HystLeftRight_f32_u8(float32 X, float32 Lsp, float32 Rsp, uint8* State);
Hysteresis with left and right switching point.
função Mfl_HystDeltaRight_f32_u8 [SWS_Mfl_00246] 📄 PDF
boolean Mfl_HystDeltaRight_f32_u8(float32 X, float32 Delta, float32 Rsp, uint8* State);
Hysteresis with right switching point and delta to left switching point
função Mfl_HystLeftDelta_f32_u8 [SWS_Mfl_00251] 📄 PDF
boolean Mfl_HystLeftDelta_f32_u8(float32 X, float32 Lsp, float32 Delta, uint8* State);
Hysteresis with left switching point and delta to right switching point.
função Mfl_DeadTime_f32_f32 [SWS_Mfl_00256] 📄 PDF
float32 Mfl_DeadTime_f32_f32(float32 X, float32 DelayTime, float32 StepTime, Mfl_DeadTimeParam_Type* Param);
This routine returns input value with specified delay time.
função Mfl_Debounce_u8_u8 [SWS_Mfl_00260] 📄 PDF
boolean Mfl_Debounce_u8_u8(boolean X, Mfl_DebounceState_Type* State, const Mfl_DebounceParam_Type* Param, float32 dT);
This routine debounces a digital input signal and returns the state of the signal as a boolean value.
função Mfl_DebounceInit [SWS_Mfl_00266] 📄 PDF
void Mfl_DebounceInit(Mfl_DebounceState_Type* State, boolean X);
This routine call shall stop the debouncing timer.
função Mfl_DebounceSetparam [SWS_Mfl_00269] 📄 PDF
void Mfl_DebounceSetparam(Mfl_DebounceParam_Type* Param, float32 THighLow, float32 TLowHigh);
This routine sets timing parameters, time for high to low transition and time for low to high for debouncing.
função Mfl_SortAscend_f32 [SWS_Mfl_00271] 📄 PDF
void Mfl_SortAscend_f32(float32* Array, uint16 Num);
The sorting algorithm modifies the given input array in ascending order & returns sorted array result via pointer
função Mfl_SortDescend_f32 [SWS_Mfl_00273] 📄 PDF
void Mfl_SortDescend_f32(float32* Array, uint16 Num);
The sorting algorithm modifies the given input array in descending order & returns sorted array result via pointer
função Mfl_MedianSort_f32_f32 [SWS_Mfl_00285] 📄 PDF
float32 Mfl_MedianSort_f32_f32(float32* Array, uint8 N);
This routine sorts values of an array in ascending order. Input array passed by the pointer shall have sorted values after this routine call. If N is set incorrectly there is a security risk of buffer overrun. Memory corruption is possible, if parameter N is greater than the array size. Therefore N is recommended to be a constant, not a variable.
função Mfl_DT1Typ2Calc [SWS_Mfl_00300] 📄 PDF
void Mfl_DT1Typ2Calc(float32 X_f32, Mfl_StateDT1Typ2_Type* State_cpst, float32 K_f32, float32 TeQ_f32, float32 dT_f32);
This routine computes DT1 controller output value using differential equation
função Mfl_DT1Typ2SetState [SWS_Mfl_00306] 📄 PDF
void Mfl_DT1Typ2SetState(Mfl_StateDT1Typ2_Type* State_cpst, float32 X1_f32, float32 Y1_f32);
The routine initialises internal state variables of a DT1 element.
função Mfl_DT1Typ2Out_f32 [SWS_Mfl_00310] 📄 PDF
float32 Mfl_DT1Typ2Out_f32(const Mfl_StateDT1Typ2_Type* State_cpst);
This routine returns 'DT1' controller's output value
função Mfl_CalcTeQApp_f32 [SWS_Mfl_00315] 📄 PDF
float32 Mfl_CalcTeQApp_f32(float32 T1rec_f32, float32 dT_f32);
This routine calculates time equivalent factor
função Mfl_ILimCalc [SWS_Mfl_00320] 📄 PDF
void Mfl_ILimCalc(float32 X_f32, Mfl_StateI_Type* State_cpst, float32 K_f32, const Mfl_Limits_Type* Limit_cpst, float32 dT_f32);
This routine computes I controller output value using differential equation
função Mfl_CtrlSetLimit [SWS_Mfl_00324] 📄 PDF
void Mfl_CtrlSetLimit(float32 Min_f32, float32 Max_f32, Mfl_Limits_Type* Limit_cpst);
Update limit structure
função Mfl_PITyp1LimCalc [SWS_Mfl_00326] 📄 PDF
void Mfl_PITyp1LimCalc(float32 X_f32, Mfl_StatePI_Type* State_cpst, const Mfl_ParamPI_Type* Param_cpst, const Mfl_Limits_Type* Limit_cpst, float32 dT_f32);
This routine computes Proportional plus integral controller (implicit type) output value using differential equation
função Mfl_PITyp2LimCalc [SWS_Mfl_00331] 📄 PDF
void Mfl_PITyp2LimCalc(float32 X_f32, Mfl_StatePI_Type* State_cpst, const Mfl_ParamPI_Type* Param_cpst, const Mfl_Limits_Type* Limit_cpst, float32 dT_f32);
This routine computes Proportional plus integral controller (explicit type) output value using differential equation
função Mfl_PIDTyp1LimCalc [SWS_Mfl_00340] 📄 PDF
void Mfl_PIDTyp1LimCalc(float32 X_f32, Mfl_StatePID_Type* State_cpst, const Mfl_ParamPID_Type* Param_cpst, const Mfl_Limits_Type* Limit_cpst, float32 dT_f32);
This routine computes Proportional plus integral plus derivative controller (implicit type) output value using differential equation
função Mfl_PIDTyp2LimCalc [SWS_Mfl_00345] 📄 PDF
void Mfl_PIDTyp2LimCalc(float32 X_f32, Mfl_StatePID_Type* State_cpst, const Mfl_ParamPID_Type* Param_cpst, const Mfl_Limits_Type* Limit_cpst, float32 dT_f32);
This routine computes Proportional plus integral plus derivative controller (explicit type) output value using differential equation
função Mfl_ArcSin_f32 [SWS_Mfl_00350] 📄 PDF
float32 Mfl_ArcSin_f32(float32 value);
Returns the arc sine of an angle, in the range of -pi/2 through pi/2.
função Mfl_ArcCos_f32 [SWS_Mfl_00354] 📄 PDF
float32 Mfl_ArcCos_f32(float32 value);
Returns the arc cosine of an angle, in the range of 0.0 through pi.
função Mfl_ArcTan_f32 [SWS_Mfl_00357] 📄 PDF
float32 Mfl_ArcTan_f32(float32 value);
Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
função Mfl_ArcTan2_f32 [SWS_Mfl_00360] 📄 PDF
float32 Mfl_ArcTan2_f32(float32 y, float32 x);
Returns the arc tangent of an angle, in the range of [-pi to pi]
função Mfl_DebounceSetParam [SWS_Mfl_00365] 📄 PDF
void Mfl_DebounceSetParam(Mfl_DebounceParam_Type* Param, float32 THighLow, float32 TLowHigh);
This routine sets timing parameters, time for high to low transition and time for low to high for debouncing.
função Mfl_CtrlSetLimits [SWS_Mfl_00367] 📄 PDF
void Mfl_CtrlSetLimits(Mfl_Limits_Type* Limit_cpst, float32 Min_f32, float32 Max_f32);
Update limit structure
função Mfl_RampCalcSwitch [SWS_Mfl_00369] 📄 PDF
float32 Mfl_RampCalcSwitch(float32 Xa_f32, float32 Xb_f32, boolean Switch, Mfl_StateRamp_Type* State_cpst);
This routine switches between two target values for a ramp service based on a Switch parameter.
função Mfl_GetVersionInfo [SWS_Mfl_00815] 📄 PDF
void Mfl_GetVersionInfo(Std_VersionInfoType* versioninfo);
Returns the version information of this library.
função Mfl_IntToFloatCvrt_<InTypeMn>_f32 [SWS_Mfl_00836] 📄 PDF
float32 Mfl_IntToFloatCvrt_<InTypeMn>_f32(<InType> ValInteger);
Returns the Float value for the corresponding Integer input.
função Mfl [SWS_Mfl_00839] 📄 PDF
<OutType> Mfl(float32 ValFloat);
Returns the Integer value for the corresponding floating point input.
função Mfl_Bitpat_f32_u32 [SWS_Mfl_91000] 📄 PDF
uint32 Mfl_Bitpat_f32_u32(float32 Value);
Return the bit representation of the single point precision float value
função Mfl_RSqrt_f32 [SWS_Mfl_91001] 📄 PDF
float32 Mfl_RSqrt_f32(float32 ValValue);
Fast reciprocal square root of the operand (ValSqrt)
função Mfl_Cos_s32_f32 [SWS_Mfl_91003] 📄 PDF
float32 Mfl_Cos_s32_f32(sint32 x_value);
Fast cosine calculation
função Mfl_Sin_s32_f32 [SWS_Mfl_91004] 📄 PDF
float32 Mfl_Sin_s32_f32(sint32 x_value);
Fast sine calculation
função Mfl_PT1Typ1Calc [SWS_Mfl_91007] 📄 PDF
void Mfl_PT1Typ1Calc(float32 X_f32, Mfl_StatePT1_Type* State_cpst, float32 K_f32, float32 TeQ_f32);
This routine computes PT1 controller output value using below difference equation Yn = exp(-d T/T1) * Yn-1+ K(1 - exp(-dT/T1)) * Xn
tipo Mfl_StatePT1_Type [SWS_Mfl_00025] 📄 PDF
System State Structure for PT1 controller routine
tipo Mfl_ParamRamp_Type [SWS_Mfl_00200] 📄 PDF
Structure definition for Ramp routine
tipo Mfl_DeadTimeParam_Type [SWS_Mfl_00259] 📄 PDF
Structure definition for Dead Time routine
tipo Mfl_DebounceParam_Type [SWS_Mfl_00265] 📄 PDF
Structure definition for Debouncing parameters
tipo Mfl_StateDT1Typ1_Type [SWS_Mfl_00823] 📄 PDF
System State Structure for DT1-Type1 controller routine
tipo Mfl_StateDT1Typ2_Type [SWS_Mfl_00824] 📄 PDF
System State Structure for DT1-Type2 controller routine
tipo Mfl_StatePD_Type [SWS_Mfl_00825] 📄 PDF
System State Structure for PD controller routine
tipo Mfl_ParamPD_Type [SWS_Mfl_00826] 📄 PDF
System and Time equivalent parameter Structure for PD controller routine
tipo Mfl_StateI_Type [SWS_Mfl_00827] 📄 PDF
System State Structure for I controller routine
tipo Mfl_StatePI_Type [SWS_Mfl_00828] 📄 PDF
System State Structure for PI additive ( Type1 and Type 2 ) controller routine
tipo Mfl_ParamPI_Type [SWS_Mfl_00829] 📄 PDF
System and Time equivalent parameter Structure for PI additive ( Type1 and Type 2 ) controller routine
tipo Mfl_StatePID_Type [SWS_Mfl_00830] 📄 PDF
System State Structure for PID additive ( Type1 and Type 2 ) controller routine
tipo Mfl_ParamPID_Type [SWS_Mfl_00831] 📄 PDF
System and Time equivalent parameter Structure for PID additive ( Type1 and Type 2 ) controller routine
tipo Mfl_Limits_Type [SWS_Mfl_00832] 📄 PDF
Controller limit value structure
tipo Mfl_StateRamp_Type [SWS_Mfl_00833] 📄 PDF
Structure definition for Ramp routine
tipo Mfl_DebounceState_Type [SWS_Mfl_00834] 📄 PDF
Structure definition for Debouncing state variables
requirement SWS_Mfl_00001 [SWS_Mfl_00001] 📄 PDF
The Mfl module shall provide the following files: • C files, Mfl_<name>.c used to implement the library. All C files shall be prefixed with 'Mfl_'.
requirement SWS_Mfl_00006 [SWS_Mfl_00006] 📄 PDF
Result = ValFloat * 2ValFixedExponent
requirement SWS_Mfl_00007 [SWS_Mfl_00007] 📄 PDF
The return value shall be saturated to the return type boundary values in the event of overflow or underflow.
requirement SWS_Mfl_00008 [SWS_Mfl_00008] 📄 PDF
If it is necessary to round the result of this equation, it is rounded toward zero.
requirement SWS_Mfl_00009 [SWS_Mfl_00009] 📄 PDF
Function ID[hex] Function prototype 0x01 uint16 Mfl_Cvrt_f32_u16(float32, sint16 ) 0x02 sint16 Mfl_Cvrt_f32_s16(float32, sint16 ) 0x03 uint32 Mfl_Cvrt_f32_u32(float32, sint16 ) 0x04 sint32 Mfl_Cvrt_f32_s32(float32, sint16 )
requirement SWS_Mfl_00011 [SWS_Mfl_00011] 📄 PDF
Result = ValFixedInteger * 2-ValFixedExponent
requirement SWS_Mfl_00012 [SWS_Mfl_00012] 📄 PDF
Function ID[hex] Function prototype 0x05 float32 Mfl_Cvrt_u16_f32( uint16, sint16 ) 0x06 float32 Mfl_Cvrt_s16_f32( sint16, sint16 ) 0x07 float32 Mfl_Cvrt_u32_f32( uint32, sint16 ) 0x08 float32 Mfl_Cvrt_s32_f32( sint32, sint16 )
requirement SWS_Mfl_00017 [SWS_Mfl_00017] 📄 PDF
If the argument is halfway between two integers, it is rounded away from zero. For example: 36.5 will be rounded to 37.00
requirement SWS_Mfl_00027 [SWS_Mfl_00027] 📄 PDF
Implemented difference equation: *P_pf32 = K_f32 * X_f32 1. Get 'P' output This routine can be realised using inline function.
requirement SWS_Mfl_00031 [SWS_Mfl_00031] 📄 PDF
Output value = *P_pf32
requirement SWS_Mfl_00033 [SWS_Mfl_00033] 📄 PDF
Yn= exp(-dT/T1) * Yn-1+ K(1- exp(-dT/T1)) * Xn-1 This derives implementation: Output_value = (TeQ_f32 * State_cpst->Y1) + K_f32 * (1 - TeQ_f32) * State_cpst->X1 where TeQ_f32 = exp (-dT/T1)
requirement SWS_Mfl_00035 [SWS_Mfl_00035] 📄 PDF
If (TeQ_f32 = 0) then PT1 controller follows Input value, State_cpst->Y1 = K_f32 * X_f32
requirement SWS_Mfl_00036 [SWS_Mfl_00036] 📄 PDF
calculated Output_value and current input value shall be stored to State_cpst->Y1 and State_cpst->X1 respectively. State_cpst->Y1 = Output_value State_cpst->X1 = X_f32 1. 'PT1' Set State Value This routine can be realised using inline function.
requirement SWS_Mfl_00038 [SWS_Mfl_00038] 📄 PDF
Initialisation of output state variable Y1. State_cpst->Y1 = Y1_f32
requirement SWS_Mfl_00039 [SWS_Mfl_00039] 📄 PDF
Initialisation of input state variable X1. State_cpst->X1 = X1_f32. 1. Calculate time equivalent Value This routine can be realised using inline function.
requirement SWS_Mfl_00041 [SWS_Mfl_00041] 📄 PDF
TeQ_f32 = exp(-T1rec_f32 * dT_f32) 1. Calculate an approximate time equivalent Value This routine calculates approximate time equivalent and can be realised using inline function
requirement SWS_Mfl_00043 [SWS_Mfl_00043] 📄 PDF
Output value = State_cpst->Y1
requirement SWS_Mfl_00045 [SWS_Mfl_00045] 📄 PDF
Yn= exp(-dT/T1) * Yn-1+ K * (1- exp(-dT/T1)) * ((Xn-1 - Xn-2) / dT) This derives implementation: Output_value = (TeQ_f32 * State_cpst->Y1) + K_f32 * (1 - TeQ_f32) * ((State_cpst->X1 - State_cpst->X2) / dT_f32) where TeQ_f32 = exp(-dT_f32/T1)
requirement SWS_Mfl_00047 [SWS_Mfl_00047] 📄 PDF
If (TeQ_f32 = 0) then DT1 controller follows Input value, Output_value = K_f32 * (X_f32 - State_cpst->X1) / dT_f32
requirement SWS_Mfl_00048 [SWS_Mfl_00048] 📄 PDF
Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value
requirement SWS_Mfl_00049 [SWS_Mfl_00049] 📄 PDF
Old input value State_cpst->X1 shall be stored to State_cpst->X2. State_cpst->X2 = State_cpst->X1 Current input value X_f32 shall be stored to State_cpst->X1. State_cpst->X1 = X_f32 1. 'DT1' Controller - Type2
requirement SWS_Mfl_00051 [SWS_Mfl_00051] 📄 PDF
Initialisation of output state variable Y1. State_cpst->Y1 = Y1_f32
requirement SWS_Mfl_00052 [SWS_Mfl_00052] 📄 PDF
Initialisation of input state variables X1 and X2. State_cpst->X1 = X1_f32 State_cpst->X2 = X2_f32 1. Set 'DT1' State Value - Type2 This routine can be realised using inline function.
requirement SWS_Mfl_00054 [SWS_Mfl_00054] 📄 PDF
Output value = State_cpst->Y1 1. Get 'DT1' output - Type2 This routine can be realised using inline function.
requirement SWS_Mfl_00056 [SWS_Mfl_00056] 📄 PDF
Yn= K(1+Tv/dT) * Xn- K(Tv/dT) * Xn-1 This derives implementation: Output_value = (Param_cpst->K_C * (1+ Param_cpst->Tv_C/dT_f32) * X_f32) - (Param_cpst->K_C * (Param_cpst->Tv_C/dT_f32) * State_cpst->X1)
requirement SWS_Mfl_00057 [SWS_Mfl_00057] 📄 PDF
Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value
requirement SWS_Mfl_00058 [SWS_Mfl_00058] 📄 PDF
Current input value X_f32 shall be stored to State_cpst->X1. State_cpst->X1 = X_f32 1. PD Set State Value This routine can be realised using inline function.
requirement SWS_Mfl_00060 [SWS_Mfl_00060] 📄 PDF
Initialisation of output state variable Y1. State_cpst->Y1 = Y1_f32
requirement SWS_Mfl_00061 [SWS_Mfl_00061] 📄 PDF
Initialisation of input state variable X1. State_cpst->X1 = X1_f32 1. Set 'PD' Parameters This routine can be realised using inline function.
requirement SWS_Mfl_00063 [SWS_Mfl_00063] 📄 PDF
Initialisation of amplification factor. Param_cpst->K_C = K_f32
requirement SWS_Mfl_00064 [SWS_Mfl_00064] 📄 PDF
Initialisation of lead time state variable Param_cpst->Tv_C = Tv_f32 1. Get 'PD' output This routine can be realised using inline function.
requirement SWS_Mfl_00067 [SWS_Mfl_00067] 📄 PDF
Output value = State_cpst->Y1
requirement SWS_Mfl_00069 [SWS_Mfl_00069] 📄 PDF
Yn= Yn-1 + K * dT * Xn-1 This derives implementation: Output_value = State_cpst->Y1 + K_f32 * dT_f32 * State_cpst->X1
requirement SWS_Mfl_00070 [SWS_Mfl_00070] 📄 PDF
Calculated Output_value and current input value shall be stored to State_cpst->Y1 and State_cpst->X1 respectively. State_cpst->Y1 = Output_value State_cpst->X1 = X_f32 1. 'I' Controller with limitation
requirement SWS_Mfl_00072 [SWS_Mfl_00072] 📄 PDF
Initialisation of output state variable Y1. State_cpst->Y1 = Y1_f32
requirement SWS_Mfl_00073 [SWS_Mfl_00073] 📄 PDF
Initialisation of input state variable X1. State_cpst->X1 = X1_f32 1. Get 'I' output This routine can be realised using inline function.
requirement SWS_Mfl_00075 [SWS_Mfl_00075] 📄 PDF
Output value = State_cpst->Y1
requirement SWS_Mfl_00077 [SWS_Mfl_00077] 📄 PDF
Yn= Yn-1+ K * Xn- K * (1 - dT/Tn) * Xn-1 This derives implementation: Output_value = State_cpst->Y1 + (Param_cpst->K_C * X_f32) - (Param_cpst->K_C * (1 - Param_cpst->Tnrec_C * dT_f32) * State_cpst->X1)
requirement SWS_Mfl_00078 [SWS_Mfl_00078] 📄 PDF
Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value
requirement SWS_Mfl_00079 [SWS_Mfl_00079] 📄 PDF
Current input value X_f32 shall be stored to State_cpst->X1. State_cpst->X1 = X_f32
requirement SWS_Mfl_00081 [SWS_Mfl_00081] 📄 PDF
Yn= Yn-1 + K * (1 + dT/Tn) * Xn - K * Xn-1 This derives implementation: Output_value = State_cpst->Y1 + (Param_cpst->K_C * (1 + Param_cpst->Tnrec_C * d T_f32) * X_f32) - (Param_cpst->K_C * State_cpst->X1)
requirement SWS_Mfl_00082 [SWS_Mfl_00082] 📄 PDF
Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value
requirement SWS_Mfl_00083 [SWS_Mfl_00083] 📄 PDF
Current input value X_f32 shall be stored to State_cpst->X1. State_cpst->X1 = X_f32
requirement SWS_Mfl_00085 [SWS_Mfl_00085] 📄 PDF
Initialisation of output state variable Y1. State_cpst->Y1 = Y1_f32
requirement SWS_Mfl_00086 [SWS_Mfl_00086] 📄 PDF
Initialisation of input state variable X1. State_cpst->X1 = X1_f32 1. Set 'PI' Parameters This routine can be realised using inline function.
requirement SWS_Mfl_00088 [SWS_Mfl_00088] 📄 PDF
Initialisation of amplification factor. Param_cpst->K_C = K_f32
requirement SWS_Mfl_00089 [SWS_Mfl_00089] 📄 PDF
Initialisation of reciprocal follow up time state variable Param_cpst->Tnrec_C = Tnrec_f32 1. Get 'PI' output This routine can be realised using inline function.
requirement SWS_Mfl_00091 [SWS_Mfl_00091] 📄 PDF
Output value = State_cpst->Y1
requirement SWS_Mfl_00093 [SWS_Mfl_00093] 📄 PDF
Yn=Yn-1+ K * (1 + Tv/dT) * Xn- K *(1 - dT/Tn + 2Tv/dT) * Xn-1 + K * (Tv/dT) * Xn-2 This derives implementation: calc1 = Param_cpst->K_C * (1 + t_val) * X_f32 calc2 = Param_cpst->K_C * (1 - dT_f32 * Param_cpst->Tnrec_C + 2 * t_val) * State_ cpst->X1 calc3 = Param_cpst->K_C * t_val * State_cpst->X2 Output_value = State_cpst->Y1 + calc1 - calc2 + calc3 Where t_val = Param_cpst->Tv_C / dT_f32
requirement SWS_Mfl_00094 [SWS_Mfl_00094] 📄 PDF
Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value
requirement SWS_Mfl_00095 [SWS_Mfl_00095] 📄 PDF
Old input value State_cpst->X1 shall be stored to State_cpst->X2 State_cpst->X2 = State_cpst->X1 Current input value X_f32 shall be stored to State_cpst->X1. State_cpst->X1 = X_f32 1. 'PID' Controller - Type1 with limitation (Implicit type)
requirement SWS_Mfl_00097 [SWS_Mfl_00097] 📄 PDF
Yn = Yn-1 + K * (1 + dT/Tn+ Tv/dT) * Xn- K *(1 + 2Tv/dT) * Xn-1+ K * (Tv/dT) * Xn-2 This derives implementation: calc1 = Param_cpst->K_C * (1 + dT_f32 * Param_cpst->Tnrec_C + t_val) * X_f32 calc2 = Param_cpst->K_C * (1 + 2 * t_val) * State_cpst->X1 calc3 = Param_cpst->K_C * t_val * State_cpst->X2 Output_value = State_cpst->Y1 + calc1 - calc2 + calc3 Where t_val = Param_cpst->Tv_C / dT_f32
requirement SWS_Mfl_00098 [SWS_Mfl_00098] 📄 PDF
Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value
requirement SWS_Mfl_00099 [SWS_Mfl_00099] 📄 PDF
Old input value State_cpst->X1 shall be stored to State_cpst->X2 State_cpst->X2 = State_cpst->X1 Current input value X_f32 shall be stored to State_cpst->X1. State_cpst->X1 = X_f32 1. 'PID' Controller - Type2 with limitation (Explicit type)
requirement SWS_Mfl_00101 [SWS_Mfl_00101] 📄 PDF
Initialisation of output state variable Y1. State_cpst->Y1 = Y1_f32
requirement SWS_Mfl_00102 [SWS_Mfl_00102] 📄 PDF
Initialisation of input state variable X1. State_cpst->X1 = X1_f32 Initialisation of input state variable X2. State_cpst->X2 = X2_f32 1. Set 'PID' Parameters This routine can be realised using inline function.
requirement SWS_Mfl_00104 [SWS_Mfl_00104] 📄 PDF
Initialisation of amplification factor. Param_cpst->K_C = K_f32
requirement SWS_Mfl_00105 [SWS_Mfl_00105] 📄 PDF
Initialisation of lead time state variable Param_cpst->Tv_C = Tv_f32
requirement SWS_Mfl_00106 [SWS_Mfl_00106] 📄 PDF
Initialisation of reciprocal follow up time state variable Param_cpst->Tnrec_C = Tnrec_f32 1. Get 'PID' output This routine can be realised using inline function.
requirement SWS_Mfl_00108 [SWS_Mfl_00108] 📄 PDF
Output value = State_cpst->Y1
requirement SWS_Mfl_00111 [SWS_Mfl_00111] 📄 PDF
ValAbs = | ValValue |
requirement SWS_Mfl_00113 [SWS_Mfl_00113] 📄 PDF
ValSign = 1, ValValue > 0.0
requirement SWS_Mfl_00114 [SWS_Mfl_00114] 📄 PDF
ValSign = 0, ValValue == 0.0
requirement SWS_Mfl_00115 [SWS_Mfl_00115] 📄 PDF
ValSign = -1, ValValue < 0.0
requirement SWS_Mfl_00117 [SWS_Mfl_00117] 📄 PDF
ValMax = ValValue1, ValValue1 ValValue2 ValMax = ValValue2, ValValue1 < ValValue2
requirement SWS_Mfl_00119 [SWS_Mfl_00119] 📄 PDF
Min = Value1, Value1 Value2 Min = Value2, Value1 > Value2
requirement SWS_Mfl_00121 [SWS_Mfl_00121] 📄 PDF
if ( newval > oldval ) and (( newval - oldval ) > maxdif ) Result = oldval + maxdif else if ( newval < oldval ) and (( oldval - newval ) > maxdif ) Result = oldval - maxdif else Result = newval
requirement SWS_Mfl_00123 [SWS_Mfl_00123] 📄 PDF
newVal = lowLim, val lowLim newVal = upLim, val upLim newVal = val, lowLim < val < upLim
requirement SWS_Mfl_00131 [SWS_Mfl_00131] 📄 PDF
ValResult = ValBaseValExp
requirement SWS_Mfl_00132 [SWS_Mfl_00132] 📄 PDF
If ValExp = 0, and ValBase = 0, ValResult = 1, ( 00 = 1) If ValBase = 0 and ValExp <> 0, ValResult = 0, ( 0ValExp = 0)
requirement SWS_Mfl_00133 [SWS_Mfl_00133] 📄 PDF
If ValBase and ValExp are having maximum value of type float32, the return value will be toward positive infinity.
requirement SWS_Mfl_00136 [SWS_Mfl_00136] 📄 PDF
ValSqrt = ValValue1/2
requirement SWS_Mfl_00137 [SWS_Mfl_00137] 📄 PDF
ValValue shall be passed as positive value. (ValValue 0)
requirement SWS_Mfl_00141 [SWS_Mfl_00141] 📄 PDF
ValExp = eValValue
requirement SWS_Mfl_00142 [SWS_Mfl_00142] 📄 PDF
Call the function with input value in the range [-24PI, +24PI]
requirement SWS_Mfl_00146 [SWS_Mfl_00146] 📄 PDF
ValLog = loge(ValValue)
requirement SWS_Mfl_00147 [SWS_Mfl_00147] 📄 PDF
ValValue shall be passed as > 0 value.
requirement SWS_Mfl_00151 [SWS_Mfl_00151] 📄 PDF
Result: result = sine ( value )
requirement SWS_Mfl_00152 [SWS_Mfl_00152] 📄 PDF
Call the function with input value in the range [-24PI, +24PI]
requirement SWS_Mfl_00156 [SWS_Mfl_00156] 📄 PDF
Result: result = cosine ( value )
requirement SWS_Mfl_00157 [SWS_Mfl_00157] 📄 PDF
Call the function with input value in the range [-24PI, +24PI]
requirement SWS_Mfl_00161 [SWS_Mfl_00161] 📄 PDF
Result: result = tangent( value )
requirement SWS_Mfl_00163 [SWS_Mfl_00163] 📄 PDF
Call the function with input value in the range [-24PI, +24PI]
requirement SWS_Mfl_00167 [SWS_Mfl_00167] 📄 PDF
If the argument is zero, then the result is a zero.
requirement SWS_Mfl_00168 [SWS_Mfl_00168] 📄 PDF
Range of the value shall be [-1, +1]
requirement SWS_Mfl_00172 [SWS_Mfl_00172] 📄 PDF
Range of the value shall be [-1, +1]
requirement SWS_Mfl_00177 [SWS_Mfl_00177] 📄 PDF
If the argument is zero, then the result is a zero with the same sign as the argument.
requirement SWS_Mfl_00182 [SWS_Mfl_00182] 📄 PDF
If the argument is zero, then the result is a zero with the same sign as the argument.
requirement SWS_Mfl_00183 [SWS_Mfl_00183] 📄 PDF
Z = X2_f32 / X1_f32 if (Z > 1) Then Result = Z / (1.0 + (0.28 * Z2)) if (Z < 1) Then Result = (pi / 2) - (Z / (Z2 + 0.28))
requirement SWS_Mfl_00191 [SWS_Mfl_00191] 📄 PDF
Output = (Value1 + Value2 ) / 2
requirement SWS_Mfl_00193 [SWS_Mfl_00193] 📄 PDF
Output = (Array[0] + Array[1]+_ _ Array[N-1] ) / N
requirement SWS_Mfl_00196 [SWS_Mfl_00196] 📄 PDF
This service computes the length of a vector: Result = square_root ( x_value * x_value + y_value * y_value)
requirement SWS_Mfl_00202 [SWS_Mfl_00202] 📄 PDF
If ramp direction is rising then ramp increases a value with slope * dT_f32 if (State_cpst->Dir_s8 == RISING) State_cpst->State_f32 = State_cpst->State_f32 + (Param_cpcst->SlopePos_f32 * dT_ f32)
requirement SWS_Mfl_00203 [SWS_Mfl_00203] 📄 PDF
If ramp direction is falling then ramp decreases a value with slope * dT_f32 if (State_cpst->Dir_s8 == FALLING) State_cpst->State_f32 = State_cpst->State_f32 - (Param_cpcst->SlopeNeg_f32 * dT_ f32)
requirement SWS_Mfl_00204 [SWS_Mfl_00204] 📄 PDF
Direction of the ramp is stored so that a change of the target can be recognized and the output will follow immediately to the new target value. State_cpst->Dir_s8 states are: RISING, FALLING, END.
requirement SWS_Mfl_00205 [SWS_Mfl_00205] 📄 PDF
Comparison of State and Target decides ramp direction. If(State_cpst->State_f32 > X_f32) then State_cpst->Dir_s8 = FALLING If(State_cpst->State_f32 < X_f32) then State_cpst->Dir_s8 = RISING If(State_cpst->State_f32 == X_f32) then State_cpst->Dir_s8 = END
requirement SWS_Mfl_00209 [SWS_Mfl_00209] 📄 PDF
Ramp direction is initialised with END value. User has no possibility to change or modify ramp direction. State_cpst->Dir_s8 = END For example: ramp direction states: RISING = 1, FALLING = -1, END = 0
requirement SWS_Mfl_00211 [SWS_Mfl_00211] 📄 PDF
Sets positive and negative ramp slopes. Param_cpst->SlopePos_f32 = SlopePosVal_f32 Param_cpst->SlopeNeg_f32 = SlopeNegVal_f32
requirement SWS_Mfl_00213 [SWS_Mfl_00213] 📄 PDF
Return Value = State_cpcst->State_f32
requirement SWS_Mfl_00215 [SWS_Mfl_00215] 📄 PDF
If target value changes to a value contrary to current ramp direction and ramp has not reached its old target value then ramp state jumps to new target value immediately. State_cpst->State_f32 = X_f32 State_cpst->Dir_s8 = END Otherwise the previous values of State_cpst->Dir_s8 and State_cpst->State_f32 should be kept.
requirement SWS_Mfl_00217 [SWS_Mfl_00217] 📄 PDF
Switch decides target to select. If (State_cpst->Switch_s8 == TARGET_A), target = Xa_f32 If (State_cpst->Switch_s8 == TARGET_B), target = Xb_f32
requirement SWS_Mfl_00218 [SWS_Mfl_00218] 📄 PDF
State_cpst->Dir_s8 holds direction information Ramp direction status: RISING, FALLING, END
requirement SWS_Mfl_00219 [SWS_Mfl_00219] 📄 PDF
If ramp is active then ramp will change to reach selected target with defined slope. if (State_cpst->Dir_s8 == RISING) then State_cpst->State_f32 = State_cpst->State_f32 + (Param_cpcst->SlopePos_f32 * dT_f32) else if (State_cpst->Dir_s8 == FALLING) then State_cpst->State_f32 = State_cpst->State_f32 - (Param_cpcst->SlopeNeg_f32 * dT_f32) else if (State_cpst->Dir_s8 == END) State_cpst->State_f32 = target value which is decided by State_cpst->Switch_s8.
requirement SWS_Mfl_00220 [SWS_Mfl_00220] 📄 PDF
Once ramp value reaches the selected target value, the ramp direction status is switched to END. State_cpst->Dir_s8 == END
requirement SWS_Mfl_00221 [SWS_Mfl_00221] 📄 PDF
If the ramp has reached its destination and no change of switch occurs, the output value follows the actual target value. If(State_cpst->State_f32 == target value) Return_value = Xa_f32 (if State_cpst->Switch_s8 is TARGET_A) Return_value = Xb_f32 (if State_cpst->Switch_s8 is TARGET_B)
requirement SWS_Mfl_00222 [SWS_Mfl_00222] 📄 PDF
Calculated ramp value shall be stored to State_cpst->State_f32 variable.
requirement SWS_Mfl_00224 [SWS_Mfl_00224] 📄 PDF
Return value = TRUE if Switch position State_cpst->Switch_s8 = TARGET_A Return value = FALSE if Switch position State_cpst->Switch_s8 = TARGET_B
requirement SWS_Mfl_00226 [SWS_Mfl_00226] 📄 PDF
return value = TRUE, if Ramp is active (State_cpst->Dir_s8 != END) return value = FALSE, if Ramp is inactive (State_cpst->Dir_s8 == END)
requirement SWS_Mfl_00237 [SWS_Mfl_00237] 📄 PDF
Return value is TRUE if input is greater then center plus halfDelta switching point.
requirement SWS_Mfl_00238 [SWS_Mfl_00238] 📄 PDF
Return value is FALSE if input is less then center minus halfDelta switching point.
requirement SWS_Mfl_00239 [SWS_Mfl_00239] 📄 PDF
Return value is former state value if input is in the range of halfDelta around the center switching point
requirement SWS_Mfl_00242 [SWS_Mfl_00242] 📄 PDF
Return value is TRUE if input is greater then right switching point.
requirement SWS_Mfl_00243 [SWS_Mfl_00243] 📄 PDF
Return value is FALSE if input is less then left switching point.
requirement SWS_Mfl_00244 [SWS_Mfl_00244] 📄 PDF
Return value is former state value if input is between left and right switching points
requirement SWS_Mfl_00247 [SWS_Mfl_00247] 📄 PDF
Return value is TRUE if input is greater then right switching point.
requirement SWS_Mfl_00248 [SWS_Mfl_00248] 📄 PDF
Return value is FALSE if input is less then right switching point minus delta.
requirement SWS_Mfl_00249 [SWS_Mfl_00249] 📄 PDF
Return value is former state value if input is between right switching points and right minus delta.
requirement SWS_Mfl_00252 [SWS_Mfl_00252] 📄 PDF
Return value is TRUE if input is greater then left switching point plus delta.
requirement SWS_Mfl_00253 [SWS_Mfl_00253] 📄 PDF
Return value is FALSE if input is less then left switching point.
requirement SWS_Mfl_00254 [SWS_Mfl_00254] 📄 PDF
Return value is former state value if input is between left switching points and left plus delta.
requirement SWS_Mfl_00257 [SWS_Mfl_00257] 📄 PDF
Buffer data stores input samples hence reproduced output signal will reduce samples in case high delay time.
requirement SWS_Mfl_00258 [SWS_Mfl_00258] 📄 PDF
Buffer size shall be configured as per the delay time range requirement.
requirement SWS_Mfl_00261 [SWS_Mfl_00261] 📄 PDF
If(X != State->XOld) then check start debouncing.
requirement SWS_Mfl_00262 [SWS_Mfl_00262] 📄 PDF
If transition is from Low to High, then use Param->TimeLowHigh as debouncing time otherwise use Param->TimeHighLow
requirement SWS_Mfl_00263 [SWS_Mfl_00263] 📄 PDF
State->Timer is incremented with sample time for debouncing input signal. Once reached to the set period, old state is updated with X. State->Timer += dT; If(State ->Timer TimePeriod) State->XOld = X, and stop the timer, State->Timer = 0 where TimePeriod = Param->TimeLowHigh or Param->TimeHighLow
requirement SWS_Mfl_00264 [SWS_Mfl_00264] 📄 PDF
Old value shall be returned as a output value. Current input is stored to old state. Return value = State->XOld State->XOld = X
requirement SWS_Mfl_00267 [SWS_Mfl_00267] 📄 PDF
State->Timer = 0
requirement SWS_Mfl_00268 [SWS_Mfl_00268] 📄 PDF
Sets the input state to the given init value. State->XOld = X
requirement SWS_Mfl_00270 [SWS_Mfl_00270] 📄 PDF
Param-> TimeHighLow = THighLow Param-> TimeLowHigh = TLowHigh
requirement SWS_Mfl_00275 [SWS_Mfl_00275] 📄 PDF
Initialisation of state variable State_cpst ->State_f32 = Val_f32
requirement SWS_Mfl_00276 [SWS_Mfl_00276] 📄 PDF
Initialisation of switch variable. User has no possibility to change or modify switch initialization value. State_cpst->Switch_s8 = OFF For example: switch states: TARGET_A = 1, TARGET_B = -1, OFF = 0
requirement SWS_Mfl_00287 [SWS_Mfl_00287] 📄 PDF
Returns the median value of sorted array in case of N is even. Result = (Sorted_array[N/2] + Sorted_array[(N/2) - 1] ) / 2 For example: Sorted_array[4] = [8.0, 10.0, 15.0, 42.0] Result = (15.0 + 10.0) / 2.0 = 12.5
requirement SWS_Mfl_00288 [SWS_Mfl_00288] 📄 PDF
Returns the median value of sorted array in case of N is odd. Return_Value = Sorted_array [N/2] = 15 For example: Sorted_array[5] = [8.0, 10.0, 15.0, 42.0, 88.0] Result = 15.0
requirement SWS_Mfl_00289 [SWS_Mfl_00289] 📄 PDF
In above calculation, N/2 shall be rounded off towards 0. If N is set incorrectly there is a security risk of buffer overrun. Memory corruption is possible, if parameter N is greater than the array size. Therefore N is recommended to be a constant, not a variable.
requirement SWS_Mfl_00301 [SWS_Mfl_00301] 📄 PDF
Yn= exp(-dT/T1) * Yn-1+ K * (1- exp(-dT/T1)) * ((Xn - Xn-1) / dT) This derives implementation: Output_value = (TeQ_f32 * State_cpst->Y1) + K_f32 * (1 - TeQ_f32) * ((X_f32 - State_ cpst->X1) / dT_f32) where TeQ_f32 = exp(-dT_f32/T1)
requirement SWS_Mfl_00303 [SWS_Mfl_00303] 📄 PDF
If (TeQ_f32 = 0) then DT1 controller follows Input value, Output_value = K_f32 * (X_f32 - State_cpst->X1) / dT_f32
requirement SWS_Mfl_00304 [SWS_Mfl_00304] 📄 PDF
Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value
requirement SWS_Mfl_00305 [SWS_Mfl_00305] 📄 PDF
Current input value X_f32 shall be stored to State_cpst->X1. State_cpst->X1 = X_f32x 1. Set 'DT1' State Value - Type1 This routine can be realised using inline function.
requirement SWS_Mfl_00307 [SWS_Mfl_00307] 📄 PDF
Initialisation of output state variable Y1. State_cpst->Y1 = Y1_f32
requirement SWS_Mfl_00308 [SWS_Mfl_00308] 📄 PDF
Initialisation of input state variable X1. State_cpst->X1 = X1_f32 1. Get 'DT1' output - Type1 This routine can be realised using inline function.
requirement SWS_Mfl_00311 [SWS_Mfl_00311] 📄 PDF
Output value = State_cpst->Y1
requirement SWS_Mfl_00316 [SWS_Mfl_00316] 📄 PDF
TeQApp_f32 = 1 - (T1rec_f32 * dT_f32) 1. Get 'PT1' output This routine can be realised using inline function.
requirement SWS_Mfl_00321 [SWS_Mfl_00321] 📄 PDF
Yn= Yn-1 + K * dT * Xn-1 This derives implementation: Output_value = State_cpst->Y1 + K_f32 * dT_f32 * State_cpst->X1
requirement SWS_Mfl_00322 [SWS_Mfl_00322] 📄 PDF
Limit output value with maximum and minimum controller limits. If (Output_value < Limit_cpst->Min_C) Then, Output_value = Limit_cpst->Min_C If (Output_value > Limit_cpst->Max_C) Then, Output_value = Limit_cpst->Max_C
requirement SWS_Mfl_00323 [SWS_Mfl_00323] 📄 PDF
Calculated Output_value and current input value shall be stored to State_cpst->Y1 and State_cpst->X1 respectively. State_cpst->Y1 = Output_value State_cpst->X1 = X_f32 1. Set limits for controllers
requirement SWS_Mfl_00325 [SWS_Mfl_00325] 📄 PDF
Update limit structure Limit_cpst->Min_C = Min_f32 Limit_cpst->Max_C = Max_f32
requirement SWS_Mfl_00327 [SWS_Mfl_00327] 📄 PDF
Yn= Yn-1+ K * Xn- K * (1 - dT/Tn) * Xn-1 This derives implementation: Output_value = State_cpst->Y1 + (Param_cpst->K_C * X_f32) - (Param_cpst->K_C * (1 - Param_cpst->Tnrec_C * dT_f32) * State_cpst->X1)
requirement SWS_Mfl_00328 [SWS_Mfl_00328] 📄 PDF
Limit output value with maximum and minimum controller limits. If (Output_value < Limit_cpst->Min_C) Then, Output_value = Limit_cpst->Min_C If (Output_value > Limit_cpst->Max_C) Then, Output_value = Limit_cpst->Max_C
requirement SWS_Mfl_00329 [SWS_Mfl_00329] 📄 PDF
Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value
requirement SWS_Mfl_00330 [SWS_Mfl_00330] 📄 PDF
Current input value X_f32 shall be stored to State_cpst->X1. State_cpst->X1 = X_f32
requirement SWS_Mfl_00332 [SWS_Mfl_00332] 📄 PDF
Yn= Yn-1 + K * (1 + dT/Tn) * Xn - K * Xn-1 This derives implementation: Output_value = State_cpst->Y1 + (Param_cpst->K_C * (1 + Param_cpst->Tnrec_C * d T_f32) * X_f32) - (Param_cpst->K_C * State_cpst->X1)
requirement SWS_Mfl_00333 [SWS_Mfl_00333] 📄 PDF
Limit output value with maximum and minimum controller limits. If (Output_value < Limit_cpst->Min_C) Then, Output_value = Limit_cpst->Min_C If (Output_value > Limit_cpst->Max_C) Then, Output_value = Limit_cpst->Max_C
requirement SWS_Mfl_00334 [SWS_Mfl_00334] 📄 PDF
Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value
requirement SWS_Mfl_00335 [SWS_Mfl_00335] 📄 PDF
Current input value X_f32 shall be stored to State_cpst->X1. State_cpst->X1 = X_f32 1. Set 'PI' State Value This routine can be realised using inline function.
requirement SWS_Mfl_00341 [SWS_Mfl_00341] 📄 PDF
Yn=Yn-1+ K * (1 + Tv/dT) * Xn- K *(1 - dT/Tn + 2Tv/dT) * Xn-1 + K * (Tv/dT) * Xn-2 This derives implementation: calc1 = Param_cpst->K_C * (1 + t_val) * X_f32 calc2 = Param_cpst->K_C * (1 - dT_f32 * Param_cpst->Tnrec_C + 2 * t_val) * State_ cpst->X1 calc3 = Param_cpst->K_C * t_val * State_cpst->X2 Output_value = State_cpst->Y1 + calc1 - calc2 + calc3 Where t_val = Param_cpst->Tv_C / dT_f32
requirement SWS_Mfl_00342 [SWS_Mfl_00342] 📄 PDF
Limit output value with maximum and minimum controller limits. If (Output_value < Limit_cpst->Min_C) Then, Output_value = Limit_cpst->Min_C If (Output_value > Limit_cpst->Max_C) Then, Output_value = Limit_cpst->Max_C
requirement SWS_Mfl_00343 [SWS_Mfl_00343] 📄 PDF
Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value
requirement SWS_Mfl_00344 [SWS_Mfl_00344] 📄 PDF
Old input value State_cpst->X1 shall be stored to State_cpst->X2 State_cpst->X2 = State_cpst->X1 Current input value X_f32 shall be stored to State_cpst->X1. State_cpst->X1 = X_f32 1. 'PID' Controller - Type2 (Explicit type)
requirement SWS_Mfl_00346 [SWS_Mfl_00346] 📄 PDF
Yn = Yn-1 + K * (1 + dT/Tn+ Tv/dT) * Xn- K *(1 + 2Tv/dT) * Xn-1+ K * (Tv/dT) * Xn-2 This derives implementation: calc1 = Param_cpst->K_C * (1 + dT_f32 * Param_cpst->Tnrec_C + t_val) * X_f32 calc2 = Param_cpst->K_C * (1 + 2 * t_val) * State_cpst->X1 calc3 = Param_cpst->K_C * t_val * State_cpst->X2 Output_value = State_cpst->Y1 + calc1 - calc2 + calc3 Where t_val = Param_cpst->Tv_C / dT_f32
requirement SWS_Mfl_00347 [SWS_Mfl_00347] 📄 PDF
Limit output value with maximum and minimum controller limits. If (Output_value < Limit_cpst->Min_C) Then, Output_value = Limit_cpst->Min_C If (Output_value > Limit_cpst->Max_C) Then, Output_value = Limit_cpst->Max_C
requirement SWS_Mfl_00348 [SWS_Mfl_00348] 📄 PDF
Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value
requirement SWS_Mfl_00349 [SWS_Mfl_00349] 📄 PDF
Old input value State_cpst->X1 shall be stored to State_cpst->X2 State_cpst->X2 = State_cpst->X1 Current input value X_f32 shall be stored to State_cpst->X1. State_cpst->X1 = X_f32 1. Set 'PID' State Value This routine can be realised using inline function.
requirement SWS_Mfl_00352 [SWS_Mfl_00352] 📄 PDF
If the argument is zero, then the result is a zero.
requirement SWS_Mfl_00353 [SWS_Mfl_00353] 📄 PDF
Range of the value shall be [-1, +1]
requirement SWS_Mfl_00356 [SWS_Mfl_00356] 📄 PDF
Range of the value shall be [-1, +1]
requirement SWS_Mfl_00359 [SWS_Mfl_00359] 📄 PDF
If the argument is zero, then the result is a zero with the same sign as the argument.
requirement SWS_Mfl_00362 [SWS_Mfl_00362] 📄 PDF
If the x coordinate is zero, then check if(y > 0.0) then Return PI/2 if(y = 0.0) then Return Zero if(y < 0.0) then Return -PI/2
requirement SWS_Mfl_00363 [SWS_Mfl_00363] 📄 PDF
Z = y / x if (|Z| < 1) Then Result = Z / (1.0 + (0.28 * Z2)) if (x < 0.0f) Then Result = (y < 0.0f) ? Result - PI : Result + PI Else Result = (pi / 2) - (Z / (Z2 + 0.28)) if ( y < 0.0f ) Result = Result - PI;
requirement SWS_Mfl_00366 [SWS_Mfl_00366] 📄 PDF
Param-> TimeHighLow = THighLow Param-> TimeLowHigh = TLowHigh
requirement SWS_Mfl_00368 [SWS_Mfl_00368] 📄 PDF
Update limit structure Limit_cpst->Min_C = Min_f32 Limit_cpst->Max_C = Max_f32 1. Set 'I' State Value This routine can be realised using inline function.
requirement SWS_Mfl_00370 [SWS_Mfl_00370] 📄 PDF
Parameter Switch decides which target value is selected. If Switch = TRUE, then Xa_f32 is selected. State_cpst->Switch_s8 is set to TARGET_A Return value = Xa_f32 If Swtich = FALSE, then Xb_f32 is selected. State_cpst->Switch_s8 is set to TARGET_B Return value = Xb_f32
requirement SWS_Mfl_00371 [SWS_Mfl_00371] 📄 PDF
State_cpst->Dir_s8 hold direction information State_cpst->Dir_s8 shall be set to END to reset direction information in case of target switch.
requirement SWS_Mfl_00372 [SWS_Mfl_00372] 📄 PDF
Mfl_RampCalcSwitch has to be called before Mfl_RampCalc routine
requirement SWS_Mfl_00800 [SWS_Mfl_00800] 📄 PDF
Mfl library shall not require initialization phase. A Library function may be called at the very first step of ECU initialization, e.g. even by the OS or EcuM, thus the library shall be ready.
requirement SWS_Mfl_00801 [SWS_Mfl_00801] 📄 PDF
Mfl library shall not require a shutdown operation phase.
requirement SWS_Mfl_00806 [SWS_Mfl_00806] 📄 PDF
The Mfl library shall be implemented in a way that the code can be shared among callers in different memory partitions.
requirement SWS_Mfl_00807 [SWS_Mfl_00807] 📄 PDF
Usage of macros should be avoided. The function should be de- clared as function or inline function. Macro #define should not be used.
requirement SWS_Mfl_00808 [SWS_Mfl_00808] 📄 PDF
A library function shall not call any BSW modules functions, e.g. the DET. A library function can call other library functions. Because a library function shall be re-entrant. But other BSW modules functions may not be re-entrant.
requirement SWS_Mfl_00809 [SWS_Mfl_00809] 📄 PDF
The library, written in C programming language, should conform to the MISRA C Standard. Please refer to SWS_BSW_00115 for more details.
requirement SWS_Mfl_00810 [SWS_Mfl_00810] 📄 PDF
Each AUTOSAR library Module implementation <library>*.c and <library>*.h shall map their code to memory sections using the AUTOSAR memory mapping mechanism.
requirement SWS_Mfl_00811 [SWS_Mfl_00811] 📄 PDF
Each AUTOSAR library Module implementation <library>*.c, that uses AUTOSAR integer data types and/or the standard return, shall include the header file Std_Types.h.
requirement SWS_Mfl_00812 [SWS_Mfl_00812] 📄 PDF
All AUTOSAR library Modules should use the AUTOSAR data types (integers, boolean) instead of native C data types, unless this library is clearly identified to be compliant only with a platform.
requirement SWS_Mfl_00813 [SWS_Mfl_00813] 📄 PDF
All AUTOSAR library Modules should avoid direct use of compiler and platform specific keyword, unless this library is clearly identified to be compliant only with a platform. eg. #pragma, typeof etc.
requirement SWS_Mfl_00814 [SWS_Mfl_00814] 📄 PDF
The standardized common published parameters as required by [SRS_BSW_00402] in the General Requirements on Basic Software Modules [REF] shall be published within the header file of this module and need to be provided in the BSW Module Description. The according module abbreviation can be found in the List of Basic Software Modules [REF].
requirement SWS_Mfl_00816 [SWS_Mfl_00816] 📄 PDF
If source code for caller and callee of Mfl_GetVersionInfo is avail- able, the Mfl library should realize Mfl_GetVersionInfo as a macro defined in the mod- ule's header file.
requirement SWS_Mfl_00817 [SWS_Mfl_00817] 📄 PDF
The functions shall not call the DET for error notification.
requirement SWS_Mfl_00818 [SWS_Mfl_00818] 📄 PDF
The Mfl library shall not have any configuration options that may affect the functional behavior of the routines. I.e. for a given set of input parameters, the outputs shall be always the same. For example, the returned value in case of error shall not be configurable.
requirement SWS_Mfl_00819 [SWS_Mfl_00819] 📄 PDF
Error detection: The validity of the parameters passed to library functions must be checked at the application level, there is no error detection or report- ing within the library function. The library functions are required return a predefined but mathematically senseless value when they are called with invalid parameters. Warning, this strategy has the unsound consequence of masking errors throughout the software development process. All the invalid input cases shall be listed in the SWS specifying a predefined function return value that is not configurable. This value is dependant of the function and the error case so it is determined case by case. If values passed to the routines are not valid and out of the function specification, then such error are not detected.
requirement SWS_Mfl_00820 [SWS_Mfl_00820] 📄 PDF
can be found here:[10](ISO/IEC 9899:1990 Programming Language - C) Mfl_Sin_f32(float32) <=> sinf(float) Mfl_Cos_f32(float32) <=> cosf(float) Mfl_Tan_f32(float32) <=> tanf(float) Mfl_Exp_f32(float32) <=> expf(float) Mfl_Log_f32(float32) <=> logf(float) Mfl_ArcSin_f32(float32) <=> asinf(float) Mfl_ArcCos_f32(float32) <=> acosf(float) Mfl_ArcTan_f32(float32) <=> atanf(float) Mfl_ArcTan2_f32(float32) <=> atan2f(float) Mfl_Hypot_f32f32_f32 <=> hypotf
requirement SWS_Mfl_00821 [SWS_Mfl_00821] 📄 PDF
Section 7.1 "Error Handling" of the document "General Specifica- tion of Basic Software Modules" describes the error handling of the Basic Software in detail. Above all, it constitutes a classification scheme consisting of five error types which may occur in BSW modules.
requirement SWS_Mfl_00822 [SWS_Mfl_00822] 📄 PDF
These requirements are not applicable to this specification.
requirement SWS_Mfl_00835 [SWS_Mfl_00835] 📄 PDF
If the ramp state State_cpst->State_f32 has reached or crossed the target value X_ f32 while the direction of the ramp had been RISING/FALLING, then set State_cpst- >State_f32 = X_f32.
requirement SWS_Mfl_00837 [SWS_Mfl_00837] 📄 PDF
The result shall be round ties to even.
requirement SWS_Mfl_00838 [SWS_Mfl_00838] 📄 PDF
Function ID[hex] Function prototype 0xD1 float32 Mfl_IntToFloatCvrt_u8_f32(uint8) 0xD2 float32 Mfl_IntToFloatCvrt_s8_f32(sint8) 0xD3 float32 Mfl_IntToFloatCvrt_u16_f32(uint16) 0xD4 float32 Mfl_IntToFloatCvrt_s16_f32(sint16) 0xD5 float32 Mfl_IntToFloatCvrt_u32_f32(uint32) 0xD6 float32 Mfl_IntToFloatCvrt_s32_f32(sint32) 0xD9 float32 Mfl_IntToFloatCvrt_u64_f32(uint64) 0xDA float32 Mfl_IntToFloatCvrt_s64_f32(sint64)
requirement SWS_Mfl_00840 [SWS_Mfl_00840] 📄 PDF
The return value shall be saturated to the return type boundary values in the event of overflow or underflow.
requirement SWS_Mfl_00841 [SWS_Mfl_00841] 📄 PDF
The result shall be rounded toward zero.
requirement SWS_Mfl_00842 [SWS_Mfl_00842] 📄 PDF
Function ID[hex] Function prototype 0xCB uint8 Mfl_FloatToIntCvrt_f32_u8(float32) 0xCC sint8 Mfl_FloatToIntCvrt_f32_s8(float32) 0xCD uint16 Mfl_FloatToIntCvrt_f32_u16(float32) 0xCE sint16 Mfl_FloatToIntCvrt_f32_s16(float32) 0xCF uint32 Mfl_FloatToIntCvrt_f32_u32(float32) 0xD0 sint32 Mfl_FloatToIntCvrt_f32_s32(float32) 0xD7 uint64 Mfl_FloatToIntCvrt_f32_u64(float32) 0xD8 sint64 Mfl_FloatToIntCvrt_f32_s64(float32)
requirement SWS_Mfl_00843 [SWS_Mfl_00843] 📄 PDF
If the input is +/- Infinity, then the output shall be limited to target type boundaries (max/min) after the conversion.
requirement SWS_Mfl_00844 [SWS_Mfl_00844] 📄 PDF
Service name: Mfl_DivLim_f32 Syntax: Mfl_Div_St Mfl_DivLim_f32(float32 x_f32, float32 y_f32, float32 min_f32, float32 max_f32, float32* Result) Service ID[hex]: 0xDC Sync/Async: Synchronous Reentrancy: Reentrant x_f32 dividend y_f32 divisor min_f32 minimum limit, min_f32 shall not be strictly greater than max_f32 Parameters (in): max_f32 maximum limit, max_f32 shall not be strictly lower than min_f32 Parameters (inout): None Parameters (out): Result Pointer to the result Return value: Mfl_Div_St Returns status of division E_SUCCESS: Division operation successful E_DIVBYZERO: Divide by Zero E_INVALID: Invalid operation Description: Divides x_f32 by y_f32 and limits the result within the min_f32 and max_f32 value. Available via: Mfl.h
requirement SWS_Mfl_00845 [SWS_Mfl_00845] 📄 PDF
Returns E_SUCCESS, in case of the following scenarios,if the dividend and divisor are finite then,Result = X_f32 / Y_f32 and the sign of result is the exclusive OR of the operands' signs. IF(*Result > max_f32) *Result = max_f32 ELSE IF(*Result < min_f32) *Result = min_f32 If the dividend is +/-Infinity and the divisor is finite number then the result shall be saturated to max/min based on the sign of the result which is the exclusive OR of the operands' signs. If the divisor is Infinity and dividend is finite number then the result shall be zero and the sign of result is the exclusive OR of the operands' signs.
requirement SWS_Mfl_00846 [SWS_Mfl_00846] 📄 PDF
Returns E_INVALID, if there is an invalid operation and the result of the IEEE754 divi- sion operation is NaN (not a number). According to IEEE 754 the results of 0/0 and (+/- 1 )/(+/- 1 ) are invalid. In these cases the function result shall remain at its initial value.
requirement SWS_Mfl_00847 [SWS_Mfl_00847] 📄 PDF
Returns E_DIVBYZERO, if the divisor is zero and the dividend is a finite non-zero num- ber, the result shall be max/min based on the sign of the result which is the exclusive OR of the operands' signs.
requirement SWS_Mfl_00848 [SWS_Mfl_00848] 📄 PDF
If the input is NaN, then the output of the conversion shall be zero.
requirement SWS_Mfl_00849 [SWS_Mfl_00849] 📄 PDF
Service name: Mfl_Mod_f32 Syntax: Mfl_Mod_St_Type Mfl_Mod_f32(float32 x_f32, float32 y_f32, float32* Result) Service ID[hex]: 0xDB Sync/Async: Synchronous Reentrancy: Reentrant x_f32 dividend Parameters (in): y_f32 divisor Parameters (inout): None Parameters (out): Result Pointer to the Result Return value: Mfl_Mod_St_Type Returns status of modulus operation E_SUCCESS: Mod operation success E_INVALID: Invalid Operation Description: This routine returns the value x_f32 - (n*y_f32), for some integer n such that, if y_ f32 is nonzero, the result has the same sign as x_f32 and magnitude less than the magnitude of y_f32. Available via: Mfl.h
requirement SWS_Mfl_00851 [SWS_Mfl_00851] 📄 PDF
Returns E_SUCCESS, in case of the following scenarios, if the dividend and divisor is finite then, *Result = x_f32 % y_f32 and the sign of result shall be same as sign of divdend. - If the dividend is +/-0 and the divisor is finite number then the result shall be +/-0. - If the dividend is finite number and divisor is +/-Infinity then the dividend shall be return as the result and the sign of result shall be same as that of the dividend.
requirement SWS_Mfl_00852 [SWS_Mfl_00852] 📄 PDF
Returns E_INVALID, if there is an invalid operation and the result of the operation shall be NaN (not a number). The operations considered as invalid in the following scenarios: - If the divisor is zero - If dividend is +/- infinity - If dividend or divisor is NaN - mod(0, 0) or mod(+/ 1 , +/ 1 )
requirement SWS_Mfl_00854 [SWS_Mfl_00854] 📄 PDF
Calculate an approximation of the reciprocal of the square root of ValValue (1/sqrt(ValValue)). The accuracy of the result is no less than 6.75 bits, and therefore always within +/- 1 % of the accurate result. This instruction can be used to implement a floating-point square root function in soft- ware using the Newton-Raphson iterative method.
Request a governed re-review of this record. The record is not changed immediately.
- Record
AUTOSAR/AP/record/CP_MOD_Mfl- Status
- unspecified
- Version
AUTOSAR/AP/record/CP_MOD_Mfl@rel:R20-11#7a091744- Content hash
7a091744- Source
- https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_MFLLibrary.pdf#nameddest=SWS_Mfl_00005