Response For Class (RFC)
Title short form | RFC |
Categories | Maintainability, reusability |
Definition | Number of different POUs, methods or actions that can be called by a POU |
Further information | RFC = Response For Class The value is used for measuring the complexity (in terms of testability and maintainability). All possible direct and indirect method calls can be reached via associations are taken into account. These can be used to respond to an incoming message or to respond to an event that has occurred. |
Sample:
Function block FB1:
FUNCTION_BLOCK FB1
VAR
d,x,y : INT;
END_VARx := METH(d+10);
y := FUN(42, 0.815);Method FB1.METH:
METHOD METH : INT
VAR_INPUT
i : INT;
END_VARMETH := FUN(CUBE(i), 3.1415);Function Cube:
FUNCTION CUBE : INT
VAR_INPUT
i : INT;
END_VARCUBE := i*i*i;Function FUN:
FUNCTION FUN : INT
VAR_INPUT
a : INT;
f : LREAL;
END_VARFUN := LREAL_TO_INT(f*10)*a;FUN,CUBE: These functions have an RFC of 0, as neither function calls other functions, function blocks or methods for their calculations.FB1.METH:The method usesFUNandCUBE, which results in an RFC of 2.FB1:- The function block
FB1callsMETHandFUN, which increases its RFC by 2. - For
FB1, its methodMETHmust also be taken into account.METHusesFUNandCUBE.FUNhas already been added to the RFC ofFB1(see previous point). Thus, only the use ofCUBEinMETHincreases the RFC forFB1to 3.