Skip to content

Commit e4132b1

Browse files
authored
Merge pull request #2 from NET-BYU/fix_mesh
Fix mesh
2 parents d06ea66 + 5481087 commit e4132b1

File tree

3 files changed

+43
-8
lines changed

3 files changed

+43
-8
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,18 @@ Here you will gather the static attenuation values that reside between your send
3838

3939
In the process of transmitting messages from one device to another, you will be trying to measure and control the attenuation between devices. Some of this attenuation will be adjusted automatically by the mesh attenuator. However, the natural properties of the mesh attenuator, RF cabling, and any splitters you are using, will introduce additional static attenuation. How much static attenuation is introduced can vary from one cable to the next, and this variation needs to be controlled for in order to prevent the data from being artificially skewed.
4040

41-
In order for the attenuation values to be equal across receiving devices, you need to take measurements of the total _static attenuation_ between the transmitters and the receivers while the _dynamic attenuation_ is set to 0. To make this easy, you can simply edit and run the following file:
41+
In order for the attenuation values to be equal across receiving devices, you need to take measurements of the total _static attenuation_ between the transmitters and the receivers while the _dynamic attenuation_ is set to 0. To make this easy, you can simply edit and run the following lines:
4242

43-
In `resource/clear_mesh.py`, edit the following line, replacing `192.168.0.1` with the IPv4 ip address of the Mini-Circuits ZTMN-0695B-S.
43+
Run this command after editing the following line, replacing `192.168.0.1` with the IPv4 ip address of the Mini-Circuits ZTMN-0695B-S.
4444
```python
45-
ip_address = '192.168.0.1'
45+
echo ip_address: 192.168.0.1 > resources/mesh_ip.yml
4646
```
47-
then run it using the command
47+
then run the clear_mesh.py file using the command
4848
```bash
4949
python3 resources/clear_mesh.py
5050
```
51+
If the IP address is invalid or does not connect to a mesh attenuator device, the script will fail.
52+
5153
This should set the dynamic attenuation between each and every link to 0. If you have everything hooked up on RF cables, though, you will still get some static attenuation from the RF cables, the mesh, and any splitters you are using. What you need to do is take measurements using something like a spectrum analyzer at the receiving end of _each_ communication endpoint to measure how attenuated the transmitted signal is compared to coming out of the sending device (so record once at the transmitter and again at the end of the line of cables leading to each receiver). Record these static attenuation values for each receiver; we will refer to these as `static_att` measurements later on in this readme.
5254

5355
<details>

resources/clear_mesh.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,45 @@
33
#----------------------------------------------------------------------------
44
# Created By : Bryson Schiel - @schielb (GitHub)
55
# Created Date: Feb 1, 2023
6-
# Latest Update: Feb 15, 2023
7-
# version ='1.0'
6+
# Latest Update: May 26, 2023
7+
# version ='1.1'
88
# ---------------------------------------------------------------------------
99
"""
1010
A python file to clear the Mini-Circuits Mesh Attenuator
1111
"""
1212
# ---------------------------------------------------------------------------
1313

1414
from mesh_class import MeshClass
15+
import sys
16+
from yaml import safe_load
1517

16-
ip_address = '192.168.0.1'
18+
# It is anticipated that this file be run from the cv2x_testing folder as "python3 resources/clear_mesh.py"
19+
with open("./resources/mesh_ip.yml") as f:
20+
yaml_data = safe_load(f)
21+
22+
ip_address = yaml_data["ip_address"]
1723

1824
mesh = MeshClass(ip_address)
1925

2026
port1s = ['A', 'B', 'C', 'D', 'E', 'F']
2127
port2s = ['A', 'B', 'C', 'D', 'E', 'F']
2228

29+
att_to_set = 0
30+
args = sys.argv
31+
32+
if len(args) == 1:
33+
pass
34+
elif len(args) == 2:
35+
if args[1] == "--reset":
36+
att_to_set = 95
37+
else:
38+
print("Error: incorrect arg passed - expecting nothing or '--reset'", file=sys.stderr)
39+
exit(1)
40+
else:
41+
print("Error: too many args passed - expecting nothing or '--reset'", file=sys.stderr)
42+
exit(1)
43+
2344
for port1 in port1s:
2445
for port2 in port2s:
2546
if port1 != port2:
26-
mesh.set_att(port1, port2, 0)
47+
mesh.set_att(port1, port2, att_to_set)

resources/mesh_class.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ def __init__(self, address):
8181
"""
8282
self.address = address
8383

84+
ports = channels["AB"]
85+
block = ports[0]
86+
channel = ports[1]
87+
88+
http = urllib3.PoolManager()
89+
response = http.request(
90+
'GET', f"http://{self.address}/:0{block}:CHAN:{channel}:ATT?")
91+
92+
if response.status != 200:
93+
raise ValueError('Device at %s is not a viable mesh attenuator.' % address)
94+
95+
8496
def set_att(self, port1: str, port2: str, atten: float):
8597
"""
8698
set_att:

0 commit comments

Comments
 (0)