2.5. summary
The communication system in SCADA is very important, which can be regarded as the neural system of SCADA system. Communication is actually a separate discipline. It is basically impossible to make it clear in one chapter here. Only a rough description can be given here. For details, please refer to the books on communication systems and principles.
The basic model of communication system is shown in Figure 3-1. In figure 31-1, the information source at the transmitting end converts message M into signal G (T). In order to make the signal suitable for transmission in the channel, it is transformed into S (T) by the transmitting equipment and then sent to the channel. Channel refers to the channel that transmits signals. The noise source in Figure 3-1 is a centralized representation of the noise in the channel and other noises in the communication system. Due to the interference of noise, the signal R (T) received by the receiver may be different from s (T). The receiving device converts R (T) into the output signal G '(T), which is the approximate or estimated value of G (T). Finally, the trustee converts G' (T) into the corresponding message M '(T).
Communication system in SCADA
Figure 3-1 basic model of communication system
From G (T) to s (T) is called channel coding. The general modulation methods include ask, FSK, PSK, QAM, TCM and so on. Channel coding is often used in wired and wireless communication. With the improvement of the computing power of DSP, the speed and accuracy of AD and DA, and the development of mathematical methods, the ability of channel coding is closer and closer to the theoretical value of Shannon information theory. On the telephone line, the theoretical value of Shannon information theory is below 64K, while the actual modem can reach the speed of 33.6k or even 56K.
The carrier signal of sinusoidal oscillation can be asin (2 * π* ω* t+ φ), Various modulation modes can be described by the following mathematical formula.
Ask signal s (T) = asin (2 * π)* ω* t+ φ) g(t)=1
s(t)=0 g(t)=0
FSK signal s (T) = asin (2 * π)* ω 1*t+ φ) g(t)=1
s(t)=Asin(2*π* ω 2*t+ φ) g(t)=0
PSK signal s (T) = asin (2 * π)* ω 1*t+π) g(t)=1
s(t)=Asin(2*π* ω 1*t+0) g(t)=0
PSK and FSK have many variants, such as DPSK, MSK, etc.
QAM and TCM are too complex to be repeated here. Please refer to relevant books.
Due to the noise interference in the communication process, errors may occur, so error control is necessary. The method of error control is coding. The mathematical theoretical basis of communication coding is modern algebra, which studies the concept of group ring domain. For details, please refer to relevant books. Coding and decoding, error detection and error correction are the research areas of communication and coding. The typical domestic textbook is the textbook compiled by Mr. Wang Xinmei of Xi'an University of electronic science and technology. Its shortcomings are too abstruse and difficult to understand.
In SCADA system, error detection is often used, and error correction is rarely used except for special occasions. Error detection mainly includes two coding methods: verification and CRC verification.
The principle of sum verification is very simple, that is, add or modulo-2 addition to the information, perform the same operation on the information after receiving, and compare whether the operation result is consistent with the verification transmitted. If it is consistent, it is considered to be correct, otherwise it is considered to be wrong. This algorithm is very simple to implement and has been widely used, but its basic principle has the possibility of error detection, which is suitable for occasions with good channel quality.
CRC verification method can detect far more errors than sum verification, which is suitable for bad communication occasions.
CRC verification is more complex. It has a generating polynomial g (x), and the information can be regarded as an I (x). If the verification bit is 16 bits, the verification polynomial R (x) = x ↑ 16 * I (x) / g (x). Then the polynomial of the whole transmission sequence is t (x) = x ↑ 16 * I (x) / g (x) + R (x). When receiving, if there is no error, use t (x) / g (x) = 0. If there is an error, it is not 0. So we can know the error. Many standard generating polynomials have been found, such as
CRC-16 g(x)=x↑16+x↑15+x↑2+1
CRC–CCITT g(x)=x↑16+x↑12+x↑5+1
The CRC calculation needs shift and modulo-2 addition operation. Unless the computer has special hardware equipment, the calculation is very slow. In order to improve the calculation speed, the table lookup calculation method is generally used to convert the operation into table lookup and byte operation, which greatly improves the operation speed. The following program is the calculation method of modbuscrc verification, which reflects the above idea.
constunsignedcharauchCRCHi[]={
0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x00,0xC1
0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40
0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x01,0xC0
0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41
0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1
0x81,0x40,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41
0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0
0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40
0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x01,0xC0
0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40
0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x00,0xC1
0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40
};
constunsigned charauchCRCLo[]={
0x00,0xC0,0xC1,0x01,0xC3,0x03,0x02,0xC2,0xC6,0x06,0x07,0xC7,0x05,0xC5,0xC4,0x04,0xCC,0x0C,0x0D,0xCD,0x0F
0xCF,0xCE,0x0E,0x0A,0xCA,0xCB,0x0B,0xC9,0x09,0x08,0xC8,0xD8,0x18,0x19,0xD9,0x1B,0xDB,0xDA,0x1A,0x1E
0xDE,0xDF,0x1F,0xDD,0x1D,0x1C,0xDC,0x14,0xD4,0xD5,0x15,0xD7,0x17,0x16,0xD6,0xD2,0x12,0x13,0xD3,0x11,0xD1
0xD0,0x10,0xF0,0x30,0x31,0xF1,0x33,0xF3,0xF2,0x32,0x36,0xF6,0xF7,0x37,0xF5,0x35,0x34,0xF4,0x3C,0xFC,0xFD
0x3D,0xFF,0x3F,0x3E,0xFE,0xFA,0x3A,0x3B,0xFB,0x39,0xF9,0xF8,0x38,0x28,0xE8,0xE9,0x29,0xEB,0x2B,0x2A,0xEA
0xEE,0x2E,0x2F,0xEF,0x2D,0xED,0xEC,0x2C,0xE4,0x24,0x25,0xE5,0x27,0xE7,0xE6,0x26,0x22,0xE2,0xE3,0x23,0xE1,
0x21,0x20,0xE0,0xA0,0x60,0x61,0xA1,0x63,0xA3,0xA2,0x62,0x66,0xA6,0xA7,0x67,0xA5,0x65,0x64,0xA4,0x6C,0xAC,
0xAD,0x6D,0xAF,0x6F,0x6E,0xAE,0xAA,0x6A,0x6B,0xAB,0x69,0xA9,0xA8,0x68,0x78,0xB8,0xB9,0x79,0xBB,0x7B,0x7A,
0xBA,0xBE,0x7E,0x7F,0xBF,0x7D,0xBD,0xBC,0x7C,0xB4,0x74,0x75,0xB5,0x77,0xB7,0xB6,0x76,0x72,0xB2,0xB3,0x73,
0xB1,0x71,0x70,0xB0,0x50,0x90,0x91,0x51,0x93,0x53,0x52,0x92,0x96,0x56,0x57,0x97,0x55,0x95,0x94,0x54,0x9C,
0x5C,0x5D,0x9D,0x5F,0x9F,0x9E,0x5E,0x5A,0x9A,0x9B,0x5B,0x99,0x59,0x58,0x98,0x88,0x48,0x49,0x89,0x4B,0x8B,
0x8A,0x4A,0x4E,0x8E,0x8F,0x4F,0x8D,0x4D,0x4C,0x8C,0x44,0x84,0x85,0x45,0x87,0x47,0x46,0x86,0x82,0x42,0x43,
0x83,0x41,0x81,0x80,0x40
};
unsignedshortcrc(unsignedchar*puchMsg,unsignedshortusDataLen)
{
unsignedcharuchCRCHi=0xFF;/*highbyteofCRCinitialized*/
unsignedcharuchCRCLo=0xFF;/*lowbyteofCRCinitialized*/
unsigneduIndex;/*willindexintoCRClookuptable*/
while(usDataLen--)/*passthroughmessagebuffer*/
{
uIndex=uchCRCHi^*puchMsg++;/*calculatetheCRC*/
uchCRCHi=uchCRCLo^auchCRCHi[uIndex];
uchCRCLo=auchCRCLo[uIndex];
}
return(uchCRCHi<<8|uchCRCLo);
}
Of course, the error can also be corrected by encoding and decoding, but the implementation is more complex. Generally, it is only used when the channel is very expensive, such as satellite channel and deep space communication. Very few error correction codes can be used in SCADA system.
Due to different communication media, communication can be divided into the following three types:
Wired, wireless and network. The reason for taking out the network alone is that the network technology has developed rapidly in recent years. At present, the network has become a very important way to transmit SCADA information.
Channel classification can also be divided into half duplex and full duplex channels, but sometimes even if the channel is full duplex and the protocol is half duplex, the system still works in half duplex state.
2.6. Wired system
Wired covers a wide range of areas, including telephone line, audio cable, power carrier, coaxial cable and optical fiber. Wired here refers to the communication mode of SCADA protocol without network protocol.
In the wired channel, except the carrier channel, generally speaking, the transmission speed is higher than the wireless channel, the bit error rate is lower than the wireless channel, the delay is also small, and the reliability is higher than the wireless channel. Its disadvantage is that the construction investment is large, the cycle is long, and it is impossible to build wired communication on some special occasions.
Some digital signals are directly transmitted in wired channels, such as RS485 / RS422 signals on twisted pair, input transmission through long-line driving equipment on twisted pair, and digital signals are directly transmitted on optical fiber. RS485 can transmit 1.2km at the speed of 100kbps, long line driver can reach the speed of 19.2kbps, optical fiber can reach the speed of hundreds of K or even hundreds of megabytes, and the transmission distance can be hundreds of meters to tens of kilometers.
Many wired channels need to use modulation and demodulation equipment, such as telephone line, audio cable and carrier channel. Its channel capacity must be less than that of Shannon information theory. The modem in the telephone line can reach the speed of 33.6kbps, while some carrier channels can only reach the speed of 300BPS.
2.7. Wireless system
The commonly used wireless channels include radio station, microwave communication and satellite communication. GPRS / CDMA communication mode is included in the category of network communication.
Due to the bandwidth limit received by the radio station, its channel is generally 25kHz. The Radio Regulatory Commission has specially set aside several frequency bands for wireless data transmission,
It mainly includes 150MHz band, 230MHz band and 470MHz band. The current modulation and demodulation technology can achieve speeds ranging from 600bps to 19200bps. At present, it is generally a data transmission radio station that uses modem and radio station together. The use of radio central station is more complicated. In order for the system to communicate better, it is necessary to build a high omni-directional antenna, some on the roof, and some special iron towers. Before implementation, frequency point interference test, shielding test, field strength test, etc. shall be carried out. The radio station is seriously affected by the terrain and buildings. Sometimes there is a high-rise building in the middle, which makes it impossible to communicate. Radio stations are sometimes not suitable for urban applications, nor for mountainous, plateau and hilly areas. It is suitable for plain, rural and water surface applications.
Radio station is a typical half duplex polling system. If the system has many points, the polling time may be as long as a few minutes or even longer. In addition, it is necessary to distinguish the interface rate and air rate of the radio station, which are independent and unrelated concepts. Air rate refers to the actual data rate of the radio station in the wireless channel. The faster the speed, the better the performance of the radio station, and the more data transmitted per unit time. Interface rate refers to the rate of radio station and RTU equipment. As long as this rate is not less than the air rate, it has nothing to do with the communication speed. Radio stations may be affected by interference, seriously affect communication performance, or even completely unavailable. The main interferences include: same frequency interference, corona interference of high-voltage transmission line, other RF equipment, etc. Generally, it is not affected by astronomical conditions, such as sunspots, solar magnetic storms, ionosphere, etc.
Microwave communication can only be implemented in particularly important occasions. Its investment is huge, and there must be a relay station every about 50km. For occasions with complex terrain, there may be a relay station in close proximity for the reason of sight distance. General units do not have the financial resources to build microwave systems.
Domestic power enterprises had a set of microwave communication system from various regions to the central government. Microwave communication will still be affected by precipitation and fog. Satellite communication is a last resort. First of all, its power is too large. A small satellite base station needs hundreds of watts of power, a 1m caliber parabolic antenna, special and expensive equipment (communication equipment costs tens of thousands of yuan), and the communication cost is very high. A message that can carry 256byte data needs 0.5 yuan, which is only on the sea, It is only used when other means of communication are really unavailable, such as the desert. Satellite communication is quite reliable. Except for solar flares, solar magnetic storms, rainstorms and other situations, communication interruption generally does not occur. Solar flares and solar magnetic storms will affect satellite communication. There is also the so-called stellar eclipse effect, that is, the communication satellite and the sun are in the same direction. Because the sun is a big interference source, satellite communication is interrupted. However, the interruption time is only a few minutes.
2.8. Network system
Network communication methods commonly used in wireless methods include GPRS / CDMA, ZigBee, wireless Ethernet, etc. Common wired modes include Ethernet, ADSL, CABLEMODEM, etc.
The advantage of network communication is that it borrows the existing network resources, really breaks the regional restrictions, and can build a globally distributed SCADA system, which is very beneficial to many global production enterprises.
Because the network is built on the public network, when an emergency occurs and the SCADA system is required to deal with the emergency, this way may lead to the paralysis or blockage of communication equipment due to the large increase in the amount of information in public communication, which may not be able to deal with such applications. This kind of communication blocking is entirely possible, so when building the SCADA system, we must evaluate this risk, otherwise it is a system that cannot be used in an emergency, and this system may not be necessary to build. For this system, independent systems with strong survivability must be adopted, such as radio stations.
In network communication, since GPRS / CDMA, ADSL and other devices are built on PPP protocol or PPPoE protocol, their address allocation may be dynamic or static. The address of the master station may be static or dynamic, so they may not know the IP address of each other. If there is no special mechanism, they cannot communicate. In order to ensure that RTU can communicate with the master station, special processing needs to be done. As far as TCP / IP communication is concerned, both parties must know each other's IP address and port number before communication. Moreover, the general communication model is client / server model, and the master station is generally used as a server, so the master station system cannot be placed behind the firewall. If it is placed behind the fire prevention period, the firewall must open at least several ports, Moreover, the IP address of the host is mapped to the public network through NAT, otherwise RTU cannot communicate with the master station.
If the address of the master station is static, set the IP address of the master station as the host IP address when setting the communication equipment at the RTU end. In this way, after power on, the communication equipment DTU of RTU can be set according to the
IP address, port number and communication mode (TCP / UDP) find the master station for communication. If the master station is a dynamic address (such as telephone dial-up Internet access or ADSL dial-up Internet access), because the host address is dynamic, the IP address of the communication equipment DTU of RTU is also dynamic, so it is impossible for both parties to find each other directly.
You need to apply for a dynamic domain name resolution service to distinguish it from the static domain name resolution service. For example, the dynamic domain name is www.juyingel COM. Cn, install dynamic domain name resolution software at the master station. As long as the master station starts up, log in to the dynamic domain name server, such as peanut shell, register its own IP address and inform www.juyingel COM. The address of CN is XX XX. XX. XX。 When setting DTU equipment at RTU end, the host of its communication cannot be set as IP address, but should be set as www.juyingel COM. Cn, after the DTU device is powered on, first request the DNS server to resolve www.juyingel COM. The IP address of CN and the IP address registered by the DNS server according to the dynamic domain name resolution software, tell DTU, www.juyingele.com COM. The IP address of CN is XX XX. XX. 20. In this way, DTU knows the IP address of the master station and the agreement between both parties
The port number and communication mode (TCP / UDP) can communicate.
In addition, since the communication is TCP / IP communication, the port number and communication mode (TCP / UDP) of the master station and RTU should be set to be consistent.
The application of GPRS / CDMA is wireless communication. There is almost no disadvantage of data transmission radio. It is built on the network of wireless communication operators. As long as the mobile phone can talk, it can work. The disadvantage is that it charges according to the traffic, and the cost may be slightly too high. In addition, the network capacity is limited, and the number of authentication connections that can be initiated and maintained at the same time is limited, which may be a considerable restriction for large-scale applications. Generally speaking, the communication speed of CDMA is higher than GPRS, while in practical application, the application speed of SCADA system is far lower than its nominal rate. Another important problem of GPRS / CDMA is network delay,
From sending a message to receiving a response message, it may take 3 seconds or more, which can not be satisfied for some demanding applications.
Wireless Ethernet is a very promising way of communication. Its price is getting cheaper and cheaper, and its bandwidth is very wide, up to 54m. It can carry language service, graphic monitoring service and SCADA service on it, which has great development potential. Moreover, the self-organizing network (mash network) can be built on the wireless Ethernet, so that whether the network is fixed or mobile, it can communicate normally; Even if individual equipment is damaged, it can ensure normal communication through the re organization of the network. When omnidirectional antenna is used in wireless Ethernet, its communication distance is greatly limited, only a few hundred meters. When directional high gain antenna is used, the distance can be several to tens of kilometers.
ADSL / CABLEMODEM is a daily Internet access method that everyone can hear and see in detail. Its advantages and disadvantages must be very clear to everyone. It is worth mentioning that few RTU devices can directly support PPPoE protocol, which may need to be configured or implemented by adding network devices, which is a limitation.