Attribute VB_Name = "Module1" Option Explicit 'CAN_Message. Public Type TPCANMsg ID As Long ' 11/29 Bit-Identifier MSGTYPE As Byte ' Bits from MSGTYPE_* LEN As Byte ' Data length code of the message(from 0 to 8) DATA(7) As Byte ' data bytes 0..7 End Type 'Declarations of the functions. Public Declare Function CAN_Read Lib "pcan_usb" (ByRef pMsgBuff As TPCANMsg) As Long Public Declare Function CAN_Init Lib "pcan_usb" _ (ByVal wBTR0BTR1 As Integer, ByVal CANMsgType As Integer) As Long Public Declare Function CAN_Close Lib "pcan_usb" () As Long 'BTR0 BTR1 register. 'Baud rate code = register value BTR0/BTR1. Public Const CAN_BAUD_1M = &H14 ' 1 MBit / s Public Const CAN_BAUD_500K = &H1C ' 500 kBit / s Public Const CAN_BAUD_250K = &H11C ' 250 kBit / s Public Const CAN_BAUD_125K = &H31C ' 125 kBit / s Public Const CAN_BAUD_100K = &H432F ' 100 kBit / s Public Const CAN_BAUD_50K = &H472F ' 50 kBit / s Public Const CAN_BAUD_20K = &H532F ' 20 kBit / s Public Const CAN_BAUD_10K = &H672F ' 10 kBit / s Public Const CAN_BAUD_5K = &H7F7F ' 5 kBit / s 'Msg Type: Public Const CAN_INIT_TYPE_EX = &H1 ' Extended Frame. Public Const CAN_INIT_TYPE_ST = &H0 ' Standard Frame. 'Variables for each sensor. Public Type SensorVble IDcan As Long 'Each sensor sends messages with a different CAN ID. iden As Integer 'Each sensor has an associated identifier. firstMsg As Integer 'This variable indicates when this sensor sends its first message. 'It is used in the registering process. n As Integer 'To know the received message type, (n=0 -> XYZ) or (n=1 -> PTV). n_anterior As Integer 'It stores the last received message type, (n=0 -> XYZ) or '(n=1 -> PTV). Counter As Double 'It counts received messages. MsgCounter_V As Double 'It counts received messages of vibration(XYZ). MsgCounter_T As Integer 'It counts received messages of pressure, temperature and 'voltage(PTV). 'Auxiliary counters to store the information in a text file periodically. MsgCounter_V_aux As Integer MsgCounter_T_aux As Integer buffer1 As Variant 'To display the message with LEN=7. buffer2 As Variant 'To display the message with LEN=5. 'Variables to count the missed messages. MsgCounter_7 As Integer 'with LEN=7. MsgCounter_5 As Integer 'with LEN=5. MsgCounter_strange As Integer 'with another LEN. flag1 As Integer 'It indicates if a message with LEN=7 has been received before 'receiving a message with LEN=5. vector(5) As Double 'It stores the data without knowledge about the type(XYZ or PTV). value(2) As Double 'It stores the data without transformation. MatrixV() As Double 'It stores XYZ data. MatrixT() As Double 'It stores PTV data. End Type 'Array of structs:to store all the information about a sensor in each struct. Public sensors_vble() As SensorVble 'Constants for the graphs scales. 'x axis: Public Const scalet_XYZ = 100 Public Const scalet_PTV = 10000 'y axis: 'XYZ Public Const scale_minx = -100 Public Const scale_maxx = 100 Public Const scale_miny = -100 Public Const scale_maxy = 100 Public Const scale_minz = -3 Public Const scale_maxz = 1000 'PTV Public Const scale_minp = 0 Public Const scale_maxp = 200 Public Const scale_mint = 0 Public Const scale_maxt = 85 Public Const scale_minv = 0 Public Const scale_maxv = 20 'Variables to change the graph scales depending on the zoom. Public min(5) As Integer Public max(5) As Integer 'Variables to store which variable type of which sensor is plotted in each graph. Public graph_sensor(5) As Integer 'Which sensor is indicated by the sensor identifier. Public graph_variable(5) As Integer 'Which variable is indicated by: 'X=0, Y=1, Z=2, P=3, T=4, V=5. e-REdING. Biblioteca de la Escuela Superior de Ingenieros de Sevilla.


SISTEMA DE MONITORIZACIÓN DE TURBINAS DE GAS AERONÁUTICAS

: Rodríguez Barquero, María
: Ingeniería Industrial
Contenido del proyecto: