Using Class Base.Container.Reactor
This is the primary component class in the Mixer simulator. It models a chemical reactor that mixes input fluid with various concentration from input pipes and dispense the mixture to output pipes. The quantities depend on the flow rates of the pipes. This class is derived from Base.Container to inherit the Concentration class attribute.
Use this class to create parts in Canvas Views to form a Mixer network. The inputs can be from various sources or from multiple reactors. The output can be sent to multiple sinks or other reactors. Connect all the components with pipes and enter the flow rates into the pipes. In order to keep the volume of the mixture constant in the reactor, you will need to make sure that the sum of all input flow rates is the same as the sum of all output flow rates. Some exceptional cases may exist (see the Great Lakes example).
Concentration (fConcentration): is the concentration, or density, of the chemical. This attribute is inherited from Class Base.Container.
Reactor Table (rReactor): is an object reference to a reactor table. The reactor table contains the r-h-s constants of the linear equations and a solution vector. See Class Table.Reactor for details.
Constant Matrix (rConstant): is an object reference to a constant matrix. The constant matrix contains the l-h-s constants of the linear equations.
Part Index (1-Based) (iPartIndex): is the index to the reactor table where the information regarding this reactor can be found. This is a hidden attribute which can only be examined in a Service Session.
Resize for Initialization (SG_xInitSize): registers the reactor to a global counter in the simulation control object. Because all the parts are called before the reference objects (starting from SansGUI version 1.0.1), the matrix and table reference objects can access the global counter and know how many reactors are there in the model to determine the appropriate sizes of the matrices and table.
Initialization (SG_xInit): registers the reactor to the reactor table (a reference object) so that the index of this reactor in the table can be stored locally for later access. It also registers the class type for later identification.
Pre-Evaluation (SG_xPreEval): deposits the current concentration of this reactor to all the output links.
Evaluation (SG_xEval): loads the l-h-s constant matrix and r-h-s constants of the linear equations, applying the law of mass conservation. For the l-h-s constants, the input values are negative and the output values are positive. For the r-h-s constants loaded into the reactor table, the input values are positive and the output values are negative. The constants are loaded into the corresponding element in the matrix or table according to the types of the adjacent object. Please see the source code in Base_Container_Reactor.c for details.
Post-Evaluation (SG_xPostEval): fetches the calculated concentration of this reactor from the reactor table and deposits the concentration to all the output pipes.
Mixer Example for SansGUI Version 1.0
Copyright © 2001-2003 ProtoDesign, Inc. All rights reserved.