You are on page 1of 11

Local Calibration Automation

VBA Macro Developmental Guide


Ryerson University
By
Afzal Waseem

Table of Contents
Material and Traffic Input files for AASHTOWare Darwin-ME Input .XML Files ..................................... 4
HMA Layers: .................................................................................................................................... 4
Ontario Manual NO and SO Distributions: ........................................................................................ 4
NO and SO Distributions: ................................................................................................................. 4
Originally Created Files (First Time Files) .............................................................................................. 4
Automation by VBA Macro (Master File.xlsm) and AutoIt (Start AutoIt Automation.Au3): ....................... 4
Preparation of VBA Macro Usable Rehabilitated Sections/VBA Macro Usable Reconstructed Sections . 5
Initial Data ........................................................................................................................................... 7
Original File Path:............................................................................................................................. 7
Destination Folder: .......................................................................................................................... 7
New Folder Name: ........................................................................................................................... 7
Number of Iteration Files: ................................................................................................................ 7
Section Number: .............................................................................................................................. 7
Calibration Parameters Values ......................................................................................................... 7
Creating Iteration Files and Replacements ........................................................................................... 8
M3 - Create Folder and Verify Existence........................................................................................... 8
M12 - Create Copies of Original File ................................................................................................. 8
M22 - Iteration Sampling ................................................................................................................. 8
M5 - Search and Replace.................................................................................................................. 9
After DARWin-ME Analysis ................................................................................................................ 10
M20 - Moving Excel Files from Results folder to DARWin-ME File Location .................................... 10
M16 -Annual Ruttings Generation ................................................................................................. 10
M23 - Moving Data from Distress Sheet ......................................................................................... 10
M1 AC, Granular, Subgrade, Total Bias and RSS Calculation ......................................................... 10
References ............................................................................................................................................ 11

Initial Data
M3 - Create Folder and Verify Existence
Start AutoIt Automation.Au3

M26- Control1

Open the already


existing Master
Excel File
Run DARWin-ME,
Input all files and
start Batch Run
Wait till no new
Dialog box Opens

M12 - Create Copy of Original


File in Destination Folder
M22 - Iteration Sampling

M5 - Search and Replace

M20- Copy Excel Files From Result


Folder To Darwin File Location
M16 - Generating Rutting
Results in Multiple Columns

M27 Control2
M23 - Moving Data From Distress Sheet

Run Matlabcode.m

Data is taken from Part B


Sheet of MasterFile.xlsm
Optimization using two functions

M28 Control3

Run DARWin-ME,
Input the only
optimized factors
file and start Batch
Run
Wait till no new
Dialog box Opens

Results are Printed in File History


Sheet of MasterFile.xlsm

M24 Optimized Iteration In Files History Sheet


M25 Handling With MATLAB Optimized Results

M20 Copy Excel Files Delete Folders


M16 Generating Rutting Results in Multiple Columns

M4 Control4
M23 Moving Data From Distress Sheet
M2 Initial Point Updating Iteration Sampling

Figure 1. Flowchart of Automation Process

Material and Traffic Input files for AASHTOWare Darwin-ME Input .XML Files
These are the material, traffic .xml files which would be useful in importing layer of specific properties in
a new project and are made based on data collected from multiple sources:
HMA Layers: All HL-1 to HL-8 material properties were built upon the properties given in thesis.
Ontario Manual NO and SO Distributions: These are the most recent distributions taken from
MTO (2013), which is the MTO guide with default inputs for Ontario.
NO and SO Distributions: These are the old distributions based on the excel file obtained from
MTO, this data is different from the updated Ontario Manual distributions.
Note 3: Although these two distributions are different from each other but they have very little
to no effect on distress. Several sections might still have this old NO and SO distributions
inputted in it because of a possible glitch in new DARWin-ME which does not allow putting zero
distributions even though we have distributions equal to zero.

Originally Created Files (First Time Files)


These are the original sections for the first time; of the sections are improved forms of these sections.
If a section is not available in then it should be taken from this folder. But as these sections are the
original sections that were created before any other section, they need to update with new data before
using. Following data should be updated in these sections before using them:
1) Traffic distribution should be updated from (MTO 2012).
2) Axles per truck should be update and from (MTO 2012) or even better use it from iCorridor (It is
a website made by MTO which gives axle per truck for a specific road, it was not available for me
to access during my research).
3) Important: Pre-overlay rut should also be updated to 7 mm (Waseem et al. 2013). (Most files
would have a value of 4mm in these files)

Automation by VBA Macro (Master File.xlsm) and AutoIt (Start AutoIt


Automation.Au3):
A fully automated process has been developed with the help of multiple Macros of Microsoft
Excel written in VBA and then integrated together with DARWin-ME and MATLAB using the AutoIt v3
software.
AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI
and general scripting. It uses a combination of simulated keystrokes, mouse movement and
window/control manipulation in order to automate tasks in a way not possible or reliable with other
languages (e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all
versions of Windows out-of-the-box with no annoying runtimes required!. This software can be
obtained from here.

This Integrated Automation tool can be used for full automation of the local calibration process
as well as semi-automation of sub-processes in a local calibration. Mostly full automation is neither
recommended nor desirable as the local calibration process could be different by each individual.
The detail use of this Master File.xlsm and AutoIt (Start AutoIt Automation.Au3) has been
discussed in detailed with an example. The flowchart of the process has been shown in Figure 1, so it
can be easily modified and updated.

Preparation of VBA Macro Usable Rehabilitated Sections/VBA Macro Usable


Reconstructed Sections
Before starting using this tool, the DARWin-ME project file (extension .dgpx) has to make usable for
Master File.xlsm. VBA Macro Usable Sections means that these sections have been edited to suite the
search and replace macro. Right click on your DARWin-ME Project file and click open with to open file in
notepad. In each pavement section following five manual changes have to be done by the user, so
search and replace Macro can search 5 unique terms aaa, bbb, ccc, ddd and eee and replace with the
values of respective calibration parameters.
1. For value of calibration parameter
Line below ACRuttingBr term in Section .dgpx DARWin-ME file has 1 which was replaced by
aaa that reflected the calibration parameter value of ACBeta1 calibration parameter.
<calibrationName>ACRuttingBr</calibrationName>
Original: <calibrationValue>1</calibrationValue>
Replaced with: <calibrationValue>aaa</calibrationValue>
Here this aaa will be the unique string read and then replaced by the Macro.

2. For value of calibration parameter


Line below CRuttingBr term in Section .dgpx DARWin-ME file has 1 which was replaced by
bbb that reflected the calibration parameter value of ACBeta2 calibration parameter.
<calibrationName>CRuttingBr</calibrationName>
Original: <calibrationValue>1</calibrationValue>
Replaced with: <calibrationValue>bbb</calibrationValue>
Here this bbb will be the unique string read and then replaced by the Macro.

3. For value of calibration parameter


Line below RuttingBr term in Section .dgpx DARWin-ME file has 1 which was replaced by
ccc that reflected the calibration parameter value of ACBeta3 calibration parameter.
<calibrationName>ACRuttingBr</calibrationName>
Original: <calibrationValue>1</calibrationValue>
Replaced with: <calibrationValue>ccc</calibrationValue>

Here this ccc will be the unique string read and then replaced by the Macro.

4. For value of calibration parameter


Line below GranularBs term in Section .dgpx DARWin-ME file has 1 which was replaced by
ddd that reflected the calibration parameter value of GranularBeta1 calibration parameter.
<calibrationName>ACRuttingBr</calibrationName>
Original: <calibrationValue>1</calibrationValue>
Replaced with: <calibrationValue>ddd</calibrationValue>
Here this eee will be the unique string read and then replaced by the Macro.

5. For value of calibration parameter


Line below FineBs term in Section .dgpx DARWin-ME file has 1 which was replaced by eee
that reflected the calibration parameter value of FineBeta1 calibration parameter.
<calibrationName>ACRuttingBr</calibrationName>
Original: <calibrationValue>1</calibrationValue>
Replaced with: <calibrationValue>eee</calibrationValue>
Here this eee will be the unique string read and then replaced by the Macro.

These pavement sections would not run in DARWin-ME by double clicking unless you change back these
aaa, bbb, ccc, ddd and eee terms back to a numerical value. The sole reason to edit them was to make it
compatible with VBA Macro.
Note 1: Some rehabilitated pavement sections that were developed in newer DARWin-METM version
have two sets of ACRuttingBr, CRuttingBr, RuttingBr, GranularBs and FineBs. Remember that the 2nd
set of ACRuttingBr, CRuttingBr, RuttingBr, GranularBs and FineBs dictates the calibration
parameters. Verified
Note 2: These are the only sections that were used in the local calibration process; hence they are
the section that was chosen because their rut depth was available. All of these sections have life
cycle after 2002 and sections whose life cycle ended before 2002 were not included in this set of
standard sections because simply they did not have rut depth available.
Note 3: DARWin-ME files should not be renamed outside DARWin-ME otherwise it would require
you to save the file with a different name during running of the project. If DARWin-ME file is
renamed outside DARWin-ME then it needs to be opened in notepad and oldname in following line
should be replaced with the new name.
Original <displayName>Old Name</displayName>
To be replace with <displayName>New Name</displayName>
For simplicity its recommended that files should be renamed in names like Section 43 where 43 is the
number of the section.

Initial Data
Original File Path:
Click Browse and select the usable file of the DARWin-ME modified in last step.
Destination Folder:
Click Browse and select the folder where you want the New Folder containing DARWin-ME files to be
created.
New Folder Name:
New folder Name by default is taken as integration of Section Number cell and New Files Custom Prefix
cell. However, it can also be changed to any desired name.
Number of Iteration Files:
It is the number of new files or iterations that are needed to be made; this number depends upon the
number of combinations of calibration parameters to replace. This value is also by default taken from
Number of Iteration Combinations cell data stored.
Section Number:
As its name suggest is the number of the section which is under analysis. Here, the significance of
section number is this cell is used to locate the sheet that contains the data for section. Hence the name
of sheet containing data for section should be same as Section Number.
Calibration Parameters Values
AC 1 , AC 2 , AC 3 Granular 1 and Fine 1 cells requires the initial calibration parameters values
which would then be used while creating a sample based on Sampling Interval cell. If calibration
parameters interval and sampling is manually selected, then there is no need to fill these cells.

Figure 2 Sheet "Part A" General Inputs

Creating Iteration Files and Replacements


It consists of 4 buttons which each calls a Macro from Excel VBA. Capital letters followed by number e.g.
M3, M12, M22 and M5 reflects the number of Module when opening it in visual basic editor.

Figure 3: Creation of Iteration Files and Replacement

M3 - Create Folder and Verify Existence


This button creates a folder in Destination Folder path with a name of string in New Folder Name
(Figure 1).
M12 - Create Copies of Original File
This button creates Number of Iteration files copies of file from Original File Path. E.g in this example
this button will create 27 copies of Darwin-ME file in S43-I1 folder. It can be used to create unlimited
number of files every time.
M22 - Iteration Sampling
This button will generate 27 set of calibration parameters on the basis of given initial values of
calibration parameters show in Figure 2 and sampling interval given in cell C21 shown in Figure 4.

Figure 4 Sampling Interval

This sampling will be generated in sheet Part B as shown in Figure 5.

Figure 5: 27 set of calibration parameters generated in Sheet "Part B"

M5 - Search and Replace


This button search and replace strings written in sheet Part B shown in Figure 6. This button does the
following tasks. During the executing of the search and replace Macro Excel will show not-responding in
the windows title, however the process will still be running. Average time to search and replace 1 file is
about 4-5 seconds hence the total time to complete the process will be approximately 5 x Number of
iteration Files. This Macro had never failed, so sit back and give it few minutes.
1. It reads file path from column A, search string in column B and replace with a string in column G
2. It reads file path from column A, search string in column C and replace with a string in column H
3. It reads file path from column A, search string in column D and replace with a string in column I
4. It reads file path from column A, search string in column E and replace with a string in column J
5. It reads file path from column A, search string in column F and replace with a string in column K
6. *It reads file path from column A, search string in column L and replace with a string in column M

*Column L and Column M have the changed name of the new files that also need to be replaced the
reason is explained in Note 3

Figure 6: Sheet "Part B" Search and Replace

After DARWin-ME Analysis


When all analysis of the files is finished in DARWin-ME following steps are carries out:

M20 - Moving Excel Files from Results folder to DARWin-ME File Location
M16 -Annual Ruttings Generation
M23 - Moving Data from Distress Sheet
M1 AC, Granular, Subgrade, Total Bias and RSS Calculation

References
MTO, M. E. R. O. (2012). "Ontarios Default Parameters for AASHTOWare Pavement ME Design Interim
Report."
Waseem, A., Yuan, X.-X., and Shehata, M. (2013). "Evaluation of Pre-overlay Rut with MEPDG Rutting
Model for Flexible Pavements using Ontario's Long Term PMS Data." Canadian Society for Civil
Engineering 2013 Annual ConferenceMontreal.

You might also like