示例#1
0
 def run(self, ds, ps):
     accum = self.__response['accum'].array()
     signal = self.__base.state_vectors()[0]['voltage'].array()
     p = self.__pid['P'].array() * signal
     i = self.__pid['I'].array() * signal + accum
     self.__response['voltage'] = ae.Value(i + p, 3)
     self.__response['accum'] = ae.Value(i, 13)
     log.critical('signal %f', signal)
     log.critical('accum %f', self.__response['accum'].array())
     log.critical('voltage %f', self.__response['voltage'].array())
     ds.update()
     return
示例#2
0
 def __init__(self):
     dawgie.Algorithm.__init__(self)
     self.__base = SummingNode()
     self.__pid = StateVector('law', {
         'P': ae.Value(0.5, 2),
         'I': ae.Value(0.3, 2),
         'D': ae.Value(0, 2)
     })
     self.__response = StateVector('response', {
         'accum': ae.Value(0, 13),
         'voltage': ae.Value(0, 3)
     })
     self._version_ = dawgie.VERSION(1, 0, 0)
     return
示例#3
0
 def __init__(self):
     dawgie.Algorithm.__init__(self)
     self.__cmd = Command()
     self.__err = Sensor()
     self.__sum = StateVector('total', {'voltage': ae.Value(10, 6)})
     self._version_ = dawgie.VERSION(1, 0, 0)
     return
示例#4
0
 def run(self, ds, ps):
     correction = self.__base.state_vectors()[0]['voltage'].array()
     state = self.__model['value'].array()
     output = int((correction + state) * 10) / 10.0
     self.__model['value'] = ae.Value(output, [correction, state])
     log.critical('reaction %f', self.__model['value'].array())
     ds.update()
     return
示例#5
0
 def run(self, ds, ps):
     self.__sum['voltage'] = ae.Value(
         self.__cmd.state_vectors()[0]['voltage'].array() +
         self.__err.state_vectors()[0]['voltage'].array(),
         self.__err.state_vectors()[0]['voltage'].uid())
     log.critical('Sum of error and command: %f',
                  self.__sum['voltage'].array())
     ds.update()
     return
示例#6
0
文件: bot.py 项目: al-niessner/DAWGIE
 def run(self, aspects):
     # pylint: disable=protected-access
     self.__noise['image'] = ae.Value((numpy.random.rand (4000,4000)-.5)*.1)
     fid,tn = tempfile.mkstemp()
     os.close (fid)
     os.unlink (tn)
     dawgie.db.connect (Engine(), aspects.ds()._bot(), tn).load()
     aspects.ds().update()
     return
示例#7
0
 def run(self, ds, ps):
     image = self.__base.sv_as_dict()['test']['image'].array()
     p = [750, 0, 500, 0]
     res = scipy.optimize.minimize(Engine._opt,
                                   p, (image, ),
                                   bounds=[(100, 1000), (-3.2, 3.2),
                                           (100, 1000), (-3.2, 3.2)])
     log.critical('Coefficients: ' + str(res.x))
     self.__clean['image'] = ae.Value(Engine._model(res.x, image.shape))
     ds.update()
     return
示例#8
0
 def run (self, ds, ps):
     base = self.__base.sv_as_dict()['test']['image'].array()
     dirt = self.__noise.sv_as_dict()['test']['image'].array()
     for _i in range (10):
         fid,fn = tempfile.mkstemp()
         os.close (fid)
         with open (fn, 'bw') as f: pickle.dump (base, f)
         os.unlink (fn)
         pass
     self.__dirty['image'] = ae.Value(array=base+dirt)
     ds.update()
     return
示例#9
0
文件: bot.py 项目: al-niessner/DAWGIE
 def run (self, ds, ps):
     shape = self.__base.sv_as_dict()['test']['image'].array().shape
     image = numpy.empty (shape)
     for r in range (shape[0]):
         for c in range (shape[1]):
             image[r,c] = numpy.sin(r/700) * numpy.cos(c/500 - numpy.pi/4)
             pass
         pass
     url = "https://github.com/OpenExoplanetCatalogue/oec_gzip/raw/master/systems.xml.gz"
     urllib.request.urlopen (url).read()
     self.__image['image'] = ae.Value(image)
     ds.update()
     return
示例#10
0
 def run(self, ds, ps):
     self.__command['voltage'] = ae.Value(10, 1)
     ds.update()
     return
示例#11
0
 def __init__(self):
     dawgie.Algorithm.__init__(self)
     self.__command = StateVector('request', {'voltage': ae.Value(0, 1)})
     self._version_ = dawgie.VERSION(1, 0, 0)
     return
示例#12
0
 def run(self, ds, ps):
     self.__output['voltage'] = ae.Value(
         self.__base.state_vectors()[0]['value'].array(), 7)
     log.critical('final reaction %f', self.__output['voltage'].array())
     ds.update()
     return
示例#13
0
 def run(self, aspects):
     self.__data['image'] = ae.Value('looks good')
     aspects.ds().update()
     return
示例#14
0
 def run(self, ds, ps):
     state = self.__model.state_vectors()[0]['value']
     self.__sensed['voltage'] = ae.Value(-state.array(), state.uid())
     ds.update()
     return
示例#15
0
 def __init__(self):
     dawgie.Algorithm.__init__(self)
     self.__model = Model(False)
     self.__sensed = StateVector('measured', {'voltage': ae.Value(0, 5)})
     self._version_ = dawgie.VERSION(1, 0, 0)
     return
示例#16
0
 def __init__(self, ff=True):
     dawgie.Algorithm.__init__(self)
     self.__base = Control() if ff else None
     self.__model = StateVector('voltage', {'value': ae.Value(0, 4)})
     self._version_ = dawgie.VERSION(1, 0, 0)
     return
示例#17
0
 def __init__(self):
     dawgie.Algorithm.__init__(self)
     self.__base = Model()
     self.__output = StateVector('actual', {'voltage': ae.Value(10, 7)})
     self._version_ = dawgie.VERSION(1, 0, 0)
     return
示例#18
0
 def run(self, ps, timeline):
     self.__data['image'] = ae.Value('history is always forgotten')
     timeline.ds().update()
     return