Exemplo n.º 1
0
 def variable_test(self):
     temp = Variable(self, "temperature", 0, float, "celcius", 0, "db")
     tempSensor = Sensor(type="Sensor",
                         name="temperature sensor",
                         tool="testTool")
     temp.attach_sensor(tempSensor)
     self.tempSensor = tempSensor
     self.testElement = temp
Exemplo n.º 2
0
    def elementsandVarsTest2(self):
        """test method, for experimental composition of nodes: this creates all the elements for a basic 
        reprap type node"""
        """CARTESIAN BOT DEFINITION"""
        cartesianBot = NodeComponent("cartesian_bot", self.rootElement)
        """3d Position"""
        pos = Variable(self, "3d_position", Vector(['x', 'y',
                                                    'z']), "vector", "mm",
                       None, "memory", 3, True, None, None, ['x', 'y', 'z'])
        """all the motors/actors controlling the 3d Position"""
        mot1 = Actor(type="StepperMotor",
                     name="x_motor",
                     tool="cartesianBot",
                     boundVariable=pos,
                     variableChannel='x')
        mot2 = Actor(type="StepperMotor",
                     name="y_motor",
                     tool="cartesianBot",
                     boundVariable=pos,
                     variableChannel='y')
        mot3 = Actor(type="StepperMotor",
                     name="z_motor",
                     tool="cartesianBot",
                     boundVariable=pos,
                     variableChannel='z')
        """all the sensors giving feedback on  the 3d Position"""
        endStop1 = Sensor(type="end_sensor",
                          name="x_startSensor",
                          tool="cartesianBot",
                          boundVariable=pos,
                          variableChannel='x')
        endStop2 = Sensor(type="end_sensor",
                          name="x_endSensor",
                          tool="cartesianBot",
                          boundVariable=pos,
                          variableChannel='x')
        endStop3 = Sensor(type="end_sensor",
                          name="y_startSensor",
                          tool="cartesianBot",
                          boundVariable=pos,
                          variableChannel='y')
        endStop4 = Sensor(type="end_sensor",
                          name="y_endSensor",
                          tool="cartesianBot",
                          boundVariable=pos,
                          variableChannel='y')
        endStop5 = Sensor(type="end_sensor",
                          name="z_startSensor",
                          tool="cartesianBot",
                          boundVariable=pos,
                          variableChannel='z')
        endStop6 = Sensor(type="end_sensor",
                          name="z_endSensor",
                          tool="cartesianBot",
                          boundVariable=pos,
                          variableChannel='z')
        """add all these to the current tool"""
        cartesianBot.add_child(pos)
        cartesianBot.add_children([
            mot1, mot2, mot3, endStop1, endStop2, endStop3, endStop4, endStop5,
            endStop6
        ])
        """EXTRUDER 1 DEFINITION"""
        """two variables"""
        extruder1 = Tool("extruder1")
        head_temp = Variable(self, "head_temp", 0, "temperature", "celcius")
        extrudate_lng = Variable(self, "filament_extrudate", Vector(['e']),
                                 "vector", "mm")
        """all the actors controlling the extrusion of this print head"""
        extrudMot = Actor(type="StepperMotor",
                          name="e_motor1",
                          tool="PrintHead",
                          boundVariable=extrudate_lng,
                          variableChannel='e')
        head_heater = Actor(type="Heater",
                            name="extruder1_heater",
                            tool="PrintHead",
                            boundVariable=head_temp)
        """all the sensors giving feedback on the extrusion of this print head"""
        head_tempSensor = Sensor(type="temperature_sensor",
                                 name="extruder1_temp_sensor",
                                 tool="PrintHead",
                                 boundVariable=head_temp)

        extrudate_lng.attach_actor(extrudMot, 'e')
        head_temp.attach_both([(head_heater, None)], [(head_tempSensor, None)])
        """EXTRUDER 2 DEFINITION"""
        """two variables"""
        extruder2 = Tool("extruder2")
        head_temp2 = Variable(self, "head_temp", 0, "temperature", "celcius")
        extrudate_lng2 = Variable(self, "filament_extrudate", Vector(['e']),
                                  "vector", "mm")
        """all the actors controlling the extrusion of this print head"""
        extrudMot2 = Actor(type="StepperMotor",
                           name="e_motor1",
                           tool="PrintHead",
                           boundVariable=extrudate_lng2,
                           variableChannel='e')
        head_heater2 = Actor(type="Heater",
                             name="extruder1_heater",
                             tool="PrintHead",
                             boundVariable=head_temp2)
        """all the sensors giving feedback on the extrusion of this print head"""
        head_tempSensor = Sensor(type="temperature_sensor",
                                 name="extruder1_temp_sensor",
                                 tool="PrintHead",
                                 boundVariable=head_temp2)

        extrudate_lng2.attach_actor(extrudMot2, 'e')
        head_temp2.attach_both([(head_heater2, None)],
                               [(head_tempSensor2, None)])
        """""" """""" """""" """""" """""" ""
        cartesianBot.add_child(extruder1)
        cartesianBot.add_child(extruder2)