Class FlashRequest

java.lang.Object
neqsim.mcp.model.FlashRequest

public class FlashRequest extends Object
Typed request model for flash calculations.

Represents the input for a flash calculation with all parameters as typed fields. Supports deserialization from JSON via the fromJson(JsonObject) factory, or direct construction via the builder pattern.

JSON format:

{ "model": "SRK", "temperature": {"value": 25.0, "unit": "C"}, "pressure": {"value":
50.0, "unit": "bara"}, "flashType": "TP", "components": {"methane": 0.85, "ethane": 0.10,
"propane": 0.05}, "mixingRule": "classic" } 
Author:
Even Solbraa @version 1.0
  • Field Details

  • Constructor Details

    • FlashRequest

      public FlashRequest()
      Default constructor. Creates a request with default values (SRK, TP, 15C, 1 atm, classic).
  • Method Details

    • fromJson

      public static FlashRequest fromJson(com.google.gson.JsonObject root)
      Parses a FlashRequest from a parsed JsonObject.
      Parameters:
      root - the parsed JSON
      Returns:
      the populated FlashRequest
    • getModel

      public String getModel()
      Gets the thermodynamic model name.
      Returns:
      the model (e.g., "SRK", "PR", "CPA")
    • setModel

      public FlashRequest setModel(String model)
      Sets the thermodynamic model name.
      Parameters:
      model - the model name
      Returns:
      this request for chaining
    • getTemperature

      public ValueWithUnit getTemperature()
      Gets the temperature specification.
      Returns:
      the temperature with unit
    • setTemperature

      public FlashRequest setTemperature(ValueWithUnit temperature)
      Sets the temperature specification.
      Parameters:
      temperature - the temperature with unit
      Returns:
      this request for chaining
    • getPressure

      public ValueWithUnit getPressure()
      Gets the pressure specification.
      Returns:
      the pressure with unit
    • setPressure

      public FlashRequest setPressure(ValueWithUnit pressure)
      Sets the pressure specification.
      Parameters:
      pressure - the pressure with unit
      Returns:
      this request for chaining
    • getFlashType

      public String getFlashType()
      Gets the flash type.
      Returns:
      the flash type (e.g., "TP", "PH", "PS")
    • setFlashType

      public FlashRequest setFlashType(String flashType)
      Sets the flash type.
      Parameters:
      flashType - the flash type
      Returns:
      this request for chaining
    • getComponents

      public Map<String,Double> getComponents()
      Gets the component map (name to mole fraction).
      Returns:
      the component map
    • setComponents

      public FlashRequest setComponents(Map<String,Double> components)
      Sets the component map.
      Parameters:
      components - the component map
      Returns:
      this request for chaining
    • addComponent

      public FlashRequest addComponent(String name, double moleFraction)
      Adds a component with mole fraction.
      Parameters:
      name - the component name
      moleFraction - the mole fraction
      Returns:
      this request for chaining
    • getMixingRule

      public String getMixingRule()
      Gets the mixing rule.
      Returns:
      the mixing rule string
    • setMixingRule

      public FlashRequest setMixingRule(String mixingRule)
      Sets the mixing rule.
      Parameters:
      mixingRule - the mixing rule
      Returns:
      this request for chaining
    • getEnthalpy

      public ValueWithUnit getEnthalpy()
      Gets the enthalpy specification (for PH flash).
      Returns:
      the enthalpy with unit, or null if not set
    • setEnthalpy

      public FlashRequest setEnthalpy(ValueWithUnit enthalpy)
      Sets the enthalpy specification.
      Parameters:
      enthalpy - the enthalpy with unit
      Returns:
      this request for chaining
    • getEntropy

      public ValueWithUnit getEntropy()
      Gets the entropy specification (for PS flash).
      Returns:
      the entropy with unit, or null if not set
    • setEntropy

      public FlashRequest setEntropy(ValueWithUnit entropy)
      Sets the entropy specification.
      Parameters:
      entropy - the entropy with unit
      Returns:
      this request for chaining
    • getVolume

      public ValueWithUnit getVolume()
      Gets the volume specification (for TV flash).
      Returns:
      the volume with unit, or null if not set
    • setVolume

      public FlashRequest setVolume(ValueWithUnit volume)
      Sets the volume specification.
      Parameters:
      volume - the volume with unit
      Returns:
      this request for chaining