@@ -66,9 +66,6 class ProcessingUnit: | |||||
66 | **kwargs : Diccionario de argumentos de la funcion a ejecutar |
|
66 | **kwargs : Diccionario de argumentos de la funcion a ejecutar | |
67 | """ |
|
67 | """ | |
68 |
|
68 | |||
69 | if self.dataIn.isEmpty(): |
|
|||
70 | return None |
|
|||
71 |
|
||||
72 | raise ValueError, "ImplementedError" |
|
69 | raise ValueError, "ImplementedError" | |
73 |
|
70 | |||
74 | def callMethod(self, name, **kwargs): |
|
71 | def callMethod(self, name, **kwargs): | |
@@ -83,9 +80,6 class ProcessingUnit: | |||||
83 |
|
80 | |||
84 | """ |
|
81 | """ | |
85 |
|
82 | |||
86 | if self.dataIn.isEmpty(): |
|
|||
87 | return None |
|
|||
88 |
|
||||
89 | methodToCall = getattr(self, name) |
|
83 | methodToCall = getattr(self, name) | |
90 |
|
84 | |||
91 | methodToCall(**kwargs) |
|
85 | methodToCall(**kwargs) | |
@@ -106,17 +100,14 class ProcessingUnit: | |||||
106 | None |
|
100 | None | |
107 | """ |
|
101 | """ | |
108 |
|
102 | |||
109 | if self.dataIn.isEmpty(): |
|
|||
110 | return None |
|
|||
111 |
|
||||
112 | object = self.objectList[objId] |
|
103 | object = self.objectList[objId] | |
113 |
|
104 | |||
114 | object.run(self.dataOut, **kwargs) |
|
105 | object.run(self.dataOut, **kwargs) | |
115 |
|
106 | |||
116 | def call(self, operation, **kwargs): |
|
107 | def call(self, operationConf, **kwargs): | |
117 |
|
108 | |||
118 | """ |
|
109 | """ | |
119 | Ejecuta la operacion "operation" con los argumentos "**kwargs". La operacion puede |
|
110 | Ejecuta la operacion "operationConf.name" con los argumentos "**kwargs". La operacion puede | |
120 | ser de dos tipos: |
|
111 | ser de dos tipos: | |
121 |
|
112 | |||
122 | 1. Un metodo propio de esta clase: |
|
113 | 1. Un metodo propio de esta clase: | |
@@ -131,16 +122,21 class ProcessingUnit: | |||||
131 |
|
122 | |||
132 |
|
123 | |||
133 | con el id de la operacion. |
|
124 | con el id de la operacion. | |
|
125 | ||||
|
126 | Input: | |||
|
127 | ||||
|
128 | Operation : Objeto del tipo operacion con los atributos: name, type y id. | |||
|
129 | ||||
134 | """ |
|
130 | """ | |
135 | if self.dataIn.isEmpty(): |
|
131 | if self.dataIn.isEmpty(): | |
136 | return None |
|
132 | return None | |
137 |
|
133 | |||
138 | if operation.type == 'self': |
|
134 | if operationConf.type == 'self': | |
139 | self.callMethod(operation.name, **kwargs) |
|
135 | self.callMethod(operationConf.name, **kwargs) | |
140 | return |
|
136 | return | |
141 |
|
137 | |||
142 | if operation.type == 'other': |
|
138 | if operationConf.type == 'other': | |
143 | self.callObject(operation.id, **kwargs) |
|
139 | self.callObject(operationConf.id, **kwargs) | |
144 | return |
|
140 | return | |
145 |
|
141 | |||
146 | class Operation(): |
|
142 | class Operation(): | |
@@ -185,8 +181,10 class VoltageProc(ProcessingUnit): | |||||
185 |
|
181 | |||
186 |
|
182 | |||
187 | def __init__(self): |
|
183 | def __init__(self): | |
|
184 | ||||
188 | self.objectDict = {} |
|
185 | self.objectDict = {} | |
189 | pass |
|
186 | self.dataOut = Voltage() | |
|
187 | ||||
190 |
|
188 | |||
191 | def setup(self, dataIn=None, dataOut=None): |
|
189 | def setup(self, dataIn=None, dataOut=None): | |
192 |
|
190 | |||
@@ -201,9 +199,6 class VoltageProc(ProcessingUnit): | |||||
201 |
|
199 | |||
202 | def init(self): |
|
200 | def init(self): | |
203 |
|
201 | |||
204 | if self.dataIn.isEmpty(): |
|
|||
205 | return 0 |
|
|||
206 |
|
||||
207 | self.dataOut.copy(self.dataIn) |
|
202 | self.dataOut.copy(self.dataIn) | |
208 | # No necesita copiar en cada init() los atributos de dataIn |
|
203 | # No necesita copiar en cada init() los atributos de dataIn | |
209 | # la copia deberia hacerse por cada nuevo bloque de datos |
|
204 | # la copia deberia hacerse por cada nuevo bloque de datos |
General Comments 0
You need to be logged in to leave comments.
Login now