IE 212: Computational Methods for Industrial Engineering Summer 2015

advertisement
IE 212: Computational Methods for Industrial Engineering
Summer 2015
Homework #6: Using variables and capturing user input
Thursday, July 30th, 2015
IMPORTANT NOTES
To obtain full credit in this homework, you must:

Submit a single Excel file via The Engineering Accounts & Classes (T.E.A.C.H.) homepage
(http://engr.oregonstate.edu/teach) before the beginning of the lecture session on Thursday,
July 30th, 2015 at 1:00 PM. Late submission is not allowed.
- Before submitting your solution file via T.E.A.C.H., make sure that the sample data
provided for each problem is in the format it was before you tested your sub procedures.
This will simplify the grading process.

Submit a hard copy of the last page included in this document at the beginning of the lecture
session on Thursday, July 30th, 2015.
- Do not forget to add your name and your grader's last name electronically to this page.

Solutions for each individual problem should be prepared in separate worksheets.

Make sure to follow good programming practices. In particular:
 Add comments to document your code, and
 Use indentation to make your code more readable and easier to grade.
1
PROBLEMS
Open a blank Excel workbook and save it as a MACRO-ENABLED file using the naming convention
“YourLastName_Hmw6.xlsm.” Your workbook must contain only two worksheets named "Prob1"
and "Prob2", respectively. In the Visual Basic Editor (VBE), insert a new module into the Project
Explorer and write (do NOT record) all your sub procedures inside this module.
Problem 1 (20 pts)
1. Write a sub procedure named Calculate_TPM_Values that calculates availability, performance,
quality, and overall equipment effectiveness (OEE) based on the total productive maintenance
(TPM) method. TPM is a method to increase the effectiveness of production environments,
especially through methods for increasing the effectiveness of equipment. The following formulas
should be used to calculate the required outputs1:
Actual Operating Time: Number of hours in which plant was actually operating.
Planed Production Time: Plant operating hours – plant shutdown time (in hours).
Total Output: Total quantity of units produced during the running
time including good, bad, reworked, QC samples, and
product during changeover.
Potential Output at Rated Speed: Potential quantity (in units) given the designed speed of
the equipment.
Good Output: Total quantity of good product (in units) produced by
the process and that are available for sale without any
type of rework or re-processing.
1
http://www.makigami.info/cms/tools#TOTAL PRODUCTIVE MAINTENANCE
2
a) The Excel VBA code in sub procedure Calculate_TPM_Values must implement the exact
algorithm depicted by the flowchart included on page 4 of this document.
b) The following inputs must be entered by the user into the spreadsheet “Prob1”. Your Excel
VBA code must then assign the values of these inputs to variables of the appropriate type.
These variables will then be used to calculate availability, performance, quality, and overall
equipment effectiveness (OEE):
 Actual Operating Time (in hours)
 Plant Operating Hours (in hours)
 Plant Shutdown Time (in hours)
 Total Output (in units)
 Potential Output at Rated Speed (in units)
 Good Output (in units)
c) The results for availability, performance, and quality, and overall equipment effectiveness
(OEE) should be reported as percentages (including the % symbol) and with exactly two digits
of precision after the decimal point in the spreadsheet cells. This requirement must be
implemented via Excel VBA code (Hint: Research the function Format and/or the
NumberFormat property of the Range object).
d) Assign the sub procedure Calculate_TPM_Values to a rectangular shape button. The caption
of the rectangular shape button should read “Calculate TPM Values”.
Note: For the purposes of this problem, you can assume that the user will always provide
input values that will result in the ratios for availability, performance, and quality to
always be between 0 and 1. In other words, you are not responsible to write Excel VBA
code to validate user input.
2. Write a sub procedure named Clear_TPM_Values that will:
a) Clear all the inputs and the displayed outputs (labels and results).
b) Assign the sub procedure named Clear_TPM_Values to a rectangular shape button. The caption
of the rectangular shape button should read “Clear TPM Data”.
3
Flowchart for Problem 1
Start
Request
Actual Operating Time (in hours),
Plant Operating Hours (in hours),
Plant Shutdown Time (in hours),
Total Output (in units),
Potential output at rated speed (in units)
Good output (in units)
Calculate Availability as
(Actual Operating Time) /
(Planned Production Time)
Calculate Performance as
(Total Output) /
(Potential Output at Rated Speed)
Calculate Quality as:
(Good Output) / (Total Output)
Calculate OEE as:
Availability × Performance ×
Quality
Display
Availability,
Performance,
Quality, and OEE
End
4
Problem 2 (30 pts)
IMPORTANT NOTE: To receive full credit in Problem 2, you MUST use string manipulation
functions and variables to fulfill the requirements. You are NOT allowed to use formulas or to
assign strings to cells in the spreadsheet to manipulate them.
In computer networking, it is essential to be able to uniquely identify every piece of equipment
attached to a network. Therefore, each piece of equipment is assigned a Media Access Control (MAC)
address. A MAC address is typically displayed as six pairs of hexadecimal numbers separated by
colons (e.g., 88:17:E8:90:E2:0A). The first three pairs of hexadecimal numbers in a MAC address
(e.g., 88:17:E8) identify the manufacturer of the hardware network adapter, whereas the last three pairs
of hexadecimal numbers (e.g., 90:E2:0A) denote the serial number of the hardware network adapter.
For the purposes of this problem, you can assume the following:
 The user always provides a valid MAC address (i.e., six pairs of hexadecimal numbers
separated by colons).
 The first pair and the last pair of hexadecimal numbers always start with a letter (i.e., A, B, C,
D, E or F).
1. Write a sub procedure named MAC_Address that takes a user-provided MAC address from cell C7
and does the following:
a) Displays the portion of the MAC address that identifies the manufacturer of the hardware
network adapter, with colons, and centered in cell C10.
b) Displays the portion of the MAC address that identifies the manufacturer of the hardware
network adapter, without colons, and centered in cell C11.
c) Displays the portion of the MAC address that identifies the serial number of the hardware
network adapter, with colons, and centered in cell D10.
d) Displays the portion of the MAC address that identifies the serial number of the hardware
network adapter, without colons, and centered in cell D11.
e) Cells B7, B10, B11, C9, and D9 should display the labels shown in Figure 1. These labels need
to be displayed in BOLD type.
f) Your sub procedure should end by selecting cell C7.
g) Assign the sub procedure MAC_Address to a rectangular shape button labeled “MAC Address
Information”.
2. Write a sub procedure named Clear_MAC_Data that will:
a) Clear the contents of cell C7 and range C10:D11.
b) Assign the sub procedure named Clear_MAC_Data to a rectangular shaped button labeled
“Clear MAC Address Data”.
5
Fig. 1 Example graphical user interface for Problem 2.
Additional requirements for BOTH problems:
- Include instructions in each spreadsheet to inform the user of the purpose of the application and
also where the required input values for each problem must be entered.
- Unless specific instructions are provided, you are at liberty to decide where to display and how to
organize and format the input values. Minimal work will get minimal grading. The example in
Figure 1 is a good example of the expectations in terms of a user-friendly graphical user interface.
- Clearly show the results produced by each problem. Unless specific instructions are provided, you
are at liberty to decide where to display the results. Minimal work will get minimal grading.
- You are not allowed to use the InputBox function in this assignment.
- Make sure your program does not experience any flickering when processing the input data or
producing results.
- Make sure to follow programming practices. In particular, pay close attention to the following:
 Explicitly declaring all variables;
 Properly indenting code so that it is more readable;
 Adding comments to your code; and
 Using the With construct where appropriate.
6
IE 212: Computational Methods for Industrial Engineering
Summer 2015
Homework #6: Using variables and capturing user input
Thursday, July 30th, 2015
Student Name: !TYPE YOUR NAME HERE!
Download