def main(): setup_file_and_console_loggers("create_valuation_example.log") # Calling with no token in constructor will load one from an environment variable if provided # or a file HOME/. session = AmunSession() region = "gbr" scenarios = session.get_scenarios(region) turbines = session.get_turbines() scenario_name = "Aurora Central Weather Years - 2020 April" valuation_parameters = { "windType": "era5", "name": f"SDK Wind Farm {datetime.now()}", "description": "Created by Api", "longitude": "-1.21", "latitude": "59.59", "turbineModelId": get_turbine_by_name(turbines, "Siemens SWT-4.0-130")["id"], "numberOfTurbines": 10, "hubHeight": 90, "obstacleHeight": 0, "roughnessLength": 0.001, "scenarioId": get_scenario_by_name(scenarios, scenario_name)["id"], # Optional # "lossesWake": 0.2, # "lossesAvailability": 0.02, # "lossesElectrical": 0.01, # "lossesTurbinePerformance": 0.1, # "lossesEnvironmental": 0.05, # "lossesOtherCurtailment": 0.0, } valuation = session.create_valuation(valuation_parameters) log.info(f"Created {valuation['id']}") save_to_json(f"valuations/valuation_{valuation['id']}.json", valuation) results = session.get_valuation_results(valuation["id"], format="json", should_return_hourly_data=False) log.info(f"Got result for {results['valuation']}") save_to_json(f"valuations/valuation_{valuation['id']}_out.json", results) log.info(f"Deleting {valuation['id']}") session.delete_valuation(valuation["id"]) log.debug("Done")
def main(): setup_file_and_console_loggers("generation_valuation_example.log") # Calling with no token in constructor will load one from an environment variable if provided # or a file HOME/. session = AmunSession() region = "gbr" scenarios = session.get_scenarios(region) turbines = session.get_turbines() scenario_name = "Aurora Central Weather Years - 2020 April" valuation_parameters = { "windType": "era5", "name": f"SDK Wind Farm {datetime.now()}", "description": "Created by Api", "longitude": "-1.21", "latitude": "59.59", "scenarioId": get_scenario_by_name(scenarios, scenario_name)["id"], } valuation = session.create_valuation(valuation_parameters) log.info(f"Created {valuation['id']}") save_to_json(f"valuations/valuation_{valuation['id']}.json", valuation) # Check the json document for a complete structure of what is required # historicCalibration is for weather years session.send_calibrated_production( valuation["id"], get_json("examples\data\example_calibratedGeneration.json")) results = session.get_valuation_results(valuation["id"], format="json", should_return_hourly_data=False) log.info(f"Got result for {results['valuation']}") save_to_json(f"valuations/valuation_{valuation['id']}_out.json", results) log.info(f"Deleting {valuation['id']}") session.delete_valuation(valuation["id"]) log.debug("Done")
def main(): setup_file_and_console_loggers("run_valuation_time_Based_curtailment.log") # Calling with no token in constructor will load one from an environment variable if provided # or a file HOME/. session = AmunSession() region = "gbr" scenarios = session.get_scenarios(region) turbines = session.get_turbines() # scenario_name = "Aurora Central Weather Years - 2020 April" scenario_name = "Aurora Central - 2020 October" valuation_parameters = { "windType": "era5", "name": f"SDK Wind Farm {datetime.now()}", "description": "Created by Api", "longitude": "-1.21", "latitude": "59.59", "turbineModelId": get_turbine_by_name(turbines, "Siemens SWT-4.0-130")["id"], "numberOfTurbines": 10, "hubHeight": 90, "obstacleHeight": 0, "roughnessLength": 0.001, "scenarioId": get_scenario_by_name(scenarios, scenario_name)["id"], "curtailmentThreshold": 2, # Optional "timeBasedCurtailmentThresholds": [ { "threshold": 10, "timeValidFrom": "2024-01-01T00:00:00.000Z", }, { "threshold": 20, "timeValidFrom": "2028-01-01T00:00:00.000Z", }, { "threshold": 40, "timeValidFrom": "2032-01-01T00:00:00.000Z", }, { "threshold": 60, "timeValidFrom": "2036-01-01T00:00:00.000Z", }, { "threshold": 80, "timeValidFrom": "2040-01-01T00:00:00.000Z", }, { "threshold": 100, "timeValidFrom": "2044-01-01T00:00:00.000Z", }, { "threshold": 120, "timeValidFrom": "2048-01-01T00:00:00.000Z", }, ], } valuation = session.create_valuation(valuation_parameters) log.info(f"Created {valuation['id']}") save_to_json(f"valuations/valuation_{valuation['id']}.json", valuation) results = session.get_valuation_results(valuation["id"], format="json", should_return_hourly_data=False) log.info(f"Got result for {results['valuation']}") save_to_json(f"valuations/valuation_{valuation['id']}_out.json", results) log.info(f"Deleting {valuation['id']}") session.delete_valuation(valuation["id"]) log.debug("Done")