Beispiel #1
0
def main():
    
    fan_obj = fan.Fan()
    solenoid_obj = solenoid.Solenoid()
    fan_obj.start_fan(0)
    time.sleep(2)
    
    pwm_values = []
    rpm_values = []
    for count in range(29, 61, 15):
        fan_obj.start_fan(count)
        pwm_values.append(count)
        rpm_val = int(rpm.get_rpm()) // 10
        #rpm_values.append(rpm_val)
        print("PWM: {0}\tRPM: {1}".format(count,rpm_val))
    
    #GPIO.cleanup()
    #solenoid_obj.release()
    #graph(pwm_values,rpm_values)
    print("Enter a desired RPM.")
    
    trpm = int(input("Enter a desired RPM."))
    while(1):
        print("works")
        rpm_val = int(rpm.get_rpm()) // 10
        if(trpm > rpm_val):
            count = count + 1
        if(trpm< rpm_val):
            count = count - 1
        else:
            #solenoid_obj.release()
            print("PWM: {0}\tRPM: {1}".format(count,rpm_val))
            print("______EQUAL________")
            #time.sleep(1)
            count = count
            solenoid_obj.block()
            time.sleep(1)
            
            solenoid_obj.release()
            
        fan_obj.start_fan(count)
        print("PWM: {0}\tRPM: {1}".format(count,rpm_val))
        
    GPIO.cleanup()
Beispiel #2
0
def main():
    fan_obj = fan.Fan()
    pid_obj = PID.PID()
    pwm = 64
    
    fan_obj.start_fan(pwm) # Roughly 15,000 RPM @ 9v
    
    while(1):
        pid_obj.setPoint(15000)
        ##print (rpm.get_rpm())
        #print("PWM: {0}\nRPM: {1}\nPV: {2}".format(pv,int(rpm.get_rpm()),pv))
        #time.sleep(1)
        # pv = pid_obj.update(rpm_va l)
        #fan_obj.update_fan(55)
        
        # Initalize sp and collect rpm(4 figures)
        # print("rpm ", rpm_value)
        mv = int((pid_obj.update(int(rpm.get_rpm())))) + 64
        
        fan_obj.start_fan(mv)
        print("PWM: {0}\tRPM: {1}".format(mv,rpm.get_rpm()))
        
    GPIO.cleanup()
Beispiel #3
0
    def __init__(self):
        self.window = globals.my_xml.get_widget('temperatureDialog')

        self.cbEnable = globals.my_xml.get_widget('checkbuttonEnable')
        self.cbEnable.connect('toggled', self.enable_changed, None)

        self.cbOverride = globals.my_xml.get_widget('checkbuttonOverride')
        self.cbOverride.connect('toggled', self.override_changed, None)

        #self.hsIntervalDuration = globals.my_xml.get_widget('hscaleIntervalDuration')
        #self.hsIntervalDuration.connect('value-changed', self.options_changed, None)

        #self.hsIntervalDelay = globals.my_xml.get_widget('hscaleIntervalDelay')
        #self.hsIntervalDelay.connect('value-changed', self.options_changed, None)

        self.hsHysteresis = globals.my_xml.get_widget('hscaleHysteresis')
        self.hsHysteresis.connect('value-changed', self.options_changed, None)

        self.swThermometers = globals.my_xml.get_widget(
            'scrolledwindowThermometers')

        self.vbThermometers = globals.my_xml.get_widget('vboxThermometers')
        self.thermos = []
        for n in range(0, globals.act_settings.get_sensor_count()):
            therm = thermometer.Thermometer()
            therm.sensor_id = n
            therm.dialog_parent = self.window
            therm.set_size_request(self.thermometer_width, therm.wanted_height)
            therm.connect('trigger-changed', self.triggers_changed, n)
            therm.connect('name-changed', self.sensor_name_changed, n)
            self.thermos.append(therm)
            self.vbThermometers.pack_start(therm)

        self.rbCelcius = globals.my_xml.get_widget('radiobuttonCelcius')
        self.rbFahrenheit = globals.my_xml.get_widget('radiobuttonFahrenheit')
        self.rbFahrenheit.set_group(self.rbCelcius)
        self.rbCelcius.connect('toggled', self.temperature_unit_changed, None)

        self.eModel = globals.my_xml.get_widget('entryModel')
        self.eProfile = globals.my_xml.get_widget('entryProfile')
        self.tvProfileComments = globals.my_xml.get_widget(
            'textviewProfileComments')

        self.aFanGraph = globals.my_xml.get_widget('alignmentFanGraph')
        self.fanGraph = fan.Fan(65, 65)
        self.aFanGraph.add(self.fanGraph)
        self.fanGraph.show()
        self.lSpeed = globals.my_xml.get_widget('labelSpeed')
        self.lSpeed.set_size_request(145, -1)

        self.dActionArea = globals.my_xml.get_widget('dialog-action_area')

        self.bAbout = globals.my_xml.get_widget('buttonAbout')
        self.bAbout.connect('clicked', self.about_clicked, None)
        self.dActionArea.set_child_secondary(self.bAbout, True)

        self.bSubmitProfile = globals.my_xml.get_widget('buttonSubmitProfile')
        self.bSubmitProfile.connect('clicked', self.submit_profile_clicked,
                                    None)
        self.dActionArea.set_child_secondary(self.bSubmitProfile, True)
        if not build.profile_submit_enabled:
            self.bSubmitProfile.hide()

        self.bUnlock = globals.my_xml.get_widget('buttonUnlock')
        #self.bUnlock.connect('clicked', self.unlock_clicked, None)
        # TODO: PolicyKit integration once Python binding become available

        self.bClose = globals.my_xml.get_widget('buttonClose')

        self.update_model_info()
        self.update_limits()
        self.refresh_monitor()

        for therm in self.thermos:
            therm.end_animation()

        gobject.timeout_add(5000, self.refresh_monitor)

        # calculate initial size
        width, height = self.window.get_size()
        screen_height = gtk.gdk.screen_height()
        height = min(screen_height - self.reserved_screen_height,
                     self.desired_height)
        self.window.resize(width, height)
Beispiel #4
0
 def __init__(self, config):
     self.config = config
     self.logger = logging.getLogger()
     self.fan_outlet = fan.Fan(config["fan"], self.logger)
     self.line = re.compile(r"([0-9]+\.[0-9]+)\s([01])\s([01])")