The final main component of the fuel scenario are pumps. While the fuel simulation uses positive displacement pumps (a given amount of fluid is pumped out per cycle), we will also write code for centrifugal pumps (a type of variable displacement pump, which uses an impeller to impart velocity and pressure to the fluid) to make this program more universal.
Simulation pumps
Base pump class
First, we will define a base Pump class, much like we did for valves, as shown in the following code:
# pump.py (part 1)
1 #!/usr/bin/env python3 2 """ 3 VirtualPLC pump.py 4 5 Purpose: Creates a generic Pump class for PLC-controlled SCADA systems. 6 7 Classes: 8 Pump: Generic superclass 9 CentrifPump:...