def __init__(self, ground_ip): self.status_vector = dict() self.command_vector = dict() self.ground_ip = ground_ip self.info_logger = InfoLogger() self.data_logger = DataLogger() self.adcs_logger = AdcsLogger() #@TODO where antenna to start #self.adcs_logger.write_info(' {}, {}, {}, {}'.format(0, 0, 0, 0)) self.elink = elinkmanager.ELinkManager(self, self.ground_ip) self.thread_elink = None self.data_manager = DataManager(self, self.info_logger, self.data_logger) self.thread_data_manager = None self.dmc = dmc.DMC(self) self.thread_dmc = None self.heat = heat.HEAT(self) self.thread_heat = None self.adc = adc.ADC(self) self.thread_adc = None self.tx = tx.TX(self) self.thread_tx = None self.counterdown = CounterDown(self) self.paths = paths.Paths() GPIO.setmode(GPIO.BOARD) Master.__instance = self
def __init__(self, ground_ip): self.status_vector = dict() self.command_vector = dict() self.ground_ip = ground_ip self.info_logger = InfoLogger() self.data_logger = DataLogger() self.adcs_logger = AdcsLogger() self.elink = elinkmanager.ELinkManager(self, self.ground_ip) self.thread_elink = None #self.data_manager = DataManager(self, self.info_logger, self.data_logger) #self.thread_data_manager = None self.adc = adc.ADC(self) self.thread_adc = None self.counterdown = CounterDown(self) self.paths = paths.Paths() self.pin_powerB = pins.Pins( ).pin_powerB # @TODO change it in boot/config.txt #GPIO.setmode(GPIO.BOARD) #GPIO.setup(self.pin_powerB, GPIO.OUT) Master.__instance = self
self.windturbine_id = row['windturbine'] self.motor.changespeed(self.wind_speed, self.wing_angle) if self.brake: self.motor.brake() if self.state == 0: self.motor.stop() elif self.state == 1: self.motor.run() GPIO.cleanup() # ADC channel, clock_pin, miso_pin, mosi_pin, cs_pin adc = ADC.ADC(0, 23, 21, 19, 24) # ADC channel, clock_pin, miso_pin, mosi_pin, cs_pin adc2 = ADC.ADC(1, 23, 21, 19, 24) # IR sensor pin ir_sensor = IRSensor.IRSensor(7) # PWM pin, Standby pin, AIN1 pin, PWM Frequincy, Duty motor = Motor.Motor(3,5,11,1000, 0) # Motor, state, brake, wind_speed, wing_angle windturbine = Windturbine(motor, 0, 0, 0.0, 0.0, 0) # Database connection cnx = pymysql.connect(user='******', password='******', host='127.0.0.1', database='control_db') cursor = cnx.cursor(pymysql.cursors.DictCursor) # Windturbine data insertion statement add_data = ("INSERT INTO windturbine_data_windturbinedata (windturbine, timestamp, state, temp_gearbox, temp_generator, rpm_generator, wind_speed) VALUES (%s, %s, %s, %s, %s, %s, %s)")