# Generic Contaminant Predictor-Corrector[LINK]

The transient air mass balance equation for the change in zone air generic contaminant concentration may be expressed as follows:

ρairVzMfordCtf,zdt=Nsource∑i=1ρairGf,i∗106−ρairNsink∑iRf,iCf,z+Nzones∑i=1˙mi(Cf,z,i−Ctf,z)+˙minf(Cf,∞−Ctf,z)+˙msys(Cf,sup−Ctf,z)+∑jhjρAj(Cs,jkj−Cf,z)+Sf(Ct−δtf,z)

where:

Nsource∑i=1ρairGf,i = Sum of internal generic contaminant loads from sources in a zone or interior surfaces.

The zone air density is used to convert the volumetric rate of generic contaminant generation from user input into mass generation rate [kg/s].The coefficient of 106 is used to make the units of generic contaminant as ppm.

ρairNsink∑iRf,iCf,z = Sum of removal rate from sinks in a zone or interior surfaces [ppm-kg/s]

∑Nzonesi=1˙mi(Cf,z,i−Ctf,z) = Generic contaminant transfer due to interzone air mixing [ppm-kg/s]

Cf,z,i = Generic contaminant concentration in the zone air being transferred into this zone [ppm]

˙minf(Cf,∞−Ctf,z) = Generic contaminant transfer due to infiltration and ventilation of outdoor air [ppm-kg/s]

Cf,∞ = Generic contaminant concentration in outdoor air [ppm]

˙msys(Cf,sup−Ctf,z) = Generic contaminant transfer due to system supply [ppm-kg/s]

Cf,sup = Generic contaminant concentration in the system supply airstream [ppm]

˙msys = Air system supply mass flow rate [kg/s]

ρairVzdCtf,zdt = Generic contaminant storage term in zone air [ppm-kg/s]

Ctf,z = Zone air generic contaminant concentration at the current time step [ppm]

ρair = Zone air density [kg/m3]

Vz = Zone volume [m3]

∑jhjρAj(Cs,jkj−Cf,z) = Generic contaminant transport through diffusion between interior surfaces and zone air

Sf(Ct−δtf,z) = Generic contaminant generation or removal rate as a function of zone air generic contaminant level at the previous time step

Mfor = Generic contaminant capacity multiplier [dimensionless] (See the InputOutput Reference for additional information on the object ZoneCapacitanceMultiplier:ResearchSpecial)

In the same manner as described above for zone air temperature (ref. Basis for the Zone and Air System Integration), the solution algorithms provided in the ZoneAirHeatBalanceAlgorithm object are also applied to the zone air carbon dioxide calculations.

In order to calculate the derivative term with respect to time, the first order backward finite difference method, defined as the EulerMethod in the ZoneAirHeatBalanceAlgorithm object, may be used:

dCtf,zdt=(δt)−1(Ctf,z−Ct−δtf,z)+O(δt)

The zone air generic contaminant concentration update at the current time step using the EulerMethod may be expressed as follows:

ρairVzMfor(δt)−1(Ctf,z−Ct−δtf,z)=Nsource∑i=1ρairGf,i∗1.06−ρairNsink∑iRf,iCf,z+Nzones∑i=1˙mi(Cf,z,i−Ctf,z)+˙minf(Cf,∞−Ctf,z)+˙msys(Cf,sup−Ctf,z)+∑jhjρAj(Cs,jkj−Cf,z)+Sf

To preserve the stability of the calculation of the zone generic contaminant concentration, the third order differential approximation, derived by a Taylor Series and used in the calculation of the next time step’s zone air temperature, is also applied to the zone air carbon dioxide calculations. This algorithm is the default choice and is defined as ThirdOrderBackwardDifference in the ZoneAirHeatBalanceAlgorithm object.

The third order derivative resulting from a Taylor Series expansion is defined as:

dCtf,zdt≈116Ctf,z−3Ct−δtf,z+32Ct−2δtf,z−13Ct−3δtf,zδt+O(δt3)

The coefficients of the approximated derivative are very close to the coefficients of the analogous Adams-Bashforth algorithm. Then the approximated derivative is substituted into the mass balance, and the terms with the carbon dioxide concentration at past time steps are all put on the right-hand side of the equation. This third order derivative zone carbon dioxide update increases the number of previous time steps that are used in calculating the new zone generic contaminant concentration and decreases the dependence on the most recent. The higher order derivative approximations have the potential to allow the use of larger time steps by smoothing transitions through sudden changes in zone operating conditions.

ρairVzMforδt(116)Ctf,z+ρairNsink∑iRf,iCtf,z+Nzones∑i=1˙miCtf,z+˙minfCtf,z+˙msysCtf,z+∑jhjρAjCtf,z=Nsource∑i=1ρairGf,i∗1.06+Nzones∑i=1˙miCf,z,i+˙minfCf,∞+˙msysCf,sup+∑jhjρAjCs,jkj+Sf−ρairVzMforδt(−3Ct−δtf,z+32Ct−2δtf,z−13Ct−3δtf,z)

This gives us the basic air mass balance equation that will be solved in two different ways, one way for the predict step and one way for the correct step.

Since the third choice of solution algorithms uses an integration approach, defined as AnalyticalSolution in the ZoneAirHeatBalanceAlgorithm object, it does not require any approximations and has no truncation errors. The solutions in both prediction and correction are provided below in detail.

## Generic Contaminant Prediction[LINK]

For the generic contaminant concentration prediction case, the equation is solved for the anticipated system response as shown below.

PredictedSystemLoad=˙msys(Cf,sup−Ctf,z)

Since the program provides three solution algorithms, the generic contaminant prediction from each solution algorithm is given below.

For this solution algorithm, the air mass balance for the predicted air system load or response is:

PredictedSystemLoad[kg/sec]=ρairVzMfor(δt)−1(Csetpoint−Ct−δtf,z)−[Nsource∑i=1ρairGf,i∗1.06−ρairNsink∑iRf,iCsetpoint+Nzones∑i=1˙mi(Cf,z,i−Csetpoint)+Sf]−[˙minf(Cf,∞−Csetpoint)+∑jhjρAj(Cs,jkj−Csetpoint)]

### ThirdOrderBackwardDifference[LINK]

For this solution algorithm, the air mass balance for the predicted system load or response is given below:

PredictedSystemLoad[kg/sec]=ρairVzMforδt(116)Csetpoint−[ρairNsink∑iRf,iCsetpoint+Nzones∑i=1˙miCsetpoint+˙minfCsetpoint]−[∑jhjρAjCsetpoint+Nsource∑i=1ρairGf,i∗1.06+Nzones∑i=1˙miCf,z,i+˙minfCf,∞+∑jhjρAjCs,jkj+Sf]+ρairVzMforδt(−3Ct−δtf,z+32Ct−2δtf,z−13Ct−3δtf,z)

### AnalyticalSolution[LINK]

For this solution algorithm, the air mass balance for the predicted air system load or response is given below:

PredictedSystemLoad[kg/sec]=[Nzones∑i=1˙mi+˙minf+ρairNsink∑iRf,i+∑jhjρAj]∗⎡⎢
⎢
⎢⎣Ctsetpoint−Ct−δtz∗exp⎛⎜
⎜
⎜⎝−Nzones∑i=1˙mi+˙minf+ρairNsink∑iRf,i+∑jhjρAjρairVZMFORδt⎞⎟
⎟
⎟⎠⎤⎥
⎥
⎥⎦∗⎡⎢
⎢
⎢⎣1−exp⎛⎜
⎜
⎜⎝−Nzones∑i=1˙mi+˙minf+ρairNsink∑iRf,i+∑jhjρAjρairVZMFORδt⎞⎟
⎟
⎟⎠⎤⎥
⎥
⎥⎦−1−(Nsource∑i=1ρairGf,i∗1.06+Nzones∑i=1˙miCf,z,i+˙minfCf,∞+∑jhjρAjCs,jkj+Sf)

At the prediction point in the simulation, the system air mass flows are not known; therefore, the system response is approximated. The predicted air system generic contaminant load is then used in the system simulation to achieve the best results possible. If a central HVAC system provides the outdoor flow rate from a Controller:MechanicalVentilation object, the outdoor airflow rate may be approximated as:

PredictedSystemLoad=˙msys(Cf,sup−Ctf,z)≈˙mOA,z(Cf,∞−Ctsetpoint)

where:

˙mOA,z = Supply outdoor airflow rate into the controlled zone [kg/s]

The above approximation is based on the assumption that the generic contaminant concentration at the outdoor air (OA) mixer inlet is equal to the zone air outlet concentration level, and the generic contaminant level at the zone supply air inlet is equal to the level at the outlet node of the OA mixer.

After the system simulation is completed, the actual response from the air system is used in the generic contaminant correction step, which is shown next.

## Generic Contaminant Correction[LINK]

For the correct step, the expanded air mass balance equation is solved for the final zone generic contaminant concentration at the current time step. In the same manner as described above for predicting the carbon dioxide load to be met by the air system, the zone air carbon dioxide correction calculation will be described individually for the three solution algorithms.

Ctf,z=Nsource∑i=1ρairGf,i∗1.06+Nzones∑i=1˙miCf,z,i+˙minfCf,∞+˙msysCf,sup+∑jhjρAjCs,jkj+ρairVZMFORCt−δtf,zδt+SfρairVzMfor(δt)−1+ρairNsink∑iRf,i+Nzones∑i=1˙mi+˙minf+˙msys+∑jhjρAj

### ThirdOrderBackwardDifference[LINK]

Ctf,z=Nsource∑i=1ρairGf,i∗1.06+Nzones∑i=1˙miCf,z,i+˙minfCf,∞+˙msysCf,sup+∑jhjρAjCs,jkj+ρairVZMFORδt(3Ct−δtf,z−32Ct−2δtf,z+13Ct−3δtf,z)+SfρairVzMfor(δt)−1(116)+ρairNsink∑iRf,i+Nzones∑i=1˙mi+˙minf+˙msys+∑jhjρAj

### AnalyticalSolution[LINK]

Ctf,z=⎡⎢
⎢
⎢⎣Ct−δtf,z−Nsource∑i=1ρairGf,i∗1.06+Nzones∑i=1˙miCf,z,i+˙minfCf,∞+˙msysCf,sys+∑jhjρAjCs,jkjNzones∑i=1˙mi+˙minf+˙msys+ρairNsink∑iRf,i+∑jhjρAj⎤⎥
⎥
⎥⎦∗exp⎡⎢
⎢
⎢⎣−Nzones∑i=1˙mi+˙minf+˙msys+ρairNsink∑iRf,i+∑jhjρAjρairVZMFORδt⎤⎥
⎥
⎥⎦+Nsource∑i=1ρairGf,i∗1.06+Nzones∑i=1˙miCf,z,i+˙minfCf,∞+˙msysCf,sys+∑jhjρAjCs,jkj+SfNzones∑i=1˙mi+˙minf+˙msys+ρairNsink∑iRf,i+∑jhjρAj

The above solutions are implemented in the Correct Zone Air Generic Contaminant step in the Zone Contaminant Predictor Corrector module of EnergyPlus.

## Generic Contaminant Predictor-Corrector[LINK]

The transient air mass balance equation for the change in zone air generic contaminant concentration may be expressed as follows:

ρairVzMfordCtf,zdt=Nsource∑i=1ρairGf,i∗106−ρairNsink∑iRf,iCf,z+Nzones∑i=1˙mi(Cf,z,i−Ctf,z)+˙minf(Cf,∞−Ctf,z)+˙msys(Cf,sup−Ctf,z)+∑jhjρAj(Cs,jkj−Cf,z)+Sf(Ct−δtf,z)

where:

Nsource∑i=1ρairGf,i = Sum of internal generic contaminant loads from sources in a zone or interior surfaces.

The zone air density is used to convert the volumetric rate of generic contaminant generation from user input into mass generation rate [kg/s].The coefficient of 106 is used to make the units of generic contaminant as ppm.

ρairNsink∑iRf,iCf,z = Sum of removal rate from sinks in a zone or interior surfaces [ppm-kg/s]

∑Nzonesi=1˙mi(Cf,z,i−Ctf,z) = Generic contaminant transfer due to interzone air mixing [ppm-kg/s]

Cf,z,i = Generic contaminant concentration in the zone air being transferred into this zone [ppm]

˙minf(Cf,∞−Ctf,z) = Generic contaminant transfer due to infiltration and ventilation of outdoor air [ppm-kg/s]

Cf,∞ = Generic contaminant concentration in outdoor air [ppm]

˙msys(Cf,sup−Ctf,z) = Generic contaminant transfer due to system supply [ppm-kg/s]

Cf,sup = Generic contaminant concentration in the system supply airstream [ppm]

˙msys = Air system supply mass flow rate [kg/s]

ρairVzdCtf,zdt = Generic contaminant storage term in zone air [ppm-kg/s]

Ctf,z = Zone air generic contaminant concentration at the current time step [ppm]

ρair = Zone air density [kg/m3]

Vz = Zone volume [m3]

∑jhjρAj(Cs,jkj−Cf,z) = Generic contaminant transport through diffusion between interior surfaces and zone air

Sf(Ct−δtf,z) = Generic contaminant generation or removal rate as a function of zone air generic contaminant level at the previous time step

Mfor = Generic contaminant capacity multiplier [dimensionless] (See the InputOutput Reference for additional information on the object ZoneCapacitanceMultiplier:ResearchSpecial)

In the same manner as described above for zone air temperature (ref. Basis for the Zone and Air System Integration), the solution algorithms provided in the ZoneAirHeatBalanceAlgorithm object are also applied to the zone air carbon dioxide calculations.

In order to calculate the derivative term with respect to time, the first order backward finite difference method, defined as the EulerMethod in the ZoneAirHeatBalanceAlgorithm object, may be used:

dCtf,zdt=(δt)−1(Ctf,z−Ct−δtf,z)+O(δt)

The zone air generic contaminant concentration update at the current time step using the EulerMethod may be expressed as follows:

ρairVzMfor(δt)−1(Ctf,z−Ct−δtf,z)=Nsource∑i=1ρairGf,i∗1.06−ρairNsink∑iRf,iCf,z+Nzones∑i=1˙mi(Cf,z,i−Ctf,z)+˙minf(Cf,∞−Ctf,z)+˙msys(Cf,sup−Ctf,z)+∑jhjρAj(Cs,jkj−Cf,z)+Sf

To preserve the stability of the calculation of the zone generic contaminant concentration, the third order differential approximation, derived by a Taylor Series and used in the calculation of the next time step’s zone air temperature, is also applied to the zone air carbon dioxide calculations. This algorithm is the default choice and is defined as ThirdOrderBackwardDifference in the ZoneAirHeatBalanceAlgorithm object.

The third order derivative resulting from a Taylor Series expansion is defined as:

dCtf,zdt≈116Ctf,z−3Ct−δtf,z+32Ct−2δtf,z−13Ct−3δtf,zδt+O(δt3)

The coefficients of the approximated derivative are very close to the coefficients of the analogous Adams-Bashforth algorithm. Then the approximated derivative is substituted into the mass balance, and the terms with the carbon dioxide concentration at past time steps are all put on the right-hand side of the equation. This third order derivative zone carbon dioxide update increases the number of previous time steps that are used in calculating the new zone generic contaminant concentration and decreases the dependence on the most recent. The higher order derivative approximations have the potential to allow the use of larger time steps by smoothing transitions through sudden changes in zone operating conditions.

ρairVzMforδt(116)Ctf,z+ρairNsink∑iRf,iCtf,z+Nzones∑i=1˙miCtf,z+˙minfCtf,z+˙msysCtf,z+∑jhjρAjCtf,z=Nsource∑i=1ρairGf,i∗1.06+Nzones∑i=1˙miCf,z,i+˙minfCf,∞+˙msysCf,sup+∑jhjρAjCs,jkj+Sf−ρairVzMforδt(−3Ct−δtf,z+32Ct−2δtf,z−13Ct−3δtf,z)

This gives us the basic air mass balance equation that will be solved in two different ways, one way for the predict step and one way for the correct step.

Since the third choice of solution algorithms uses an integration approach, defined as AnalyticalSolution in the ZoneAirHeatBalanceAlgorithm object, it does not require any approximations and has no truncation errors. The solutions in both prediction and correction are provided below in detail.

## Generic Contaminant Prediction[LINK]

For the generic contaminant concentration prediction case, the equation is solved for the anticipated system response as shown below.

PredictedSystemLoad=˙msys(Cf,sup−Ctf,z)

Since the program provides three solution algorithms, the generic contaminant prediction from each solution algorithm is given below.

## EulerMethod[LINK]

For this solution algorithm, the air mass balance for the predicted air system load or response is:

PredictedSystemLoad[kg/sec]=ρairVzMfor(δt)−1(Csetpoint−Ct−δtf,z)−[Nsource∑i=1ρairGf,i∗1.06−ρairNsink∑iRf,iCsetpoint+Nzones∑i=1˙mi(Cf,z,i−Csetpoint)+Sf]−[˙minf(Cf,∞−Csetpoint)+∑jhjρAj(Cs,jkj−Csetpoint)]

## ThirdOrderBackwardDifference[LINK]

For this solution algorithm, the air mass balance for the predicted system load or response is given below:

PredictedSystemLoad[kg/sec]=ρairVzMforδt(116)Csetpoint−[ρairNsink∑iRf,iCsetpoint+Nzones∑i=1˙miCsetpoint+˙minfCsetpoint]−[∑jhjρAjCsetpoint+Nsource∑i=1ρairGf,i∗1.06+Nzones∑i=1˙miCf,z,i+˙minfCf,∞+∑jhjρAjCs,jkj+Sf]+ρairVzMforδt(−3Ct−δtf,z+32Ct−2δtf,z−13Ct−3δtf,z)

## AnalyticalSolution[LINK]

For this solution algorithm, the air mass balance for the predicted air system load or response is given below:

PredictedSystemLoad[kg/sec]=[Nzones∑i=1˙mi+˙minf+ρairNsink∑iRf,i+∑jhjρAj]∗⎡⎢ ⎢ ⎢⎣Ctsetpoint−Ct−δtz∗exp⎛⎜ ⎜ ⎜⎝−Nzones∑i=1˙mi+˙minf+ρairNsink∑iRf,i+∑jhjρAjρairVZMFORδt⎞⎟ ⎟ ⎟⎠⎤⎥ ⎥ ⎥⎦∗⎡⎢ ⎢ ⎢⎣1−exp⎛⎜ ⎜ ⎜⎝−Nzones∑i=1˙mi+˙minf+ρairNsink∑iRf,i+∑jhjρAjρairVZMFORδt⎞⎟ ⎟ ⎟⎠⎤⎥ ⎥ ⎥⎦−1−(Nsource∑i=1ρairGf,i∗1.06+Nzones∑i=1˙miCf,z,i+˙minfCf,∞+∑jhjρAjCs,jkj+Sf)

At the prediction point in the simulation, the system air mass flows are not known; therefore, the system response is approximated. The predicted air system generic contaminant load is then used in the system simulation to achieve the best results possible. If a central HVAC system provides the outdoor flow rate from a Controller:MechanicalVentilation object, the outdoor airflow rate may be approximated as:

PredictedSystemLoad=˙msys(Cf,sup−Ctf,z)≈˙mOA,z(Cf,∞−Ctsetpoint)

where:

˙mOA,z = Supply outdoor airflow rate into the controlled zone [kg/s]

The above approximation is based on the assumption that the generic contaminant concentration at the outdoor air (OA) mixer inlet is equal to the zone air outlet concentration level, and the generic contaminant level at the zone supply air inlet is equal to the level at the outlet node of the OA mixer.

After the system simulation is completed, the actual response from the air system is used in the generic contaminant correction step, which is shown next.

## Generic Contaminant Correction[LINK]

For the correct step, the expanded air mass balance equation is solved for the final zone generic contaminant concentration at the current time step. In the same manner as described above for predicting the carbon dioxide load to be met by the air system, the zone air carbon dioxide correction calculation will be described individually for the three solution algorithms.

## EulerMethod[LINK]

Ctf,z=Nsource∑i=1ρairGf,i∗1.06+Nzones∑i=1˙miCf,z,i+˙minfCf,∞+˙msysCf,sup+∑jhjρAjCs,jkj+ρairVZMFORCt−δtf,zδt+SfρairVzMfor(δt)−1+ρairNsink∑iRf,i+Nzones∑i=1˙mi+˙minf+˙msys+∑jhjρAj

## ThirdOrderBackwardDifference[LINK]

Ctf,z=Nsource∑i=1ρairGf,i∗1.06+Nzones∑i=1˙miCf,z,i+˙minfCf,∞+˙msysCf,sup+∑jhjρAjCs,jkj+ρairVZMFORδt(3Ct−δtf,z−32Ct−2δtf,z+13Ct−3δtf,z)+SfρairVzMfor(δt)−1(116)+ρairNsink∑iRf,i+Nzones∑i=1˙mi+˙minf+˙msys+∑jhjρAj

## AnalyticalSolution[LINK]

Ctf,z=⎡⎢ ⎢ ⎢⎣Ct−δtf,z−Nsource∑i=1ρairGf,i∗1.06+Nzones∑i=1˙miCf,z,i+˙minfCf,∞+˙msysCf,sys+∑jhjρAjCs,jkjNzones∑i=1˙mi+˙minf+˙msys+ρairNsink∑iRf,i+∑jhjρAj⎤⎥ ⎥ ⎥⎦∗exp⎡⎢ ⎢ ⎢⎣−Nzones∑i=1˙mi+˙minf+˙msys+ρairNsink∑iRf,i+∑jhjρAjρairVZMFORδt⎤⎥ ⎥ ⎥⎦+Nsource∑i=1ρairGf,i∗1.06+Nzones∑i=1˙miCf,z,i+˙minfCf,∞+˙msysCf,sys+∑jhjρAjCs,jkj+SfNzones∑i=1˙mi+˙minf+˙msys+ρairNsink∑iRf,i+∑jhjρAj

The above solutions are implemented in the Correct Zone Air Generic Contaminant step in the Zone Contaminant Predictor Corrector module of EnergyPlus.

Documentation content copyright © 1996-2022 The Board of Trustees of the University of Illinois and the Regents of the University of California through the Ernest Orlando Lawrence Berkeley National Laboratory. All rights reserved. EnergyPlus is a trademark of the US Department of Energy.

This documentation is made available under the EnergyPlus Open Source License v1.0.