#
# This code has been auto-generated by the MDE Workbench
# Version: 3.1.24.
#
# File: Elevated_release_rainout_in_bund
# Date: 2023-03-13 14:01
# Time: 14:01
#


# The following import is required for sys.exit
import sys

from pypws.calculations import LoadMassInventoryVesselForLeakScenarioCalculation
from pypws.calculations import VesselLeakCalculation
from pypws.calculations import DispersionCalculation
from pypws.calculations import DistancesToConcLevelsCalculation

from pypws.entities import Material, MaterialComponent
from pypws.entities import DischargeParameters, Substrate, Bund
from pypws.entities import DischargeResult, DischargeRecord, State
from pypws.entities import Weather, DispersionParameters
from pypws.entities import DispersionOutputConfig

from pypws.enums import ResultCode, PropertyTemplate, FlashAtOrifice
from pypws.enums import SurfaceType, PoolSurfaceType, DynamicType
from pypws.enums import FluidSpec, MixtureModelling, TimeVaryingOption
from pypws.enums import AtmosphericStabilityClass, RainoutThermoFlag
from pypws.enums import Resolution, SpecialConcentration, ContourType

from pypws.utilities import getAnalyticsApiTarget


print('\n******************************************************************************************')
print(' Running against: %s' % (getAnalyticsApiTarget()))
print('******************************************************************************************\n')

# No items with data mappings to the loadMassInventoryVesselForLeakScenarioCalculation instance.
# All input data will have to be specified for the calculation itself.

# Declare the loadMassInventoryVesselForLeakScenarioCalculation calclulation instance.
loadMassInventoryVesselForLeakScenarioCalculation = LoadMassInventoryVesselForLeakScenarioCalculation()


# Set unmapped properties for loadMassInventoryVesselForLeakScenarioCalculation (Material property).
loadMassInventoryVesselForLeakScenarioCalculation.material.name = ""
loadMassInventoryVesselForLeakScenarioCalculation.material.componentCount = 1
materialComponent = MaterialComponent()
materialComponent.name = "CHLORINE"
materialComponent.moleFraction = 1.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = ""
materialComponent.moleFraction = 0.0
loadMassInventoryVesselForLeakScenarioCalculation.material.components.append(materialComponent)

loadMassInventoryVesselForLeakScenarioCalculation.material.propertyTemplate = PropertyTemplate.PHAST_MC

# Set unmapped properties for loadMassInventoryVesselForLeakScenarioCalculation (Mass property).
loadMassInventoryVesselForLeakScenarioCalculation.mass = 20000.0

# Set unmapped properties for loadMassInventoryVesselForLeakScenarioCalculation (Pressure property).
loadMassInventoryVesselForLeakScenarioCalculation.pressure = 601325.0

# Set unmapped properties for loadMassInventoryVesselForLeakScenarioCalculation (Temperature property).
loadMassInventoryVesselForLeakScenarioCalculation.temperature = 190.0

# Set unmapped properties for loadMassInventoryVesselForLeakScenarioCalculation (HoleSize property).
loadMassInventoryVesselForLeakScenarioCalculation.holeSize = 0.05

# Set unmapped properties for loadMassInventoryVesselForLeakScenarioCalculation (ReleaseElevation property).
loadMassInventoryVesselForLeakScenarioCalculation.releaseElevation = 4.0

# Set unmapped properties for loadMassInventoryVesselForLeakScenarioCalculation (ReleaseAngle property).
loadMassInventoryVesselForLeakScenarioCalculation.releaseAngle = 0.01

# Run the loadMassInventoryVesselForLeakScenarioCalculation instance.
print('.... Running load mass inventory vessel for leak scenario calculation')

resultCode = loadMassInventoryVesselForLeakScenarioCalculation.run()

print('>>>> Result code of loadMassInventoryVesselForLeakScenarioCalculation (LoadMassInventoryVesselForLeakScenarioCalculation) run: ', resultCode)

if resultCode == ResultCode.SUCCESS:

    # Load mass inventory vessel for leak scenario calculation ran successfully

    print('>>>> loadMassInventoryVesselForLeakScenarioCalculation (LoadMassInventoryVesselForLeakScenarioCalculation) ran successfully')
    # Print out any messages
    loadMassInventoryVesselForLeakScenarioCalculation.print_messages()

    loadMassInventoryVesselForLeakScenarioCalculation.print()

else:

    # Errors encountered running loadMassInventoryVesselForLeakScenarioCalculation
    # Print the messages as these may help in diagnosing the issue(s)
    loadMassInventoryVesselForLeakScenarioCalculation.print_messages()

    print('!!!! Errors encountered running loadMassInventoryVesselForLeakScenarioCalculation')

    sys.exit(loadMassInventoryVesselForLeakScenarioCalculation.resultCode)


# Set properties with data mappings to the vesselLeakCalculation instance.
# Declare the vesselLeakCalculation calculation instance.
vesselLeakCalculation = VesselLeakCalculation()

vesselLeakCalculation.vessel = loadMassInventoryVesselForLeakScenarioCalculation.vessel
vesselLeakCalculation.leak = loadMassInventoryVesselForLeakScenarioCalculation.leak

# Set unmapped properties for vesselLeakCalculation (DischargeParameters property).
vesselLeakCalculation.dischargeParameters.flashAtOrifice = FlashAtOrifice.DISALLOW_LIQUID_FLASH
vesselLeakCalculation.leak.timeVaryingOption = TimeVaryingOption.INITIAL_RATE

# Run the vesselLeakCalculation instance.
print('.... Running vessel leak calculation')

resultCode = vesselLeakCalculation.run()

print('>>>> Result code of vesselLeakCalculation (VesselLeakCalculation) run: ', resultCode)

if resultCode == ResultCode.SUCCESS:

    # Vessel leak calculation ran successfully

    print('>>>> vesselLeakCalculation (VesselLeakCalculation) ran successfully')
    # Print out any messages
    vesselLeakCalculation.print_messages()

    vesselLeakCalculation.print()

else:

    # Errors encountered running vesselLeakCalculation
    # Print the messages as these may help in diagnosing the issue(s)
    vesselLeakCalculation.print_messages()

    print('!!!! Errors encountered running vesselLeakCalculation')

    sys.exit(vesselLeakCalculation.resultCode)


# Set properties with data mappings to the dispersionCalculation_AVG_Def instance.
# Declare the dispersionCalculation_AVG_Def calculation instance.
dispersionCalculation_AVG_Def = DispersionCalculation()

dispersionCalculation_AVG_Def.material = vesselLeakCalculation.exitMaterial
dispersionCalculation_AVG_Def.dischargeResult = vesselLeakCalculation.dischargeResult
dispersionCalculation_AVG_Def.dischargeRecords = vesselLeakCalculation.dischargeRecords

# Set unmapped properties for dispersionCalculation_AVG_Def (Material property).
dispersionCalculation_AVG_Def.material.name = "                                "
dispersionCalculation_AVG_Def.material.componentCount = 1
materialComponent = MaterialComponent()
materialComponent.name = "CHLORINE"
materialComponent.moleFraction = 1.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)
materialComponent = MaterialComponent()
materialComponent.name = "                                "
materialComponent.moleFraction = 0.0
dispersionCalculation_AVG_Def.material.components.append(materialComponent)

dispersionCalculation_AVG_Def.material.propertyTemplate = PropertyTemplate.PHAST_MC

# Set unmapped properties for dispersionCalculation_AVG_Def (Substrate property).
dispersionCalculation_AVG_Def.substrate.surfaceRoughness = 0.183
dispersionCalculation_AVG_Def.substrate.surfaceType = SurfaceType.LAND
dispersionCalculation_AVG_Def.substrate.poolSurfaceType = PoolSurfaceType.CONCRETE
dispersionCalculation_AVG_Def.substrate.bund.bundHeight = 10.0
dispersionCalculation_AVG_Def.substrate.bund.bundDiameter = 8.5
dispersionCalculation_AVG_Def.substrate.bund.specifyBund = True

# Set unmapped properties for dispersionCalculation_AVG_Def (DischargeResult property).
dispersionCalculation_AVG_Def.dischargeResult.expansionEnergy = 0.0
dispersionCalculation_AVG_Def.dischargeResult.releaseMass = 1000.0000000000302
dispersionCalculation_AVG_Def.dischargeResult.height = 4.0
dispersionCalculation_AVG_Def.dischargeResult.angle = 0.01
dispersionCalculation_AVG_Def.dischargeResult.releaseType = DynamicType.CONTINUOUS
dispersionCalculation_AVG_Def.dischargeResult.holeDiameter = 0.05
dispersionCalculation_AVG_Def.dischargeResult.preDilutionAirRate = 0.0
dispersionCalculation_AVG_Def.dischargeRecords = vesselLeakCalculation.dischargeRecords

# Set unmapped properties for dispersionCalculation_AVG_Def (Weather property).
dispersionCalculation_AVG_Def.weather.windSpeed = 5.0
dispersionCalculation_AVG_Def.weather.stabilityClass = AtmosphericStabilityClass.STABILITY_D
dispersionCalculation_AVG_Def.weather.temperature = 283.0
dispersionCalculation_AVG_Def.weather.relativeHumidity = 0.7
dispersionCalculation_AVG_Def.weather.mixingLayerHeight = 800.0
dispersionCalculation_AVG_Def.weather.solarRadiation = 500.0

# Set unmapped properties for dispersionCalculation_AVG_Def (DispersionParameters property).
dispersionCalculation_AVG_Def.dispersionParameters.relativeTolerance = 0.001
dispersionCalculation_AVG_Def.dispersionParameters.rainoutThermoFlag = RainoutThermoFlag.RAINOUT_NON_EQUILIBRIUM
dispersionCalculation_AVG_Def.dispersionParameters.fixedStepSize = 0.01
dispersionCalculation_AVG_Def.dispersionParameters.outputStepMultiplier = 1.2
dispersionCalculation_AVG_Def.dispersionParameters.maxDispersionDistance = 50000.0
dispersionCalculation_AVG_Def.dispersionParameters.maxDispersionHeight = 1000.0
dispersionCalculation_AVG_Def.dispersionParameters.numberOfReleaseObservers = 5
dispersionCalculation_AVG_Def.dispersionParameters.numberOfPoolObservers = 10
dispersionCalculation_AVG_Def.dispersionParameters.averagingTime = 18.75
dispersionCalculation_AVG_Def.dispersionParameters.lflFractionToStop = 0.5

# Set unmapped properties for dispersionCalculation_AVG_Def (EndPointConcentration property).
dispersionCalculation_AVG_Def.endPointConcentration = 0.0

# Run the dispersionCalculation_AVG_Def instance.
print('.... Running dispersion calculation')

resultCode = dispersionCalculation_AVG_Def.run()

print('>>>> Result code of dispersionCalculation_AVG_Def (DispersionCalculation) run: ', resultCode)

if resultCode == ResultCode.SUCCESS:

    # Dispersion calculation ran successfully

    print('>>>> dispersionCalculation_AVG_Def (DispersionCalculation) ran successfully')
    # Print out any messages
    dispersionCalculation_AVG_Def.print_messages()

else:

    # Errors encountered running dispersionCalculation_AVG_Def
    # Print the messages as these may help in diagnosing the issue(s)
    dispersionCalculation_AVG_Def.print_messages()

    print('!!!! Errors encountered running dispersionCalculation_AVG_Def')

    sys.exit(dispersionCalculation_AVG_Def.resultCode)


# Set properties with data mappings to the dispersionCalculation_AVG_1hour instance.
# Declare the dispersionCalculation_AVG_1hour calculation instance.
dispersionCalculation_AVG_1hour = DispersionCalculation()

dispersionCalculation_AVG_1hour.material = vesselLeakCalculation.exitMaterial
dispersionCalculation_AVG_1hour.dischargeResult = vesselLeakCalculation.dischargeResult
dispersionCalculation_AVG_1hour.dischargeRecords = vesselLeakCalculation.dischargeRecords

# Set unmapped properties for dispersionCalculation_AVG_1hour (Substrate property).
dispersionCalculation_AVG_1hour.substrate.surfaceRoughness = 0.183
dispersionCalculation_AVG_1hour.substrate.surfaceType = SurfaceType.LAND
dispersionCalculation_AVG_1hour.substrate.poolSurfaceType = PoolSurfaceType.CONCRETE
dispersionCalculation_AVG_1hour.substrate.bund.bundHeight = 10.0
dispersionCalculation_AVG_1hour.substrate.bund.bundDiameter = 8.5
dispersionCalculation_AVG_1hour.substrate.bund.specifyBund = True

# Set unmapped properties for dispersionCalculation_AVG_1hour (Weather property).
dispersionCalculation_AVG_1hour.weather.windSpeed = 5.0
dispersionCalculation_AVG_1hour.weather.stabilityClass = AtmosphericStabilityClass.STABILITY_D
dispersionCalculation_AVG_1hour.weather.temperature = 283.0
dispersionCalculation_AVG_1hour.weather.relativeHumidity = 0.7
dispersionCalculation_AVG_1hour.weather.mixingLayerHeight = 800.0
dispersionCalculation_AVG_1hour.weather.solarRadiation = 500.0

# Set unmapped properties for dispersionCalculation_AVG_1hour (DispersionParameters property).
dispersionCalculation_AVG_1hour.dispersionParameters.relativeTolerance = 0.001
dispersionCalculation_AVG_1hour.dispersionParameters.rainoutThermoFlag = RainoutThermoFlag.RAINOUT_NON_EQUILIBRIUM
dispersionCalculation_AVG_1hour.dispersionParameters.fixedStepSize = 0.01
dispersionCalculation_AVG_1hour.dispersionParameters.outputStepMultiplier = 1.2
dispersionCalculation_AVG_1hour.dispersionParameters.maxDispersionDistance = 50000.0
dispersionCalculation_AVG_1hour.dispersionParameters.maxDispersionHeight = 1000.0
dispersionCalculation_AVG_1hour.dispersionParameters.numberOfReleaseObservers = 5
dispersionCalculation_AVG_1hour.dispersionParameters.numberOfPoolObservers = 10
dispersionCalculation_AVG_1hour.dispersionParameters.averagingTime = 3600.0
dispersionCalculation_AVG_1hour.dispersionParameters.lflFractionToStop = 0.5

# Set unmapped properties for dispersionCalculation_AVG_1hour (EndPointConcentration property).
dispersionCalculation_AVG_1hour.endPointConcentration = 0.0

# Run the dispersionCalculation_AVG_1hour instance.
print('.... Running dispersion calculation')

resultCode = dispersionCalculation_AVG_1hour.run()

print('>>>> Result code of dispersionCalculation_AVG_1hour (DispersionCalculation) run: ', resultCode)

if resultCode == ResultCode.SUCCESS:

    # Dispersion calculation ran successfully

    print('>>>> dispersionCalculation_AVG_1hour (DispersionCalculation) ran successfully')
    # Print out any messages
    dispersionCalculation_AVG_1hour.print_messages()

else:

    # Errors encountered running dispersionCalculation_AVG_1hour
    # Print the messages as these may help in diagnosing the issue(s)
    dispersionCalculation_AVG_1hour.print_messages()

    print('!!!! Errors encountered running dispersionCalculation_AVG_1hour')

    sys.exit(dispersionCalculation_AVG_1hour.resultCode)


# Set properties with data mappings to the distancesToConcLevelsCalculation instance.
# Declare the distancesToConcLevelsCalculation calculation instance.
distancesToConcLevelsCalculation = DistancesToConcLevelsCalculation()

distancesToConcLevelsCalculation.scalarUdmOutputs = dispersionCalculation_AVG_1hour.scalarUdmOutputs
distancesToConcLevelsCalculation.weather = dispersionCalculation_AVG_1hour.weather
distancesToConcLevelsCalculation.dispersionRecords = dispersionCalculation_AVG_1hour.dispersionRecords
distancesToConcLevelsCalculation.substrate = dispersionCalculation_AVG_1hour.substrate
distancesToConcLevelsCalculation.material = dispersionCalculation_AVG_1hour.material
distancesToConcLevelsCalculation.dispersionParameters = dispersionCalculation_AVG_1hour.dispersionParameters

# Set unmapped properties for distancesToConcLevelsCalculation (DispersionOutputConfigs property).
dispersionOutputConfig = DispersionOutputConfig()
dispersionOutputConfig.downwindDistance = 100.0
dispersionOutputConfig.time = 60.0
dispersionOutputConfig.resolution = Resolution.HIGH
dispersionOutputConfig.elevation = 1.0
dispersionOutputConfig.specialConcentration = SpecialConcentration.NOT_DEFINED
dispersionOutputConfig.concentration = 0.001
dispersionOutputConfig.crosswindDistance = 0.0
dispersionOutputConfig.contourType = ContourType.FOOTPRINT
dispersionOutputConfig.lflFractionValue = 0.5
distancesToConcLevelsCalculation.dispersionOutputConfigs.append(dispersionOutputConfig)

dispersionOutputConfig = DispersionOutputConfig()
dispersionOutputConfig.downwindDistance = 100.0
dispersionOutputConfig.time = 60.0
dispersionOutputConfig.resolution = Resolution.HIGH
dispersionOutputConfig.elevation = 1.0
dispersionOutputConfig.specialConcentration = SpecialConcentration.NOT_DEFINED
dispersionOutputConfig.concentration = 0.0001
dispersionOutputConfig.crosswindDistance = 0.0
dispersionOutputConfig.contourType = ContourType.FOOTPRINT
dispersionOutputConfig.lflFractionValue = 0.5
distancesToConcLevelsCalculation.dispersionOutputConfigs.append(dispersionOutputConfig)


# Run the distancesToConcLevelsCalculation instance.
print('.... Running distances to conc levels calculation')

resultCode = distancesToConcLevelsCalculation.run()

print('>>>> Result code of distancesToConcLevelsCalculation (DistancesToConcLevelsCalculation) run: ', resultCode)

if resultCode == ResultCode.SUCCESS:

    # Distances to conc levels calculation ran successfully

    print('>>>> distancesToConcLevelsCalculation (DistancesToConcLevelsCalculation) ran successfully')
    # Print out any messages
    distancesToConcLevelsCalculation.print_messages()

else:

    # Errors encountered running distancesToConcLevelsCalculation
    # Print the messages as these may help in diagnosing the issue(s)
    distancesToConcLevelsCalculation.print_messages()

    print('!!!! Errors encountered running distancesToConcLevelsCalculation')

    sys.exit(distancesToConcLevelsCalculation.resultCode)


# Set properties with data mappings to the distancesToConcLevelsCalculation1 instance.
# Declare the distancesToConcLevelsCalculation1 calculation instance.
distancesToConcLevelsCalculation1 = DistancesToConcLevelsCalculation()

distancesToConcLevelsCalculation1.scalarUdmOutputs = dispersionCalculation_AVG_1hour.scalarUdmOutputs
distancesToConcLevelsCalculation1.weather = dispersionCalculation_AVG_1hour.weather
distancesToConcLevelsCalculation1.dispersionRecords = dispersionCalculation_AVG_1hour.dispersionRecords
distancesToConcLevelsCalculation1.substrate = dispersionCalculation_AVG_1hour.substrate
distancesToConcLevelsCalculation1.material = dispersionCalculation_AVG_1hour.material
distancesToConcLevelsCalculation1.dispersionParameters = dispersionCalculation_AVG_1hour.dispersionParameters

# Set unmapped properties for distancesToConcLevelsCalculation1 (DispersionOutputConfigs property).
dispersionOutputConfig = DispersionOutputConfig()
dispersionOutputConfig.downwindDistance = 100.0
dispersionOutputConfig.time = 60.0
dispersionOutputConfig.resolution = Resolution.HIGH
dispersionOutputConfig.elevation = 1.0
dispersionOutputConfig.specialConcentration = SpecialConcentration.NOT_DEFINED
dispersionOutputConfig.concentration = 0.001
dispersionOutputConfig.crosswindDistance = 0.0
dispersionOutputConfig.contourType = ContourType.FOOTPRINT
dispersionOutputConfig.lflFractionValue = 0.5
distancesToConcLevelsCalculation1.dispersionOutputConfigs.append(dispersionOutputConfig)

dispersionOutputConfig = DispersionOutputConfig()
dispersionOutputConfig.downwindDistance = 100.0
dispersionOutputConfig.time = 60.0
dispersionOutputConfig.resolution = Resolution.HIGH
dispersionOutputConfig.elevation = 1.0
dispersionOutputConfig.specialConcentration = SpecialConcentration.MIN
dispersionOutputConfig.concentration = 0.0001
dispersionOutputConfig.crosswindDistance = 0.0
dispersionOutputConfig.contourType = ContourType.FOOTPRINT
dispersionOutputConfig.lflFractionValue = 0.5
distancesToConcLevelsCalculation1.dispersionOutputConfigs.append(dispersionOutputConfig)


# Run the distancesToConcLevelsCalculation1 instance.
print('.... Running distances to conc levels calculation')

resultCode = distancesToConcLevelsCalculation1.run()

print('>>>> Result code of distancesToConcLevelsCalculation1 (DistancesToConcLevelsCalculation) run: ', resultCode)

if resultCode == ResultCode.SUCCESS:

    # Distances to conc levels calculation ran successfully

    print('>>>> distancesToConcLevelsCalculation1 (DistancesToConcLevelsCalculation) ran successfully')
    # Print out any messages
    distancesToConcLevelsCalculation1.print_messages()

else:

    # Errors encountered running distancesToConcLevelsCalculation1
    # Print the messages as these may help in diagnosing the issue(s)
    distancesToConcLevelsCalculation1.print_messages()

    print('!!!! Errors encountered running distancesToConcLevelsCalculation1')

    sys.exit(distancesToConcLevelsCalculation1.resultCode)
