Mathematical Functions ¶ DERIVATIVE (FunctionBlock) INTEGRAL (FunctionBlock) LIN_TRAFO (FunctionBlock) ROTATION_DIFFERENCE (FunctionBlock) STATISTICS_INT (FunctionBlock) STATISTICS_REAL (FunctionBlock) VARIANCE (FunctionBlock)
DERIVATIVE (FB) ¶ FUNCTION_BLOCK DERIVATIVE Approximates the derivative of a given value in its time course Four consecutive values are recorded and used in the calculation so that the resulting derivative is as accurate as possible. Example: Function block in FBD InOut: Scope Name Type Comment Input IN REAL Input value TM DWORD Time since last call in msec RESET BOOL TRUE : OUT is set to zero and saved values are set to the current input IN Output OUT REAL Derivative
INTEGRAL (FB) ¶ FUNCTION_BLOCK INTEGRAL determines approximately the integral over time. Example: Function block in FBD InOut: Scope Name Type Initial Comment Input IN REAL Input value TM DWORD Time since last call in msec RESET BOOL TRUE : OUT is set to zero and OVERFLOW to FALSE Output OUT REAL Value of the integral. This is done by summing all part integrals IN * TM OVERFLOW BOOL FALSE TRUE : The value of OUT is out of range of REAL variables. he function is blocked till it is new initialised by input RESET .
LIN_TRAFO (FB) ¶ FUNCTION_BLOCK LIN_TRAFO Performs a linear transformation The transformation is performed by using the minimum and maximum values of the inputs for a linear approximation of the output value. Application example: A temperature sensor provides Volt-values (input IN ). These are to be converted to temperature values in degree centigrade (output OUT ). The input (Volt) values range is defined by the limits IN_MIN=0 and IN_MAX=10 . The output(degree centigrade) value range is defined by the limits OUT_MIN=-20 and OUT_MAX=40 . Thus for an input of 5 Volt a temperature of 10 degree centigrade will result. InOut: Scope Name Type Comment Input IN REAL Input value IN_MIN REAL Minimum input value IN_MAX REAL Maximum input value OUT_MIN REAL Corresponding minimum output value OUT_MAX REAL Corresponding maximum output value Output OUT REAL Output value ERROR BOOL TRUE : IN_MIN = IN_MAX or IN out of input range
GPIO (FB) ¶ FUNCTION_BLOCK GPIO This function block is the base class for SPI devices controlled via the SPI device /dev/spidev0.0. It is meant to be extended by other function blocks that overload the body and the following methods/properties and replace it with their specific implementation, always including a call of the base implementation with super^.<MethodName>() : - body (general handling, start-up) - AfterReadInputs (reading input data) - BeforeWriteOutputs (writing output data) - Initialize [optional] (used to read parameters from the configuration) - Operational [optional] (used to signal the status of the device) The body of this FB is called by the methods AfterReadInputs and BeforeWriteOutputs, where _xAfterReadInputs indicates the caller. Use _iState to control your statemachine. A value of 10 by default indicates that the drive is operational. Do not forget to call the base implementation with super^(), where the diagnosis indicators are set according to the Operational property. InOut: Scope Name Type Input aeType ARRAY [0..31] OF GPIOType axOutputs ARRAY [0..31] OF BOOL udiPWMFrequency UDINT uiPWMDutyCycle UINT Output dwInputs DWORD axInputs ARRAY [0..31] OF BOOL Properties: Operational Methods: AfterReadInputs BeforeWriteOutputs DetermineConstants DetermineProcessorType Initialize Structure: connector AfterReadInputs (Method) BeforeWriteOutputs (Method) Initialize (Method) internal DetermineConstants (Method) DetermineProcessorType (Method) status Operational (Property)
connector ¶ AfterReadInputs (Method) BeforeWriteOutputs (Method) Initialize (Method)
GPIO.AfterReadInputs (METH) ¶ METHOD AfterReadInputs : INT This method can be overloaded by extending FBs. It is used to read in the inputs of the device in the beginning of the cycle. Always including a call of the base implementation with super^.AfterReadInputs() In the base implementation, the body of the FB is called. InOut: Scope Name Type Return AfterReadInputs INT
GPIO.BeforeWriteOutputs (METH) ¶ METHOD BeforeWriteOutputs : INT This method can be overloaded by extending FBs. It is used to write the outputs to the device at the end of the cycle. Always including a call of the base implementation with super^.BeforeWriteOutputs() In the base implementation, the body of the FB is called. InOut: Scope Name Type Return BeforeWriteOutputs INT
GPIO.Initialize (METH) ¶ METHOD Initialize : UDINT This method can be overloaded by extending FBs. It is called once during initialization phase, before the PLC goes into “run”. Always including a call of the base implementation with super^.Initialize(wModuleType, udiInstance, pConnector) Typically, parameter values from the configuration are read here. InOut: Scope Name Type Return Initialize UDINT Input wModuleType UINT dwInstance UDINT pConnector POINTER TO IoConfigConnector
internal ¶ {attribute ‘libdoc_include’} DetermineConstants (Method) DetermineProcessorType (Method)