Skip to content

Commit 36cdee9

Browse files
author
Jacob Gelman
committed
Add README
1 parent cdf35e8 commit 36cdee9

File tree

6 files changed

+66
-0
lines changed

6 files changed

+66
-0
lines changed

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Process Simulator Basic
2+
3+
## Hardware Overview
4+
The simulator defined in this repository models a process consisting of the following physical components:
5+
6+
![Process hardware](/images/1.png)
7+
8+
| Component | Description |
9+
| --------- | ----------- |
10+
| Tank | A hollow cylinder with finite dimensions is used to store a liquid. |
11+
| Inlet valve | An electronically controlled valve that can be opened or closed to control the inflow of a pressurized liquid. |
12+
| Drain valve | A secondary, electronically controlled valve that can be opened to allow gravity to drain the liquid in the tank. |
13+
| High limit | A sensor mounted near the top of the tank is used to detect when the liquid is at or above that height. |
14+
| Low limit | A sensor mounted near the bottom of the tank is used to detect when the liquid is at or above that height. |
15+
16+
### Potential application
17+
A potential use-case for this tank configuration is in a fire suppression system. In this application, the tank is filled with water to the upper limit through the inlet; if an unexpected drop in water occurs, more is added automatically. In the event of a fire, the drain is opened to rapidly release the tank's contents to suppress the fire. The fire itself could be detected with the addition of a smoke detection sensor or a push-button pressed by an operator.
18+
19+
## Control Overview
20+
A PLC controls the filling and draining of the tank based on the inputs from the limit switches. The logic used depends on the application.
21+
![Control Overview](/images/2.png)
22+
23+
### Abstraction of the physical process
24+
The "Physical Process" is drawn in the shape of a cloud to indicate that the process may be run as a simulation. In this scenario, the PLC's inputs and outputs are directed towards a simulator in place of actual hardware (i.e. solenoid valves and photoelectric sensors). However, from PLC's perspective, there need not be any alteration to the inputs, outputs, or logic if the process is being simulated.
25+
26+
## Implementation of the Simulator
27+
28+
### Hardware
29+
The simulator's hardware consists of a [P1AM-100](https://www.automationdirect.com/open-source/home) Arduino-based CPU, I/O modules, and a bus of WS2812B addressable LEDs to indicate the current state of the tank, valves, and limit sensors. Additionally, a push-button allows the simulation to be reset.
30+
31+
![Simulator hardware](/images/3.png)
32+
33+
#### LED bus
34+
Currently, the LED bus consists of 26 LEDs. The first 21 are used to indicate the current fill percentage of the tank by illuminating the appropriate number of LEDs in the series. For example, if the tank is 55% full, then 12 out of 21 will be illuminated (⌈0.55 * 21⌉ = 12). The remaining LEDs are used as discrete state indicators for the valves and limit sensors.
35+
36+
![LED layout](/images/4.png)
37+
38+
#### Display panel
39+
The simulator along with the PLC interacting with it is integrated into a Pelican case. The upper panel of the case will illustrate the physical hardware components being simulated, and the LEDs will display the current state of each component.
40+
41+
### Software
42+
This repository contains the Arduino sketch powering the simulator. The following flow diagram provides a high-level overview of how the program operates:
43+
44+
![Software flow diagram](/images/5.png)
45+
46+
#### Modeling the physical process
47+
The simulation is modeled to reflect the physical process as closely as possible; constants are used to define physical characteristics such as the dimensions of the cylindrical tank, how long it should tank to fill and empty the tank, and the vertical height at which the limit sensors are mounted. From these constants, additional values are calculated such as the volume inside the tank and the flow rates required to achieve the desired fill and drain times.
48+
49+
The simulation could be made more realistic by accounting for the following variables which may be present in the equivalent physical process.
50+
- Flowrate variation: the rate at which liquid enters or exits the tank may not be constant.
51+
- Valve latency: when the PLC orders a valve to open or close, it takes time for the valve to respond mechanically; during this time, liquid may flow at a reduced rate or not at all.
52+
53+
#### Class structure
54+
The program is structured into two key components to provide a level of abstraction between the simulation and how it is controlled and presented:
55+
56+
##### `Process`
57+
Where the actual simulation is performed; it holds an internal representation of the simulation state (i.e. the volume of liquid in the tank), and provides an interface to set the simulation inputs, calculate the new state, and read the updated state.
58+
59+
##### `ProcessIO`
60+
Responsible for interfacing the simulation with the outside world. It reads the inputs from the PLC (i.e. valve state), passes them to `Process`, and receives back the new state. That new state is written to the LED indicators via the `LEDBus` helper class.
61+
62+
#### Dependencies
63+
64+
- [P1AM](https://github.com/facts-engineering/P1AM): provides a high-level interface to features specific to the P1AM-100 CPU and compatible IO modules.
65+
- [FastLED](https://fastled.io): a popular Arduino library for controlling addressable RGB LEDs. A series of LEDs is modeled in-memory as an array in which each element represents the RGB value of an individual LED. These RGB values are written over the LED's data bus by calling a write method.
66+

images/1.png

62.4 KB
Loading

images/2.png

66.1 KB
Loading

images/3.png

120 KB
Loading

images/4.png

15.2 KB
Loading

images/5.png

179 KB
Loading

0 commit comments

Comments
 (0)