4.3. P RUEBA DE H IPÓTESIS
4.3.2 Contrastación de las Hipótesis Específicas
Variables
There are many different ways to classify OFM variables (also called project variables), depending on how you would want to use them. Based on the table types that the variables belong to (or created from), you would have monthly, daily, sporadic variables, etc… Based on data type, you would have date, numeric or alphanumeric (text) variables. However, the most
recognizable classification, the OFM primary classification, is based on database (storage/processing) properties.
Consequently, there are three types of variables:
• Input Variable
• Calculated Variable
• Calculated Field
Input Variable is the simplest form of variable. Input variables are fields that belong to physical tables with physically loaded data. In other words, if you open the table in Access or in OFM you would see editable data. Input variables do not change value, i.e. every time a request is made to an input variable (on a specific entity), you would get the same copy of the data. In its Access database (project), OFM stores both the design and the data of the input variable.
Calculated Variables are derived variables or dependent variables. OFM only saves the definition of a calculated variable, not its physical data. Therefore the value of a calculated variable may change from time to time. For example, each time a retrieval request for a calculated variable is made you may get a different copy of the data. The advantage of this variable type is that you always get the most up-to-date copy of the data, and you do not have to worry about project storage capacity.
Calculated Field (formerly known as Imputed Variable) is a unique variable type in OFM. There are scenarios when neither input nor calculated variable would be sufficient to address. Fortunately, with the existence of Calculated Fields, those problems are resolved; and the combination of these three types of variables has been proven to be a complete solution for any practical purpose.
The first scenario involves divide by zero operation. As most of the software applications handling computing, this operation involves some sorts of unusable result. In the oil industry many variables are defined as ratios, and
following rule on all the arithmetic operations: Any arithmetic operation with a null operand results in a null. If you choose to handle this problem from calculated variable perspective, you may get into trouble grouping (adding or averaging) or performing consequent arithmetic operations on that calculated variable. OFM offers a better way of doing it, with an intrinsic if statement to replace the unusable results by nulls.
The second scenario arises with the grouping option. One perfect example to demonstrate the concept of calculated field is the Gas-Oil Ratio, defined as Gas/Oil. On an individual level (single well), it does not make any difference.
Yet on grouped level, there is a big difference between ratio of the sums and sum of the ratios. As you group the wells, OFM groups (sums) Gas from the source, groups Oil from the source, and then takes the ratio. This is similar to taking the average (per well). What if you want to group individual (well) ratios?
The last scenario is even more complicated. Primary OFM data frequency is monthly, and users are used to creating (average) daily rates by dividing monthly productions by the reported numbers of producing days in the month.
Grouping productions and producing days at the source and then taking the ratio would yield the (per well) average daily rate. Taking the ratios and then grouping them would result in a field daily rate. Depending on what you want to do with your data, you have to choose the correct implementation of which variable type to use.
Learning Objectives
In this module we will cover how to create calculated variables and calculated fields. You will have a chance to apply them in the next section, Reporting. At the completion of this module you will be able to:
• Edit Calculated Variables
• Add Calculated Fields
• Create Calculated Variables
Calculated Field
1. Select Database>Schema Tables. The Edit Schema Tables dialog displays.
2. Highlight the MonthlyProd table from the OFM Representation pane and right-click. A shortcut menu displays and select Add.
3. Name the new field GOR.
4. Highlight the GOR field on the left pane. Select Field tabbed page and locate the Variable section of the dialog.
5. In the Type field select Calculated (Double). The Edit Calculated Field dialog displays.
Note: You can select the desired fields from Source Fields list, click Add (as many times) to add them to the Definition box, and click to add the necessary operators (from Operators group box) to complete the statement.
6. In the Definition section type, IIF( OIL <> 0, GAS/OIL, NULL ).
7. Click OK. The Edit Calculated Field dialog closes and you are returned to the Edit Schema Tables dialog. The equation is displayed in the Equation section of the dialog.
Note: You can always edit the equation by clicking the Edit button and changing it from the Definition text box.
8. Select the Units tab. Select cf/bbl from the Units list.
9. Select the Math tab. Change the Input and Output Multipliers to M (since Monthlyprod.Gas is set to M).
10. Select the Report tab. Change the Format Width to 12. Accept the default Decimals.
11. (Optional) Change the heading.
12. Select the Plot tab. In the Curve Name field type (Calc’d Field) Gas-Oil Ratio.
13. Assign the following attributes:
• Line Color – Red
• Line Type – Solid
• Line Width – 4
14. Click OK. The Edit Schema Tables dialog closes and you are returned to the main OFM window.
Exercise 14 Adding Calculated Fields
Add the following calculated fields to your project, from the Monthlyprod table:
1. Name: PDOIL, definition: IIF( DAYS <> 0, OIL/DAYS, NULL ). Assign the attributes.
2. Name: WCUT, definition: IIF( (WATER+OIL) <> 0, WATER/(WATER+OIL), NULL ). Assign the attributes.
3. Name: ON, definition: IIF( [OIL] OR [GAS] OR [WATER], 1, 0 ). Assign the attributes. (This variable may have been included in the project).
Question
What do you think the variables mean?
Calculated Variables
There are virtually no limitations on how many calculated variables you can have in your project. Calculated variables can be exported/imported to/from similar projects (i.e. using a template). With more than 230 system functions in OFM, calculated variable is one of the strongest functionalities that OFM users should take advantage of. In the scope of this course, we will be learning how to create a few most common used calculated variables.
Note: Most of them will be verified on the Report, your next module.
The Demo2005 project comes with a built-in set of typical calculated variables.
In any case, you are welcome to examine their definitions, attributes and use them as a starting point.
Note: The Database>Calculated Variables menu command is a global menu command that you can access from any module in the project.
Ratio Variable
1. Open the Demo2005 project. Select Database>Calculated Variables.
The Edit Calculated Variables dialog displays.
An individual or asset team may be familiar with a standard set of calculated variables.
The User column classifies the following:
• Standard Company Calculated Variables
• Calculated Variables for a specific asset team
• An engineer’s personal set of Calculated Variables
• A combination of the above points
The Class column specifies the category type of calculated variables. Such classifications can be to:
• Class monthly calculated variables only
• Class daily calculated variables only
• Class water flood variables only
The Variables column displays the subset of calculated variables of interest in an OFM project based on the “User” and “Class” selected. The default is to display all calculated variables.
2. Click New. The Edit Calculated Variable dialog displays. In the text field at the top of the dialog type Monthlyprod.Gas/Monthlyprod.Oil.
3. Click OK. The Edit Calculated Variable dialog closes and the Edit dialog displays.
4. In the Name field type CV.GOR. Leave User and Class fields unspecified.
5. Assign attributes to the calculated variable. Select the Units tab and assign M as the Output Multiplier. In the Units section select cf/bbl.
Note: It is recommended to assign more attributes for this variable, i.e. Report Headers, Plot Name, etc.
6. Click OK the Edit dialog closes and you are returned to the Edit Calculated Variables dialog.
7. Click Close.
Cumulative Variable
Cumulative productions are always figures of interest. To create cumulative productions, OFM provides a system function named @CumInput(). This function calculates the running sum of the variable inside the parentheses (called argument), including prior cumulatives (precums). Please ask your instructor for the concept and usage of precums in OFM.
1. Open the Demo2005. Select Database>Calculated Variables. The Edit Calculated Variables dialog displays.
2. Select New. The Edit Calculated Variable dialog displays.
3. In the text field at the top of the dialog type @CumInput( MonthlyProd.Oil ).
4. Click OK. The Edit dialog displays which prompts for name of the variable, units, reports, and plots attributes.
5. In the Name field type CV.CumOil .
6. Select User and Class according to the type of the variable. Leave them empty for this exercise.
Do NOT click OK. (If you select a variable from the list, you can edit/delete that variable).
7. Select the Units tab.
8. Select M for Output Multiplier and select bbl (bbl = = >m3) for Units.
9. Select the Report tab. In the Decimals field type 3.
10. Change the Heading to Cumulative and Oil (two different rows).
11. Select the Plot tab. In the Curve Name field type Cumulative Oil.
12. Assign the following attributes:
• Line Color – Green
• Line Type – Solid
• Line Width – 4
13. Click OK. The CumOil has been added to the project (can be found from the variable list). The @CumInput() function can only take input variable as argument. If your argument is not an input variable, use @Rsum() or
@CRSum(). These system functions do not take previous volumes (precums) into account.
Exercise 15 Create Calculated Variables
1. Create similar calculated variable for Gas Cumulative and Water Cumulative.
2. Close the Edit Calculated Variables window.
Date/Event Variables
Many dates are very important to the project. Date of first production, date of last production, date of a specific event, etc., mark critical instances for analytical work. Even though dates and numbers resemble each other in many aspects, they are different in many other aspects. Therefore, dates are specially treated when it comes to their use.
1. Select Database>Calculated Variables. The Edit Calculated Variables dialog displays.
2. Click New. The Edit Calculated Variable dialog displays.
3. In the text field at the top of the dialog type @First( Date,
(Monthlyprod.Oil > 0) | (Monthlyprod.Gas > 0) | (Monthlyprod.Water >
0) ).
4. Click OK. The Edit Calculated Variable dialog closes and the Edit dialog displays.
5. Select the Define tab and in the Name field type CV.FirstProdDate.
6. Select the Units tab. In the Units section, select Date.
7. Select the Report tab. In the Heading section type First, Production, and Date. Please refer to the image below.
8. Do not change anything on the Plot tab. Click OK.
Note: @First() and @Cfirst() functions very much do the same thing.
@First() doesn’t require the second argument (the condition) whereas
@Cfirst() imposes the existence of the condition.
Exercise 16 Create a Calculated Variable
Create a calculated variable for Date of Last Production using @Last() or
@CLast() function.
When reporting (or plotting), date variables are displayed in number-like forms, i.e., 19900101.000. Even if you choose not to display the decimals, the date displays still resemble numbers. OFM provides a function called @FmtDate() so you can format the date variables to the displayed forms that you want, i.e.
1990/01/01 or Jan-01-1990. This function is used extensively on the report and headers (since headers can only be text). The output (return) of this function is a text string.
1. Select Database>Calculated Variables. The Calculated Variables dialog displays.
2. The Edit Calculated Variable dialog displays.
3. Click New.
4. In the text field at the top of the dialog type @FmtDate(
CV.FirstProdDate, “Mmm-dd-yyyy”).
5. Click OK. The Edit dialog displays.
6. In the Name list field type CV.DateofFirstProd.
7. Click OK. The variable has been added to the project.
(Dynamic) Computing Variables
Sometimes, scrolling through all the records of a well (an entity) to find a specific record (i.e. maximum production) is time consuming, especially when the maximum production value varies from well to well and happens at different times. Even though OFM provides the sorting algorithm to make the task easier, having the dates shuffling up may not be a desirable by-product.
Fortunately, OFM has functions that can resolve such a concern. In this exercise, you are going to learn how to create a calculated variable that
returns the maximum oil production rate for each well. You can even report the date where that peak production was achieved.
1. From the Calculated Variable dialog, click New.
2. In the text field at the top of the dialog type @Tmax( Monthlyprod.Oil, Monthlyprod.Oil > 0 ).
3. Click OK. The Edit dialog displays.
4. Select the Define tab. In the Name field type CV.MaxOil. Leave the rest on this tab unchanged.
5. Select the Units tab. Select bbl for Units.
6. Select the Report tab. Enter Max Oil Production (separate rows) for the Heading.
7. Select the Plot tab. Enter Maximum Oil Production in the Curve Name text field.
8. Select the following curve attributes:
• Line Color – Dark Red
1. Create a variable that reports the date where the well achieved its peak oil production.
Hint: You can logically argue that date could be the first instance (date) where the well’s oil production (Monthlyprod.Oil) equals to the maximum oil
production (CV.MaxOil). Thus, using the @First() (or @Cfirst() function) to pick up the Date where Monthlyprod.Oil = CV.MaxOil would be a good approach.
2. Click Close to close the Calculated Variables window and return to the opened module.
Exercise 18 Plot Variables Versus Date
Plot the MonthlyProd.Oil and CV.MaxOil versus Date and traverse through the wells/entities to see how the CV.MaxOil variable works.
Question
How could we plot only one value, right where the peak oil happens?
Text Display Variables
There will be times that you may want to display some values on the report, plot and/or other modules as headers/footers. Numeric variables can certainly be displayed in their original format, yet they would not appear very neat. You may want to create calculated variables to convert the outputs to texts and display them better with attributes like names, units, multipliers, etc. In this exercise, you will look at several built-in variables (provided with the Demo2005 project) and then create a couple calculated variables.
1. Select Database>Calculated Variables. The Edit Calculated Variables dialog displays.
2. In the Variables column, select the first variable and type gh. OFM searches the variables name list and guides you to the first variable in the list that starts with gh, gh.Cumgas.
3. Select gh.Cumoil from the list, then click Edit.
4. Click the Edit button located in the Equation section of the dialog. The Edit Calculated Variable dialog opens displaying the definition of this variable.
Note: You can edit/modify this equation at this time. However, this definition is good as it is, @FmtName(Oil.Cum, @Last(Oil.Cum)). Analogous to the syntax of the @FmtDate() function in your earlier exercise, this variable will return the value of the last cumulative oil production (based on monthly records), with the plot name, and other numeric attributes assigned for its properties.
5. Click OK (or Cancel) to close the Edit Calculated Variable window. You are returned to the Edit gh.Cumoil dialog. Since this variable is used for retrieving the last value of Oil.Cum, it will use the variable attributes of Oil.Cum for display. Do not worry about assigning attributes for it (not even the field Width).
6. Click OK. The Edit gh.Cumoil dialog closes and you are returned to the Edit Calculated Variables dialog. Do not close this dialog.
Notes:
• Notice that if you highlight a variable, its definition is displayed at the bottom of the window. If you select Edit again, you can also see its definition in the Equation box. These provide quick studying of the variable’s definition. However, there is a limitation of how many characters of the definition can be displayed, and it could be misleading if you do not see the complete equation and use it correspondingly.
• The gh.Cumgas and gh.Cumwater were similarly defined to retrieve last cumulative gas and water productions in text form.
7. From the Variables section of the dialog select gh.Lease from the list.
Look at its definition at the bottom of the dialog. This variable retrieves the name of the lease the selected entity is related to. The equation is short enough to be displayed in full below, read the definition from the Edit Calculated Variable dialog. (The gh.Reservoir variable was created similarly).
8. From the Edit Calculated Variables dialog, click New. The Edit Calculated Variable dialog displays.
9. In the text field at the top of the dialog type @FmtName( Ratio.GOR,
@Last(Ratio.GOR) ).
10. Click OK. The Edit Calculated Variable dialog closes and the Edit dialog displays.
11. In the Name field type gh.lastGOR and leave the rest of the settings at their default value.
Notes:
• The spaces and, sometimes, parentheses are not required. However, the use of those helps promote readability and makes it easy to maintain.
• OFM variables are not case-sensitive.
12. Click OK. The Edit dialog closes and you are returned to the Edit
Calculated Variables dialog. Remember that this variable will only be used for displaying on the header, so it is using the attributes of the Ratio.GOR variable. It is a good time to look at what attributes were assigned to the Ratio.GOR variable.
13. Locate and select the Ratio.GOR variable from the list. You can either scroll down the list to find or start typing the word Ratio. OFM will dynamically shift the variable display list to where it starts with the matching letter(s)).
14. Click Edit. The Edit dialog displays with the Define tab active.
15. Select the Units tab and look at the units specifications. It should be set to cf/bbl (though it appears as cf/bbl = => scm/m3), since this project is set to the English unit system.
Note: OFM reads the list of available units seen in Edit>Project>Units, to which you can add your own customized units.
5. Select the Report and the Plot tabs. OFM will use the Plot Name of this Ratio.GOR variable as it displays gh.LastGOR on the header.
17. (Optional) Select the Units tab and verify that the Output Multiplier is set to M.
18. Click OK the Edit Ratio.GOR dialog closes and you are returned to the Edit Calculated Variables dialog.
19. Click Close. This concludes Editing Calculated Variables at this time.
20. Click the Plot icon. The Edit Plot dialog displays.
21. Click in the Variables field and select Monthlyprod.Oil.
22. Click Add Curve. Another row is inserted in the Edit Plot dialog.
23. Click in the Variables field and select Monthlyprod.Gas.
When all the data is grouped and Monthlyprod.Oil, Monthlyprod.Gas are plotted vs. Date, the plot displays as pictured below (provided that the Y axis scale is Logarithmic and Legend to be displayed).
24. Locate the Properties pane, expand the Headers property and click in the field to the right of Setup. A button is displayed in the Setup field.
24. Locate the Properties pane, expand the Headers property and click in the field to the right of Setup. A button is displayed in the Setup field.