CS698 - PowerPoint PPT Presentation

1 / 54
About This Presentation
Title:

CS698

Description:

... sections which in turn is composed of four Runs taken in a rectangular fashion. ... History. Software application composed of two parts. Data collection version. ... – PowerPoint PPT presentation

Number of Views:54
Avg rating:3.0/5.0
Slides: 55
Provided by: Bhu8
Category:
Tags: cs698

less

Transcript and Presenter's Notes

Title: CS698


1
CS-698 MASTERS PROJECT
SURFACE PROFILING AND ANALYSIS SOFTWARE
Rizwan Ahmad Bhutta
2
  • Introduction
  • The software developed deals with calculating,
    storing and evaluating the flatness and levelness
    of any surface.
  • Uses the ATSM E-1155 F-Number system, an industry
    standard.
  • The software was developed for a commercial
    enterprise.
  • This application software is used in many facets
    of structural engineering industry.

3
Profiling a Floor.
A sample view of a pavement, showing a surface
being divided into four sections which in turn is
composed of four Runs taken in a rectangular
fashion.
4
  • History
  • Software application composed of two parts
  • Data collection version.
  • Data processing version.
  • The original software application was developed
    more then ten years ago.

5
  • Challenges
  • Making application response time faster.
  • Reducing errors in data processing.
  • Reducing errors in data collection.
  • Memory Management.

6
  • Compatibility with existing data
  • Previous version was compiled using Borland
    compiler.
  • Different Compilers use different storage space
    for data variables.
  • Example, for integer variable , Borland compiler
    uses 4 bytes for storage but Microsoft Visual C
    compiler uses 2 bytes.
  • How is that a problem ?
  • - Boundary mismatch issue.

7
  • Software Structure
  • Data processing version.
  • Windows 2000, Windows XP
  • Data collection version.
  • Windows CE

8
Rotating handle
Sound Speaker
Windows CE device
Profiling hardware
Display
Base Feet
9
Overview of F numbers The F-Number System is
the American Concrete Institute (ACI 117) and
Canadian Standards Association (CSA A23.1)
standard for the specification and measurement of
concrete floor flatness and levelness.  The new
standards include two F-Numbers, Ff for flatness
and Fl for levelness .  SpecFf and SpecFl are
the F numbers specified (desirable values)
initially before the floor is analyzed. The
overall F-numbers represent the minimum values
allowed for the entire floor. The measured
F-Numbers define the values calculated for a
particular run.
10
Data Structure for surface information typedef
struct _tagSURFACE char areaName17 doub
le size float specFf float specFl
float minFf float minFl float me
asFf float measFl float areaOutFfSpec
float areaOutFlSpec float bias unsig
ned long areaFlags SURFACE
11
Data structure for run information typedef
struct _tagRUN char deleted unsigned
long runFlags unsigned long histFlags un
signed int numRdgs unsigned int ftSpacing
float bias float slope float stP
tElev time_t runDate char dfName9
char runName9 char dsOperator25
RUN
12
DATA PROCESSING VERSION
13
Steps in data processing version
Data Selection
Data Conversion
Application Functionalities
Data Display
14
SELECTING DATA LOCATION After the application is
launched , the user has to select the directory
in which the Data Files are located. Tree Control
is used for displaying the directory structure on
the host machine. Tree control uses MFC's
CTreeCtrl class.
15
No
Yes
Data selection operation
16
Conversion of previous data There are three main
data files DIPFL1.FDB (Contains information
regarding Surfaces) DIPFL2.FLB (Contains
information regarding Sections) DIPFL3.FLB
(Contains information regarding Run
records) Each Run has an associated file
containing the readings for that particular run.
The extension for such files is .FRD
17
Steps involved in data conversion.
No
Yes
18
Excerpts from code used for data conversion
The program is passed three variables as
arguments for the programs main functions.The
three arguments are the names of the files that
are to be opened and converted. Consider the case
of DIPFL3.FDB int filehandle filehandle
open(argv1 , O_RDWR O_BINARY , S_IREAD
S_IWRITE) if ( filehandle -1 ) cout
ltlt"The file could not be opened......"ltltendl exi
t( ) else long filesize
filelength(filehandle) The variable filesize
contains the size of the file we have just
opened. asurfacerecord sizeof(AREAREC) The
variable asurfacerecord now contains the size of
a single AREAREC structure, The AREAREC structure
is used for Surface information
19
Now that we have the size of the file opened and
also the size of a single AREAREC structure , we
can easily calculate the number of Surface
records contained in the DIPFL3.FDB file. long
numofrecords filesize / asurfacerecord The
variable numofrecords contains the numberof
surface records contained in the file. Each
Surface file starts with version information at
the start. We have to extract this information
first and then move to collecting surface records
from the file. VERSION pVersion unsigned
recSize recSize sizeof(VERSION) lseek(filehand
le,0,SEEK_SET) read(filehandle, pVersion,
recSize) Here we calculate the size of the
VERSION structure, and keeping the file pointer
at the start of the file reads number of bytes
equal to the size of structure VERSION, thus
version information is stored in variable
pVersion.
20
ofstream surconversionfile("TEMPSUR.TXT") A
Text file TEMSUR.TXT is opened for writing
Surface information surconversionfile
ltltnumofrecordsltlt'\n' At the start of the file the
number of surface records contained in the file
are stored. ltlt"DipFloor Area
DB"ltlt'\n' The next statements are used to store
the version information to the start of the
TEMPSUR.TXT file. ltltpVersion.majVer
ltlt'\n' ltltpVersion.minVerltlt'\n'
ltltpVersion.maintVerltlt'\n'
ltlt"EndofVersion"ltlt'\n'
21
for(long recNo 0 recNo lt numofrecords
recNo) AREAREC pRecord unsigned
surfacerecord surfacerecord
sizeof(AREAREC) long lStart
(long)sizeof(VERSION) (long) surfacerecord
recNo lseek(filehandle, lStart, SEEK_SET)
read(filehandle, pRecord, surfacerecord)
surconversionfileltltpRecord.areaNameltlt'\n'
ltltpRecord.sizeltlt'\n' ltltpRecord.specFfltlt'\n
' ltltpRecord.specFlltlt'\n'
ltltpRecord.minFfltlt'\n' ltltpRecord.minFlltlt'\n
' ltltpRecord.measFfltlt'\n' In the above
code we start to extract the information
regarding surface records from the DIPFL3.FDB
file and store them in text format in the
TEMPSUR.TXT file. This file is going to be used
to construct data files compatible with the new
application being constructed.
22
Using a similar procedure as described in the
previous slides we construct the following text
files TEMPSUR.TXT This contains the Surface
information in text format as extracted from the
DIPFL3.FDB file. TEMPSEC.TXT This contains the
Section information in text format as extracted
from the DIPFL1.FDB file. TEMPRUN.TXT This
contains the Run information in text format as
extracted from the DIPFL2.FDB file.
23
Yes
No
Yes
No
Yes
No
Creating Data Files Compatible with new format.
24
Displaying data
Now that we have successfully converted the
data files to the new format , the next step is
to display the information contained in these
data files. For the duration the application is
open we keep the entire information using link
lists. As we are dealing with Surface, Section
and Run information's therefore we have three
link lists SURFACE INFORMATION
surList SECTION INFORMATION secList RUN
INFORMATION runList These link lists are of
type CObList class. CObList provides a list of
objects of classes derived from CObject.
25
Surface information example
class surfclass public CObject public surfc
lass( ) surfacestruct new
AREAREC AREAREC surfacestruct The
above class is just a wrapper around the
structure AREAREC, structure containing Surface
Information. We follow the same procedure for
Section and Run Information.
26
No
Yes
FLOWCHART FOR CREATING LINK LIST
27
Now that we have all the Surface, Section and Run
information/records in a link list the next step
is displaying this information.This information
is displayed using a List Control.This control
maps to CListCtrl class. The elements to be
displayed are arranged in a grid. In this case
the List control covers the entire main view
window. When we open a particular data set the
initial information to be displayed in the main
view window is Surface Information.This includes
Surface Name and Surface Size. In this
application we used the following list control
object to display data . CListCtrl main_list
Please refer to the following slide for a screen
shot.
28
Surface Information displayed
29
Section Information displayed
30
Run Information displayed
31
Level Traversal
In this application as I have mentioned we have
three levels, to go from one level to another
like going from Surface to Section or going from
Run to Section is a topic that needs a little
more explanation. To keep track of which view we
currently are in and the top level and lower
level views in reference to the current one we
use the following three variables CString
CurrentLevel CString Next Level CString Previ
ous Level In case we are at the Section Level
the above variables have the following
values CurrentLevel SECTION NextLevel SURFAC
E PreviousLevel RUN
32
Flow Chart for level traversal
33
int numberofitems main_list.GetItemCount() /
/This get us the number of items displayed in the
List control object. CString SurfaceName,
SurfaceSize for(int count0 countltnumberofitems
count) if((main_list.GetItemState(count,LVIS
_FOCUSED)) LVIS_FOCUSED (main_list.GetItemSta
te(count,LVIS_SELECTED)) LVIS_SELECTED) //The
item selected will be both focused and selected,
in this way we can find out which item was
selected by the user. SurfaceName
main_list.GetItemText(count,0) SurfaceSize
main_list.GetItemText(count,1) //For the case of
surface information we have only two sub items
per item.First one as we saw from the surface
view is Surface name while the second one is the
Surface size.
34
DISPLAYING SURFACE INFORMATION
int tempcolumnwidth ScreenWidth /2
//ScreenWidth is the width of the main view
window we get this information from OnDraw
function which is called when ever the view
window is resized. main_list.InsertColumn(0,
_T("SURFACE NAME"), LVCFMT_CENTER,
tempcolumnwidth) main_list.InsertColumn(1,
_T("SURFACE SIZE"), LVCFMT_CENTER,
tempcolumnwidth) //Create two columns in list
control of equal size and with column headers
indicated int surfacecount surList.GetCount() /
/Here we get the number of AREAREC structures we
have in the Surface File. surfileread
surfaceobject POSITION pos //We need the
POSTION data type to get an object out of the
CObList.
35
for(int index 0 index lt surfacecount
index) surfaceobject new surfclass pos
surList.FindIndex(index) surfaceobject
(surfclass)surList.GetAt(pos) CString
surfacename (CString) surfaceobject-gtsurfclass-gt
areaName surfacename.MakeUpper( ) int
surfacesize (int)tempsurface-gtsurfacestruct-gtsiz
e CString sizeofsurface sizeofsurface.Format("
d", surfacesize) main_list.InsertItem(index,
surfacename, 1) main_list.SetItemText(index, 1,
sizeofsurface) //The above code displays all
surface records in the list view control .
36
Application Functionalities
  • The method employed in opening and displaying
    Surface information are also used in displaying
    Section and Run information. Section and Run
    information's are contained in secList and
    runList respectively.
  • Now that we have successfully opened/displayed
    the data files, next phase of the project is to
    add functionality to the application to analyze
    and process the data. Two major menus we will
    discuss are
  • Edit Test Section ( Under Edit Menu).
  • Project Summary ( Under Reports Menu).

37
EDIT TEST SURFACE This menu is used to edit
surface information and in some cases the changes
not only apply to the selected surface but also
propagate down to the section and run levels.
The Dialog Box associated with this menu is
IDD_EDITSURFACE, and the associated class is
editsurface.
38
No
Yes
Yes
No
39
FLOWCHART FOR EDIT SURFACE, FOR THE CASE OF
SURFACE BIAS CHANGES
No
Yes
No
Yes
Yes
No
40
FLOWCHART FOR EDIT SURFACE, FOR THE CASE OF
SURFACE SIZE CHANGES
No
Yes
41
FLOWCHART FOR PROJECT SUMMARY
42
DATA COLLECTION VERSION
43
DATA COLLECTION HARDWARE
44
(No Transcript)
45
Yes
No
No
Yes
Different steps involved in implementing data
collection.
46
INITIALIZATION OF COMMUNICATION PORT
HANDLE serialport serialport
CreateFile(_T("COM1"), GENERIC_READ
GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0,
NULL) // This opens up the COM1 serial port and
set it up as a read/write port, makes it un
sharable and the handle can not be
inherited. if(serialport INVALID_HANDLE_VALUE)
AfxMessageBox(_T("Problem in opening the
Serial Port1")) SetupComm(serialport, 128,
128) //This command is used to set the input and
output buffer for the serial port. In this case
the buffer size for both cases if 128
bytes. PurgeComm(serialport, PURGE_TXABORT
PURGE_RXABORT PURGE_TXCLEAR
PURGE_RXCLEAR) //This command clears the input
and output queues.
47
DCB commstate commstate.DCBlength
sizeof(DCB) commstate.BaudRate
CBR_1200 commstate.ByteSize
8 commstate.Parity NOPARITY commstate.StopBi
ts ONESTOPBIT commstate.fOutxCtsFlow
FALSE commstate.fOutxDsrFlow
FALSE commstate.fDtrControl
DTR_CONTROL_ENABLE commstate.XonChar
0x11 commstate.XoffChar 0x13 commstate.XonLi
m 100 commstate.XoffLim 100 The DCB
structure is used to define the control settings
for the communication port.
48
COMMTIMEOUTS commtout commtout.ReadIntervalTime
out MAXDWORD commtout.ReadTotalTimeoutConstant
0 commtout.ReadTotalTimeoutMultiplier
0 commtout.WriteTotalTimeoutConstant
10 commtout.WriteTotalTimeoutMultiplier
1000 This structure is used to set the time out
values for the serial port, meaning how long
Windows CE waits for the read or write operation
to finish. SetCommState(serialport,
commstate) SetCommTimeouts(serialport,
commtout)
49
Starting Data Collection Process
previous 9999.0 current 99.99 // We set
these initial values before we start collecting
readings from the Hardware. collectstatus
1 // As I will show next we use different status
values to move between different stages of data
collection. SetTimer(3, 300, NULL) // This
installs a systems timer, after the time out
occurs a message is posted to the application
queue. The first argument is the timer
identifier, the second variable is the time out
value in milliseconds and the third variable is
for the application or function that is going to
handle the system call. In our case we use NULL
value to specify that the message is sent to the
application's message queue.
50
Timer Function
char commandtosend16 strcat(commandtosend,
"\x91\x0D\x0A\0") returnvalue
WriteFile(serialport, (LPBYTE)commandtosend,
strlen(commandtosend), cBytes, NULL) We have
send the command to the DIPSTICK to read the
value of the accelerometer. char
receivebuffer128 returnvalue
ReadFile(serialport, (LPBYTE)receivebuffer,
sizeof(receivebuffer), cBytes, NULL) //Now we
will read the return value . KillTimer(3) //We
kill the timer now that we have collected a value
. PostMessage(m_hWnd, WM_ONRECEIVEDATA, 0, 0
) // A message is posted to the function
OnReceiveData so that we can move to the next
stage of the application.
51
ONRECEIVEDATA function implementation
switch(collectstatus) case 0 START
COLLECTING DATA break case 1 TURN OFF THE
DISPLAY break case 2 COMPARE READINGS
COLLECTED break case 3 TURN ON THE
DISPLAY break case 4 PLAY SOUND
break case 5 WAIT FOR HARDWAREPICKUP
break
52
ONCOMPAREREADINGS function implementation.
SetTimer(3, 300, NULL) if(current
previous) readingscollected
tempcollection tempcollection new
readingscollected tempcollection-gtreadings
current readinglist.AddTail(tempcollection)
tempcollection NULL delete
tempcollection // The collected reading is added
to the link list associated with the particular
RUN. collectstatus 3 // This sets the status
to point to stage where the screen is Turned back
ON.
53
else previous current Sleep(sleepvalue
) This is the case where we DO NOT have two
identical readings. The value of the variable
"sleepvalue" is what the user sets at the start
of the collection process. SetTimer(3, 300,
NULL) The timer function is called here to take
us back to the stage where another value is
collected from the accelerometer.
54
ONWAITPICKUP function implementation
SetTimer(3, 300, NULL) if( fabs(fabs(current)
- fabs(previous)) gt pickupvariable ) The pickup
variable is a number that can be changed by the
user before the collection process starts, by
default it is 0.08, so if the difference between
two successive readings is 0.08 that means that
dipstick has been lifted for the next reading.
collectstatus 0 This sets the next stage to
be the start of data collection
process. else SetTimer(3, 300,
NULL) In case what it means is that we do
detect that the DIPSTICK has been lifted for the
next reading , so this means the value of the
accelerometer will be checked after every 300
milliseconds till we have a pickup or the
collection process is stopped.
Write a Comment
User Comments (0)
About PowerShow.com