0
0
SCADA systemsdevops~10 mins

Serial vs Ethernet communication in SCADA systems - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to open a serial port connection.

SCADA systems
serial_port = Serial(port=[1], baudrate=9600)
Drag options to blanks, or click blank then click option'
A"COM3"
BEthernet()
C"192.168.1.1"
Dsocket()
Attempts:
3 left
💡 Hint
Common Mistakes
Using Ethernet or IP address instead of serial port name.
2fill in blank
medium

Complete the code to create an Ethernet socket connection.

SCADA systems
sock = socket.socket(socket.AF_INET, socket.SOCK_[1])
Drag options to blanks, or click blank then click option'
ARAW
BSTREAM
CDGRAM
DSEQPACKET
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing datagram (UDP) socket for TCP connection.
3fill in blank
hard

Fix the error in the code to send data over serial port.

SCADA systems
serial_port.write([1])
Drag options to blanks, or click blank then click option'
A"Hello"
Bbytearray("Hello")
Cb"Hello"
DHello
Attempts:
3 left
💡 Hint
Common Mistakes
Sending string instead of bytes causes error.
4fill in blank
hard

Fill both blanks to create a dictionary mapping communication types to their typical ports.

SCADA systems
comm_ports = {"serial": [1], "ethernet": [2]
Drag options to blanks, or click blank then click option'
A"COM3"
B80
C22
D"192.168.1.100"
Attempts:
3 left
💡 Hint
Common Mistakes
Using IP address instead of port number for Ethernet.
5fill in blank
hard

Fill all three blanks to create a function that sends a message over the chosen communication type.

SCADA systems
def send_message(comm_type, message):
    if comm_type == "serial":
        port = Serial(port=[1], baudrate=9600)
        port.write(message.[2]())
    elif comm_type == "ethernet":
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.connect(([3], 80))
        sock.sendall(message.encode())
Drag options to blanks, or click blank then click option'
A"COM4"
Bencode
C"192.168.0.10"
Ddecode
Attempts:
3 left
💡 Hint
Common Mistakes
Using decode() instead of encode() for sending.
Using IP address as serial port name.