Tank Level Control with PID (Siemens)
This project demonstrates controlling a tank’s filling level using a PID controller. The system uses three key components:
Proportional (P): Adjusts the input flow based on the difference between the current tank level and the setpoint. A larger error results in a larger correction.
Integral (I): Accounts for accumulated errors over time, helping to eliminate any steady-state error and ensuring the tank level reaches and stays at the desired value.
Derivative (D): Responds to the rate of change of the error, predicting future errors and adjusting the flow to prevent overshooting or oscillations.
Together, these components follow a formula where the control output is the sum of these three terms:
Output = Kp Error + Ki Integral(Error) + Kd * Derivative(Error)
In Factory IO and TIA Portal, the system requires conversions between int and real data types because the analog world must be discretized for digital processing. The PID values must be continuously adjusted based on the desired response. For this project, I used the PID Compact function block from the S7-1500, where you input the setpoint and receive the adjusted output, allowing for precise control of the tank’s level under varying conditions.
Additionally, to ensure fast and reliable execution, the program uses a Cyclic Interrupt Organization Block. This block provides a rapid execution cycle, ensuring the PID control loop and critical operations run quickly and consistently for real-time control of the tank level.
Separating station(Siemems)
This project replicates the Separating Station (https://docs.factoryio.com/manual/scenes/separating-station/) scene from Factory IO, where boxes are sorted based on their color. The system controls:
Entry Conveyors (1 and 2): Move boxes to the sorting area.
Exit Conveyors (1 and 2): Transport sorted boxes to their assigned lanes.
Pushers: Shift boxes between conveyors according to their color.
Each exit lane is assigned a specific color, and the pushers activate only when conditions are met (e.g., box color and conveyor status). Additionally, the system includes:
Counters: Track the number of boxes sorted per lane.
Safety System: Includes an emergency stop and fault indicators.
HMI Interface: Allows control and monitoring of the process, with options for automatic, manual, and emergency modes.
Beacon Lights: Display system status using colored signals.
Challenges in Programming
The logic for this system is complex due to multiple conditions for activating conveyors and pushers. It involves:
Edge Detection: Using rising and falling edges to trigger precise actions.
Memory Bits: To manage permissions for equipment.
State Machines: Implementing states for start, stop, auto, manual, and emergency modes to ensure smooth and safe operation.
This project successfully reproduces the final effect shown in the official Factory IO video while adding enhancements for safety and user control via the HMI.