Skip to content

Commit 53df587

Browse files
Creates an installable pip package for the program (#27)
- Corrects the examples README and adds USERGUIDE for the package - Updates the poetry.lock - Updates pyproject.toml to create an installable pip package
1 parent 66e00b8 commit 53df587

File tree

6 files changed

+1166
-796
lines changed

6 files changed

+1166
-796
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ poetry install # installs all required python packages
2121
pylint src tests --rcfile=.pylintrc # runs linting checks
2222

2323
poetry build # builds cp-sens package that can be published on pip
24-
poetry run python .\src\examples\example.py oma-and-plot # run an experiment with real data (Needs "production.json" Config)
24+
poetry run python .\src\examples\example.py align-readings # run an experiment with real data (Needs "production.json" Config)
2525
```
2626

2727
The `poetry build` will create a `.whl` file in the `dist/` directory, e.g., `dist/cp_sens-0.1.0-py3-none-any.whl`.

USERGUIDE.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
# User Guide
2+
3+
This guide outlines configuration and execution of the _example-shm_ application. It provides detailed information on the configuration parameters, command-line options, and execution procedures.
4+
5+
## Install
6+
7+
You can install the built package using pip:
8+
9+
```bash
10+
$pip install dist/example_shm-<version>-py3-none-any.whl
11+
```
12+
13+
Replace `<version>` with the actual version number (e.g., `0.5.0`).
14+
15+
## Create Configuration
16+
17+
The package requires a json configuration file and access to MQTT broker.
18+
The format of configuration file is,
19+
20+
```json
21+
{
22+
"MQTT": {
23+
"host": "",
24+
"port": ,
25+
"userId": "",
26+
"password": "",
27+
"ClientID": "NOT_NEEDED",
28+
"QoS": 1,
29+
"TopicsToSubscribe": [
30+
"sensors/1/acc/raw/data",
31+
"sensors/1/acc/raw/metadata",
32+
"sensors/2/acc/raw/data",
33+
"sensors/3/acc/raw/data",
34+
"sensors/4/acc/raw/data"
35+
]
36+
},
37+
38+
"sysID": {
39+
"host": "",
40+
"port": ,
41+
"userId": "",
42+
"password": "",
43+
"ClientID": "NOT_NEEDED",
44+
"QoS": 2,
45+
"TopicsToSubscribe": ["sensors/1/acc/sysid/data"]
46+
},
47+
48+
"mode_cluster": {
49+
"host": "",
50+
"port": ,
51+
"userId": "",
52+
"password": "",
53+
"ClientID": "NOT_NEEDED",
54+
"QoS": 2,
55+
"TopicsToSubscribe": ["sensors/1/acc/mode_cluster/data"]
56+
},
57+
58+
"model_update": {
59+
"host": "",
60+
"port": ,
61+
"userId": "",
62+
"password": "",
63+
"ClientID": "NOT_NEEDED",
64+
"QoS": 2,
65+
"TopicsToSubscribe": ["sensors/1/acc/model_update/data"]
66+
}
67+
}
68+
```
69+
70+
The file needs to be saved. The application looks for configuration in
71+
`config/production.json`.
72+
73+
## Use
74+
75+
Launch the bridge with the default configuration:
76+
77+
```bash
78+
$example-shm
79+
```
80+
81+
The file needs to be saved. The application looks for configuration in
82+
`config/production.json`. A different configuration can be provided by
83+
using
84+
85+
```bash
86+
example-shm --config <config-file>
87+
```
88+
89+
The following experiments can be run using
90+
the package.
91+
92+
### Run Experiments
93+
94+
The following experiments can be run using
95+
the package.
96+
97+
* **acceleration_readings** demonstrates the extraction of
98+
accelerometer measurements from MQTT data stream.
99+
* **aligning_readings** collects and aligns the accelerometer measurements from multiple MQTT data streams.
100+
101+
* **sysid** demonstrates the use of `sys_id` with four cases:
102+
1. **sysid-and-plot**: plots natural frequencies.
103+
1. **sysid-and-print**: prints SysID results to console.
104+
1. **sysid-and-publish**: publishes one set of SysID results via MQTT to the config given under [sysid] config.
105+
1. **live-sysid-and-publish**: Continuously publishes SysID results via MQTT to the config given under [sysid] config.
106+
107+
* **mode-tracking** demonstrates the use of `mode_track` with three cases:
108+
1. **mode-tracking-with-local-sysid**: gets the pyOMA results by runing sysid
109+
locally, then runs the mode track.
110+
1. **mode-tracking-with-remote-sysid**: gets pyOMA results by subscribing,
111+
then runs the mode track. This is a one time operation.
112+
1. **live-mode-tracking-with-remote-sysid**: gets pyOMA results by subscribing,
113+
then runs the mode track. This operation runs in loop.
114+
115+
* **model-update** demonstrates the use of `model_update` with two cases:
116+
1. **model-update-local-sysid**: gets the mode track output, then uses it to
117+
run update model and get updated system parameters.
118+
1. **live-model-update-remote-sysid**: gets the mode track output by subscribing to
119+
MQTT topic, then uses the mode track output to run update model and get updated system parameters.
120+
121+
You can find the available experiments by running the program
122+
123+
```bash
124+
$example-shm
125+
Usage: example-shm [OPTIONS] COMMAND [ARGS]...
126+
127+
Options:
128+
--config TEXT Path to config file
129+
--help Show this message and exit.
130+
131+
Commands:
132+
accelerometers
133+
align-readings
134+
clustering-with-local-sysid
135+
clustering-with-remote-sysid
136+
live-clustering-with-remote-sysid
137+
live-mode-tracking-with-remote-sysid
138+
live-model-update-remote-sysid
139+
live-sysid-publish
140+
mode-tracking-with-local-sysid
141+
mode-tracking-with-remote-sysid
142+
model-update-local-sysid
143+
sysid-and-plot
144+
sysid-and-print
145+
sysid-and-publish
146+
```
147+
148+
To run the examples with the default config (`config/production.json`), use:
149+
150+
```bash
151+
$example-shm
152+
Usage: example-shm accelerometers
153+
```
154+
155+
To run the examples with a custom config, use:
156+
157+
```bash
158+
$example-shm
159+
Usage: example-shm --config <config-file> accelerometers
160+
```

0 commit comments

Comments
 (0)