# Scale scenario

### Request payload

```json
{
    "method": "scalechem.mixerCalculation",
    "params": {
        "name": "mixer",
        "chemistryModel": "mixerChemistry",
        "externalStreams": [...<snip>...],
        "inletInputs": [...<snip>...],
        "scenarios": [...<snip>...]
    }
}
```

| **params**      | type             | description                                                                                                                                         |
| --------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| name            | string           | name of output stream                                                                                                                               |
| chemistryModel  | string           | [chemistry model file (dbs) name](https://devdocs.olisystems.com/oli-scalechem-api/main-methods/..#chemistry-model) for scale scenario calculations |
| externalStreams | array of objects | [inputs for external streams](#external-streams)                                                                                                    |
| inletInputs     | array of objects | [flow rate specifications for mixer inlet streams](#undefined)                                                                                      |
| scenarios       | array of objects | [scale scenario specification](#undefined)                                                                                                          |

After combining all inlet streams, this calculation performs a series of calculations in the locations specified as below, where the outlet of each location is passed as the inlet to the next location.

### Scale scenario inputs

```json
{
    "method": "scalechem.mixerCalculation",
    "params": {
        ...<snip>...,
        "scenarios": [
        {
            "location": "Stock tank",
            "temperature": {
                "unit": "°C",
                "value": 20
            },
            "pressure": {
                "unit": "bar",
                "value": 2
            }
        },
        {
            "location": "Stock tank",
            "temperature": {
                "unit": "°C",
                "value": 15
            },
            "pressure": {
                "unit": "bar",
                "value": 1.5
            },
            "dropSolids": true
        },
        ...<snip>...
        ]
    }
}
```

|                           |                                                                |                                                                                                                                |
| ------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| **params.scenarios\[{}]** | type                                                           | description                                                                                                                    |
| location                  | string                                                         | location name                                                                                                                  |
| temperature               | [valueObject](https://devdocs.olisystems.com/terms-definition) | specified temperature with [unit](https://devdocs.olisystems.com/input-unit-set)                                               |
| pressure                  | [valueObject](https://devdocs.olisystems.com/terms-definition) | specified pressure with [unit](https://devdocs.olisystems.com/input-unit-set)                                                  |
| dropSolids                | boolean                                                        | optional. If specified as true, all solids in the outlet are removed when passing as inlet to next location. Default is false. |

### Additional input

{% hint style="info" %}
In addition to the inputs shown above, some optional properties may also be specified. They can be viewed [here](https://devdocs.olisystems.com/optional-inputs).
{% endhint %}

### Response (status = PROCESSED)

```json
{
    "code": 200,
    "result": {
       "external stream 1": {...<snip>...},
       "external stream 2": {...<snip>...},
       ...<snip>...,
       "scenarioOutputs": [
       {
          "location": "Stock tank", 
          "result": {...<snip>...}
       },
       ...<snip>...
       ]
    },
    "message": "Results returned successfully", 
    "status": "PROCESSED"
}
```

The "result" contains all [stream outputs ](https://devdocs.olisystems.com/stream-output-json)for each external stream. Results of each location are listed as an array of objects in **result.scenarioOutputs**, with location and result of corresponding [stream output](https://devdocs.olisystems.com/stream-output-json).

by their names specified in the input.

### 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/temperature/value"                                                                                                         |
| "/params/pressure/value"                                                                                                            |
| "/params/inletInputs/***i***/totalAmount/value" where ***i*** is the index (0 based) of the **params.inletInputs** array of objects |
| "/params/scenarios/***i***/temperature/value" where ***i*** is the index (0 based) of the **params.scenarios** array of objects     |
| "/params/scenarios/***i***/pressure/value" where ***i*** is the index (0 based) of the **params.scenarios** array of objects        |
