aboutsummaryrefslogtreecommitdiff
path: root/behaviors
diff options
context:
space:
mode:
authorGravatar eugue <eug.sun@gmail.com>2011-01-27 20:27:12 -0500
committerGravatar eugue <eug.sun@gmail.com>2011-01-27 20:27:12 -0500
commit6341992254c837b1d814b3eaa24b2ab3e729c8e2 (patch)
tree4cdf2f65e7a5b1d0a4be0f667754e73053af8493 /behaviors
parentf103e47da5d563d1b8448bc021676ed7db0f529d (diff)
Added HTMLInput, SmootWind behavior, and a config file for testing.
Diffstat (limited to 'behaviors')
-rwxr-xr-xbehaviors/SmootWind.py32
-rw-r--r--behaviors/XYMove.py2
2 files changed, 33 insertions, 1 deletions
diff --git a/behaviors/SmootWind.py b/behaviors/SmootWind.py
new file mode 100755
index 0000000..bf05ab2
--- /dev/null
+++ b/behaviors/SmootWind.py
@@ -0,0 +1,32 @@
+from operationscore.Behavior import *
+import util.ComponentRegistry as compReg
+
+class SmootWind(Behavior):
+ def behaviorInit(self):
+ self.mapper = None
+ self.xFor = None
+
+ def processResponse(self, sensorInputs, recursiveInputs):
+ if self.mapper == None:
+ try:
+ self.mapper = compReg.getComponent('windgaussmap')
+ except KeyError:
+ pass
+ if self.xFor == None:
+ try:
+ self.xFor = compReg.getComponent('xfor')
+ except KeyError:
+ pass
+
+ for sensory in sensorInputs:
+ #print sensory
+ # input[0] is windspeed, [1] is dir
+ windSpeed = sensory[0]
+ windDir = sensory[1]
+
+ #print self.mapper.argDict
+ self.mapper.argDict['Width'] = float(windSpeed) ** 3
+ self.xFor.argDict['ParamOp'] = float(windSpeed) ** 2
+ #print 'Width: ' + str(self.mapper.argDict['Width'])
+ #print 'xFor: ' + str(self.xFor.argDict['ParamOp'])
+ return (sensorInputs, recursiveInputs)
diff --git a/behaviors/XYMove.py b/behaviors/XYMove.py
index 0ba3baf..44a93bb 100644
--- a/behaviors/XYMove.py
+++ b/behaviors/XYMove.py
@@ -13,7 +13,7 @@ class XYMove(Behavior):
for loc in sensor:
oploc = dict(loc)
self.insertStepIfMissing(oploc)
- print oploc['YStep']
+ #print oploc['YStep']
oploc['Location'] = Geo.addLocations((oploc['XStep'], oploc['YStep']), oploc['Location'])
ret.append(oploc)
return (ret, [])