Esempio n. 1
0
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()
Esempio n. 2
0
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()
Esempio n. 3
0
 def __init__(self, **kwargs):
     super(DistributeFilledPolygon, self).__init__(**kwargs)
     self.polyfill = PolyFill(self.borders, 100, 100)
     self.old_positions = self.baseline
Esempio n. 4
0
 def __init__(self, **kwargs):
     super(DistributeFilledPolygon, self).__init__(**kwargs)
     self.polyfill = PolyFill(self.borders, 100, 100)
     self.old_positions = self.baseline