Beispiel #1
0
 def __init__(self, input_keys, optional_inputs, additional_models=[]):
     WindTurbineFunction.__init__(self,
                                  input_keys,
                                  optional_inputs,
                                  output_keys=['power', 'ct'])
     for i, m in enumerate(additional_models):
         check_model(m, AdditionalModel, f"Additional model, element {i}")
         self.add_inputs(m.required_inputs, m.optional_inputs)
     self.model_lst = additional_models
Beispiel #2
0
    def __init__(self,
                 site,
                 windTurbines: WindTurbines,
                 wake_deficitModel,
                 rotorAvgModel,
                 superpositionModel,
                 blockage_deficitModel=None,
                 deflectionModel=None,
                 turbulenceModel=None,
                 groundModel=None):

        WindFarmModel.__init__(self, site, windTurbines)
        check_model(wake_deficitModel, WakeDeficitModel, 'wake_deficitModel')
        check_model(rotorAvgModel, RotorAvgModel, 'rotorAvgModel')
        check_model(superpositionModel, SuperpositionModel,
                    'superpositionModel')
        check_model(blockage_deficitModel, BlockageDeficitModel,
                    'blockage_deficitModel')
        check_model(deflectionModel, DeflectionModel, 'deflectionModel')
        check_model(turbulenceModel, TurbulenceModel, 'turbulenceModel')
        if groundModel is None:
            groundModel = NoGround()
        check_model(groundModel, GroundModel, 'groundModel')
        if isinstance(superpositionModel, WeightedSum):
            assert isinstance(wake_deficitModel, ConvectionDeficitModel)
            assert rotorAvgModel.__class__ is RotorCenter, "Multiple rotor average points not implemented for WeightedSum"
        assert 'TI_eff_ilk' not in wake_deficitModel.args4deficit or turbulenceModel  # TI_eff requires a turbulence model
        self.wake_deficitModel = wake_deficitModel
        self.rotorAvgModel = rotorAvgModel

        self.superpositionModel = superpositionModel
        self.blockage_deficitModel = blockage_deficitModel
        self.deflectionModel = deflectionModel
        self.turbulenceModel = turbulenceModel
        self.groundModel = groundModel

        self.wec = 1  # wake expansion continuation (wake-width scale factor) see
        # Thomas, J. J. and Ning, A., “A Method for Reducing Multi-Modality in the Wind Farm Layout Optimization Problem,”
        # Journal of Physics: Conference Series, Vol. 1037, The Science of Making
        # Torque from Wind, Milano, Italy, jun 2018, p. 10.
        self.deficit_initalized = False

        self.args4deficit = self.wake_deficitModel.args4deficit
        self.args4deficit = set(self.args4deficit) | {'yaw_ilk'} | set(
            self.rotorAvgModel.args4rotor_avg_deficit)
        if self.blockage_deficitModel:
            self.args4deficit = set(self.args4deficit) | set(
                self.blockage_deficitModel.args4deficit)
        if self.groundModel:
            self.args4deficit = set(self.args4deficit) | set(
                self.groundModel.args4deficit)
        self.args4all = set(self.args4deficit)
        if self.turbulenceModel:
            if self.turbulenceModel.rotorAvgModel is None:
                self.turbulenceModel.rotorAvgModel = rotorAvgModel
            self.args4addturb = set(self.turbulenceModel.args4addturb) | set(
                self.turbulenceModel.rotorAvgModel.args4rotor_avg_deficit)
            self.args4all = self.args4all | set(
                self.turbulenceModel.args4addturb)
        if self.deflectionModel:
            self.args4all = self.args4all | set(
                self.deflectionModel.args4deflection)
Beispiel #3
0
 def __init__(self, site, windTurbines):
     check_model(site, Site, 'site')
     check_model(windTurbines, WindTurbines, 'windTurbines')
     self.site = site
     self.windTurbines = windTurbines
Beispiel #4
0
def test_check_model_wrong_model(model, cls, arg_name, msg):
    with pytest.raises(ValueError, match=msg):
        check_model(model, cls, arg_name)
Beispiel #5
0
def test_check_model():
    check_model(LinearSum(), SuperpositionModel)