Skip to content

Commit f680491

Browse files
committed
Update README
1 parent 1c7b28b commit f680491

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

README.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Process Simulator Basic
1+
# Arduino Process Simulator
22

33
## Hardware Overview
44

5-
<img align="center" width="200" src="/images/1.png">
6-
5+
<img align="center" width="200" src="images/1.png">
6+
77
The simulator defined in this repository models a process consisting of the following physical components:
88

99
| Component | Description |
@@ -13,57 +13,69 @@
1313
| Drain valve | A secondary, electronically controlled valve that can be opened to allow gravity to drain the liquid in the tank. |
1414
| High limit | A sensor mounted near the top of the tank used to detect when the liquid is at or above that height. |
1515
| Low limit | A sensor mounted near the bottom of the tank used to detect when the liquid is at or above that height. |
16-
16+
1717
### Potential application
18+
1819
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.
1920

2021
## Control Overview
22+
2123
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.
2224

2325
<p align="center">
24-
<img width="600" src="/images/2.png">
26+
<img width="600" src="images/2.png">
2527
</p>
2628

2729
### Abstraction of the physical process
30+
2831
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.
2932

3033
## Implementation of the Simulator
3134

3235
### Hardware
36+
3337
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](https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf) addressable LEDs to indicate the current state of the tank, valves, and limit sensors. Additionally, a push-button allows the simulation to be reset.
3438

3539
<p align="center">
36-
<img width="800" src="/images/3.png">
40+
<img width="800" src="images/3.png">
3741
</p>
3842

3943
#### LED bus
44+
4045
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.
4146

4247
![LED layout](/images/4.png)
4348

4449
#### Display panel
50+
4551
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.
52+
4653
### Software
54+
4755
This repository contains the Arduino sketch powering the simulator. The following flow diagram provides a high-level overview of how the program operates:
4856

4957
<p align="center">
50-
<img width="600" src="/images/5.png">
58+
<img width="600" src="images/5.png">
5159
</p>
5260

5361
#### Modeling the physical process
62+
5463
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.
5564

5665
The simulation could be made more realistic by accounting for the following variables which may be present in the equivalent physical process.
5766
- Flowrate variation: the rate at which liquid enters or exits the tank may not be constant.
5867
- 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.
5968

6069
#### Class structure
70+
6171
The program is structured into two key components to provide a level of abstraction between the simulation and how it is controlled and presented:
6272

6373
##### `Process`
74+
6475
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.
6576

6677
##### `ProcessIO`
78+
6779
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 then passed to the outside world; the LEDs and the discrete outputs read by the PLC are updated.
6880

6981
#### Dependencies
@@ -72,14 +84,19 @@ Responsible for interfacing the simulation with the outside world; it reads the
7284
- [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.
7385

7486
## Build Procedure
87+
7588
In the [Arduino IDE](https://www.arduino.cc/en/software), select "Manage Libraries," search for each dependency listed above, and press install if required. Next, under settings, add the following URL in the "Additional Board Manager URLs" field:
89+
7690
```
7791
https://raw.githubusercontent.com/facts-engineering/facts-engineering.github.io/master/package_productivity-P1AM-boardmanagermodule_index.json
7892
```
93+
7994
With this URL added, select "Boards Manager" and install the board definition for "P1AM-100." With the CPU attached via USB and the apporiate serial port selected, the sketch can now be built and uploaded.
8095

8196
## Unresolved Issues
97+
8298
- The circuitry within the P1AM-GPIO module distorts the signal sent over the LED data bus—this results in the LEDs behaving erratically. The current workaround is remove the module and interface with the GPIO directly.
8399

84100
## Links
101+
85102
- [P1AM Documentation](https://facts-engineering.github.io): includes FAQs, a module configuration tool, and API reference.

0 commit comments

Comments
 (0)