[go: up one dir, main page]

0% found this document useful (0 votes)
94 views13 pages

Mobatec Modeller Intorduction Course Tutorial III

The document describes building a model of a buffer tank in Mobatec Modeller software. Key steps include: 1) Creating the physical components like the tank and inlet/outlet connections. 2) Writing equations like the mass balance and relationships for inlet and outlet flowrates. 3) Adding parameters, variables, and default values to complete the model. The goal is to simulate the dynamic operation of the buffer tank and understand how to construct models in Mobatec Modeller from scratch.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views13 pages

Mobatec Modeller Intorduction Course Tutorial III

The document describes building a model of a buffer tank in Mobatec Modeller software. Key steps include: 1) Creating the physical components like the tank and inlet/outlet connections. 2) Writing equations like the mass balance and relationships for inlet and outlet flowrates. 3) Adding parameters, variables, and default values to complete the model. The goal is to simulate the dynamic operation of the buffer tank and understand how to construct models in Mobatec Modeller from scratch.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Mobatec Modeller

INTRODUCTION COURSE

Model Developer I

Power to take Control!


Mobatec Modeller Intro Course – Model developer I

1 Modelling and Simulation of a Buffer Tank

1.1 Objectives
By the end of this exercise, you will know

• How to build a model from scratch


• How to write equations and add them to your model
• How to monitor variable & parameter values using var. & par. tables
• How to add parameters value access displays & filled rectangle displays

1.2 Model description


We want to model a dynamic operation of a buffer tank

Figure 1 Single tray – Buffer Tank

The tank has a single inlet at the top and single outlet at the bottom. The geometry of the tank and
the inlet flow will be provided as model inputs. The outlet flowrate is driven by gravity (hydrostatic
pressure) and is dependent on the liquid level in the tank.

In MM (Mobatec Modeller) language, (topologically) this model consists of 2 “Battery Limit” system
objects for the liquid source and sink, “Capacity” system object for the buffer tank and inlet and outlet
mass connection.

1.3 Assumptions
• The tank is well-stirred (ideally mixed).
• The cross-section area is constant along the height of the tank.
• The operation of the tank is isothermal.
• The tank contains single component in the liquid phase, water - H2O.

Page 1 of 12
1.4 Model Equations
Buffer Tank model equations
Mass balance (system equation - generated automatically)

mi
• d = Fini − Fouti , i є COMP
dt
Buffer cross-section area (system equation)

D2
• A = 
4
Total mass holdup (system equation)

• M =  (mi )

Liquid level (system equation)

• M =   A L

Liquid lines equations


Inlet mass flowrate (mass connection equation)

• Fin =   Fm
Inlet component mass flowrate (mass connection equation)

• Fmi = Fin  ( or ) Xmi

Outlet component mass flowrate (mass connection equation)

• Fmi =   ( or ) L

1.5 Parameters
Symbol Name Model object Units
D Diameter System [m]
ρ Liquid density System [kg/ m3]
Fm Inlet mass flow In. Connection [kg/s]
α Inl. line valve position In. Connection [-]
β Outlet flowrate coeff. Out. Connection [kg/s/m^(1/2)]
Xmi Species mass fraction System [-]
Table 1 Model parameters

1.6 Variables
Symbol Name Model Object Units
Horizontal cross-
A System [m2]
section area
Amount of the
M System [kg]
liquid contained
L Liquid level System [m]
Fin Inlet mass flow In. Connection [kg/s]
Fmi In. com. mass flow In. Connection [kg/s]
Fmi Out com. mass flow Out. Connection [kg/s]
Table 2 Model variables

Page 2 of 12
1.7 Things to do

1. Create a New Model

Open a new model, by clicking on a “New Model” button, or click on File/New Model. A new
model called “Universe” will open. Save your model with a different name by clicking on a
save as icon, or click File/Save Model as, choose appropriate location for your model.

2. Building model physical topology

Now that you have blank MM model on your screen you can start building the model physical
topology. Go to Property Browser/Insert Objects/Objects/ Systems from the scratch, or press
“SHIFT+s”. From available options, choose mass based “Capacity” for the model parts that
should store mass and energy. Choose mass based “Battery Limit” system for the mass & heat
sources and sinks. Select appropriate system and then just click anywhere in MM modelling
environment and the system will be inserted. Do that for all the model parts as they are
described in the paragraph 1.2. Choose battery limits systems for the liquid source & liquid
sink. Choose capacity system for the buffer tank.

Now that you have placed the model systems to resemble Figure 1, you should make physical
mass connections. Go to Property Browser/Insert Objects/Objects/Connections from Scratch
(shortcut, “SHIFT+c”) and choose “Uni-Directional Mass” connection. Connect the liquid
source battery limit to the buffer tank, and then make a mass connection from the buffer tank
capacity system to the liquid sink battery limit system as illustrated in Figure 2.

Figure 2 Buffer Tank Mobatec Modeller physical topology

In MM you can choose to use either molar or mass based balanced calculation for the capacity
systems. In this model our input parameter is in mass units (kg/s) so a mass based balance
calculation should be chosen. If needed this setting can be changed always by selecting the
system and going to Property Browser/Selected Objects/Systems/Equations, then click on
Equation Sorting button and under “Equation Class” drop-down menu (left bottom corner of
the tab) one can choose between “System (mass based balances)” & “System (mole based
balances)”.

Page 3 of 12
3. Adding Icons to systems and connections

After connecting all the model parts, we can add specific icons to each part. Select one of the
systems or connections and go to Property Browser/General/Icons. You will see that the
“Plant Icons” box is empty. In “Available Plant Icons” select “Exercises Icons” folder and find
“Ex_Buffer_tank” icon and click “Add Plant Icon” button, now this icon is available in the “Plant
Icons” box above, do so for the “Ex_Liquid_Source”, “Ex_Liquid_Sink” & “Ex_Valve” icons. All
icons related to all the exercises have “Ex_” prefix before their name.
Now all four icons are available. Select the buffer tank system in MM working space, then go
to Property Browser/Selected Object/ System /Graphics select the “Ex_Buffer_tank” icon in
the “Plant Icons” and click “Change Icon” button. Do so for other two objects accordingly. Use
corner active points on the icons to resize the icons. Now your model looks similar like
presented in Figure 3. To add icons to connections, go to Property Browser/Selected Object/
Connection /Graphics then do the same as for the systems (add valve icon).

Figure 3 Buffer Tank model with icons added

In the “Graphics” tab in the right bottom corner you can choose the position of the system
label. You can hide (6), place it below the system (7), above the system (8) or in the system (9)
(the same holds for connections). To rename the system or connection select the object,
press “F2” or do right click/rename.

4. Adding Species to your model

Add H2O to the plant species and then inject H2O to Liquid Source battery limit. Procedure is
the same as performed in Exercise 2.

5. Writing & Adding Equations in Mobatec Modeller - MM syntax

Writing Equations

By making physical topology of the model and species topology (injecting species) of the
model in Mobatec Modeller you have already created the mass balance equations of all your
model systems (in this case one system). As you are making mass and heat connections
Mobatec Modeller is generating mass & energy balance equations automatically in the
systems, based on the connections you have made. Select the Buffer Tank system object and
go to Properties/Selected Object/System and select the Equations tab.
Page 4 of 12
In the upper section of the tab you will be able to see the automatically generated mass
balance (Figure 4) as it is given in the Model Equations paragraph. Energy balance is not
present as the buffer tank is modelled to have isothermal operation and no heat flow (HF)
equation is present in the mass connections, and no heat connection(s) are included in the
model as well. You will never have to define the balances equations! Mobatec Modeller
will always take care of that for you, and will update the balances automatically as you change
each system mass or heat connections!

Figure 4 Automatically generated mass balance

Next step is to create the (algebraic) equations and add them to your systems & connections.
First, let us create and add the Inlet connection equations.

Inlet connection equations (MM syntax):

Equation name: Function: Equation Class:

Inlet_Mass_Flowrate Fin = Alpha * Fm Mass Connection

Inlet_Comp_Mass_Flowrate Fm[] = Fin * or.Xm[] Mass Connection

(or.Xm[] calls the variable Xm[] from the origin source system)

Select the active point of inlet mass connection (not source battery limit system) go to
Selected Objects/Connections/Equations tab and click on Define Equations button (left bottom
corner), “Define Equations” tab will open. To create a new equation, click on “Define New
Equation” button. The “Define New Equation” tab will appear.

Figure 5 Define New Equation Window – Creating “Inlet Mass Flowrate” equation of Inlet mass connection.

Page 5 of 12
Write the equation name according to the list at the end of this paragraph. There should not
be empty spaces in defined name, as then MM will report “illegal character” and will not let
you create the equation (e.g. “Inlet_Mass_Flowrate” is correct). Under the “Equation Class”
select “Mass Connection” (every time you want to create a mass connection equation). You
can choose to use the equation for more than one system type by selecting two or more
equation classes.

Under “Function:” write the equation for the inlet mass flowrate as shown in Figure 5. As you
typed the equation, MM will determine automatically whether the equation is a “scalar” or
“vector” under the “Dimension”. Press “OK” to create (save) the equation. Use the same
procedure to make the second equation for the inlet connection, i.e. “Inlet component mass
flowrate”.

After you created both equations you should add those equations to the inlet mass
connection. Already opened Define Equation tab now has two equations in its “Database
Equations:” list-box, equation you have created. Select one, equation and press “Add” button
to add it to the inlet mass connection. Do the same for the other equation.

Figure 6 Adding the equations of Inlet mass connection

Use the same procedure to create and add the equations to Buffer tank system. In this case
choose “System” type under equation class. Create and add following three equations to the
buffer tank system.

Buffer tank system equations (MM syntax):

Equation name: Function: Equation Class:

Area A = D^2 * PI() / 4 System

Total_mass_holdup M = SUM(m[]) System

Liquid_level M = rho * A * L System

Page 6 of 12
Create and add, the equation to the outlet mass connection on the exact same way as you did
for the Inlet mass connection. After doing that, your model parts should hold all the equations
needed.

Outlet connection equations (MM syntax):

Equation name: Function: Equation Class:

Outlet_comp_mass_flowrate Fm[] = Beta * SQRT(or.L) Mass Connection

(or.X calls the variable X from the origin system, tar.X calls the
variable X from the target system of the connection)

Equations can also be created by using the Main Editor. You can open it by using the “ ” icon
in the toolbar (or just press “d”). Main editor will open. You will be able to see: Equations,
Variables, Species, Reactions, Equation Objects and External functions tabs. For now, we will
only focus on Equations and Variables tabs. Go to Equations tab of the main editor and follow
the exact same procedure to add equations to the database as described when adding the
equations directly when having selected a model object. Adding equations is done by
selecting a model object and adding the equations from the available selected database.

FYI: If some equations are repeating in different systems or connections, there is no need to
create them again, every equation needs to be created ONLY ONCE, it will become a part of
equation database and it can be used where ever you need them as many time as needed.

6. Declaring variables dimensions (units)

After you have entered the equations you need to declare the dimensions of the variables
used. Open the main editor tab, select the main editor icon “ ” in the toolbar (or just press
“d”) and select the “Variables” tab. There you will find listed all the variables that you have
used in your equations (some other MM predefined variables will be listed there as well, don’t
mind them at this point). Select any variable and you will be able to “Edit Variable”, chose the
variable “Unit Category” from available drop down many and by doing that the “Engineering
Unit” will be filled automatically. Set the variable upper & lower bound. Do this for all the
variables according to Table 3 below. If variable does not belong to any available unit category,
like “Beta” in this case, use “_Undefined” unit category and input the unit into the
“Engineering Unit” box.

Symbol Name Unit Eng. Unit Bounds


Category
D Diameter Length m [0 – 100]
rho Density Density kg/m3 [0 – 3000 ]
Fm Inlet mass flow Mass flow kg/s [0 – 1000]
Alpha Inllet line valve position Fraction (-) [0 – 1]
Beta Outlet flowrate coefficient - kg/s/m^(1/2) [0 – 50]
Xm[] Species mass fraction Fraction (-) [0 – 1]
A Area Area m2 [0 – 50]
M Total mass holdup Mass kg [0 – 3000 ]
L Level Length m [0 – 100]
Fin Inlet mass flow Mass flow kg/s [0 – 1000]
Fm[] Component mass flow Mass flow kg/s [0 – 1000]
Table 3 Variable dimension declaration

Page 7 of 12
7. Sorting the equations

What is a well posed system?

There should be identical number of equations and variables to make a well posed system, i.e.

(nº variables = nº equations)

To assure a well posed system in each model object every time, Mobatec has developed
equation sorting to ensure maximal certainty with this important step of model building. Let’s
take a look on how the “Buffer_Tank” system should be “sorted”. First select the system and
go to Property Browser/Selected Objects/Systems/Equations then click Equation Sorting
button.

If you added all the equations correctly you will see the picture presented in Figure 7. You can
see that some equations are marked with “***” sign. This sign in front of the equation
indicates that specific equation cannot be solved (cannot calculate specific variable value) and
needs more input. This is time to define the parameters (inputs) of the “Buffer Tank” model.

Figure 7 Buffer tank system – unsorted – not well posed

Next to the “Object Equations” box in the “Equation & variable Sorting” tab you can see three
groups “Selectable:”, “Constants:” and “Computed & Knowns:”. In Computed & Knowns box
are the variables that can be calculated or are known from the provided equations. In the
Selectable box, Mobatec Modeller will list the variables that cannot be calculated from the
given system of equations.

Now check the model parameter Table 1 and define the parameters (D,rho) of the
“Buffer_Tank” system. By clicking on the variable in the selectable box the variable will move
to constants box (user changeable constant) and becomes a parameter (model input). After
this system will become well posed, as shown in Figure 8.

Figure 8 Buffer tank system - sorted - well posed

At the bottom of the “Equation & Variable Sorting” tab as well as on the top of selected model
object “Equations” tab, the visual sign with message of the current state of the model object
system of equations will be displayed as showed in Figure 9.

Figure 9 System of Equations CHECK message – unsorted (left) & sorted (right)

Select the Source battery limit system and open “Equation & Variable Sorting” tab (the same
as for the buffer tank system). There will be no equations present in this system as we did not
add any, but variable “Xm[]” will be present (Figure 10 n. p.) in the selectable box list as this

Page 8 of 12
variable was “called” using prefix “or.” in “Fm[]= Fin * or.Xm[]” equation of the inlet
connection. Sort variable “Xm[]” as parameter according to Table 1.

Figure 10 Battery Limit Source system sorting

Sort the equations of the inlet and outlet liquid line following the exact same procedure.

8. Initializing the “Buffer Tank” model

Insert the given parameters values to the “Buffer Tank” system & inlet and outlet connection
according to Table 4 in Appendix 1. Do that by selecting the desired system/connection then
go to the Property Browser/Selected Objects/ Systems or Connections/Parameters and in the
“Constants & Parameters Values” tab enter the value under the “Value” column for each
parameter defined for the selected object.
Now you need to enter the initial values of a certain variables in the capacity systems (system
that can store mass & energy), in our case “Buffer_Tank” system, so that you can initialize the
model.
Select buffer tank system, go to Property Browser/Selected Objects/ Systems/Initial Values
tab. Check the “I” box for the “L” (level) variable as shown in Figure 11 and click “Calculate
Initial Values”. You could also specify “M” or “m[]” as well (try that too). After, you have
successfully initialized the “Buffer_Tank” system, initialize the Inlet & Outlet mass connections
by clicking on “Calculate Initial Values” as they do not require the initial variable values
because they are not capacities.

Figure 11 Buffer Tank system initialization

To learn all on first principles model building in MM and mass balance formulation/definition
read Chapter 5. To learn all on degrees of freedom and initial conditions read Chapter 6. in
Mobatec Modeller handbook for beginning and advanced users.

Page 9 of 12
9. Running a Dynamic Simulation & monitoring variable values

Before running a model simulation, the model compilation is required. Compilation is a model
code generation process where all the “programming” is done by Mobatec Modeller, after
which the model is ready to be solved by the solver. To Compile the model, press “Compile
Model and Switch to Simulation Environment” icon in the toolbar “ ” (shortcut - F12), or go
to Property Browser/General/Basic Commands and press “Compile Model and Switch to
Simulation Environment” button. When your Model is compiled you will get a message that
compilation was successful!
Go to Property Browser/General/Basic Commands in Simulation environment and select
“Dynamic” under the “Simulation type”. Under “Integration Method” select “Fix Step Size”
and enter “1” (sec), you can also choose bigger or smaller time steps. Under “Calculation Delay
(in ms)” enter “1000” if you want a Real Time simulation, if not leave “0”.

Click the “Start Calculation” button ” “ and run a dynamic simulation of the
model. If there are no errors your model should be running the simulation and you are able
to follow the “Simulation time” in seconds on the Basic Commands tab, or at the left bottom
corner of the screen.
Monitoring variables values
You can monitor your variables and monitor & change parameter values of any model object
by selecting the object, doing the right click and choosing “Show Variable Table” or “Show
Parameters Table”, or just select object and press numbers from 1-5 for variable tables or
numbers from 6-9 & 0 for parameter tables. You can have up to 5 variable & 5 parameter
separate tables open in the same time. You can open just one variable table and then just click
on another model object to inspect the variable values of those objects (try it). If you want
one table to always show only one object variable values, select “Lock Selection Filter” check
box and then the shown variables are locked to that specific table as shown in Figure 12. The
same holds for parameter tables. If you make no selection and open a table all model variables
or parameters (depending on opened table) will be displayed.

Figure 12 Variable Table with Locked Selection Filter

10. Adding variables & parameter displays

Now, that your model is running, lets “display” some variable and parameter values to be
visible at all time for easy process variables monitoring and parameter value monitoring &
change.

In MM you can display the variable value in two ways, graphically in a form of a filled rectangle
where filled area corresponds to a value of the variable with respect to its maximum value
(totally filled) or digitally with numbers, as used in Exercise 2.

Add mass flow value display object (kg/s) for “Fin” variable of the inlet connection. Do the
same for the outlet mass connection where you should display “Fm_H2O” variable. This
variable appears as “Fm[H2O]” in the modelling environment but after compilation in the
Simulation environment it will always appear in “Fm_H2O” form.

Page 10 of 12
Make a value display object to monitor the liquid level (simulation variable “L”) in the tank.
Also make a rectangle filled display (Figure 13) to graphically represent the liquid level (same
simulation variable “L”), use 10 m as max value (upper bound). Use your mouse pointer to re-
shape the rectangle display to desired form.

Figure 13 Value Filled Rectangle

Now, let’s make some parameter display so that parameter values could be changed directly
while simulation is running. For this purpose, Value Access Objects are used. The procedure
is the same as for value display objects but now in “Simulation Variable” box of the value
access object display properties you will type the parameter exact name. Now while in
simulation click on the display and a small pop-up window “Set New Value” will open allowing
you to change the parameter value directly as shown in Figure 14.

Figure 14 Buffer Tank model parameter change using display

Page 11 of 12
1.8 Questions:

Question1:

What should be the "Beta" - outlet flowrate coefficient so that the liquid level in the tank is L = 4 m &
L = 6 m?

Beta (4m) = ___.

Beta (6m) = ___.

Question 2:

Make a cascade of 3 buffer tanks in series by copying and reconnecting model parts from the existing
model. Rename the tanks to B1, B2 & B3. Rename the connections to "B1, B2 & B3_Fout".

What should be the "Beta" - outlet flowrate coefficients values of the outlet lines so that the liquid
level in tank B1 is L = 6 m in tank B2, L = 4 m and thank B3, L = 2 m?

Beta_B1_Fout (6m) = ___.

Beta_B2_Fout (4m) = ___.

Beta_B3_Fout (2m) = ___.

Appendix 1
1. Model parameter values

Symbol Topology Name Value Units


D Tank Diameter 0.15 [m]
ρ Tank Liquid density 1000 [kg/ m3]
Fm Inlet conn. Inlet mass flow 20 [kg/s]
α Inlet conn. Inl. line valve position 1 [-]
Xm Source system Species mass fraction 1 [-]
β Outlet conn. Outlet flowrate coeff. 20 [kg/s.√m]
Table 4 Buffer Tank model parameters

Page 12 of 12

You might also like