Tech Note

Title:               Duration Calculation and Temperature Control in the SOM
Date:              April 15, 2003
Written by:     Peter C. Bosch
Number:        TN-006
Version:         1.1

A SOMOperation will be responsible for determining its own duration and its mixture’s final temperature, from data provided by the Modeler.

Figure 1 below, describes the system we are modeling. A vessel is surrounded by a heating/cooling (temperature control) system, which may be on or off at any given time. (i.e. temperature control is or is not, in effect.)


heat transfer in a vessel

Figure 1 : Temperature Control Parameters

When temperature control is in effect, we will presume that at any given instant, the temperature of the medium in the temperature control jacket (Tsrc) is uniform, and that the rate of energy transferred into or out of the mixture is dependent upon the temperature of the mixture (Tmix), Tsrc, and the heat transfer coefficient of the vessel wall corresponding to the level of the surface of the mixture in the vessel, (Qtc). There are three values for the heat transfer coefficient, specifying the values for the 30%, 60%, and 90% levels, and our algorithm must interpolate between these to a value that is appropriate to the current level. This interpolation will be linear from 0 through 30 to 60, and linear from 60 through 90 to 100. As the volume of material changes, so does the actual heat transfer coefficient in use by the algorithm. The purpose of temperature control will be to reach, and maintain, a specified temperature setpoint, which we will call Tset. This goal may be reached across several SOMOperations’ execution, unless an operation is temperature constrained, in which case it must reach the required temperature setpoint before being allowed to complete.

When temperature control is off, we presume that the temperature control medium is at the same temperature as the mixture, and therefore, that the temperatures of both are governed by energy transferred out of or into the mixture directly from the environment. This energy transfer is dependent upon ambient temperature (Tamb), Tmix, and a different set of 30,60, and 90 percent volume heat transfer coefficients (Qamb) are used to reflect the rate of energy transfer to or from the environment.

A SOMOperation may be temperature-constrained, meaning that it’s completion is dependent upon its mixture reaching a Tset, or it may be duration-constrained, meaning that it’s completion is dependent upon completion of some minimum acceptable timespan, Tmin. See Figure 2 for details on timing.

Temperature Control Algorithm

Parameters relevant to temperature control are shown in Table 1.






Obtained From



°C / °K[1]

Mixture Temperature




°C/ °K

TC Sys Src Temperature

Unit State/SOM API



°C/ °K

Ambient Temperature

Unit State/SOM API



°K sec

Heat Xfer Coeff to Ambient (level-variant)

Unit State/SOM API



°K sec

Heat Xfer Coeff to TC System (level-variant)

Unit State/SOM API




Temp Ctrl System On

Unit State/SOM API



°C/ °K

TC System Setpoint

Unit State/SOM API



Const T
Const DT
Const Ramp

Tsrc is constant, Tsrc is adjusted to track Tmix, keeping DT constant, or Tsrc is adjusted to maintain a constant ramp rate.

Unit State/SOM API



°C/ °K

Error band for temp ctrl.

Unit State/SOM API

Table 1: Temperature Parameters

If temperature control is off, then Tsrc is maintained at Tmix, and heat transfer is presumed to proceed between the mixture and ambient. If temperature control is on, then Tsrc may be continually modified by the temperature control system, and heat transfer is presumed to occur between the mixture and the TC jacket.

If TCMode specifies a constant DT, then Tsrc is continually adjusted to maintain the DT that was present at the beginning of the operation. If TCMode specifies a constant T, then the existing value of Tsrc is used throughout temperature control. If TCMode specifies a constant ramp rate, then the Tsrc value is adjusted to ensure a constant ramp rate to the target temperature.

Terr defaults to 3°C.

If Tset is specified (i.e. is not double.NaN), then temperature is set to Tset ± Random[0,Terr) once the mixture temperature is within the error band of Tset. If Terr is zero, then once the temperature is within three degrees of Tset , the temperature is set to the specified target value. This is done to bound computation time.

Timing Specification

Parameters relevant to temperature control are shown in Table 1.





Obtained From




Time to acquire resources

SOM, Resource Acquisition Requests from Modeler




Time to complete all inflows

Obtained from outflow spec at other end of connector




Time To Reach Tset





Minimum Acceptable Duration

Unit State




Time to complete all outflows.

This SOMOperation’s stated durations (specified per transfer spec – can be different for each port.)




If Duration, then max(Tmin , Tinflow).
If TempCtrl, then max(Tinflow, Ttemp) triggers completion.

Unit State

Table 2 : Timing Parameters

The sequence of activities and their durations consumed by the execution of a SOMOperation is shown in Figure 2. Immediately upon starting the operation (following the Validate or Simulate events) the preDelay parameter may impose a wait. Then, resource acquisition begins, with the temperature control mode from the preceding operation still in effect. Once resource acquisition is complete, inflow processing is begun, and the unit’s temperature mode is updated and put into effect. The total inflow duration will be the longest of all of the inflow durations, obtained by reviewing the transfer specifications provided by the output end of each connection.

duration constrained

Figure 2 : Timing-Related Dependencies

As shown in the figure above, the timespan between the start of inflow and the start of outflow is dependent on the TimingConstraint parameter. If TimingConstraint specifies DurationConstrained, then outflow will begin after a timespan equal to Max(Tinflow, Tmin). If TimingConstraint specifies TemperatureConstrained, then outflow will begin after a timespan equal to Max(Tinflow, Tset).Finally, outflow-processing proceeds as did inflow, with its duration being the maximum of the durations specified for this task’s TransferOutSpec specifications.

Implementation Notes

SOMEquipment has an API for getting the temperature controller associated with the equipment.

(*) Predelay occurs after vertex synchronization. This can cause a loss of synchronization between transfers out and in, if the specified delays are different between the exporter and the importer - if the exporter’s predelay is longer than the importer’s, it will not find material to import, and mass may be lost.

Temperature control over one or more charge or discharge operations will be considered linearly over the time and delta-volume of the flow-in or out.

Implementation names differ somewhat from names previously indicated in this document, but on the SOMTemperatureController, should be clear as to their intent.

To implement temperature control, two things need to happen.

1.)    When equipment is created and assigned to a unit, its temperature controller should be initialized. This code will look like the following snippet:

SOMEquipment vat2   = mb.AddEquipment("Vat 2",Guid.NewGuid(),unit1,1000);

SOMTemperatureController stc = vat2.GetTemperatureController();
TemperatureControllerMode mode = TemperatureControllerMode.Constant_T

stc.Initialize(.15,.30,.45,.9,1.2,1.6,120,30,100, mode,37,1,true);

The parameters’ descriptions in the Initialize call are provided in the API documentation.

2.) In the code that is called on each SOMOperation’s Validate or Simulate events, the developer may change the mode, setpoint, srcTemp, deltaT, on/off status, error band, etc. This code will look something like the following snippet – note that duration criteria are attached to the SOMOperation – that is, the SOMOperation is what is duration or temperature constrained, not the SOMTemperatureController.

        private void OnValSim_ChargeLiquid_1(IDictionary graphContext, SOMTask somTask){

            SOMUnit unit = ((SOMOperation)somTask).SOMUnit;


SOMTemperatureController stc = ((SOMOperation)somTask).GetCurrentEquipment(graphContext).GetTemperatureController();


            stc.TCSetpoint = 100;

            stc.TCSrcTemperature = 130;

            stc.TCEnabled = true;

            stc.TCMode = TemperatureControllerMode.Constant_T;


            ((SOMOperation)somTask).TimingConstraint =



Current Unit State Snapshot looks like:

Charge Solid 1 PostState        (Dictionary)

        Volume  (Dictionary)

                Value   1000

        Mixture (Dictionary)

                Mass    285

                Volume  318.3975

                Temperature     20.9009928237186

                Mud     (Dictionary)

                        Name    Mud

                        Mass    30

                        Volume  40.32

                        Temp    20.9009928237186

                Water   (Dictionary)

                        Name    Water

                        Mass    5

                        Volume  5

                        Temp    20.9009928237186

                Muffins (Dictionary)

                        Name    Muffins

                        Mass    250

                        Volume  273.0775

                        Temp    20.9009928237186

        DefaultTC       (Dictionary)

                TCEnabled       True

                TCMode  Constant_T

                TCSetpoint      20

                TCSrcDelta      30

                TCSrcTemperature        130

                ErrorBand       1

                QTC30   0.15

                QTC60   0.3

                QTC90   0.45

                QAmb30  0.15

                QAmb60  0.3

                QAmb90  0.45



EMAIL Sent 4/24/03, 17:10

(1) What is a typical charge duration? What is the range of values I might reasonably see?


(2) What happens if I have a Tsrc of, say, 70 degrees C, to raise the temperature of a mixture to a Tset of, say, 50 degrees C, and then I add something to the mixture that causes an exothermic reaction, and suddenly, my Tmix is 55 degrees C? Tsrc can't drive Tmix back to 50 degrees C if it is at 70 degrees C... This sort of a change could be imposed in either direction by hotter or cooler influent material or by an exo/endothermic reaction.


Is this where constant deltaT mode comes in, and I'd just use a negative delta-T?


If so, this would seem to imply that the deltaT is itself specified rather than Tsrc (when in constant delta-T mode), and that if Tmix < Tset, Tsrc is adjusted to Tmix+deltaT, whereas if Tmix > Tset, then Tsrc is adjusted to Tmix-deltaT.


Or is there some other mechanism you'd like to use? Fire a "heatingNeededEvent" or a "coolingNeededEvent", and let you react by changing Tsrc yourself?


We'll need some way of handling things when the temperature control system is in constant Tsrc mode, and both Tsrc and Tmix are on the same side of (i.e. above or below) Tset.


After resources are acquired, we update the mixture state to the “current time”.

Compute Tinflow and process.

Compute interim.

            If temperature constrained, this is the time to reach Tset.

            If duration constrained, this is the greater of (minacceptableduration, Tinflow).

Apply interim time effect to mixture.

Compute Toutflow and process.

Delay accumulated duration.

Release resources.

[1] Temperatures are specified in degrees Celsius, but converted to Kelvin for computation.