Tutorial 6
Evaluation and reporting

Learning goals

  1. Using the INCASE, THEN and ELSE functions.
  2. Using the SORT# function.
  3. Creating reports using the WINWORD$ function.

1    Objective

In this tutorial we will evaluate the systematic variations of the design using a weighted average of all parameters describing the compatibility of the ships. Then we'll sort the designs in order of compatibility and finally a report is created in MS Word for each design. 

Start

To start this tutorial, a knowledgebase is available [Tutorial 6 start.qkb]. This knowledgebase contains the results of tutorial 5 and is the basis for this tutorial.

Also a Word template file (Report.rtf) has been provided. Make sure you save this file in the Applic directory of your knowledge base so it can be found during calculation.

2    Create a new Dataset as starting point

Create a new object Ship_evaluation. Add this to the list of the present Data object in Dataset (you can either leave the existing Shipsobject or delete is). Make sure that the Determined by property of Ship_evalation is OBJ, otherwise you will discover later on that the data inside the object is not taken to the solution. 

 1. Add the following parameters to the knowledge base:

  • Stab;
  • Comf;
  • Rt;
  • PE; 

    All parameters are values and the "Determined by" of Slots & Properties should be OBJ because they should be taken from the dataset. Stab and Comf are without a dimension. Rt is in [N] PE is in [W]. Move Stab and Comf to the Stability class, Rt and PE to the Resistance class.

    2. Now add data to the dataset that we are going to use during the calculations: 
  • Select the Ship_calc# pararameter in the Ship_calc# solution en press F2 to see the TeLiTab as ASCII data in the editor. 
  • Select and copy all data. 
  • Go to Ship_evaluation in the Data object of the Dataset, right mouse click and select "Database Input..."
  • Select editor, paste the selected data and press ok;
  • Add all parameters as new;

This is the starting point of our evaluation.  

3    Evaluation of the designs

Create the following evaluation relations:


  • Efficiency = 1 + 25.7 - (PE / (DISP * V_eco) * 2.25)
  • Journey = 1 + (28 - (10000 / V_eco / 24)) * 2.25
  • Grade = INCASE(GM,LT,0.4,THEN,0,ELSE,(Stab + Comf + 1.2 * Journey + 1.2 * Efficiency )/4.4)

Add the evaluation parameters as goals to the Ship_evaluation object using a relation: 

  • Evaluation#=Ship_evaluation(@Journey, @Efficiency, @Grade)

Sort the ships, based on their grade

  • Sorted_evaluation# = SORT#(Evaluation#, "Grade",1)

To check whether all this works, carry out a calculation. Start the process manager. Select Data and select Sorted_evaluation#. The content of Sorted_evaluation# will be:

1
"T"  6
13     "B" "Comf"  "DISP"     "Efficiency"             "GM"          "Grade"         "Journey" "Lpp"   "PE"  "Rt" "Ship_no" "Stab" "V_eco"
"1"     10      8 2333.93 38.6480491449654 .553398202459656 5.57756712218065 -30.6969696969697    69 207203 40628        24      7     9.9
"2"     10      8 2266.28 38.3465066099511 .553398128700385 5.49532824899493 -30.6969696969697    67 204204 40040        23      7     9.9
"3"     10      8 2198.63 38.7907926625442 .553398050402093 5.08399312539864 -32.6494845360825    65 189895 37979        22      7     9.7
"4"    9.5      8 2217.23 38.3440805234869 .440943520894688  5.0401211345047 -30.6969696969697    69 199808 39178        16      5     9.9
"5"    9.5      8 2152.96 38.0417738622852 .440944712112109 4.95767386326785 -30.6969696969697    67 196880 38604        15      5     9.9
"6"     10      8 2130.98 39.2266042038479 .553397967132492 4.64792554841785 -34.6842105263158    63 176336 35987        21      7     9.5
"7"    9.5      8 2088.69 38.4964440408142   .4409459766382 4.54917077401774 -32.6494845360825    65 183050 36610        14      5     9.7
"8"   10.5      6 2450.62 43.2450561580245 .671624891047978 4.33356676437631  -39.021978021978    69 154419 32855        32      8     9.1
"9"     11      4 2567.32 43.9532574910716 .795613455795666 4.29943985520735  -39.021978021978    69 154419 32855        40      9     9.1
"10"  10.5      6 2379.59 42.7799998201278 .671623574439293 4.20673321767722  -39.021978021978    67 154419 32855        31      8     9.1
"11"    10      8 2063.33 39.6535948036083 .553397878402603 4.18558450655592 -36.8064516129032    61 163502 34063        20      7     9.3
"12"    11      4  2492.9 43.5092946054707 .795616214404463 4.17835906822529  -39.021978021978    67 154419 32855        39      9     9.1
"13"   9.5      8 2024.43 38.9419763964749 .440942179527076 4.11575432822523 -34.6842105263158    63 169952 34684        13      5     9.5
"14"    10      8 1995.68 39.3103079425753 .553397783657142  4.0919608171833 -36.8064516129032    59 160973 33536        19      7     9.3
"15"  10.5      6 2308.56 42.2863256843998 .671622176811518 4.07209481702412  -39.021978021978    65 154419 32855        30      8     9.1
"16"    11      4 2418.49 43.0380742827045 .795613372163805 4.04984443474358  -39.021978021978    65 154419 32855        38      9     9.1
"17"  10.5      6 2237.52  41.761232088195 .671626373619006 3.92888747260462  -39.021978021978    63 154419 32855        29      8     9.1
"18"    11      4 2344.07  42.536867829023 .795616303267392 3.91315176555773  -39.021978021978    63 154419 32855        37      9     9.1
"19"  10.5      6 2166.49 41.2017836555802 .671624976113436 3.77631062734606  -39.021978021978    61 154419 32855        28      8     9.1
"20"    11      4 2269.66 42.0028671792154 .795613277563843  3.7675152247011  -39.021978021978    61 154419 32855        36      9     9.1
"21"   9.5      8 1960.16 39.3791713513841 .440943443930879 3.65619629231296 -36.8064516129032    61 157550 32823        12      5     9.3
"22"  10.5      6 2095.46 40.6044078732011 .671623483865116 3.61338995942448  -39.021978021978    59 154419 32855        27      8     9.1
"23"    11      4 2195.24 41.4325864242534 .795616404179547 3.61198410971146  -39.021978021978    59 154419 32855        35      9     9.1
"24"    10      8 1928.03  39.719508104925 .553397682262895 3.59932638625825  -39.021978021978    57 148981 31698        18      7     9.1
"25"   9.5      8 1895.89 39.0354178155157 .440944794060366 3.56244532798522 -36.8064516129032    59 155078 32308        11      5     9.3
"26"    11      4 2120.83 40.8223680219433 .795613169686709 3.44556090908144  -39.021978021978    57 154419 32855        34      9     9.1
"27"  10.5      6 2024.43 39.9651125363574 .671621886901496 3.43903668573983  -39.021978021978    57 154419 32855        26      8     9.1
"28"    11      4 2046.41  40.167682073474  .79561651976985 3.26701019586255  -39.021978021978    55 154419 32855        33      9     9.1
"29"    10      8 1860.38 40.1189177220167 .553397573494541 3.07686520099944 -41.3370786516854    55 137655 29925        17      7     8.9
"30"   9.5      8 1831.62 39.4542897982222 .440946238939662 3.07244866624842  -39.021978021978    57 143496 30531        10      5     9.1
"31"  10.5      6 1953.39 40.3558977978991 .671626683611566 2.91422340351284 -41.3370786516854    55 142706 31023        25      8     8.9
"32"   9.5      8 1767.36 39.8627523665082 .440941899059738 2.55245646767894 -41.3370786516854    55 132563 28818         9      5     8.9
"33"     9      6 1674.34 39.5858243556777 .334253150495119                0 -41.3370786516854    55 127420 27700         1      2     8.9
"34"     9      6 1735.22 39.1664102984186 .334255891471973                0  -39.021978021978    57 137964 29354         2      2     9.1
"35"     9      6 1796.11 38.7377720642155 .334253245068508                0 -36.8064516129032    59 149126 31068         3      2     9.3
"36"     9      6 1856.99 39.0816814246225 .334255803208416                0 -36.8064516129032    61 151541 31571         4      2     9.3
"37"     9      6 1917.88 38.6343673606713 .334253327632593                0 -34.6842105263158    63 163498 33367         5      2     9.5
"38"     9      6 1978.76 38.1771111732371  .33425572580808                0 -32.6494845360825    65 176140 35228         6      2     9.7
"39"     9      6 2039.65 37.7117519605636 .334253400338292                0 -30.6969696969697    67 189480 37153         7      2     9.9
"40"     9      6 2100.53 38.0146677158968 .334255657381707                0 -30.6969696969697    69 192336 37713         8      2     9.9

4    Check the template file of the report, create a report 

Open the file (Report.rtf) in MS Word to take a look at it. All kind of parameters between # are visible. Moreover, a Boolean expression is used in: #GM<0.4[1]#INSUFFICIENT[1]: When GM is smaller then 0.4, the text INSUFFICIENT is shown. More information on the possibilities with templates is given in the description of the function TEMPLATE$() in the wiki.

 

This template should always first be checked on strange RTF code. Use the menu item Tools>RTF Template Check... You will be asked to select a file and the Template delimiter (usually #, as in our file). Then Quaestor will check,  rovide a log file and store the original and changed template. The log is as follows:

Do this once or twice until you only see sensible template code in the log. 

We will end this tutorial creating a report of each ship. Add the folowing relation to create the report:

Report$= WINWORD$ Report.rtf("Report.doc",0,Ship_no,Lpp,B,T,DISP,GM,Stab,Comf,V_eco,Rt,PE,Efficiency,Journey,Grade)

The WINWORD$() function will create Word files named Report*.doc. in your report directory and returns the name of this file to Report$. In multiple case situations a number (*) is added to the name of the document.

So make sure the reports are created, modify Evalution# and add Report$:

Evaluation#=Ship_evaluation(@Journey, @Efficiency, @Grade, @Report$)

Make sure Report.rtf can be found.

To generated the total solution, select Data in the dataset and run Evaluation# as top goal. A report is generated for each ship and added to each case. If parameters are requested during the calculation, check the following:

  • Does Ship_evaluation have the OBJ Determined by property?
  • Do the parameters carrying out intermediate values have the correct Determined by properties? 

You can open a document by double-clicking it in the object:

 
 

One of the Word reports:

 

Final remarks 

These six tutorials showed both the way to create a knowledge base and some basic elements about working with ranges, objects, data and external processes, in general used in classical knowledge based applications and Scenario base applications.

Please note that it is possible to create the same functionality in many different ways. So feel free to experiment. For instance, it is possible to make the ship design variations (B, Lpp, etc.) part of the calculation process enabling a user to vary the design space he or she wants to investigate. Moreover, we did not discuss the SCENARIO$() function to create a scenario of input and output actions or all kind of other intrinsic functions.

Moreover, we have not discussed any specific knowledge engineering related to Taxonomy based applications. For the latter we will introduce a new set of tutorials. 

For more inside information you can use the following KE resources on Quaestor:

 

Also take a look at examples, these are always very helpful to solve a particular problem. [Example applications] 

5    Check

 You can verify your results by comparing it to [Tutorial 6 finish]

<< Back to tutorial 5  Overview

  • No labels