Tutorial 3Intrinsic functions Interpolation and integration | Learning goals
| Prior Knowledge |
In this third tutorial, we you will store the waterline data of the previous tutorial in a new object within the object Ships
. We You will perform linear and quadratic interpolation to obtain the relative width of unknown frames at the waterline. This will be checked with the exact solution, and the error is to be calculated. Some hydrostatic calculations will be performed: by numerical integration the waterplane area and the moment of inertia of this area are calculated. The stability GM will be calculated and compared to other ships using the least squares method.
Start
For this tutorial, the knowledgebase from tutorial 2 is used. You can either use your own (verified) knowledgebase, or download it here: [Tutorial 3 Start]
The solution Waterline Waterline
containing the shape of the dimensionless waterline, has been created in tutorial 2. In order to store this data and use it for further operations, the contents will be placed in a new object within the object Ships.
...
Geometry
, create a new object (i.e. a parameter of type Object) called Hull
. As ...
...
...
Ships
(under Dataset). In the Knowledge Browser, right click the parameter ...
Hull
and select Parameter to Dataset (or press Ctrl+O or drag ...
Hull
tot ...
Ships
). The new object is now placed within Ships
.Let's add the content of the Waterline
object in the Waterline
solution to the object Hull
.
...
Anchor | ||||
---|---|---|---|---|
|
...
Waterline
, in the tree of the Workbase, ...
Waterline
object (so the tree node in the solution) ...
...
Waterline
object are now displayed. You temporarily have to use a workaround now, because the Paste ...
Hull
object in the Dataset and select Database Input or press Shift+F3. In the pop-up window that appears, select Use Editor and click Continue. In the window that appears next, press Ctrl+V to paste the data in the object. Click OK. Select Yes to All and click Continue.When you are done, you will have a Ships
object containing data in a Hull
object. The Hull
object should be part of the Ships
object because the Ships
object is the database entry point. And because you want to use all Waterline
data as one set, it should be in one Hull
object (or as a TeLiTab value as an alternative).
The workbase is full of solutions weyou'll not use anymore. So now first let's clean it up.
The relative width Rel_B
at every frame was calculated directly using the a polynomial formula. In reality, the waterline of a ship will be defined more likely by a number of points than by a formula. To obtain the width at a certain location, you should interpolate between these points. We'll You can use the LININT() function to perform a linear integrationinterpolation.
...
Top Goals/Undefined
:Intpol_Rel_B=LININT(@Hull,2,@Frame,@Rel_B,Frame)
Intpol_Rel_B
is dimensionless and determined by SYS: System/Equation....
The syntax of every intrinsic function in Quaestor is described in the wikithis documentation, see the functions overview. The syntax above means the following.
Inpol_Rel_B
will be the linear interpolated dimensionless width at a desired frame number (Frame
).@Hull
is the object containing all the data you want to use for the interpolation.2
is the number of dimensions in which the interpolation will take place.@Frame
makes sure the ...
Frame
of object Hull
will be used as the parameter X in the interpolation.@Rel_B
makes sure the column Rel_B
of object Hull
will be used as the parameter Y in the interpolation.Frame
is the input parameter for which an interpolated value should be obtained.When Quaestor calculates this function, it determines the value value of Frame
(which is user input). This value is then compared to the values of the given column for X (which is the column Frame of column Frame
of the object Hull
), and an interpolated value for Relfor Rel_
B with B
with respect to the input Frame
is assigned to the parameter Intpol_Rel_B
. Notice that an @
is used to identify the data within the object.
...
Intpol_Rel_B
using the ...
...
Ships
object. Make sure that Intpol_Rel_B
is in the class Top Goals/Undefined
to see it in the Process Manager. The ...
...
Ships
object should be used (which contains the object Hull
). For ...
Frame
, enter 3.20.Quaestor should return 0.26 for Intpol_Rel_B
.
To find out how accurate the interpolation is, we let's introduce an error Error
parameter. The interpolated parameter uses static data from the object Hull
, but we you also defined the relative width analytically (the parameter Rel_B
).
...
...
Top Goals/Undefined
class:Error = Intpol_Rel_B - Rel_B
in which
...
Error
is a dimensionless SYS parameter.
Intpol_Rel_B
will be calculated by Quaestor automatically because it is required by Error
. Make sure you use the ...
...
Ships
object as dataset. For ...
Frame
, enter 3.20 again.The solution in two-digit format (-0.00) will be presented in the list of the Workbase. When you select this solutionvalue, more digits are shown in the Frame Viewer (figure 2a) or the Explanation window (figure 2b). Note that you .
Info |
---|
You can change the number of decimal places presented in the Workbase by changing the value Decimal places in the |
...
Properties window. |
...
Note |
---|
For |
...
input values, |
...
the number of |
...
decimal places also defines the maximum accuracy accepted for this input. So, when you |
...
define |
...
decimal places, providing input with three will give a warning |
...
followed by rounding the provided number |
...
to two |
...
decimals. |
Figure 2a In the Frame Viewer, more digits of the selected parameter are shown
Figure 2b In the Explanation window, more digits of the selected parameter are shown
...
Error
, Intpol_Rel_B
and Rel_B
to 4.Intpol_Rel_
...
B
toIntpol_Rel_B = DQUAD(@Hull, 2, @Frame, @Rel_B, Frame)
...
which uses the same data, but now performs a quadratic interpolation. It's not necessary to initialize existing solutions.
Editing relations was covered in tutorial 2. Remember that the use, syntax and examples of all quaestor Quaestor functions are available in the wikidocumentation: functionsoverview.
...
Error
again with the same value of Frame
.The error now turns out to be zero. This makes sense, as DQUAD is a quadratic interpolation method and this waterline is defined by a quadratic function as well.
By numerical integration, the waterplane area can be calculated. Therefore, the dimensionless length and width should be transformed to the real length and width. For the width we you can use the existing relation for B_Frame
, for the length in meters we add a new relation is needed.
...
Geometry
, add the following relation...
X = Frame/20 * Lpp
which is the position in meters along the longitudinal direction of the ship. By now you should know
...
what proper dimension, reference and determined by value
...
must be provided.
To calculate the waterplane are area for a certain ship, we would like Quaestor to Quaestor has to integrate the width with respect to X. The dimensionless width table is already present in our your object Hull
, so let's use it in the integration.
...
Top Goals/Undefined
class, add the following relation...
Waterplane_Area = INTEGR(Hull(@X, @B_Frame, Lpp, B), 2, @X, @B_Frame, 2, 0, Lpp)
...
which is the waterplane area in square meters (m^2).
The syntax used here may seem a bit confusing at first.
First, we take a look at the arguments after Hull
. Data within the object Hull
will be used in the integration, but yet it only contains dimensionless frame numbers and dimensionless widths. By putting (@X, @B_Frame, Lpp, B)
behind it, you ask Quaestor to calculate X
and B_Frame
using data from within Hull
, using Lpp
and B
from outside Hull
and add all these parameters to the object Hull
. You do actually use the object Hull
as a function to calculate other parameters. This is a very powerful ability of Quaestor (see also QuaestorSyntax).
The arguments for the INTEGR function are as follows:
HULL(..)
is the object from which data will be used, now containing the columns X
and B_frame
2
is the number of dimensions = always 2 using INTEGR.@X
refers to the column that will be used as the parameter X in the integration: X
@B_Frame
refers to the column that will be used as the parameter Y in the integration: B_Frame
2
is the mode of integration, either Riemann (0), Trapezium (1) or Simpson (2). The latter is chosen here....
0
and Lpp
are the ...
...
Waterplane_Area
, using the process manager Process Manager. The waterplane area is calculated for every variation in length and breadth of the ship.
...
Waterplane_Area
solution tree, select the object Hull
...
The telitab of the object hull is visible now (figure 3). Because we Because you solved a multiple case problem, the object has been used as function and reused for every case. Only the contents content of the last case calculated remains in the object.
The columns X
and B3_Frame
are added to the object. These values are calculated for every case of Frame
and Rel_B
within Hull
.
Figure 3 Contents of the object Hull
The initial stability (GM) of the ships can also be calculated using numerical integration.
...
...
Stability
, as sub-class of Geometry
. ...
GM = KB + BM - KG
The dimension dimensions of all new parameters is must be meters (m), and they are defined by a relation (which follows). GM SYS parameters. Their relations follow. GM
is a Top Goal and should be moved to Top Goals/Undefined
.
Stability
, enter the following relations.Distance between keel K and center of buoyancy B, select KB
...
, right-click and select New Relation...
...
(or press Ctrl+N). By selecting KB
it is automatically presented as left side part of the relation:
KB = 0.7 * T
Distance between keel K and center of gravity G, KG
, in meters:
KG = 0.8 * T
Distance between center of buoyancy B and metacenter M, BM
, in meters:
BM = Moment_of_Inertia / (DISP * 1000/ Rho)
Third power of the width at a specified frame number in m^3:
B3_Frame = B_Frame^3
Moment of inertia of the waterplane area in m^4:
...
Moment_of_Inertia = 1/12 * INTEGR(Hull(@X, @B3_Frame, Lpp, B), 2, @X, @B3_Frame, 2, 0, Lpp)
Note that the syntax of the moment of inertia relation is similar to that of the waterplane area relation. might still have a red cross and an Error warning in the knowledge base although you have provided the relation and a dimension. When this is the case, for sure you still have the Hull object in focus in a solution of the Workbase. When this is the case, Quaestor communicates that the relation you have provided cannot be used inside this object (and thus you have a red cross for Moment_of_Inertia). When you select a top node of a solution, you will see that the Moment_of_Inertia parameter is properly defined.Third power of the width at a specified frame number in m^3:
Do not forget to provide all dimensions and references, and change the Determined by fields to SYS: System/equation
Note that the syntax of the moment of inertia relation is similar to that of the waterplane area relation.
...
.
@RANGEALLOWED
to parameter DISP
(Parameter tab, Data field of Properties window).GM
of every possible ship, by selecting the ...
Ships
object and GM
as task in the ...
GM
solution tree, select the object Hull
.If the object Hull
in the solution is now opened again, you'll see that, like for the waterplane area, the columns X
and B3_
frame Frame
are added to the object, whose values are calculated for every case of Frame
and Rel_B
within Hull
. Note that the parameter B_Frame
is also added, as it is used to calculate B3_Frame
. See figure 4. Again, only the values of the last ship (last input case) are stored in the object.
Figure 4 Object Hull with added parameters
Finaly, welet'd like to s compare the obtained values for GM
to other ships. Data of the GM
value for a certain ship length is available, so we only have to compare them. We'll You can use the least squares method to obtain an average GM
value for a certain length, using the data of some other ships.
...
Top Goals/Undefined
:GM_Check = LEASQ(TEXTITEM$(1), 2, "L", "GM", Lpp, 2)
GM_Check
is in meters.
...
...
GM_Check
:...
Code Block | ||
---|---|---|
| ||
TEXTITEM1 =
|0
3 "ExampleShip" "L" "GM"
"1" 1 70 0.6
"2" 2 75 0.7
"3" 3 60 0.5
"4" 4 80 0.9
"5" 5 75 0.55
"6" 6 60 0.6
"7" 7 55 0.8
"8" 8 65 0.75
"9" 9 72 0.6
"10" 10 80 0.56| |
...
The LEASQ interpolation function now returns an average GM GM
value in meters for a certain Lpp
. The syntax TEXTITEM$(nr)
is often used in Quaestor, and refers to a template, text item or TeLiTab in the Data slot of the Expression Editor. In this way, data that is not included in the knowledgebase but is only used in a particular function (as in our relation) can be used.
Note that the syntax of the relation uses TEXTITEM$(nr)
, but in the data slot the syntax TEXTITEM1=
is used. The TeLiTab is written between two | characters. Multiple textitems can be available in a relation (TEXTITEM$(
101), TEXTITEM$(2) .. TEXTITEM$(n))
. Furthermore, please
Note |
---|
Please note that "the devil is in the detail". Small errors in your syntax will always be a |
...
problem for software such as Quaestor. Therefore, keep checking the correctness of your syntax. |
...
Figure 5 Including data in the relation by using textitems
...
|
Waterplane_Area
, GM
...
GM_Check
as goals. ...
Info |
---|
You can select several goals at once |
...
! |
To browse through results, it might be convenient to maximize the workbase window. Remember that you can always return to the default lay-out using the menu sequence Window->Standard. The result of the last solution is shown in figure 6.
should look like this:
Figure 6 Output of the solution, if the workbase window is maximized an inspection of the results is more easy
You can verify your results by comparing it to [Tutorial 3 Finished]