Streams¶
Streams is a modelica package available under Simulator. It consists of models as:
MaterialStreamEnergyStream
Material Stream¶
A Material Stream represents whatever enters and leaves the simulation passing through the unit operations. It is one of the important models to be used in any simulation. To simulate a material stream, following inputs should be given:
- Flash Specification
- Molar Flowrate
- Mole Fraction of Components
Flash specification is a binarry combination of different thermophysical properties which needs to be passed as input variables as mentioned above. It can be of following types:
- TP: Temperature and Pressure
- PH: Pressure and Enthalpy
- PVF: Pressure and Vapor Fraction
- TVF: Temperature and Vapor Fraction
- PS: Pressure and Entropy
To simulate a material stream, one needs to extend the MaterialStream model along with the necessary property method from ThermodynamicPackages.
Simulating a Material Stream¶
There are two different approach by which a material stream can be simulated. First one is to create a model where the MaterialStream,
and necessary property method from ThermodynamicPackages are instantiated, components are called from ChemsepDatabase
and required input variables are passed through equation section.
Other way is to create a model where only the MaterialStream and necessary property method from ThermodynamicPackages are extended. Then this model is
instantiated in another new model where the components are called from the ChemsepDatabase and input variables are passed through equation section.
One might think that there is not much difference between the two approaches. However, the second one is a more useful one when has to simulate a flowsheet
with multiple material streams. We wil explain more about this when we simulate a flowsheet.
Creating a material stream using both the approaches is explained below:
Let us consider a ternary system consisting of Methanol, Ethanol and Water. The stream is at pressure of 101325 Pa and temperature of 351 K. Mole fractions of these componente are 0.33, 0.33, 0.34 respectively. Molar flow rate of the stream is 100 mol/s.
Here are step by step explaination as to how to create and simulate this material stream by first approach.
First, create a model named
TPflash.Next, create an instance of
ChemsepDatabaseimport data = Simulator.Files.ChemsepDatabase;Then, create instances of components to be used
parameter data.Methanol meth; parameter data.Ethanol eth; parameter data.Water wat;4. Extend
MaterialStreammodel available underStreams. Here we must pass a few arguments such as number of componentsNcand component arrayCextends Streams.MaterialStream(Nc = 3, C = {meth, eth, wat});
Extend the necessary property method from
ThermodynamicPackages. Here, we are extending theRaoultsLawextends Simulator.Files.ThermodynamicPackages.RaoultsLaw;6. Specify values of input variables in equation section. It is clear from the model name that we will be doing a TP flash therefore, we will pass temperature, pressure, molar flow rate and mole fraction of components as input variables
P = 101325; T = 351; x_pc[1, :] = {0.33, 0.33, 0.34}; F_p[1] = 100;
This completes the material stream. Now, click on simulate button to simulate the TPflash model. Alternatively, you can also
find this package named TPflash in the Simulator library under MaterialStream package under Examples.
Now, let us see how we can create and simulate the material stream by second approach. We will consider a different problem statement here.
Let us consider a binary system consisting of Benzene and Toluene. The stream is at pressure of 101325 Pa and temperature of 368 K. Molar flow rate of the stream is 100 mol/s and the components are in equimolar composition.
Create a package called
CompositeMSCreate new model named
MSin the packageCompositeMSExtend
MaterialStreammodel insideMSextends Simulator.Streams.MaterialStream;Extend the necessary property method from
ThermodynamicPackagesinsideMSextends Simulator.Files.ThermodynamicPackages.RaoultsLaw;Create another new model called
MatStreamSimulationinsideCompositeMSNow, inside model
MatStreamSimulation, create an instance ofChemsepDatabaseimport data = Simulator.Files.ChemsepDatabase;Create instances of components to be used
parameter data.Benzene benz; parameter data.Toluene tol;Create an Integer parameter for number of components (Nc)
parameter Integer Nc = 2;Create an component array C to access the properties of components from ChemsepDatabase
parameter data.GeneralProperties C[Nc] = {benz, tol};Now, we will create an instance of the model
MS. To do this, open diagram view ofMatStreamSimulationmodel, drag & dropMSas shown in fig. Name the model asms1Switch to text view there will be generated code for instantiation of “MS”. Pass the values of
NcandCas argument of the material stream instanceS1Simulator.Examples.CompositeMS.MS S1(Nc = Nc, C = C) annotation( ...);Specify values of input variables in equation section. Here, we will pass temperature, pressure, molar flow rate and mole fraction of components
P = 101325; T = 368; x_pc[1, :] = {0.5, 0,5}; F_p[1] = 100;
This completes the material stream package. Now click on Simulate button to simulate the MatStreamSimulation model. Switch to Plotting Perspective to view the results.
Note
You can also find this example named
CompositeMSin theSimulatorlibrary underExamplespackage.
Energy Stream¶
This model is used for dispalying heat loss/required for the unit operations which involve energy balance. This model can be instantiated by dragging and dropping. The code looks like follows
Simulator.Streams.EnergyStream E1 annotation(....);
We will discuss about this in detail when we describe unit operations which requires energy stream.