def add_aggregator(self, sensor_list=[]):
     new_aggregator = run_agent("aggregator_" +
                                str(self.get_numAggregators()),
                                base=Aggregator)
     self.aggregator_list.append(new_aggregator)
     new_aggregator.bind_sensors(sensor_list)
     return new_aggregator
    def add_simsensor(
        self,
        type="force",
        unit_v="N",
        unit_t=datetime.now(),
        id=" ",
        generator="",
        dataset="",
    ):
        # if sensor_id is not provided by user, then resort to generic names
        if id == " ":
            sensor_id = "sensor_" + type + "_" + str(self.get_numSensors())
        else:
            sensor_id = id
        new_sensor = run_agent(sensor_id, base=Sensor)
        new_sensor.set_attr(type=type, unit_v=unit_v, unit_t=unit_t, id=sensor_id)

        if generator != "":
            new_sensor.set_generator(generator)
        if dataset != "":
            new_sensor.set_generatorDataSet(dataset)

        self.sensor_list.append(new_sensor)
        self.log_info("sensor added generator function")
        return new_sensor
 def add_decisionMaker(self, predictor=""):
     new_decisionMaker = run_agent(
         "decisionMaker_" + str(self.get_numDecisionMaker()), base=DecisionMaker
     )
     self.decisionMaker_list.append(new_decisionMaker)
     if predictor != "":
         new_decisionMaker.bind_predictor(predictor)
     return new_decisionMaker
 def add_predictor(self, aggregator=""):
     new_predictor = run_agent(
         "predictor_" + str(self.get_numPredictors()), base=Predictor
     )
     self.predictor_list.append(new_predictor)
     if aggregator != "":
         new_predictor.bind_aggregator(aggregator)
     return new_predictor
# In[3]:


if __name__ == '__main__':
	ns = osbrain.nameserver.run_nameserver(addr='127.0.0.1:14065')


	# ## Creating Agent
	# 
	# We firstly create a SensorNetwork Agent which enable wrapper functions and manages agents
	# 

	# In[4]:


	sensor_network = run_agent('sensor_network', base=SensorNetwork)


	# ## Sensor Agents
	# 
	# 1. Next, we create a Sensor Agent by `sensor_network.addsimsensor(type,unit)`, and store into a list `sensors`. 
	# 2. We set the data source of the Sensor Agent : `sensor_new.set_generatorDataSet(dataSet)` where dataSet is a 3-dimensional numpy array with: [Row x Sequence Length x Sensor]

	# In[5]:


	#add sensors
	sensors=[]
	sensorTypes = ["Temperature","Temperature","Temperature","Temperature","Vibration","EfficiencyFactor","VolumeFlow","VolumeFlow","Pressure","Pressure","Pressure","Pressure","Pressure","Pressure","MotorPower","CoolingEfficiency","CoolingPower"]
	sensorUnits = ["C","C","C","C","mm/s","%","l/min","l/min","bar","bar","bar","bar","bar","bar","W","%","kW"]
    x = 0.3 * t - 1
    unc_x = 0.01
    return x, unc_x


def gen2(t=0):
    x = 10 * t - 5
    unc_x = 0.05
    return x, unc_x


if __name__ == "__main__":
    # SYSTEM INITIALIZE
    ns = osbrain.nameserver.run_nameserver(addr="127.0.0.1:14065")

    sensor_network = run_agent("sensor_network", base=SensorNetwork)

    # add sensors
    sensor1 = sensor_network.add_simsensor(generator=gen1,
                                           type="force",
                                           unit_v="N",
                                           id="sensor_force1")
    sensor2 = sensor_network.add_simsensor(generator=gen2,
                                           type="temperature",
                                           unit_v="F",
                                           id="sensor_temp1")
    sensor3 = sensor_network.add_simsensor(generator=gen2,
                                           type="speed",
                                           unit_v="ms-1",
                                           id="sensor_speed1")
    sensor4 = sensor_network.add_simsensor(generator=gen1,