Now that we have our utility formulas defined, we can move into modeling the environment. First, we will figure out how to write the storage tanks, as they are fairly simple constructs: all we need to figure out is the pressure of the fluid in the tanks, as well as the flow rate out due to gravity. In addition, we need to know the tank level, as that affects the pressure of the fluid.
The code for the tanks is shown next, followed by explanations:
# tank.py (part 1)1 #!/usr/bin/env python3 2 """ 3 VirtualPLC tank.py 4 5 Purpose: Creates a generic Tank class for PLC-controlled SCADA systems. 6 7 Author: Cody Jackson 8 9 Date: 5/28/18 10 ################################# 11 Version 0.2 12 Added path extension to alleviate ...