npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dnv-plant/typescriptpws

v1.0.95

Published

Integrate Phast models with our versatile APIs for enhanced customization and efficiency.

Downloads

220

Readme

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 TypeScript PWS have been developed to enable you to call Phast consequence calculations from within your own TypeScript files.

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 Phast Web Services can be found here.

Getting started

In order to call the Phast Web Services calculations you will need to obtain an access token from DNV.

Sample 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.

import { VesselLeakCalculation, VesselStateCalculation } from "@dnv-plant/typescriptpws";
import { DischargeParameters, Leak, Material, MaterialComponent, State, Vessel } from "@dnv-plant/typescriptpws";
import { ResultCode, TimeVaryingOption, VesselShape } from "@dnv-plant/typescriptpws";

// Define the material contained by the vessel.
const material = new Material("METHANE", [new MaterialComponent("METHANE", 1.0)]);

// Define the initial state of the vessel.
const pressure = 2000000; // Pa
const temperature = 300; // K
const liquidFraction = 0.0;

const myState = new State(pressure, temperature, liquidFraction);

// Create a vessel state calculation using the material and state.
const vesselStateCalculation = new VesselStateCalculation();
vesselStateCalculation.material = material;
vesselStateCalculation.materialState = myState;

// Run the vessel state calculation.
vesselStateCalculation.run();

// Create a vessel entity and pass in the results from the VesselStateCalculation.
const vessel = new Vessel();
vessel.material = material;
vessel.state = myState;
vessel.vesselConditions = vesselStateCalculation.vesselConditions;

// Create a leak to use in the vessel leak calculation.
// The leak has a hole diameter of 50mm (0.05m). The hole height fraction is set to 0.0, which corresponds to the
// bottom of the vessel. The time-varying option is set to initial rate.
const leak = new Leak();
leak.holeDiameter = 0.05;
leak.holeHeightFraction = 0.0;
leak.timeVaryingOption = TimeVaryingOption.INITIAL_RATE;

// Create discharge parameters to use in the vessel leak calculation taking all the default values.
const dischargeParameters = new DischargeParameters();

// Create a vessel leak calculation using the vessel, leak, and discharge parameters.
const vesselLeakCalculation = new VesselLeakCalculation();
vesselLeakCalculation.vessel = vessel;
vesselLeakCalculation.leak = leak;
vesselLeakCalculation.dischargeParameters = dischargeParameters;

// Run the vessel leak calculation.
const resultCode = vesselLeakCalculation.run();

if (resultCode === ResultCode.SUCCESS) {
    console.log('SUCCESS: vesselLeakCalculation');
} else {
    console.log(`FAILED vesselLeakCalculation with result code ${resultCode}`);
    throw new Error(`Vessel leak calculation failed with result code ${resultCode}`);
}

// Print any messages.
if (vesselLeakCalculation.messages.length > 0) {
    console.log('Messages:');
    vesselLeakCalculation.messages.forEach((message: string) => console.log(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 vesselLeakCalculation for reasons of brevity.