Siemens SIMATIC S7-1500 Manual De Funcionamiento página 135

Ocultar thumbs Ver también para SIMATIC S7-1500:
Tabla de contenido
SCL
//Caste of the variant "TransformationParameters" to the referenced datatype
//"TO_Struct_TransformationParameter_V1".
//This has to be done in order to access the variant pointer, which references
//the "TransformationParameters" where the "AxisData" and "CartesianData" for
//the calculation of user transformation are stored.
#P ?= #TransformationParameters;
//Check if cast of "TransformationParameters" was successfull. Otherwise abort calcula-
tion.
IF #P = NULL THEN
#FunctionResult := #InvalidCast;
RETURN;
END_IF;
//Check if "KinematicsUserDefined2D" needs transformation.
IF #KinematicsObject = "KinematicsUserDefined2D" THEN
//Read the user defined cartesian parameters.
#GearRatioA1 := "KinematicsUserDefined2D".Kinematics.Parameter[1];
#GearRatioA2 := "KinematicsUserDefined2D".Kinematics.Parameter[2];
//Calculate the forward transformation "AxisData" -> "CartesianData".
//The system fills the "AxisData" of "TransformationParameters" with values.
//To calculate the "CartesianData" evaluate "AxisData".
IF #TransformationType = 0 THEN
//Calculate the position, velocity and acceleration component for the x-vector.
#P^.CartesianData.xPosition := #P^.AxisData.a1Position * #GearRatioA1;
#P^.CartesianData.xVelocity := #P^.AxisData.a1Velocity * #GearRatioA1;
#P^.CartesianData.xAcceleration := #P^.AxisData.a1Acceleration * #GearRatioA1;
//Calculate the position, velocity and acceleration component for the z-vector.
#P^.CartesianData.zPosition := #P^.AxisData.a2Position * #GearRatioA2;
#P^.CartesianData.zVelocity := #P^.AxisData.a2Velocity * #GearRatioA2;
#P^.CartesianData.zAcceleration := #P^.AxisData.a2Acceleration * #GearRatioA2;
//Link constellation can be set to 0 here, hence it is not needed.
#P^.CartesianData.LinkConstellation := 16#0000;
//Transformation was successfull.
#FunctionResult := 0;
//Calculate the backward transformation "CartesianData" -> "AxisData".
//The system fills the "CartesianData" of "TransformationParameters" with values.
//To calculate the "AxisData" evaluate "CartesianData".
ELSIF #TransformationType = 1 THEN
//Calculate the position, velocity and acceleration component for the first axis.
#P^.AxisData.a1Position := #P^.CartesianData.xPosition / #GearRatioA1;
#P^.AxisData.a1Velocity := #P^.CartesianData.xVelocity / #GearRatioA1;
#P^.AxisData.a1Acceleration := #P^.CartesianData.xAcceleration / #GearRatioA1;
Funciones de cinemática de S7-1500T V4.0 en el TIA Portal V15
Manual de funciones, 12/2017, A5E42063028-AA
Principios básicos
3.8 Transformación de la cinemática
135
Tabla de contenido
loading

Tabla de contenido