Complete the code to define the main component that collects data from remote units in a distributed SCADA system.
class [1]: def __init__(self): self.data = [] def collect_data(self, remote_unit): self.data.append(remote_unit.send_data())
The MasterStation is the central component that collects data from remote units in a distributed SCADA system.
Complete the code to send data from a remote unit to the master station.
class RemoteUnit: def __init__(self, id): self.id = id def [1](self): return f"Data from unit {self.id}"
The method send_data is used by remote units to send their data to the master station.
Fix the error in the code that initializes communication between master and remote units.
master = MasterStation() remote = RemoteUnit(1) master.collect_data([1])
The collect_data method expects a remote unit object, not the data itself. So passing remote is correct.
Fill both blanks to create a dictionary of remote unit IDs and their data in the master station.
data_summary = {unit.id: unit.[1]() for unit in remote_units if unit.[2]() is not None}We use send_data() to get data from each remote unit and check if it is not None before adding it to the dictionary.
Fill all three blanks to implement a control command sent from the master to a remote unit and confirm execution.
class MasterStation: def send_command(self, unit, command): response = unit.[1](command) if response == [2]: print(f"Command [3] executed successfully on unit {unit.id}")
The master station calls execute_command on the remote unit, checks if the response is True, and prints the command executed.