pypws


Namepypws JSON
Version 4.1.6 PyPI version JSON
download
home_pageNone
SummaryPython library supporting Phast Web Services
upload_time2024-07-26 11:44:14
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords cpqra consequence analysis dnv discharge dispersion explosion fire flammable gas hazard phast qra toxic
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PHAST WEB SERVICES

## Introduction

Phast is the world's most comprehensive process hazard analysis software which models the progress of a potential incident from the initial release to far-field dispersion including modelling of pool spreading and evaporation and resulting flammable and toxic effects. In Phast Web Services we have taken the same state of the art consequence modelling calculations and made them available as web services so you can use them in your own applications.

## Consequence analysis

Phast Web services and Python PWS have been developed to enable you to call Phast consequence calculations from within your own Python scripts.

We have services available for a wide range of consequence calculations:

- Discharge
- Toxic/flammable gas dispersion
- Fire and explosion modelling
- Various supporting, utility calculations

## Reference documentation
A detailed reference document for using PyPWS can be found [here](https://pwsassets.blob.core.windows.net/prod/PyPws.pdf).

## Getting started
In order to create a Python script that is able to call the Phast Web Services calculations you will need to obtain an access token from DNV.  


## Sample Python code to perform a vessel leak calculation
In the following example the **VesselLeakCalculation** is used to predict the release of Methane from a 50mm hole in a horizontal vessel.  In order to get the correct conditions within the vessel the **VesselStateCalculation** is called first and the results from this are passed to the **VesselLeakCalculation** to correctly set it up.

```python
from pypws.calculations import VesselLeakCalculation, VesselStateCalculation
from pypws.entities import DischargeParameters, Leak, Material, MaterialComponent, State, Vessel
from pypws.enums import ResultCode, TimeVaryingOption, VesselShape

# Define the material contained by the vessel.
material = Material(material_name, [MaterialComponent(material_name, 1.0)])

# Define the initial state of the vessel.
state = State(temperature=state_temperature, pressure=state_pressure, liquid_fraction=0.0)

# Create a vessel state calculation using the material and state.
vessel_state_calculation = VesselStateCalculation(material, state)

# Run the vessel state calculation.
vessel_state_calculation.run()

# Create a vessel entity and pass in the results from the VesselStateCalculation.
vessel = Vessel(state=vessel_state_calculation.output_state, material=vessel_state_calculation.material, vessel_conditions=vessel_state_calculation.vessel_conditions, diameter=6.0, length=10.0, shape=VesselShape.HORIZONTAL_CYLINDER, liquid_fill_fraction_by_volume=0.0)

# Create a leak to use in the vessel leak calculation.
# The leak has a hole of diameter of 50mm but we specify it as 0.05 as all calculations are performed using
# SI units which in this case is metres.  The hole height fraction is set to 0.0 which corresponds to the
# bottom of the vessel.  The time varying option is set topytest initial rate.
leak = Leak(hole_diameter=0.05, hole_height_fraction=0.0, time_varying_option=TimeVaryingOption.INITIAL_RATE)

# Create discharge parameters to use in the vessel leak calculation taking all the default values.
discharge_parameters = DischargeParameters()

# Create a vessel leak calculation using the vessel, leak, and discharge parameters.
vessel_leak_calculation = VesselLeakCalculation(vessel, leak, discharge_parameters)

# Run the vessel leak calculation.
result_code = vessel_leak_calculation.run()

if resultCode == ResultCode.SUCCESS:
    print('SUCCESS: vessel_leak_calculation')
else:
    print(f'FAILED vessel_leak_calculation with result code {resultCode}')
    assert False

# Print any messages.
if len(vessel_leak_calculation.messages) > 0:
    print('Messages:')
    for message in vessel_leak_calculation.messages:
        print(message)
```

Note that each calculation returns a "Result Code" which can be used to check whether the calculation was successful.  In the event of a failed calculation another property (messages) of the calculation instance can be inspected to display possible reasons for the failed calculation.  These two features are only shown for the vessel_leak_calculation for reasons of brevity.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pypws",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "CPQRA, Consequence Analysis, DNV, Discharge, Dispersion, Explosion, Fire, Flammable, Gas, Hazard, Phast, QRA, Toxic",
    "author": null,
    "author_email": "DNV <software.support@dnv.com>",
    "download_url": "https://files.pythonhosted.org/packages/42/cc/803447c8a2727e6628e378338580493bce68ba033fa87a14e3af8514b413/pypws-4.1.6.tar.gz",
    "platform": null,
    "description": "# PHAST WEB SERVICES\n\n## Introduction\n\nPhast is the world's most comprehensive process hazard analysis software which models the progress of a potential incident from the initial release to far-field dispersion including modelling of pool spreading and evaporation and resulting flammable and toxic effects. In Phast Web Services we have taken the same state of the art consequence modelling calculations and made them available as web services so you can use them in your own applications.\n\n## Consequence analysis\n\nPhast Web services and Python PWS have been developed to enable you to call Phast consequence calculations from within your own Python scripts.\n\nWe have services available for a wide range of consequence calculations:\n\n- Discharge\n- Toxic/flammable gas dispersion\n- Fire and explosion modelling\n- Various supporting, utility calculations\n\n## Reference documentation\nA detailed reference document for using PyPWS can be found [here](https://pwsassets.blob.core.windows.net/prod/PyPws.pdf).\n\n## Getting started\nIn order to create a Python script that is able to call the Phast Web Services calculations you will need to obtain an access token from DNV.  \n\n\n## Sample Python code to perform a vessel leak calculation\nIn the following example the **VesselLeakCalculation** is used to predict the release of Methane from a 50mm hole in a horizontal vessel.  In order to get the correct conditions within the vessel the **VesselStateCalculation** is called first and the results from this are passed to the **VesselLeakCalculation** to correctly set it up.\n\n```python\nfrom pypws.calculations import VesselLeakCalculation, VesselStateCalculation\nfrom pypws.entities import DischargeParameters, Leak, Material, MaterialComponent, State, Vessel\nfrom pypws.enums import ResultCode, TimeVaryingOption, VesselShape\n\n# Define the material contained by the vessel.\nmaterial = Material(material_name, [MaterialComponent(material_name, 1.0)])\n\n# Define the initial state of the vessel.\nstate = State(temperature=state_temperature, pressure=state_pressure, liquid_fraction=0.0)\n\n# Create a vessel state calculation using the material and state.\nvessel_state_calculation = VesselStateCalculation(material, state)\n\n# Run the vessel state calculation.\nvessel_state_calculation.run()\n\n# Create a vessel entity and pass in the results from the VesselStateCalculation.\nvessel = Vessel(state=vessel_state_calculation.output_state, material=vessel_state_calculation.material, vessel_conditions=vessel_state_calculation.vessel_conditions, diameter=6.0, length=10.0, shape=VesselShape.HORIZONTAL_CYLINDER, liquid_fill_fraction_by_volume=0.0)\n\n# Create a leak to use in the vessel leak calculation.\n# The leak has a hole of diameter of 50mm but we specify it as 0.05 as all calculations are performed using\n# SI units which in this case is metres.  The hole height fraction is set to 0.0 which corresponds to the\n# bottom of the vessel.  The time varying option is set topytest initial rate.\nleak = Leak(hole_diameter=0.05, hole_height_fraction=0.0, time_varying_option=TimeVaryingOption.INITIAL_RATE)\n\n# Create discharge parameters to use in the vessel leak calculation taking all the default values.\ndischarge_parameters = DischargeParameters()\n\n# Create a vessel leak calculation using the vessel, leak, and discharge parameters.\nvessel_leak_calculation = VesselLeakCalculation(vessel, leak, discharge_parameters)\n\n# Run the vessel leak calculation.\nresult_code = vessel_leak_calculation.run()\n\nif resultCode == ResultCode.SUCCESS:\n    print('SUCCESS: vessel_leak_calculation')\nelse:\n    print(f'FAILED vessel_leak_calculation with result code {resultCode}')\n    assert False\n\n# Print any messages.\nif len(vessel_leak_calculation.messages) > 0:\n    print('Messages:')\n    for message in vessel_leak_calculation.messages:\n        print(message)\n```\n\nNote that each calculation returns a \"Result Code\" which can be used to check whether the calculation was successful.  In the event of a failed calculation another property (messages) of the calculation instance can be inspected to display possible reasons for the failed calculation.  These two features are only shown for the vessel_leak_calculation for reasons of brevity.",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python library supporting Phast Web Services",
    "version": "4.1.6",
    "project_urls": {
        "Homepage": "https://plantwebservices.dnv.com",
        "Phast Desktop": "https://www.dnv.com/software/services/plant/consequence-analysis.html",
        "Reference help": "https://pwsassets.blob.core.windows.net/prod/PyPws.pdf"
    },
    "split_keywords": [
        "cpqra",
        " consequence analysis",
        " dnv",
        " discharge",
        " dispersion",
        " explosion",
        " fire",
        " flammable",
        " gas",
        " hazard",
        " phast",
        " qra",
        " toxic"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9fa3f7cfe2f4cd3018b95e09d2cb4e9b89e521d61dcb161c56285c2c27f1ee85",
                "md5": "962b3c99f208110d4cc1bb5a7c20de52",
                "sha256": "e9c333ca6d97352e167c52456903e840a5759c18c3e2080cd2f10edc41097c95"
            },
            "downloads": -1,
            "filename": "pypws-4.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "962b3c99f208110d4cc1bb5a7c20de52",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 110241,
            "upload_time": "2024-07-26T11:44:12",
            "upload_time_iso_8601": "2024-07-26T11:44:12.594536Z",
            "url": "https://files.pythonhosted.org/packages/9f/a3/f7cfe2f4cd3018b95e09d2cb4e9b89e521d61dcb161c56285c2c27f1ee85/pypws-4.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "42cc803447c8a2727e6628e378338580493bce68ba033fa87a14e3af8514b413",
                "md5": "e7b3077e0017f639f72ab75a4c2fd4b0",
                "sha256": "4120a64da392c3d3338e600fee122c8d55707671a65cb2833ee581910c29f7b1"
            },
            "downloads": -1,
            "filename": "pypws-4.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "e7b3077e0017f639f72ab75a4c2fd4b0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 204880,
            "upload_time": "2024-07-26T11:44:14",
            "upload_time_iso_8601": "2024-07-26T11:44:14.314031Z",
            "url": "https://files.pythonhosted.org/packages/42/cc/803447c8a2727e6628e378338580493bce68ba033fa87a14e3af8514b413/pypws-4.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-26 11:44:14",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pypws"
}
        
Elapsed time: 0.33066s