DEENESPTFRRUARHIKOZHNL

MFl Library (Mfl)

ModulMfl (MFl Library)
BSW-Modul-ID210
Standard-Header#include "Mfl.h"
SWS-SpezifikationAUTOSAR_CP_SWS_MFLLibrary.pdf, AUTOSAR_SWS_MFLLibrary.pdf
Umfang319 Records · 0 Snippets
ClusterAUTOSAR-Bibliotheken

MFl Library (Mfl)

AUTOSAR Classic Libraries-Modul MFl Library (Mfl, Spezifikation: AUTOSAR_CP_SWS_MFLLibrary.pdf, AUTOSAR_SWS_MFLLibrary.pdf).

Funktionen — Übersicht

Typen — Übersicht

Anforderungen — Übersicht

Funktionen & Typen — Detailansicht

函数 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.

函数 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.

函数 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

函数 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.

函数 Mfl_PT1Out_f32 [SWS_Mfl_00042] 📄 PDF

float32 Mfl_PT1Out_f32(const Mfl_StatePT1_Type* State_cpst);

This routine returns 'PT1' controllers output value

函数 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.

函数 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

函数 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

函数 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.

函数 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.

函数 Mfl_PDOut_f32 [SWS_Mfl_00066] 📄 PDF

float32 Mfl_PDOut_f32(const Mfl_StatePD_Type* State_cpst);

This routine returns 'PD' controllers output value.

函数 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.

函数 Mfl_IOut_f32 [SWS_Mfl_00074] 📄 PDF

float32 Mfl_IOut_f32(const Mfl_StateI_Type* State_cpst);

This routine returns 'I' controllers output value.

函数 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

函数 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

函数 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.

函数 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.

函数 Mfl_PIOut_f32 [SWS_Mfl_00090] 📄 PDF

float32 Mfl_PIOut_f32(const Mfl_StatePI_Type* State_cpst);

This routine returns 'PI' controllers output value.

函数 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

函数 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

函数 Mfl_PIDOut_f32 [SWS_Mfl_00107] 📄 PDF

float32 Mfl_PIDOut_f32(const Mfl_StatePID_Type* State_cpst);

This routine returns 'PID' controllers output value.

函数 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.

函数 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).

函数 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.

函数 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.

函数 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.

函数 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.

函数 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.

函数 Mfl_RampGetSwitchPos [SWS_Mfl_00223] 📄 PDF

boolean Mfl_RampGetSwitchPos(const Mfl_StateRamp_Type* State_cpst);

Gets the current switch position of ramp switch function.

函数 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.

函数 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.

函数 Mfl_DebounceInit [SWS_Mfl_00266] 📄 PDF

void Mfl_DebounceInit(Mfl_DebounceState_Type* State, boolean X);

This routine call shall stop the debouncing timer.

函数 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.

函数 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

函数 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

函数 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.

函数 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.

函数 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

函数 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

函数 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

函数 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

函数 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

函数 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

函数 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.

函数 Mfl_IntToFloatCvrt_<InTypeMn>_f32 [SWS_Mfl_00836] 📄 PDF

float32 Mfl_IntToFloatCvrt_<InTypeMn>_f32(<InType> ValInteger);

Returns the Float value for the corresponding Integer input.

函数 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

类型 Mfl_ParamPD_Type [SWS_Mfl_00826] 📄 PDF

System and Time equivalent parameter Structure for PD controller routine

类型 Mfl_StatePI_Type [SWS_Mfl_00828] 📄 PDF

System State Structure for PI additive ( Type1 and Type 2 ) controller routine

类型 Mfl_ParamPI_Type [SWS_Mfl_00829] 📄 PDF

System and Time equivalent parameter Structure for PI additive ( Type1 and Type 2 ) controller routine

类型 Mfl_StatePID_Type [SWS_Mfl_00830] 📄 PDF

System State Structure for PID additive ( Type1 and Type 2 ) controller routine

类型 Mfl_ParamPID_Type [SWS_Mfl_00831] 📄 PDF

System and Time equivalent parameter Structure for PID additive ( Type1 and Type 2 ) controller routine

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_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_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_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_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_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_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_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_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_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_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_00117 [SWS_Mfl_00117] 📄 PDF

ValMax = ValValue1, ValValue1  ValValue2 ValMax = ValValue2, ValValue1 < ValValue2

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_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_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 * Zˆ2)) if (Z < 1) Then Result = (pi / 2) - (Z / (Zˆ2 + 0.28))

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_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_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_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_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_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 * Zˆ2)) if (x < 0.0f) Then Result = (y < 0.0f) ? Result - PI : Result + PI Else Result = (pi / 2) - (Z / (Zˆ2 + 0.28)) if ( y < 0.0f ) Result = Result - PI;

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_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_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_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_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_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_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#8bd2ba48
Content hash
8bd2ba48
Source
https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_MFLLibrary.pdf#nameddest=SWS_Mfl_00005

主题图

初始化与状态

1

需求

207
SWS_Mfl_00001SWS_Mfl_00006SWS_Mfl_00007SWS_Mfl_00008SWS_Mfl_00009SWS_Mfl_00011SWS_Mfl_00012SWS_Mfl_00017SWS_Mfl_00027SWS_Mfl_00031SWS_Mfl_00033SWS_Mfl_00035SWS_Mfl_00036SWS_Mfl_00038SWS_Mfl_00039SWS_Mfl_00041SWS_Mfl_00043SWS_Mfl_00045SWS_Mfl_00047SWS_Mfl_00048SWS_Mfl_00049SWS_Mfl_00051SWS_Mfl_00052SWS_Mfl_00054SWS_Mfl_00056SWS_Mfl_00057SWS_Mfl_00058SWS_Mfl_00060SWS_Mfl_00061SWS_Mfl_00063SWS_Mfl_00064SWS_Mfl_00067SWS_Mfl_00069SWS_Mfl_00070SWS_Mfl_00072SWS_Mfl_00073SWS_Mfl_00075SWS_Mfl_00077SWS_Mfl_00078SWS_Mfl_00079SWS_Mfl_00081SWS_Mfl_00082SWS_Mfl_00083SWS_Mfl_00085SWS_Mfl_00086SWS_Mfl_00088SWS_Mfl_00089SWS_Mfl_00091SWS_Mfl_00093SWS_Mfl_00094SWS_Mfl_00095SWS_Mfl_00097SWS_Mfl_00098SWS_Mfl_00099SWS_Mfl_00101SWS_Mfl_00102SWS_Mfl_00104SWS_Mfl_00105SWS_Mfl_00106SWS_Mfl_00108SWS_Mfl_00111SWS_Mfl_00113SWS_Mfl_00114SWS_Mfl_00115SWS_Mfl_00117SWS_Mfl_00119SWS_Mfl_00121SWS_Mfl_00123SWS_Mfl_00131SWS_Mfl_00132SWS_Mfl_00133SWS_Mfl_00136SWS_Mfl_00137SWS_Mfl_00141SWS_Mfl_00142SWS_Mfl_00146SWS_Mfl_00147SWS_Mfl_00151SWS_Mfl_00152SWS_Mfl_00156SWS_Mfl_00157SWS_Mfl_00161SWS_Mfl_00163SWS_Mfl_00167SWS_Mfl_00168SWS_Mfl_00172SWS_Mfl_00177SWS_Mfl_00182SWS_Mfl_00183SWS_Mfl_00191SWS_Mfl_00193SWS_Mfl_00196SWS_Mfl_00202SWS_Mfl_00203SWS_Mfl_00204SWS_Mfl_00205SWS_Mfl_00209SWS_Mfl_00211SWS_Mfl_00213SWS_Mfl_00215SWS_Mfl_00217SWS_Mfl_00218SWS_Mfl_00219SWS_Mfl_00220SWS_Mfl_00221SWS_Mfl_00222SWS_Mfl_00224SWS_Mfl_00226SWS_Mfl_00237SWS_Mfl_00238SWS_Mfl_00239SWS_Mfl_00242SWS_Mfl_00243SWS_Mfl_00244SWS_Mfl_00247SWS_Mfl_00248SWS_Mfl_00249SWS_Mfl_00252SWS_Mfl_00253SWS_Mfl_00254SWS_Mfl_00257SWS_Mfl_00258SWS_Mfl_00261SWS_Mfl_00262SWS_Mfl_00263SWS_Mfl_00264SWS_Mfl_00267SWS_Mfl_00268SWS_Mfl_00270SWS_Mfl_00275SWS_Mfl_00276SWS_Mfl_00287SWS_Mfl_00288SWS_Mfl_00289SWS_Mfl_00301SWS_Mfl_00303SWS_Mfl_00304SWS_Mfl_00305SWS_Mfl_00307SWS_Mfl_00308SWS_Mfl_00311SWS_Mfl_00316SWS_Mfl_00321SWS_Mfl_00322SWS_Mfl_00323SWS_Mfl_00325SWS_Mfl_00327SWS_Mfl_00328SWS_Mfl_00329SWS_Mfl_00330SWS_Mfl_00332SWS_Mfl_00333SWS_Mfl_00334SWS_Mfl_00335SWS_Mfl_00341SWS_Mfl_00342SWS_Mfl_00343SWS_Mfl_00344SWS_Mfl_00346SWS_Mfl_00347SWS_Mfl_00348SWS_Mfl_00349SWS_Mfl_00352SWS_Mfl_00353SWS_Mfl_00356SWS_Mfl_00359SWS_Mfl_00362SWS_Mfl_00363SWS_Mfl_00366SWS_Mfl_00368SWS_Mfl_00370SWS_Mfl_00371SWS_Mfl_00372SWS_Mfl_00800SWS_Mfl_00801SWS_Mfl_00806SWS_Mfl_00807SWS_Mfl_00808SWS_Mfl_00809SWS_Mfl_00810SWS_Mfl_00811SWS_Mfl_00812SWS_Mfl_00813SWS_Mfl_00814SWS_Mfl_00816SWS_Mfl_00817SWS_Mfl_00818SWS_Mfl_00819SWS_Mfl_00820SWS_Mfl_00821SWS_Mfl_00822SWS_Mfl_00835SWS_Mfl_00837SWS_Mfl_00838SWS_Mfl_00840SWS_Mfl_00841SWS_Mfl_00842SWS_Mfl_00843SWS_Mfl_00844SWS_Mfl_00845SWS_Mfl_00846SWS_Mfl_00847SWS_Mfl_00848SWS_Mfl_00849SWS_Mfl_00851SWS_Mfl_00852SWS_Mfl_00854

详细视图

请在大纲中选择一个条目。

初始化与状态

Returns the version information of this library.

void Mfl_GetVersionInfo(Std_VersionInfoType* versioninfo);

服务

Mfl 函数

Returns the Integer value for the corresponding floating point input.

<OutType> Mfl(float32 ValFloat);

Returns the absolute value of the argument (ValAbs), determined according to the following equation.

float32 Mfl_Abs_f32(float32 ValValue);

Returns the arc cosine of an angle, in the range of 0.0 through pi.

float32 Mfl_arcCos_f32(float32 value);

Returns the arc cosine of an angle, in the range of 0.0 through pi.

float32 Mfl_ArcCos_f32(float32 value);

Returns the arc sine of an angle, in the range of -pi/2 through pi/2.

float32 Mfl_arcSin_f32(float32 value);

Returns the arc sine of an angle, in the range of -pi/2 through pi/2.

float32 Mfl_ArcSin_f32(float32 value);

Returns the arc tangent of an angle, in the range of [-pi to pi]

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_ArcTan2_f32(float32 y, float32 x);

Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.

float32 Mfl_arcTan_f32(float32 value);

Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.

float32 Mfl_ArcTan_f32(float32 value);

The routine returns average value of an array.

float32 Mfl_ArrayAverage_f32_f32(const float32* Array, uint32 Count);

The routine returns average value.

float32 Mfl_Average_f32_f32(float32 value1, float32 value2);

Return the bit representation of the single point precision float value

uint32 Mfl_Bitpat_f32_u32(float32 Value);

This routine calculates time equivalent factor

float32 Mfl_CalcTeQ_f32(float32 T1rec_f32, float32 dT_f32);

This routine calculates time equivalent factor

float32 Mfl_CalcTeQApp_f32(float32 T1rec_f32, float32 dT_f32);

Returns the integer value determined by rounding the argument toward positive infinity.

float32 Mfl_Ceil_f32(float32 ValValue);

Calculates the cosine of the argument.

float32 Mfl_Cos_f32(float32 value);

Fast cosine calculation

float32 Mfl_Cos_s32_f32(sint32 x_value);

Update limit structure

void Mfl_CtrlSetLimit(float32 Min_f32, float32 Max_f32, Mfl_Limits_Type* Limit_cpst);

Update limit structure

void Mfl_CtrlSetLimits(Mfl_Limits_Type* Limit_cpst, float32 Min_f32, float32 Max_f32);

Returns the integer value of the fixed point result of the conversion, determined according to the following equation.

<OutType> Mfl_Cvrt_f32_<OutTypeMn>(float32 ValFloat, sint16 ValFixedExponent);

Returns the floating-point result of the conversion, determined according to the following equation.

float32 Mfl_Cvrt_<InTypeMn>_f32(<InType> ValFixedInteger, sint16 ValFixedExponent);

This routine returns input value with specified delay time.

float32 Mfl_DeadTime_f32_f32(float32 X, float32 DelayTime, float32 StepTime, Mfl_DeadTimeParam_Type* Param);

This routine debounces a digital input signal and returns the state of the signal as a boolean value.

boolean Mfl_Debounce_u8_u8(boolean X, Mfl_DebounceState_Type* State, const Mfl_DebounceParam_Type* Param, float32 dT);

This routine call shall stop the debouncing timer.

void Mfl_DebounceInit(Mfl_DebounceState_Type* State, boolean X);

This routine sets timing parameters, time for high to low transition and time for low to high for debouncing.

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_DebounceSetParam(Mfl_DebounceParam_Type* Param, float32 THighLow, float32 TLowHigh);

This routine computes DT1 controller output value using differential equation

void Mfl_DT1Typ1Calc(float32 X_f32, Mfl_StateDT1Typ1_Type* State_cpst, float32 K_f32, float32 TeQ_f32, float32 dT_f32);

This routine returns 'DT1' controller's output value

float32 Mfl_DT1Typ1Out_f32(const Mfl_StateDT1Typ1_Type* State_cpst);

The routine initialises internal state variables of a DT1 element.

void Mfl_DT1Typ1SetState(Mfl_StateDT1Typ1_Type* State_cpst, float32 X1_f32, float32 X2_f32, float32 Y1_f32);

This routine computes DT1 controller output value using differential equation

void Mfl_DT1Typ2Calc(float32 X_f32, Mfl_StateDT1Typ2_Type* State_cpst, float32 K_f32, float32 TeQ_f32, float32 dT_f32);

This routine returns 'DT1' controller's output value

float32 Mfl_DT1Typ2Out_f32(const Mfl_StateDT1Typ2_Type* State_cpst);

The routine initialises internal state variables of a DT1 element.

void Mfl_DT1Typ2SetState(Mfl_StateDT1Typ2_Type* State_cpst, float32 X1_f32, float32 Y1_f32);

Returns the exponential of the operand (ValExp), determined according to the following equation.

float32 Mfl_Exp_f32(float32 ValValue);

Returns the natural number value determined by rounding the argument toward negative infinity.

float32 Mfl_Floor_f32(float32 ValValue);

This service computes the length of a vector

float32 Mfl_Hypot_f32f32_f32(float32 x_value, float32 y_value);

Hysteresis with center and left and right side halfDelta switching point.

boolean Mfl_HystCenterHalfDelta_f32_u8(float32 X, float32 center, float32 halfDelta, uint8* State);

Hysteresis with right switching point and delta to left switching point

boolean Mfl_HystDeltaRight_f32_u8(float32 X, float32 Delta, float32 Rsp, uint8* State);

Hysteresis with left switching point and delta to right switching point.

boolean Mfl_HystLeftDelta_f32_u8(float32 X, float32 Lsp, float32 Delta, uint8* State);

Hysteresis with left and right switching point.

boolean Mfl_HystLeftRight_f32_u8(float32 X, float32 Lsp, float32 Rsp, uint8* State);
Mfl_ICalc 函数

This routine computes I controller output value using differential equation

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

void Mfl_ILimCalc(float32 X_f32, Mfl_StateI_Type* State_cpst, float32 K_f32, const Mfl_Limits_Type* Limit_cpst, float32 dT_f32);

Returns the Float value for the corresponding Integer input.

float32 Mfl_IntToFloatCvrt_<InTypeMn>_f32(<InType> ValInteger);

This routine returns 'I' controllers output value.

float32 Mfl_IOut_f32(const Mfl_StateI_Type* State_cpst);

The routine initialises internal state variables of an I element.

void Mfl_ISetState(Mfl_StateI_Type* State_cpst, float32 X1_f32, float32 Y1_f32);

Returns the bounded value (newVal), determined according to the following equation.

float32 Mfl_Limit_f32(float32 val, float32 lowLim, float32 upLim);

Returns the natural (base-e) logarithm of the operand (ValLog), determined according to the following equation.

float32 Mfl_Log_f32(float32 ValValue);

Returns the value of the larger of the two arguments (ValMax), determined according to the following equation.

float32 Mfl_Max_f32(float32 ValValue1, float32 ValValue2);

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.

float32 Mfl_MedianSort_f32_f32(float32* Array, uint8 N);

Returns the value of the smaller of the two arguments (Min), determined according to the following equation.

float32 Mfl_Min_f32(float32 Value1, float32 Value2);
Mfl_PCalc 函数

Differential equation: Y = K * X

void Mfl_PCalc(float32 X_f32, float32* P_pf32, float32 K_f32);
Mfl_PDCalc 函数

This routine computes proportional plus derivative controller output value using differential equation

void Mfl_PDCalc(float32 X_f32, Mfl_StatePD_Type* State_cpst, const Mfl_ParamPD_Type* Param_cpst, float32 dT_f32);

This routine returns 'PD' controllers output value.

float32 Mfl_PDOut_f32(const Mfl_StatePD_Type* State_cpst);

The routine sets the parameter structure of a PD element.

void Mfl_PDSetParam(Mfl_ParamPD_Type* Param_cpst, float32 K_f32, float32 Tv_f32);

The routine initialises internal state variables of a PD element.

void Mfl_PDSetState(Mfl_StatePD_Type* State_cpst, float32 X1_f32, float32 Y1_f32);

This routine returns 'PID' controllers output value.

float32 Mfl_PIDOut_f32(const Mfl_StatePID_Type* State_cpst);

The routine sets the parameter structure of a PID element.

void Mfl_PIDSetParam(Mfl_ParamPID_Type* Param_cpst, float32 K_f32, float32 Tv_f32, float32 Tnrec_f32);

The routine initialises internal state variables of a PID element.

void Mfl_PIDSetState(Mfl_StatePID_Type* State_cpst, float32 X1_f32, float32 X2_f32, float32 Y1_f32);

This routine computes Proportional plus integral plus derivative controller (implicit type) output value using differential equation

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

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 (explicit type) output value using differential equation

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

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 returns 'PI' controllers output value.

float32 Mfl_PIOut_f32(const Mfl_StatePI_Type* State_cpst);

The routine sets the parameter structure of a PI element.

void Mfl_PISetParam(Mfl_ParamPI_Type* Param_cpst, float32 K_f32, float32 Tnrec_f32);

The routine initialises internal state variables of a PI element.

void Mfl_PISetState(Mfl_StatePI_Type* State_cpst, float32 X1_f32, float32 Y1_f32);

This routine computes Proportional plus integral controller (implicit type) output value using differential equation

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

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 (explicit type) output value using differential equation

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

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 returns 'P' controllers output value limited by the return data type

float32 Mfl_POut_f32(const float32* P_pf32);

Returns the ValBase raised to ValExp power, determined according to the following equation.

float32 Mfl_Pow_f32(float32 ValBase, float32 ValExp);

This routine computes PT1 controller output value using below difference equation

void Mfl_PT1Calc(float32 X_f32, Mfl_StatePT1_Type* State_cpst, float32 K_f32, float32 TeQ_f32);

This routine returns 'PT1' controllers output value

float32 Mfl_PT1Out_f32(const Mfl_StatePT1_Type* State_cpst);

The routine initialises internal state variables of a PT1 element.

void Mfl_PT1SetState(Mfl_StatePT1_Type* State_cpst, float32 X1_f32, float32 Y1_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

void Mfl_PT1Typ1Calc(float32 X_f32, Mfl_StatePT1_Type* State_cpst, float32 K_f32, float32 TeQ_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).

void Mfl_RampCalc(float32 X_f32, Mfl_StateRamp_Type* State_cpst, const Mfl_ParamRamp_Type* Param_cpcst, float32 dT_f32);

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.

void Mfl_RampCalcJump(float32 X_f32, Mfl_StateRamp_Type* State_cpst);

This routine switches between two target values for a ramp service based on a Switch parameter.

float32 Mfl_RampCalcSwitch(float32 Xa_f32, float32 Xb_f32, boolean Switch, Mfl_StateRamp_Type* State_cpst);

This routine switches ramp between two target values based on the Switch 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 checks the status of the ramp and returns a TRUE if the ramp is active, otherwise it returns FALSE.

boolean Mfl_RampCheckActivity(const Mfl_StateRamp_Type* State_cpst);

Gets the current switch position of ramp switch function.

boolean Mfl_RampGetSwitchPos(const Mfl_StateRamp_Type* State_cpst);

Initializes the state, direction and switch parameters for the ramp.

void Mfl_RampInitState(Mfl_StateRamp_Type* State_cpst, float32 Val_f32);

Returns the internal state of the ramp element.

float32 Mfl_RampOut_f32(const Mfl_StateRamp_Type* State_cpcst);

Sets the slope parameter for the ramp provided by the structure Mfl_ParamRamp_Type.

void Mfl_RampSetParam(Mfl_ParamRamp_Type* Param_cpst, float32 SlopePosVal_f32, float32 SlopeNegVal_f32);

An increasing value and decreasing value is rate limited by maxdif

float32 Mfl_RateLimiter_f32(float32 newval, float32 oldval, float32 maxdif);

Returns the integer value determined by rounding the argument toward the nearest whole number.

float32 Mfl_Round_f32(float32 ValValue);

Fast reciprocal square root of the operand (ValSqrt)

float32 Mfl_RSqrt_f32(float32 ValValue);

Returns the sign of the argument (ValSign), determined according to the following equation.

sint8 Mfl_Sign_f32(float32 ValValue);

Calculates the sine of the argument.

float32 Mfl_Sin_f32(float32 value);

Fast sine calculation

float32 Mfl_Sin_s32_f32(sint32 x_value);

The sorting algorithm modifies the given input array in ascending order & returns sorted array result via pointer

void Mfl_SortAscend_f32(float32* Array, uint16 Num);

The sorting algorithm modifies the given input array in descending order & returns sorted array result via pointer

void Mfl_SortDescend_f32(float32* Array, uint16 Num);

Returns the square root of the operand (ValSqrt), determined according to the following equation

float32 Mfl_Sqrt_f32(float32 ValValue);

Calculates the tangent of the argument.

float32 Mfl_Tan_f32(float32 value);

Returns the integer value determined by rounding the argument toward zero.

float32 Mfl_Trunc_f32(float32 ValValue);

类型

Structure definition for Dead Time routine

Structure definition for Debouncing parameters

Structure definition for Debouncing state variables

Controller limit value structure

System and Time equivalent parameter Structure for PD controller routine

System and Time equivalent parameter Structure for PI additive ( Type1 and Type 2 ) controller routine

System and Time equivalent parameter Structure for PID additive ( Type1 and Type 2 ) controller routine

Structure definition for Ramp routine

System State Structure for DT1-Type1 controller routine

System State Structure for DT1-Type2 controller routine

System State Structure for I controller routine

System State Structure for PD controller routine

System State Structure for PI additive ( Type1 and Type 2 ) controller routine

System State Structure for PID additive ( Type1 and Type 2 ) controller routine

System State Structure for PT1 controller routine

Structure definition for Ramp routine

需求

SWS_Mfl_00001 requirement

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_'.

SWS_Mfl_00006 requirement

Result = ValFloat * 2ValFixedExponent

SWS_Mfl_00007 requirement

The return value shall be saturated to the return type boundary values in the event of overflow or underflow.

SWS_Mfl_00008 requirement

If it is necessary to round the result of this equation, it is rounded toward zero.

SWS_Mfl_00009 requirement

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 )

SWS_Mfl_00011 requirement

Result = ValFixedInteger * 2-ValFixedExponent

SWS_Mfl_00012 requirement

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 )

SWS_Mfl_00017 requirement

If the argument is halfway between two integers, it is rounded away from zero. For example: 36.5 will be rounded to 37.00

SWS_Mfl_00027 requirement

Implemented difference equation: *P_pf32 = K_f32 * X_f32 1. Get 'P' output This routine can be realised using inline function.

SWS_Mfl_00031 requirement

Output value = *P_pf32

SWS_Mfl_00033 requirement

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)

SWS_Mfl_00035 requirement

If (TeQ_f32 = 0) then PT1 controller follows Input value, State_cpst->Y1 = K_f32 * X_f32

SWS_Mfl_00036 requirement

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.

SWS_Mfl_00038 requirement

Initialisation of output state variable Y1. State_cpst->Y1 = Y1_f32

SWS_Mfl_00039 requirement

Initialisation of input state variable X1. State_cpst->X1 = X1_f32. 1. Calculate time equivalent Value This routine can be realised using inline function.

SWS_Mfl_00041 requirement

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

SWS_Mfl_00043 requirement

Output value = State_cpst->Y1

SWS_Mfl_00045 requirement

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)

SWS_Mfl_00047 requirement

If (TeQ_f32 = 0) then DT1 controller follows Input value, Output_value = K_f32 * (X_f32 - State_cpst->X1) / dT_f32

SWS_Mfl_00048 requirement

Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value

SWS_Mfl_00049 requirement

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

SWS_Mfl_00051 requirement

Initialisation of output state variable Y1. State_cpst->Y1 = Y1_f32

SWS_Mfl_00052 requirement

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.

SWS_Mfl_00054 requirement

Output value = State_cpst->Y1 1. Get 'DT1' output - Type2 This routine can be realised using inline function.

SWS_Mfl_00056 requirement

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)

SWS_Mfl_00057 requirement

Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value

SWS_Mfl_00058 requirement

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.

SWS_Mfl_00060 requirement

Initialisation of output state variable Y1. State_cpst->Y1 = Y1_f32

SWS_Mfl_00061 requirement

Initialisation of input state variable X1. State_cpst->X1 = X1_f32 1. Set 'PD' Parameters This routine can be realised using inline function.

SWS_Mfl_00063 requirement

Initialisation of amplification factor. Param_cpst->K_C = K_f32

SWS_Mfl_00064 requirement

Initialisation of lead time state variable Param_cpst->Tv_C = Tv_f32 1. Get 'PD' output This routine can be realised using inline function.

SWS_Mfl_00067 requirement

Output value = State_cpst->Y1

SWS_Mfl_00069 requirement

Yn= Yn-1 + K * dT * Xn-1 This derives implementation: Output_value = State_cpst->Y1 + K_f32 * dT_f32 * State_cpst->X1

SWS_Mfl_00070 requirement

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

SWS_Mfl_00072 requirement

Initialisation of output state variable Y1. State_cpst->Y1 = Y1_f32

SWS_Mfl_00073 requirement

Initialisation of input state variable X1. State_cpst->X1 = X1_f32 1. Get 'I' output This routine can be realised using inline function.

SWS_Mfl_00075 requirement

Output value = State_cpst->Y1

SWS_Mfl_00077 requirement

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)

SWS_Mfl_00078 requirement

Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value

SWS_Mfl_00079 requirement

Current input value X_f32 shall be stored to State_cpst->X1. State_cpst->X1 = X_f32

SWS_Mfl_00081 requirement

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)

SWS_Mfl_00082 requirement

Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value

SWS_Mfl_00083 requirement

Current input value X_f32 shall be stored to State_cpst->X1. State_cpst->X1 = X_f32

SWS_Mfl_00085 requirement

Initialisation of output state variable Y1. State_cpst->Y1 = Y1_f32

SWS_Mfl_00086 requirement

Initialisation of input state variable X1. State_cpst->X1 = X1_f32 1. Set 'PI' Parameters This routine can be realised using inline function.

SWS_Mfl_00088 requirement

Initialisation of amplification factor. Param_cpst->K_C = K_f32

SWS_Mfl_00089 requirement

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.

SWS_Mfl_00091 requirement

Output value = State_cpst->Y1

SWS_Mfl_00093 requirement

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

SWS_Mfl_00094 requirement

Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value

SWS_Mfl_00095 requirement

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)

SWS_Mfl_00097 requirement

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

SWS_Mfl_00098 requirement

Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value

SWS_Mfl_00099 requirement

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)

SWS_Mfl_00101 requirement

Initialisation of output state variable Y1. State_cpst->Y1 = Y1_f32

SWS_Mfl_00102 requirement

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.

SWS_Mfl_00104 requirement

Initialisation of amplification factor. Param_cpst->K_C = K_f32

SWS_Mfl_00105 requirement

Initialisation of lead time state variable Param_cpst->Tv_C = Tv_f32

SWS_Mfl_00106 requirement

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.

SWS_Mfl_00108 requirement

Output value = State_cpst->Y1

SWS_Mfl_00111 requirement

ValAbs = | ValValue |

SWS_Mfl_00113 requirement

ValSign = 1, ValValue > 0.0

SWS_Mfl_00114 requirement

ValSign = 0, ValValue == 0.0

SWS_Mfl_00115 requirement

ValSign = -1, ValValue < 0.0

SWS_Mfl_00117 requirement

ValMax = ValValue1, ValValue1  ValValue2 ValMax = ValValue2, ValValue1 < ValValue2

SWS_Mfl_00119 requirement

Min = Value1, Value1  Value2 Min = Value2, Value1 > Value2

SWS_Mfl_00121 requirement

if ( newval > oldval ) and (( newval - oldval ) > maxdif ) Result = oldval + maxdif else if ( newval < oldval ) and (( oldval - newval ) > maxdif ) Result = oldval - maxdif else Result = newval

SWS_Mfl_00123 requirement

newVal = lowLim, val  lowLim newVal = upLim, val  upLim newVal = val, lowLim < val < upLim

SWS_Mfl_00131 requirement

ValResult = ValBaseValExp

SWS_Mfl_00132 requirement

If ValExp = 0, and ValBase = 0, ValResult = 1, ( 00 = 1) If ValBase = 0 and ValExp <> 0, ValResult = 0, ( 0ValExp = 0)

SWS_Mfl_00133 requirement

If ValBase and ValExp are having maximum value of type float32, the return value will be toward positive infinity.

SWS_Mfl_00136 requirement

ValSqrt = ValValue1/2

SWS_Mfl_00137 requirement

ValValue shall be passed as positive value. (ValValue  0)

SWS_Mfl_00141 requirement

ValExp = eValValue

SWS_Mfl_00142 requirement

Call the function with input value in the range [-24PI, +24PI]

SWS_Mfl_00146 requirement

ValLog = loge(ValValue)

SWS_Mfl_00147 requirement

ValValue shall be passed as > 0 value.

SWS_Mfl_00151 requirement

Result: result = sine ( value )

SWS_Mfl_00152 requirement

Call the function with input value in the range [-24PI, +24PI]

SWS_Mfl_00156 requirement

Result: result = cosine ( value )

SWS_Mfl_00157 requirement

Call the function with input value in the range [-24PI, +24PI]

SWS_Mfl_00161 requirement

Result: result = tangent( value )

SWS_Mfl_00163 requirement

Call the function with input value in the range [-24PI, +24PI]

SWS_Mfl_00167 requirement

If the argument is zero, then the result is a zero.

SWS_Mfl_00168 requirement

Range of the value shall be [-1, +1]

SWS_Mfl_00172 requirement

Range of the value shall be [-1, +1]

SWS_Mfl_00177 requirement

If the argument is zero, then the result is a zero with the same sign as the argument.

SWS_Mfl_00182 requirement

If the argument is zero, then the result is a zero with the same sign as the argument.

SWS_Mfl_00183 requirement

Z = X2_f32 / X1_f32 if (Z > 1) Then Result = Z / (1.0 + (0.28 * Zˆ2)) if (Z < 1) Then Result = (pi / 2) - (Z / (Zˆ2 + 0.28))

SWS_Mfl_00191 requirement

Output = (Value1 + Value2 ) / 2

SWS_Mfl_00193 requirement

Output = (Array[0] + Array[1]+_ _ Array[N-1] ) / N

SWS_Mfl_00196 requirement

This service computes the length of a vector: Result = square_root ( x_value * x_value + y_value * y_value)

SWS_Mfl_00202 requirement

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)

SWS_Mfl_00203 requirement

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)

SWS_Mfl_00204 requirement

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.

SWS_Mfl_00205 requirement

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

SWS_Mfl_00209 requirement

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

SWS_Mfl_00211 requirement

Sets positive and negative ramp slopes. Param_cpst->SlopePos_f32 = SlopePosVal_f32 Param_cpst->SlopeNeg_f32 = SlopeNegVal_f32

SWS_Mfl_00213 requirement

Return Value = State_cpcst->State_f32

SWS_Mfl_00215 requirement

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.

SWS_Mfl_00217 requirement

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

SWS_Mfl_00218 requirement

State_cpst->Dir_s8 holds direction information Ramp direction status: RISING, FALLING, END

SWS_Mfl_00219 requirement

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.

SWS_Mfl_00220 requirement

Once ramp value reaches the selected target value, the ramp direction status is switched to END. State_cpst->Dir_s8 == END

SWS_Mfl_00221 requirement

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)

SWS_Mfl_00222 requirement

Calculated ramp value shall be stored to State_cpst->State_f32 variable.

SWS_Mfl_00224 requirement

Return value = TRUE if Switch position State_cpst->Switch_s8 = TARGET_A Return value = FALSE if Switch position State_cpst->Switch_s8 = TARGET_B

SWS_Mfl_00226 requirement

return value = TRUE, if Ramp is active (State_cpst->Dir_s8 != END) return value = FALSE, if Ramp is inactive (State_cpst->Dir_s8 == END)

SWS_Mfl_00237 requirement

Return value is TRUE if input is greater then center plus halfDelta switching point.

SWS_Mfl_00238 requirement

Return value is FALSE if input is less then center minus halfDelta switching point.

SWS_Mfl_00239 requirement

Return value is former state value if input is in the range of halfDelta around the center switching point

SWS_Mfl_00242 requirement

Return value is TRUE if input is greater then right switching point.

SWS_Mfl_00243 requirement

Return value is FALSE if input is less then left switching point.

SWS_Mfl_00244 requirement

Return value is former state value if input is between left and right switching points

SWS_Mfl_00247 requirement

Return value is TRUE if input is greater then right switching point.

SWS_Mfl_00248 requirement

Return value is FALSE if input is less then right switching point minus delta.

SWS_Mfl_00249 requirement

Return value is former state value if input is between right switching points and right minus delta.

SWS_Mfl_00252 requirement

Return value is TRUE if input is greater then left switching point plus delta.

SWS_Mfl_00253 requirement

Return value is FALSE if input is less then left switching point.

SWS_Mfl_00254 requirement

Return value is former state value if input is between left switching points and left plus delta.

SWS_Mfl_00257 requirement

Buffer data stores input samples hence reproduced output signal will reduce samples in case high delay time.

SWS_Mfl_00258 requirement

Buffer size shall be configured as per the delay time range requirement.

SWS_Mfl_00261 requirement

If(X != State->XOld) then check start debouncing.

SWS_Mfl_00262 requirement

If transition is from Low to High, then use Param->TimeLowHigh as debouncing time otherwise use Param->TimeHighLow

SWS_Mfl_00263 requirement

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

SWS_Mfl_00264 requirement

Old value shall be returned as a output value. Current input is stored to old state. Return value = State->XOld State->XOld = X

SWS_Mfl_00267 requirement

State->Timer = 0

SWS_Mfl_00268 requirement

Sets the input state to the given init value. State->XOld = X

SWS_Mfl_00270 requirement

Param-> TimeHighLow = THighLow Param-> TimeLowHigh = TLowHigh

SWS_Mfl_00275 requirement

Initialisation of state variable State_cpst ->State_f32 = Val_f32

SWS_Mfl_00276 requirement

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

SWS_Mfl_00287 requirement

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

SWS_Mfl_00288 requirement

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

SWS_Mfl_00289 requirement

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.

SWS_Mfl_00301 requirement

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)

SWS_Mfl_00303 requirement

If (TeQ_f32 = 0) then DT1 controller follows Input value, Output_value = K_f32 * (X_f32 - State_cpst->X1) / dT_f32

SWS_Mfl_00304 requirement

Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value

SWS_Mfl_00305 requirement

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.

SWS_Mfl_00307 requirement

Initialisation of output state variable Y1. State_cpst->Y1 = Y1_f32

SWS_Mfl_00308 requirement

Initialisation of input state variable X1. State_cpst->X1 = X1_f32 1. Get 'DT1' output - Type1 This routine can be realised using inline function.

SWS_Mfl_00311 requirement

Output value = State_cpst->Y1

SWS_Mfl_00316 requirement

TeQApp_f32 = 1 - (T1rec_f32 * dT_f32) 1. Get 'PT1' output This routine can be realised using inline function.

SWS_Mfl_00321 requirement

Yn= Yn-1 + K * dT * Xn-1 This derives implementation: Output_value = State_cpst->Y1 + K_f32 * dT_f32 * State_cpst->X1

SWS_Mfl_00322 requirement

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

SWS_Mfl_00323 requirement

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

SWS_Mfl_00325 requirement

Update limit structure Limit_cpst->Min_C = Min_f32 Limit_cpst->Max_C = Max_f32

SWS_Mfl_00327 requirement

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)

SWS_Mfl_00328 requirement

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

SWS_Mfl_00329 requirement

Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value

SWS_Mfl_00330 requirement

Current input value X_f32 shall be stored to State_cpst->X1. State_cpst->X1 = X_f32

SWS_Mfl_00332 requirement

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)

SWS_Mfl_00333 requirement

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

SWS_Mfl_00334 requirement

Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value

SWS_Mfl_00335 requirement

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.

SWS_Mfl_00341 requirement

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

SWS_Mfl_00342 requirement

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

SWS_Mfl_00343 requirement

Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value

SWS_Mfl_00344 requirement

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)

SWS_Mfl_00346 requirement

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

SWS_Mfl_00347 requirement

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

SWS_Mfl_00348 requirement

Calculated Output_value shall be stored to State_cpst->Y1. State_cpst->Y1 = Output_value

SWS_Mfl_00349 requirement

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.

SWS_Mfl_00352 requirement

If the argument is zero, then the result is a zero.

SWS_Mfl_00353 requirement

Range of the value shall be [-1, +1]

SWS_Mfl_00356 requirement

Range of the value shall be [-1, +1]

SWS_Mfl_00359 requirement

If the argument is zero, then the result is a zero with the same sign as the argument.

SWS_Mfl_00362 requirement

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

SWS_Mfl_00363 requirement

Z = y / x if (|Z| < 1) Then Result = Z / (1.0 + (0.28 * Zˆ2)) if (x < 0.0f) Then Result = (y < 0.0f) ? Result - PI : Result + PI Else Result = (pi / 2) - (Z / (Zˆ2 + 0.28)) if ( y < 0.0f ) Result = Result - PI;

SWS_Mfl_00366 requirement

Param-> TimeHighLow = THighLow Param-> TimeLowHigh = TLowHigh

SWS_Mfl_00368 requirement

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.

SWS_Mfl_00370 requirement

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

SWS_Mfl_00371 requirement

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.

SWS_Mfl_00372 requirement

Mfl_RampCalcSwitch has to be called before Mfl_RampCalc routine

SWS_Mfl_00800 requirement

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.

SWS_Mfl_00801 requirement

Mfl library shall not require a shutdown operation phase.

SWS_Mfl_00806 requirement

The Mfl library shall be implemented in a way that the code can be shared among callers in different memory partitions.

SWS_Mfl_00807 requirement

Usage of macros should be avoided. The function should be de- clared as function or inline function. Macro #define should not be used.

SWS_Mfl_00808 requirement

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.

SWS_Mfl_00809 requirement

The library, written in C programming language, should conform to the MISRA C Standard. Please refer to SWS_BSW_00115 for more details.

SWS_Mfl_00810 requirement

Each AUTOSAR library Module implementation <library>*.c and <library>*.h shall map their code to memory sections using the AUTOSAR memory mapping mechanism.

SWS_Mfl_00811 requirement

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.

SWS_Mfl_00812 requirement

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.

SWS_Mfl_00813 requirement

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.

SWS_Mfl_00814 requirement

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].

SWS_Mfl_00816 requirement

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.

SWS_Mfl_00817 requirement

The functions shall not call the DET for error notification.

SWS_Mfl_00818 requirement

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.

SWS_Mfl_00819 requirement

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.

SWS_Mfl_00820 requirement

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

SWS_Mfl_00821 requirement

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.

SWS_Mfl_00822 requirement

These requirements are not applicable to this specification.

SWS_Mfl_00835 requirement

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.

SWS_Mfl_00837 requirement

The result shall be round ties to even.

SWS_Mfl_00838 requirement

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)

SWS_Mfl_00840 requirement

The return value shall be saturated to the return type boundary values in the event of overflow or underflow.

SWS_Mfl_00841 requirement

The result shall be rounded toward zero.

SWS_Mfl_00842 requirement

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)

SWS_Mfl_00843 requirement

If the input is +/- Infinity, then the output shall be limited to target type boundaries (max/min) after the conversion.

SWS_Mfl_00844 requirement

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

SWS_Mfl_00845 requirement

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.

SWS_Mfl_00846 requirement

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.

SWS_Mfl_00847 requirement

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.

SWS_Mfl_00848 requirement

If the input is NaN, then the output of the conversion shall be zero.

SWS_Mfl_00849 requirement

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

SWS_Mfl_00851 requirement

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.

SWS_Mfl_00852 requirement

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 )

SWS_Mfl_00854 requirement

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.