@@ -380,52 +380,52 @@ def work_package_config_to_json(self, work_package: WorkPackageConfig) -> dict:
380380 }
381381 },
382382 "intervention" : work_package .intervention and (
383- {
384- "baseWorkPackageId" : work_package .intervention .base_work_package_id ,
385- "interventionType" : work_package .intervention .intervention_type .name ,
386- "candidateGeneration" : work_package .intervention .candidate_generation and {
387- "type" : work_package .intervention .candidate_generation .type .name ,
388- "interventionCriteriaName" : work_package .intervention .candidate_generation .intervention_criteria_name ,
389- "averageVoltageSpreadThreshold" : work_package .intervention .candidate_generation .average_voltage_spread_threshold ,
390- "voltageUnderLimitHoursThreshold" : work_package .intervention .candidate_generation .voltage_under_limit_hours_threshold ,
391- "voltageOverLimitHoursThreshold" : work_package .intervention .candidate_generation .voltage_over_limit_hours_threshold ,
392- "tapWeightingFactorLowerThreshold" : work_package .intervention .candidate_generation .tap_weighting_factor_lower_threshold ,
393- "tapWeightingFactorUpperThreshold" : work_package .intervention .candidate_generation .tap_weighting_factor_upper_threshold
394- },
395- "allocationCriteria" : work_package .intervention .allocation_criteria ,
396- "specificAllocationInstance" : work_package .intervention .specific_allocation_instance ,
397- "phaseRebalanceProportions" : work_package .intervention .phase_rebalance_proportions and {
398- "a" : work_package .intervention .phase_rebalance_proportions .a ,
399- "b" : work_package .intervention .phase_rebalance_proportions .b ,
400- "c" : work_package .intervention .phase_rebalance_proportions .c
401- },
402- "dvms" : work_package .intervention .dvms and {
403- "lowerLimit" : work_package .intervention .dvms .lower_limit ,
404- "upperLimit" : work_package .intervention .dvms .upper_limit ,
405- "lowerPercentile" : work_package .intervention .dvms .lower_percentile ,
406- "upperPercentile" : work_package .intervention .dvms .upper_percentile ,
407- "maxIterations" : work_package .intervention .dvms .max_iterations ,
408- "regulatorConfig" : {
409- "puTarget" : work_package .intervention .dvms .regulator_config .pu_target ,
410- "puDeadbandPercent" : work_package .intervention .dvms .regulator_config .pu_deadband_percent ,
411- "maxTapChangePerStep" : work_package .intervention .dvms .regulator_config .max_tap_change_per_step ,
412- "allowPushToLimit" : work_package .intervention .dvms .regulator_config .allow_push_to_limit
413- }
414- }
415- } |
416- (
417- { "allocationLimitPerYear" : work_package .intervention .allocation_limit_per_year }
418- if work_package .intervention .allocation_limit_per_year is not None else {}
419- ) |
420- (
421383 {
422- "yearRange" : {
423- "maxYear" : work_package .intervention .year_range .max_year ,
424- "minYear" : work_package .intervention .year_range .min_year
384+ "baseWorkPackageId" : work_package .intervention .base_work_package_id ,
385+ "interventionType" : work_package .intervention .intervention_type .name ,
386+ "candidateGeneration" : work_package .intervention .candidate_generation and {
387+ "type" : work_package .intervention .candidate_generation .type .name ,
388+ "interventionCriteriaName" : work_package .intervention .candidate_generation .intervention_criteria_name ,
389+ "averageVoltageSpreadThreshold" : work_package .intervention .candidate_generation .average_voltage_spread_threshold ,
390+ "voltageUnderLimitHoursThreshold" : work_package .intervention .candidate_generation .voltage_under_limit_hours_threshold ,
391+ "voltageOverLimitHoursThreshold" : work_package .intervention .candidate_generation .voltage_over_limit_hours_threshold ,
392+ "tapWeightingFactorLowerThreshold" : work_package .intervention .candidate_generation .tap_weighting_factor_lower_threshold ,
393+ "tapWeightingFactorUpperThreshold" : work_package .intervention .candidate_generation .tap_weighting_factor_upper_threshold
394+ },
395+ "allocationCriteria" : work_package .intervention .allocation_criteria ,
396+ "specificAllocationInstance" : work_package .intervention .specific_allocation_instance ,
397+ "phaseRebalanceProportions" : work_package .intervention .phase_rebalance_proportions and {
398+ "a" : work_package .intervention .phase_rebalance_proportions .a ,
399+ "b" : work_package .intervention .phase_rebalance_proportions .b ,
400+ "c" : work_package .intervention .phase_rebalance_proportions .c
401+ },
402+ "dvms" : work_package .intervention .dvms and {
403+ "lowerLimit" : work_package .intervention .dvms .lower_limit ,
404+ "upperLimit" : work_package .intervention .dvms .upper_limit ,
405+ "lowerPercentile" : work_package .intervention .dvms .lower_percentile ,
406+ "upperPercentile" : work_package .intervention .dvms .upper_percentile ,
407+ "maxIterations" : work_package .intervention .dvms .max_iterations ,
408+ "regulatorConfig" : {
409+ "puTarget" : work_package .intervention .dvms .regulator_config .pu_target ,
410+ "puDeadbandPercent" : work_package .intervention .dvms .regulator_config .pu_deadband_percent ,
411+ "maxTapChangePerStep" : work_package .intervention .dvms .regulator_config .max_tap_change_per_step ,
412+ "allowPushToLimit" : work_package .intervention .dvms .regulator_config .allow_push_to_limit
413+ }
425414 }
426- }
427- if work_package .intervention .year_range is not None else {}
428- )
415+ } |
416+ (
417+ {"allocationLimitPerYear" : work_package .intervention .allocation_limit_per_year }
418+ if work_package .intervention .allocation_limit_per_year is not None else {}
419+ ) |
420+ (
421+ {
422+ "yearRange" : {
423+ "maxYear" : work_package .intervention .year_range .max_year ,
424+ "minYear" : work_package .intervention .year_range .min_year
425+ }
426+ }
427+ if work_package .intervention .year_range is not None else {}
428+ )
429429 )
430430 }
431431
@@ -674,6 +674,77 @@ async def async_run_feeder_load_analysis_report(self, feeder_load_analysis_input
674674 else :
675675 response .raise_for_status ()
676676
677+ def get_feeder_load_analysis_report_status (self , report_id : str , full_spec : bool = False ):
678+ """
679+ Send request to evolve app server to retrieve a feeder load analysis report status
680+
681+ :param report_id: Feeder load analysis report ID
682+ :param full_spec: If true the response will include the request sent to generate the report
683+ :return: The HTTP response received from the Evolve App Server after requesting a feeder load analysis report status
684+ """
685+ return get_event_loop ().run_until_complete (
686+ self .async_get_feeder_load_analysis_report_status (report_id , full_spec ))
687+
688+ async def async_get_feeder_load_analysis_report_status (self , report_id : str , full_spec : bool = False ):
689+ """
690+ Asynchronously send request to evolve app server to retrieve a feeder load analysis report status
691+
692+ :param report_id: Feeder load analysis report ID
693+ :param full_spec: If true the response will include the request sent to generate the report
694+ :return: The HTTP response received from the Evolve App Server after requesting a feeder load analysis report status
695+ """
696+ with warnings .catch_warnings ():
697+ if not self ._verify_certificate :
698+ warnings .filterwarnings ("ignore" , category = InsecureRequestWarning )
699+ json = {
700+ "query" :
701+ """
702+ query getFeederLoadAnalysisReportStatus($reportId: ID!, $fullSpec: Boolean!) {
703+ getFeederLoadAnalysisReportStatus(reportId: $reportId, fullSpec: $fullSpec) {
704+ id
705+ name
706+ createdAt
707+ createdBy
708+ completedAt
709+ state
710+ errors
711+ generationSpec {
712+ feeders
713+ substations
714+ subGeographicalRegions
715+ geographicalRegions
716+ startDate
717+ endDate
718+ fetchLvNetwork
719+ processFeederLoads
720+ processCoincidentLoads
721+ produceBasicReport
722+ produceConductorReport
723+ aggregateAtFeederLevel
724+ output
725+ }
726+ }
727+ }
728+ """ ,
729+ "variables" : {
730+ "reportId" : report_id ,
731+ "fullSpec" : full_spec ,
732+ }
733+ }
734+ if self ._verify_certificate :
735+ sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
736+
737+ async with self .session .post (
738+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
739+ headers = self ._get_request_headers (),
740+ json = json ,
741+ ssl = sslcontext if self ._verify_certificate else False
742+ ) as response :
743+ if response .ok :
744+ return await response .json ()
745+ else :
746+ response .raise_for_status ()
747+
677748 def upload_study (self , study : Study ):
678749 """
679750 Uploads a new study to the Evolve App Server
0 commit comments