Example #1
0
# try:
#     import GPSwavesC
# except Exception as e:
#     logger.info('error importing GPSwavesC')
#     logger.info(e)

# Change to Importing Python GPSwaves
try:
    from GPSwaves import GPSwaves
except Exception as e:
    logger.info('error importing GPSwaves.py')
    logger.info(e)
    
#load config file and get parameters
configFilename = sys.argv[1] #Load config file/parameters needed
config = Config() # Create object and load file
ok = config.loadFile( configFilename )
if( not ok ):
    logger.info ('Error loading config file: "%s"' % configFilename)
    sys.exit(1)

dataDir = config.getString('System', 'dataDir')
floatID = os.uname()[1]
sensor_type = config.getInt('System', 'sensorType')
badValue = config.getInt('System', 'badValue')
port = config.getInt('System', 'port')
payload_type = config.getInt('System', 'payloadType')
burst_seconds = config.getInt('System', 'burst_seconds')        
gps_freq = config.getInt('GPS', 'GPS_frequency') #currently not used, hardcoded at 4 Hz (see init_gps function)

Example #2
0
from logging import *
from time import sleep

#third party imports
import RPi.GPIO as GPIO

#my imports
from config3 import Config
import adafruit_fxos8700_microSWIFT
import adafruit_fxas21002c_microSWIFT

#---------------------------------------------------------------
configDat = sys.argv[1]
configFilename = configDat  #Load config file/parameters needed

config = Config()  # Create object and load file
ok = config.loadFile(configFilename)
if (not ok):
    sys.exit(0)

#set up logging
logDir = config.getString('Loggers', 'logDir')
LOG_LEVEL = config.getString('Loggers', 'DefaultLogLevel')
#format log messages (example: 2020-11-23 14:31:00,578, recordIMU - info - this is a log message)
#NOTE: TIME IS SYSTEM TIME
LOG_FORMAT = ('%(asctime)s, %(filename)s - [%(levelname)s] - %(message)s')
#log file name (example: home/pi/microSWIFT/recordIMU_23Nov2020.log)
LOG_FILE = (logDir + '/' + 'recordIMU' + '_' +
            datetime.strftime(datetime.now(), '%d%b%Y') + '.log')
logger = getLogger('system_logger')
logger.setLevel(LOG_LEVEL)
Example #3
0
#third party imports
import RPi.GPIO as GPIO
import adafruit_fxos8700
import adafruit_fxas21002c

#my imports
from config3 import Config
from utils import *

#initialize gpio pin 21 as modem on/off control
GPIO.setmode(GPIO.BCM)
#---------------------------------------------------------------
configDat = sys.argv[1]
configFilename = configDat  #Load config file/parameters needed

config = Config()  # Create object and load file
ok = config.loadFile(configFilename)
if (not ok):
    sys.exit(0)

#set parameters
burstInterval = config.getInt('Iridium', 'burstInt')
burstNum = config.getInt('Iridium', 'burstNum')
dataDir = config.getString('LogLocation', 'dataDir')
logDir = config.getString('LogLocation', 'logDir')
floatID = config.getString('System', 'floatID')
bad = config.getInt('System', 'badValue')
projectName = config.getString('System', 'projectName')

imuFreq = config.getInt('IMU', 'imuFreq')
numSamplesConst = config.getInt('System', 'numSamplesConst')
Example #4
0
from struct import *
from logging import *
from datetime import datetime
import time as t
import RPi.GPIO as GPIO
import pynmea2
import struct
from time import sleep

#my imports
from config3 import Config
import process_data

#load config file and get parameters
configFilename = sys.argv[1]  #Load config file/parameters needed
config = Config()  # Create object and load file
ok = config.loadFile(configFilename)
if (not ok):
    logger.info('Error loading config file: "%s"' % configFilename)
    sys.exit(1)

#system parameters
dataDir = config.getString('System', 'dataDir')
floatID = os.uname()[1]
#floatID = config.getString('System', 'floatID')
sensor_type = config.getInt('System', 'sensorType')
badValue = config.getInt('System', 'badValue')
numCoef = config.getInt('System', 'numCoef')
port = config.getInt('System', 'port')
payload_type = config.getInt('System', 'payloadType')
burst_seconds = config.getInt('System', 'burst_seconds')
Example #5
0
import logging

# my imports
from config3 import Config
from utils import *

GPIO.setwarnings(False)  #no GPIO warning
#=============================================================================
#Load config file
configDat = sys.argv[1]

#sample to prime in command line when ran
primeValve = int(sys.argv[2])

configFilename = configDat  #Load config file/parameters needed
config = Config()  # Create object and load file
ok = config.loadFile(configFilename)
if (not ok):
    sys.exit(0)

#PRIME
runTime = config.getInt('Prime', 'RunTime')

#MOTOR
waterPump = config.getInt('Motor', 'sampleMotor')
soluPump = config.getInt('Motor', 'ethanolMotor')
sampleMotorHz = config.getInt('Motor', 'sampleMotorHz')

#VALVES
valve1En = config.getInt('Valves', 'Valve1En')
valve1 = config.getInt('Valves', 'Valve1')
Example #6
0
from datetime import datetime
import numpy as np
import logging
from logging import *

# Import SPI library (for hardware SPI) and MCP3008 library.
import Adafruit_GPIO.SPI as SPI
import Adafruit_MCP3008

#my imports
from config3 import Config
#---------------------------------------------------------------
configDat = sys.argv[1]
configFilename = configDat #Load config file/parameters needed

config = Config() # Create object and load file
ok = config.loadFile( configFilename )
if( not ok ):
    sys.exit(0)

#set up logging
logDir = config.getString('Loggers', 'logDir')
LOG_LEVEL = config.getString('Loggers', 'DefaultLogLevel')
#format log messages (example: 2020-11-23 14:31:00,578, recordTemp - info - this is a log message)
#NOTE: TIME IS SYSTEM TIME
LOG_FORMAT = ('%(asctime)s, %(filename)s - [%(levelname)s] - %(message)s')
#log file name (example: home/pi/microSWIFT/recordGPS_23Nov2020.log)
LOG_FILE = (logDir + '/' + 'recordTemp' + '_' + datetime.strftime(datetime.now(), '%d%b%Y') + '.log')
logger = getLogger('system_logger')
logger.setLevel(LOG_LEVEL)
logFileHandler = FileHandler(LOG_FILE)
Example #7
0
import Adafruit_ADS1x15 #ADC for pressure

# my imports
from utils import *
from config3 import Config
from ednaClass import *
import logging

# initialize GPIO
GPIO.setwarnings(False) #no GPIO warning
GPIO.setmode(GPIO.BCM)  #pin number
#--------------------------------------------------------------------
#Load config file 
configDat =  sys.argv[1]
configFilename = configDat #Load config file/parameters needed
config = Config() # Create object and load file
ok = config.loadFile( configFilename )
if( not ok ):
	sys.exit(0)

#Initialize parameters 
#PARAMS
logDir = config.getString('System', 'LogDir')
adcAddr = config.getString('Params', 'ADCAddr')
adcBus = config.getString('Params', 'ADCBus')

#FLOW
flowGPIO = config.getInt('FlowSensor', 'Flow')

#LED
ledGPIO = config.getInt('LED', 'ledGPIO')
Example #8
0
#from logging import *
import struct
import numpy as np
import time
from datetime import datetime
from logging import *
import RPi.GPIO as GPIO
from time import sleep

import logging

from config3 import Config

#load config file and get parameters
configFilename = sys.argv[1]  #Load config file/parameters needed
config = Config()  # Create object and load file
ok = config.loadFile(configFilename)
if (not ok):
    logger.info('Error loading config file: "%s"' % configFilename)
    sys.exit(1)

burst_seconds = config.getInt('System', 'burst_seconds')
burst_time = config.getInt('System', 'burst_time')
burst_int = config.getInt('System', 'burst_interval')
call_int = config.getInt('Iridium', 'call_interval')
call_time = config.getInt('Iridium', 'call_time')

call_duration = burst_int * 60 - burst_seconds  #time between burst end and burst start to make a call

#Iridium parameters - fixed for now
modemPort = '/dev/ttyUSB0'  #config.getString('Iridium', 'port')
Example #9
0
import logging
from logging import *

#third party imports
from ina219 import INA219
from ina219 import DeviceRangeError

#my imports
from config3 import Config
from utils import *

##########################################################################
#Load config file
configDat = sys.argv[1]
configFilename = configDat  #Load config file/parameters needed
config = Config()  # Create object and load file
ok = config.loadFile(configFilename)
if (not ok):
    sys.exit(0)

#voltage parameters
voltFreq = config.getInt('Voltage', 'voltFreq')
numSamplesConst = config.getInt('System', 'numSamplesConst')
voltNumSamples = voltFreq * numSamplesConst
shuntOhms = config.getFloat('Voltage', 'shuntOhms')
maxExpectedAmps = config.getFloat('Voltage', 'maxExpectedAmps')

#when to record accoring to burst int
burstInterval = config.getInt('Iridium', 'burstInt')
burstNum = config.getInt('Iridium', 'burstNum')