class DistributeFilledPolygon(DistributeXY): borders = Array(iotype='in', desc='The polygon defining the borders ndarray([n_bor,2])', unit='m') baseline = Array( unit='m', iotype='in', desc='Array of wind turbines attached to particular positions') wt_positions = Array( [], unit='m', iotype='out', desc='Array of wind turbines attached to particular positions') def __init__(self, **kwargs): super(DistributeFilledPolygon, self).__init__(**kwargs) self.polyfill = PolyFill(self.borders, 100, 100) self.old_positions = self.baseline def execute(self): new_positions = np.array([ self.unscale( [getattr(self, wt_name + '_x'), getattr(self, wt_name + '_y')]) for wt_name in self.wt_names ]) self.wt_positions = self.polyfill.update(self.old_positions, new_positions) self.old_positions = self.wt_positions.copy()
class DistributeFilledPolygon(DistributeXY): borders = Array(iotype='in', desc='The polygon defining the borders ndarray([n_bor,2])', unit='m') baseline = Array(unit='m', iotype='in', desc='Array of wind turbines attached to particular positions') wt_positions = Array([], unit='m', iotype='out', desc='Array of wind turbines attached to particular positions') def __init__(self, **kwargs): super(DistributeFilledPolygon, self).__init__(**kwargs) self.polyfill = PolyFill(self.borders, 100, 100) self.old_positions = self.baseline def execute(self): new_positions = np.array([self.unscale([getattr(self, wt_name+'_x'), getattr(self, wt_name+'_y')]) for wt_name in self.wt_names]) self.wt_positions = self.polyfill.update(self.old_positions, new_positions) self.old_positions = self.wt_positions.copy()
def __init__(self, **kwargs): super(DistributeFilledPolygon, self).__init__(**kwargs) self.polyfill = PolyFill(self.borders, 100, 100) self.old_positions = self.baseline