# Inflows input

This page explains the **params.inflows** object that is required as an input for most flash calculations.&#x20;

### JSON input (example)

```javascript
    "params": {
        ...<snip>...
        "inflows": {
            "unit": "mol",
            "values": {
                "H2O": 50.0,
                "BENZENE": 10.0,
                "CH4": 20.0,
                "NAOH": 35.0
            },
            "totalAmount": {
                "value": 3402.68,
                "unit": "g"
            }
        }
        ...<snip>...
    }
```

<table data-header-hidden><thead><tr><th width="177.87372218881546">params.inflows</th><th width="154.33333333333331">type</th><th>description</th></tr></thead><tbody><tr><td>params.inflows</td><td>type</td><td>description</td></tr><tr><td>unit</td><td>string</td><td>unit for inflows</td></tr><tr><td>values</td><td>object</td><td>the amount of each inflow specified as <strong>"inflow_name": number</strong>. Species with zero amount need not be specified.</td></tr><tr><td>totalAmount</td><td><a href="terms-definition">valueObject</a></td><td>optional total stream amount</td></tr></tbody></table>

{% hint style="warning" %}
**params.inflows.totalAmount** is optional. However, when it's specified and conflicts with the summation of inflows, the totalAmount takes priority, and **params.inflows.values** are normalized proportionally.
{% endhint %}

### Units in batch systems

| unit types    | units                                                             |
| ------------- | ----------------------------------------------------------------- |
| moles         | mol, nmol, kgmol, nanomol, lbmol, micromol, µmol, mmol, (mol/100) |
| mole fraction | `mol/mol, mole %, ppm (mole)`                                     |
| mass          | mg, kg, nanog, lb, µg, microg, ng, g, tonne, (g/100)              |
| mass fraction | `g/g, mass %, ppm (mass)`                                         |

{% hint style="info" %}
**params.inflows.unit** can be specified from any units as listed in the above table.&#x20;
{% endhint %}

### Units in flowing systems

Unit types of moles and mass can be specified in flowing system by dividing a time unit, i.e. "mol/hr". Available time units are "s", "min", "hr", "day", "yr".&#x20;

### Unit consistency between inflows and total amount

Unit for **params.inflows.totalAmount** needs to be consistent with inflows as explained below:

| **params.inflows.unit**         | **params.inflows.totalAmount.unit**                                                                                                                                 |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| moles or mass in batch system   | Optional. If specified, it can be any moles or mass units in batch system. And **params.inflows** will be scaled to match the total amount.                         |
| moles or mass in flowing system | Optional. If specified, it can be any moles or mass units in flowing system. And **params.inflows** will be scaled to match the total amount.                       |
| mole fraction or mass fraction  | Optional. If specified, it can be any moles or mass units in batch or flowing system. If not specified, a total amount of 100 mole in batch system will be assumed. |

### Normalize option (optional)

{% tabs %}
{% tab title="prorate" %}

```json
    "params": {
        ...<snip>...
        "inflows": {
            "unit": "mole %",
            "values": {
                "H2O": 50.0,
                "BENZENE": 10.0,
                "CH4": 20.0,
                "NAOH": 35.0
            },
            "normalize": {
                "option": "prorate"
            }
        }
        ...<snip>...
    }    
```

{% endtab %}

{% tab title="make up component" %}

```json
    "params": {
        ...<snip>...
        "inflows": {
            "unit": "mole %",
            "values": {
                "H2O": 50.0,
                "BENZENE": 10.0,
                "CH4": 20.0,
                "NAOH": 35.0
            },
            "normalize": {
                "option": "makeup",
                "makeupComponent": "CH4"
            }
        }
        ...<snip>...
    }   
```

{% endtab %}
{% endtabs %}

When specified from mole fraction units, inflow values will be normalized if they don't add up to 100%. Different normalization options could be specified as below:

| params.inflows.normalize.option | description                                                                                                                                     |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| "prorate"                       | All specified inflow values will be prorated                                                                                                    |
| "makeup"                        | One inflow component will be added or removed for normalization. **params.inflows.normalize.option.makeupComponent** specifies the inflow name. |

{% hint style="info" %}
"prorate" option is used by default if **params.inflows.normalize** object is not specified.
{% endhint %}

### Survey Calculation

Survey calculation is supported for the variables below. Please refer to [Survey calculation](https://devdocs.olisystems.com/survey-calculation) for explained input schema.

| supported **params.surveyInputs\[{}].field** |
| -------------------------------------------- |
| "/params/inflows/values/*\<InflowName>*"     |
| "/params/inflows/totalAmount/value"          |

{% hint style="warning" %}
When specific inflow value(s) is changed in the survey calculation and the total amount is given, the total amount will not be modified in survey input unless it's specified. In other words, the survey calculation will only overwrite the specified value field(s) to construct a series of JSON inputs to perform single-point calculations.
{% endhint %}
