Tech Note

Title:               Environmental Emissions in the Simulation Object Model (SOM)
Date:              June 17, 2005
Written by:     Peter Bosch
Number:        TN-014
Version:         0.7

emissions decision treeExecutive Summary

In order for emissions to run in a given Task in the SOM, the application’s config file must contain an Emissions section, in which the emissions service is explicitly enabled. The SOMModel’s and individual SOMTask’s EmissionsEnabled property must be true. The SomTask’s  InferEmissions property can be set to true or to false. If false, the application will need to explicitly request emissions through the SOMTask’s emissions helper. If true, there are a few cases where inference rules fall short and the application will need to call the SOMTask’s SetOpType(…) API.

 

Introduction

Our goal is to enable a running model to predict the quantity and temporal distribution of emissions to the environment, in order to (a) enable planners to predict and manage the emissions profile, and (b) help generate reports that will satisfy client’s obligations to the EPA.

We will enable a SOM model execution to generate a set of emission records from which can be determined the times, sources, ports-of-egress, and amounts of specific substances of interest (SOIs) that were emitted from the model. This set of emission records will be stored with the rest of the model’s material transfer records in the model’s MaterialTransferList.

Further, we intend to impose minimal requirements for provisioning on the modeler &/or operation step writer by using some heuristics to infer what emissions operations should be performed on any given SOMTask, and what values its required parameters should take on.

Background

The existing emissions service accepts an initial mixture, an emissions model specification (e.g. “Heat”, “Fill”, “Gas Sweep”, etc.) and parameters (either late-bound specified as string pairs, or early-bound specified as method arguments) necessary to that model. After running the requested model, the service returns an emitted mixture, optionally modifying the initial mixture to reflect the emitted mixture’s removal. We use this service to compute the emissions from SOMOperations and generate MaterialTransferRecords that reflect these emissions.

Approach

Controlling Emissions

There are five ways that emissions can be enabled or disabled. If the emissions service section of the Catalyst.exe.ini file is omitted, or if the “Enabled” element is present and set to ‘false’ (see Emissions config data sample below), then emissions calculations throughout the model are turned off.

If the SOMModel.EmissionsEnabled property is set to false (default is true), then emissions calculations throughout the model are turned off.

If a SOMTask’s EmissionsEnabled property is set to false (default is true), then emissions calculations throughout that task are turned off.

If a SOMTask’s EmissionsEnabled property is true, then there are two ways that emissions will be executed.

If a SOMTask’s InferEmissions property is true (the default), the SOM will do its best (see ModelInference table below) to determine what emissions models are appropriate and should therefore be run – and with what parameters. How it makes those determinations is listed below, under the sections titled “Model Inference” and “Parameter Inference” However, there are several operations that cannot be inferred, or for which some parameters cannot be inferred. In these operations (Purge, N2Blanket or other Gas Sweep, and Dry), the modeler must call the SOMTask’s SetOpType(…) API as described below under the sections titled “SetOpType Operation Types & Parameter Lists”. This API can also be called to specify an explicit mixture for emission via the Mass Balance

If a SOMTask’s InferEmissions property has been set to false, then only those emissions models explicitly requested via the EmissionsHelper’s ApplyXXXXXModel(…) will be run. See the section entitled “Explicit Model Request APIs.” In this case, of course, if no emissions models are explicitly requested, then none will run, and emissions are, effectively, disabled.

Emissions Helper

An Emissions Helper exists on the SOMTask as a named entity. Its retrieval API is defined below. Through this helper in any given SOMTask, code can (on a per-batch basis) request the running of specific emissions models, clear all preceding submitted requests, and control whether emissions are to be automatically inferred for that operation step. When making a request for a specific model, the caller may also specify values for some or all of the parameters required for the requested model. Those that are not specified will be inferred using the parameter value inference rules described below. If emissions models are to be automatically inferred, then the SOMTask will use the model inference rules described below.

A Word about Units

The emissions service uses Meters, Kilograms and Seconds in its calculations (while calculations are in seconds, time input is in minutes). The modeler uses SCFM, Bar, Kg, degrees C, and others – so in some cases, conversions may need to be done in order to properly provision the SOM. There are four ways that such provisioning occurs.

1.)    Through the modeler setting named model properties such as SOMModel.DefaultAmbientPressureInBar. These parameters are named to indicate the units they expect, and the SOM converts as necessary when it uses them. 

2.)    Through entries in UnitState. The SOM expects these in the current modeler-defined units, degrees C, Bar.

3.)    Through the explicitly-named API of the EmissionsHelper – these look like EmissionsHelper.ApplyXXXXXModel(…) In these cases, intellisense will provide the argument names, and they are suffixed such that the expected units should be clear. (_KG, _MIN, _P, …)

4.)    Through the prescribed names for NameValuePairs in the EmissionsHelper. These are listed in the Parameter Inference section below, and should be clear as well.

5.)    Through the SetOpType parameters. These parameters’ names are also suffixed such that they should be clear (StartPressureInBar, GasSweepRateSCFM, …)

SOMModel and SOMTask APIs Relevant To Emissions

GetEmissionsHelper

This API retrieves the emissions helper called “Final” from the specified SOMTask. If there is no such named Emissions Helper, it returns <null>. Note that the key “Final” is the only one present, currently.

SOMB_EmissionsHelper SOMTask.GetEmissionsHelper(“Final”);

Once the emissions helper has been retrieved, its explicit emission model APIs may be called. These APIs’ names and purposes are shown below, and their complete parameters

ApplyAirDryModel

Overloaded. Applies the air dry model.

ApplyEvacuateModel

Overloaded. Applies the evacuate model.

ApplyFillModel

Overloaded. Applies the fill model.

ApplyGasEvolutionModel

Overloaded. Applies the gas evolution model.

ApplyGasSweepModel

Overloaded. Applies the gas sweep model.

ApplyMassBalanceModel

Overloaded. Applies the mass balance model.

ApplyPressureTransferModel

Overloaded. Applies the pressure transfer model.

ApplyVacuumDistillationModel

Overloaded. Applies the vacuum distillation model.

ApplyVacuumDistillationWithScrubberModel

Applies the vacuum distillation with scrubber model.

ApplyVacuumDryModel

Overloaded. Applies the vacuum dry model.

 

SOMModel.EmissionsEnabled

This API enables and disables emissions throughout the model. It defaults to true.

bool SOMModel.EmissionsEnabled { set; get; }

SOMTask.EmissionsEnabled

This API enables and disables emissions in the specific SOMTask. It defaults to true.

bool SOMTask.EmissionsEnabled { set; get; }

SOMTask.SetDefaultEmissionsPort

This API declares the port (assumed, but not required, to be a vent port) that will be used to receive any inferred emissions for which the port cannot otherwise be determined. For a mass-balance emission that is specified by a transfer spec, the port can be determined from the TransferSpec.

bool SOMTask.SetDefaultEmissionsPort(Guid portGuid)

SOMTask.InferEmissions

This API enables and disables automatic inference of which emissions models are to be run in the specific SOMTask. It defaults to true.

bool SOMTask.InferEmissions { set; get; }

If the SOMTask needs to infer which emissions models to run (emissions at the model level, and on the local SOMTask are enabled, and the emissions helper has not been explicitly told not to infer emissions), then the following rules will be used to infer which models are to run, and which port to use for emissions. The model-selection parameters are located on the SOMB_EmissionsHelper.

M_AIR_DRY

This model will be performed if operation type has been provided via SetOpStep(...) to "Dry" and Vacuum Control is not enabled.

M_VACUUM_DRY

This model will be performed if operation type has been provided via SetOpStep(...) to "Dry" and VacuumControl is enabled.

M_EVACUATE

This model will be performed if the operation is a Purge operation.

M_FILL

This model will be performed if a transfer-in is being performed.

M_GAS_EVOLUTION

This model will be performed if any reaction produced gas.

M_GAS_SWEEP

This model will be performed if operation type has been provided via SetOpStep(...) to "GasSweept"

M_MASS_BALANCE

This model will be performed if a transfer out spec has been provided on any gaseous non-product port.

M_PRESSURE_TRANSFER

This model will be performed if a transfer-out is being performed.

M_VACUUM_DISTILL

This model will be performed if the operation is a SOMDistillOperation and VacuumControl is enabled.

M_VACUUM_DISTILL_W_SCRUBBER

This model will be performed if the operation is a SOMDistillOperation and VacuumControl is disabled.

If the emissions helper has been told to infer emissions, then the values of parameters are discerned (or must be provided) according to the following rules.

 

ControlTemperature_K

CANNOT CURRENTLY BE INFERRED: Will use new CondenserTemperature value from Unit State.

FinalTemperature_K

Inferred by the temperature of the mixture at the start of the operation. If there is no mixture, we will assume ambient as read from the model.

InitialTemperature_K

Inferred by the temperature of the mixture at the start of the operation. If there is no mixture, we will assume ambient as read from the model.

FillVolume_M3

Inferred by the volume of the inflow mixture.

InitialPressure_P

Inferred by final pressure existent in the operation before this one. If there is no preceding operation, we will assume ambient as read from the SOMModel.

FinalPressure_P

Inferred by final pressure existent in this operation unless the operation is a VACUUM_DISTILL_W_SCRUBBER, in which case it is the SOMModel-defined Ambient Pressure.

GasSweepDuration_Min

Inferred by the duration of the entire operation.

GasSweepRate_M3perMin

CANNOT CURRENTLY BE INFERRED : Will use SetOpType(GasSweep,newNameValuePair("GasSweepRateSCFM",123.456); (See Appendix 3)

MolesOfGasEvolved

Inferred by (a) the presence of a reaction in this opStep, and (b) one or more of the products being gaseous.

AirLeakRate_KgPerMin

CANNOT CURRENTLY BE INFERRED: Will use new "AirLeakRateInSCFM" SOMModel-level property, converting accordingly.

AirLeakDuration_Min

Inferred by the duration of the entire operation.

VacuumSystemPressure_P

Inferred by the unit state variable, “VacuumSystemPressure”. The SOM will convert from Bar to Pascals.

SystemPressure_P

Inferred by final pressure existent in this operation.

MassOfDriedProductCake_Kg

Provided in call to SetOpType(“Dry”, …) (See below for arguments)

MaterialToAdd

This is inferred from any provided charge material.

DesiredEmission

This is inferred from any amount of material discharged from a gas port that is not declared as a product port.

MaterialGuidToVolumeFraction

Provided in call to SetOpType(“Dry”, …) (See below for arguments)

SOMTask.SetOpType

If you tell the SOM to infer emissions, then on certain types of operations, you need to give it information that it cannot otherwise infer.  This API tells the SOMTask what kind of operation it is, and provides needed parameters to describe aspects of that operation that are needed for correct inference & behavior of emissions models. The specific operations that need either explicit indication or extra parameters are provided below. If the required NameValuePairs are not provided (they are documented in the XML documentation – and therefore the help file), an ArgumentException will be thrown. See appendix 3 of this document for the values that are needed.

void SOMTask.SetOpType(SOMTask.OpType opType, params NameValuePair[] parameters);

In order to call this API, you use one of the SOMType.OpType specifiers, along with an array of Highpoint.VR.Utility.NameValuePair instances. The name is obtained as one of the values on SOMTask.EmissionsOpTypeParamNames, and the value is the type and specified units shown below.

OpType

Name

Value

Purge

PURGE_START_PRESSURE_IN_BAR

double StartPressureInBar

PURGE_END_PRESSURE_IN_BAR

double EndPressureInBar

PURGE_CYCLE_COUNT

int CycleCount

N2Blanket (or other Gas Sweep)

GAS_SWEEP_RATE_SCFM

double GasSweepRateSCFM

Dry

DRY_MASS_OF_DRIED_PRODUCT_CAKE

double MassOfDriedProductCake_kg

DRY_MATERIAL_GUID_TO_VOLUME_FRACTION

Hashtable MaterialGuidToVolumeFraction

MassBalance

MASS_BALANCE_MIXTURE

Mixture MaterialToAdd

The MaterialGuidToVolumeFraction hashtable is a hashtable with one entry per material in the mixture being dried. Each entry’s key is the material type guid known to the SOM (which is currently the same as the one in the modeler) and the value is the volume fraction of that material in the dried product cake.

SOMTask.SetPortUsage

This API tells the SOMTask (and thereby the emissions helper) what the purpose of the specified port is. If no information is provided for a given port, it is assumed to be non-product, and for transfers of materials with unknown material state. In creating inferred emissions, the last-defined port with gas as its material state, and nonProduct usage is the assumed vent port for the emissions.

void SOMTask.SetPortUsage(Guid portGuid, bool isProduct, MaterialState solLiqGasUnk);

SOMModel.DefaultAmbientPressureInBar

This API tells the SOMModel the ambient pressure it is to use if it cannot determine a vessel’s pressure (e.g. determining initial pressure for the first opStep in a Unit). It defaults to 1.0, but if it has not been set, a ModelWarning will be generated.

double SOMModel.DefaultAmbientPressureInBar { get; set; }

SOMModel.DefaultAirLeakRateInSCFM

This API tells the SOMModel the default Air Leak Rate in Standard Cubic Feet per Minute (SCFM) it is to use if it is not explicitly provided one for a given model – this value defaults to 0.0.

double SOMModel.DefaultAirLeakRateInSCFM { get; set; }

Required New Unit State Variables

The modeler must provide “CondenserTemperature” (in degrees C) and “VacuumSystemPressure” (in Bar) in the SOMEquipment’s UnitState. We will use their values if they are present, and if they are not, will use 5 degrees C and 0.0 Bar, respectively – and log a ModelWarning.


Appendix 1 : Emissions Service Configuration Section

<EmissionsService>

   <Enabled>true</Enabled>

   <PermitOverEmission>false</PermitOverEmission>

   <PermitUnderEmission>false</PermitUnderEmission>

   <IgnoreUnknownModelTypes>false</IgnoreUnknownModelTypes>

   <Enabled>true</Enabled>

   <Models>

       <Model

       assembly="VR_Sim, Version=1.0.*,Culture=neutral,PublicKeyToken=null"

       type="Highpoint.VR.Chemistry.Emissions.AirDryModel"

       signed="false"

       encrypted="false"/>

       <!—Data omitted for ten emissions models: EvacuateModel, FillModel, GasEvolutionModel,

          GasSweepModel, HeatModel, MassBalanceModel, NoEmissionModel, VacuumDistillationModel,   

          VacuumDistillationWScrubberModel, VacuumDryModel. A sample config section will be

          written to console as a suggestion, if there is not one in the config file. -->

       <Model

       assembly="VR_Sim, Version=1.0.*,Culture=neutral,PublicKeyToken=null"

       type="Highpoint.VR.Chemistry.Emissions.PressureTransferModel"

       signed="false"

       encrypted="false"/>

   </Models>

</EmissionsService>

 

Appendix 4 : Emission Models’ Required Parameters

emission models

Note: SystemPressure and VacuumSystemPressure are used identically in the emissions models – the reason for separate parameters is the difference in their sources from the supplying SOM Model.