Beruflich Dokumente
Kultur Dokumente
PLC’s
Énfasis en Automatización
Tipos de Datos
•Un programa PLC contiene diferentes tipos de datos
(punto flotante, codigo BCD, Contadores) que tienen
formatos incompatibles y es más crítico en diferentes
fabricantes
•La portabilidad del programa requerirá grandes modificaciones
debido al cambio de tipo de datos
•Por esto se definió el tipo de datos uniforme (útil
cuando se tienen diferentes fabricantes en un solo
proyecto)
Universidad del Cauca
Martha Lucia Orozco G. Programación Avanzada de PLC's 2
PROGRAMACION AVANZADA DE
PLC`s
TYPE
LongFloatNum : LREAL;
FloatingPoint : LongFloatNum;
InitFloatNum : LREAL :=1.0;
tControl : BOOL :=TRUE;
END_TYPE
Structure Varios tipos de datos son agrupados para formar un tipo de dato.
Las variables se acceden por nombre del componente
Enumeration:
Colour puede tomar 1 de 3 valores posibles
TYPE
Colour : (red, yellow, green);
Sensor : INT (-56..128);
Measure : ARRAY [1..45] OF Sensor;
TestBench
STRUCT
Place : UINT;
Ligth : Colour:=red;
Meas1 : Measure;
Meas2 : Measure;
Meas3 : Measure;
END_STRUCT;
END_TYPE
Universidad del Cauca
Martha Lucia Orozco G. Programación Avanzada de PLC's 14
PROGRAMACION AVANZADA DE
PLC`s
Range:
Sensor es una variable de temperatura
puede tomar valores entre –56 y 128
TYPE
Colour : (red, yellow, green);
Sensor : INT (-56..128);
Measure : ARRAY [1..45] OF Sensor;
TestBench
STRUCT
Place : UINT;
Ligth : Colour:=red;
Meas1 : Measure;
Meas2 : Measure;
Meas3 : Measure;
END_STRUCT;
END_TYPE
Universidad del Cauca
Martha Lucia Orozco G. Programación Avanzada de PLC's 15
PROGRAMACION AVANZADA DE
PLC`s
Array:
Measure es un arreglo de datos tipo Sensor
Máximo soporta 45 datos
TYPE
Colour : (red, yellow, green);
Sensor : INT (-56..128);
Measure : ARRAY [1..45] OF Sensor;
TestBench
STRUCT
Place : UINT;
Ligth : Colour:=red;
Meas1 : Measure;
Meas2 : Measure;
Meas3 : Measure;
END_STRUCT;
END_TYPE
Universidad del Cauca
Martha Lucia Orozco G. Programación Avanzada de PLC's 16
PROGRAMACION AVANZADA DE
PLC`s
Structure:
TestBench es una estructura de datos compuesta
de datos elementales y derivados
TYPE
Colour : (red, yellow, green);
Sensor : INT (-56..128);
Measure : ARRAY [1..45] OF Sensor;
TestBench
STRUCT
Place : UINT;
Ligth : Colour:=red;
Meas1 : Measure;
Meas2 : Measure;
Meas3 : Measure;
END_STRUCT;
END_TYPE
Universidad del Cauca
Martha Lucia Orozco G. Programación Avanzada de PLC's 17
PROGRAMACION AVANZADA DE
PLC`s
ARRAY
TYPE
Meas_1Dim : ARRAY[1..45] OF Sensor;
Meas_2Dim : ARRAY[1..10,1..45] OF Sensor;
END_TYPE
Data Structures
TYPE
LimitedRevol : UINT (0..230);
TypLevel : (Idling, SpeedUP1, SpeedUp2, MaxPower);
MotorState
STRUCT
Revolutions : LimitedRevol;
Level : TypLevel;
MaxReached : BOOL;
Failure : BOOL;
Brake : BYTE;
END_STRUCT;
END_TYPE
TYPE
MultiMotState : ARRAY [1..4] OF MotorState;
END_TYPE
VAR
(*Case 1:*)
Motor1 : MotorState;
(*Case 2:*)
Motors : ARRAY [1..4] OF MotorState;
(*Case 3:*)
FourMotors : MultiMotState;
END_VAR
TYPE
MotorState:
STRUCT
Revolutions : LimitedRevol:=0;
Level : TypeLevel:=Idling;
MaxReached : BOOL:=FALSE;
Failure : BOOL:=FALSE;
Brake : BYTE:=16#FF;
END_STRUCT;
END_TYPE
Forma Abreviada
VAR
Field1: ARRAY[1..12] OF SINT:=[3,16#FF,-5,-9,-5,-9,-5,-9,-5,-9,0,0];
Field2: ARRAY[1..12] OF SINT:=[3,16#FF,4(-5,-9),2(0)];
Text: STRING[4]:=‘stop’;
END_VAR
ANY
ANY_BIT ANY_NUM ANY_DATE
ANY_INT ANY_REAL