-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efca003
commit d321ddf
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import json | ||
from its_preselector.controlbyweb_web_relay import ControlByWebWebRelay | ||
from its_preselector.web_relay_preselector import WebRelayPreselector | ||
|
||
sensor_definition_file = "/opt/scos-sensor/configs/sensor_definition.json" | ||
preselector_json_file = "/opt/scos-sensor/configs/preselector_config.json" | ||
spu_relay_json_file = "/opt/scos-sensor/configs/switches/x410_config.json" | ||
|
||
# Load Preselector | ||
with open(sensor_definition_file, "r") as f: | ||
sensor_definition_json = json.load(f) | ||
with open(preselector_json_file, "r") as f: | ||
preselector_json = json.load(f) | ||
preselector = WebRelayPreselector(sensor_definition_json, preselector_json) | ||
|
||
# Load SPU Relay | ||
with open(spu_relay_json_file, "r") as f: | ||
spu_json = json.load(f) | ||
spu_relay = ControlByWebWebRelay(spu_json) | ||
|
||
# Enable Preselector Power | ||
spu_relay.set_state("power_on_preselector") | ||
|
||
# Set Preselector to Antenna State | ||
preselector.set_state("antenna") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import json | ||
from its_preselector.controlbyweb_web_relay import ControlByWebWebRelay | ||
from its_preselector.web_relay_preselector import WebRelayPreselector | ||
|
||
sensor_definition_file = "/opt/scos-sensor/configs/sensor_definition.json" | ||
preselector_json_file = "/opt/scos-sensor/configs/preselector_config.json" | ||
spu_relay_json_file = "/opt/scos-sensor/configs/switches/x410_config.json" | ||
|
||
# Load Preselector | ||
with open(sensor_definition_file, "r") as f: | ||
sensor_definition_json = json.load(f) | ||
with open(preselector_json_file, "r") as f: | ||
preselector_json = json.load(f) | ||
preselector = WebRelayPreselector(sensor_definition_json, preselector_json) | ||
|
||
# Load SPU Relay | ||
with open(spu_relay_json_file, "r") as f: | ||
spu_json = json.load(f) | ||
spu_relay = ControlByWebWebRelay(spu_json) | ||
|
||
# Set Preselector to Noise Diode Off State | ||
preselector.set_state("noise_diode_off") | ||
|
||
# Disable Preselector Power | ||
spu_relay.set_state("power_off_preselector") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
# Usage: | ||
# - Activate a Python environment with the its_preselector | ||
# package installed | ||
# - Run this script with start and stop times for input | ||
# protection specified as command line arguments. | ||
|
||
# Example: Enable input protection from 10:00 to 12:00 | ||
# > sudo bash | ||
# > cd /opt/scos-sensor | ||
# > venv/bin/activate | ||
# > pip install git+https://github.com/NTIA/Preselector | ||
# > bash scripts/input_protection.sh 10:00 12:00 | ||
|
||
# This script sets the preselector state to "noise_diode_off" | ||
# then powers off the preselector, at START_TIME | ||
# Then, at STOP_TIME, the preselector is powered on and set to | ||
# the "antenna" state. | ||
|
||
|
||
START_TIME=$1 | ||
STOP_TIME=$2 | ||
|
||
SCRIPT_DIR=$(dirname "$0") | ||
|
||
echo "python3 $SCRIPT_DIR/_input_protection_enable.py" | at $START_TIME | ||
|
||
echo "python3 $SCRIPT_DIR/_input_protection_disable.py" | at $STOP_TIME |