report on gui development in python

53
A REPORT ON DEVELOPMENT OF TOOLS FOR AUTOMATING FLOW & QUALITY CHECK PROCESS BY HARISYAM.MNV 2010B2A4232H AT MERCEDES BENZ RESEARCH & DEVELOPMENT INDIA, BANGALORE A Practice School-II Station of BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI August, 2014

Upload: venkatesh-sathya-harisyam

Post on 30-Sep-2015

51 views

Category:

Documents


1 download

DESCRIPTION

GUI development in python and VBA

TRANSCRIPT

  • A REPORT

    ON

    DEVELOPMENT OF TOOLS FOR AUTOMATING FLOW & QUALITY CHECK PROCESS

    BY

    HARISYAM.MNV 2010B2A4232H

    AT

    MERCEDES BENZ RESEARCH & DEVELOPMENT INDIA,

    BANGALORE

    A Practice School-II Station of

    BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI

    August, 2014

  • A REPORT

    ON

    DEVELOPMENT OF TOOLS FOR AUTOMATING

    FLOW & QUALITY CHECK PROCESS

    BY

    HARISYAM.MNV 2010B2A4232H

    Prepared in partial fulfillment of the

    PRACTICE SCHOOL-II

    BITS C412

    AT

    MERCEDES BENZ RESEARCH & DEVELOPMENT INDIA,

    BANGALORE

    A Practice School-II Station of

    BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI

    August, 2014

  • ii | P a g e

    ACKNOWLEDGEMENTS

    I thank Dr. Jens Cattarius, CEO, Mercedes Benz Research and Development

    India Pvt. Ltd. for giving me this opportunity to work at MBRDI. I would also

    like to thank Miss Deborah DeSouza, Human Resources and Facilities, for

    permitting me to pursue the Practice School II program at this Centre.

    I specially thank Dr. Anshuman Awasthi for assigning me this project and Mr.

    Prashant Kulkarni, Head of TPE-PCD Team, for giving me the opportunity to

    work on this project. Last but not the least; I would like to express my gratitude

    to my mentor Mr. Vinod Nandakumar for sharing his knowledge and giving me

    valuable inputs from time to time. This report is a result of the efforts and time

    he invested in me.

    I thank my institute BITS Pilani and the Practice School Division for designing

    the Practice School program which trains students to match up to the

    expectations of the Corporate world.

    I am grateful to my Practice School instructor Mr. P.B.Venkatraman for sharing

    their vast industrial experience and guiding us right throughout the internship.

    Lastly, I extend my gratitude to all my team members from the TPE Team for

    their priceless inputs and support during my stay at MBRDI.

  • iii | P a g e

    BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI

    Practice School Division

    ABSTRACT

    Station: Mercedes Benz Research & Development India Centre: Bangalore

    Duration: July 3rd to Dec 14th 2014 Date of start: July 3rd 2014

    Date of submission: December 14th 2014

    Title of the project: Development of tools for automating Flow & quality check process

    Name: HARISYAM.MNV I.D. No: 2010B2A4232H

    Discipline: B.E. (Hons.) Mechanical & M.Sc. (Hons.) Chemistry

    Name of the expert: Vinod Nandakumar Designation: Technical Lead

    Name of the PS faculty: Mr. P.B.Venkatraman

    Key words:

    Project Area: CAE Simulation

    Abstract:

    The quality check process is a very essential process which is to be done to keep

    the FE model up to the quality standards of the DAIMLER group. The process

    is to be done with the set of commands in a checklist given by the DAIMLER

    group; this has to be repeated for each model at the end of its Pre-Processing.

    The commands have to be executed in MEDINA pre-processor and this has

    become very tedious job because we have to enter the commands manually. So

    in order to automate this process we have decided to make a Python GUI

    interface which will perform the necessary checks and gives us a result of the

    checks done. In this report I will be emphasizing on how the tool has been

    developed and what is the basis and algorithm for designing the GUI and the

    functions it can do. After that Ill be throwing some light on the other tools

    developed which will help the flow process followed in MBRDI.

    Signature of student Signature of faculty

    Date: Date:

  • iv | P a g e

    BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI

    Practice School Division

    Response Option Sheet

    Station: Mercedes Benz Research & Development India Centre: Bangalore

    I.D. No: 2010B2A4232H Name: Harisyam.MNV

    Title of the project: Development of a tool for automating quality check process

    Usefulness of the project to the on-campus courses of study in various disciplines. Project should be scrutinized keeping in view the following response options. Write Course No. and Course Name against the option under which the project comes. Refer Bulletin for Course No. and Course Name

    Code

    No.

    Response options Course No. (s) &

    Name

    1. A new course can be designed out of this project NO

    2. The project can help modifications of the course

    content of some of the existing Courses.

    NO

    3.

    The project can be used directly in some of the

    existing Compulsory Discipline Courses (CDC)/

    Discipline Courses Other than compulsory (DCOC)/

    Emerging Area (EA) etc. Courses.

    NO

    4.

    The project can be used in preparatory courses like

    Analysis and Application oriented Courses (AAOC)/

    Engineering Science (ES)/ technical Art (TA) and

    Core Courses.

    NO

    5.

    This project cannot come under any of the above-

    mentioned options as it relates to the professional

    work of the host organization.

    YES

    ________________ __________________

    Signature of Student Signature of Faculty

  • v | P a g e

    Table of Contents

    ACKNOWLEDGEMENTS ........................................................................................... ii

    BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI .................................... iii

    ABSTRACT ................................................................................................................ iii

    STATION: MERCEDES BENZ RESEARCH & DEVELOPMENT INDIA CENTRE:

    BANGALORE ............................................................................................................. iii

    BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI .................................... iv

    RESPONSE OPTION SHEET .................................................................................... iv

    RESPONSE OPTIONS .............................................................................................. iv

    COURSE NO. (S) & NAME ........................................................................................ iv

    1. ABOUT MERCEDES BENZ RESEARCH AND DEVELOPMENT INDIA ............ 1

    2. INTRODUCTION ................................................................................................. 2

    1.1 PROJECT BACKGROUND ............................................................................. 2

    1.2 PROJECT METHODOLOGY ........................................................................ 5

    3. ALGORITHM FOR THE QUALITY CHECK GUI ................................................. 6

    4. GRAPHICAL USER INTERFACE ....................................................................... 7

    5. BUGS IN QC_TOOL V1.0 ................................................................................. 11

    6. DEVELOPING THE QC_TOOLV2.0 ................................................................. 13

    7. CONCLUSION TO THE QC_TOOL DEVELOPMENT ...................................... 19

    8. INTRODUCTION TO MASS - INERTIA COMPENSATION .............................. 20

    9. INERTIA COMPENSATION TOOL USING VBA ............................................... 27

    10. IMAGE INSERT TOOL USING VBA IN POWERPOINT ................................... 32

    11. SOFTWARE SELECTOR TOOL IN PYTHON .................................................. 37

    12. MAT10 CARD GENERATOR TOOL USING VBA ............................................ 41

    13. FOLDER LIST TOOL FOR ENGINES (INCORPORATED IN SAM) ................. 44

    14. CONCLUSION .................................................................................................. 45

    15. REFERENCES ................................................................................................. 46

  • vi | P a g e

    List of Figures

    1. Existing buttons in the MEDINA GUI

    2. Schematic of existing process

    3. QC_toolv1.0 main window

    4. QC_toolv1.0 extra functions window

    5. Qt4 designer showing drag and drop action

    6. QC_toolv2.0 layout (developed in Qt4designer)

    7. Custom quality check section

    8. Check BIF/Check BDF section

    9. Extra functions tab with search options

    10. Quality check tab with messages printed in the status/message box

    11. Custom quality check section displaying the checked commands in msg box

    12. Extra functions tab (showing the Eigen frequency table for *.fo6 file)

    13. Normal mode analysis of an engine block

    14. RESULT of using Inertia-Compensation

    15. Mass-Inertia Compensation Tool

    16. Image Insert Tool

    17. Usage of Image Insert tool

    18. Software Selector tool (CAE tool selector)

    19. MAT10 card generator tool

    20. Folder list tool For Engines

  • ABOUT MERCEDES BENZ RESEARCH AND DEVELOPMENT INDIA

    1 | P a g e

    1. ABOUT MERCEDES BENZ RESEARCH AND

    DEVELOPMENT INDIA

    Mercedes-Benz as a company needs no introduction. It is synonymous with quality

    and excellence. It is a name that always reminds people of exquisite high-

    performance luxury vehicles. Mercedes-Benz is the multinational division of the

    German manufacturer Daimler AG. Karl Benz and Gottlieb Daimler are the

    founders of Mercedes-Benz. The company is headquartered in Stuttgart, Germany.

    The main focus of Mercedes-Benz is the production of high-performance cars. It

    aims at providing a comfortable yet powerful driving experience. The company

    also has a special focus on Research and Development to provide a safe and

    thrilling driving experience and to be the best they can be. This is evident in the

    ground breaking innovations they have installed in their cars. The most recent

    example is the Distrionic Plus crash detection system, which was famously praised

    by Vic Gundotra as having saved his life.

    CAE SIMULATION

    The structural mechanics CAE (Computer Aided Engineering) activities comprise

    of crash, occupant safety, pedestrian protection, NVH and durability. There is also

    a team which specializes in carrying out manufacturing simulation work. The CAE

    team also comprises of engineers working on multi body simulation and also on

    ride and handling of vehicles. The engineers at MBRDI build finite element

    models of automotive subsystems and full vehicles using Ansa, Medina, and

    Hypermesh. Different disciplinary analysis like NVH, Non-linear and Crash

    analysis are carried out as a part of virtual validation. These analyses are

    performed using tools like Nastran, Abaqus, LS-Dyna, Permas, Femfat, and

    Autoform. The teams are also capable of interfacing with design teams and look at

    methods for improvement of design for various subsystems. The CAE team thus

  • INTRODUCTION

    2 | P a g e

    contributes significantly to the improvement of design, cost and weight of the

    automotive product as a whole.

    2. INTRODUCTION

    Quality Check is the most important step in the process of FE Modeling. A FE

    model is checked for all the quality parameters before it is sent to Germany.

    Conventional way is to check the models using commands in chekkai sheet and

    once a check is done a tick mark is put against each check.

    This method has two demerits:

    The first one is, it is time consuming and second it should be done manually by

    entering the commands in the MEDINA GUI. So there is a chance of human error

    in this process which may hinder the subsequent processes that is to be followed

    unless the model is fully qualified.

    So the following method is developed to eliminate the above demerits and there by

    achieving automation of quality checks and automated quality report generation.

    1.1 PROJECT BACKGROUND

    The existing method for quality check process is as follows:

    1. Two buttons were created in Medina GUI out of which, one does all the checks in

    chekkai and the other generates output quality report.

  • INTRODUCTION

    3 | P a g e

    Figure 1: Existing buttons in the MEDINA GUI

    2. A shell script runs which reads the prot file & log file generated by the medina and

    condition file created by the user.

    3. Based on the presence /absence of commands in prot file and log file, it writes an output

    report.

    4. The Report tells user, whether all checks have done or missed any checks. It also tells

    user what corrections to be done further if any.

    The process described above follows the steps as shown here:

    Figure 2: Schematic of existing process

  • INTRODUCTION

    4 | P a g e

    The above process has many shortcomings:

    1. First and foremost is that the process was run by a shell script which is not encrypted and

    can be easily changed.

    2. It can be run as a local script and cannot be distributed as a package.

    3. It doesnt do any fatal error checks and no post processing checks can be done.

    So in order to overcome this shortcomings and for a better user interaction we have

    come with a solution that it is better to design and program a graphic user interface

    for the quality check automation. To achieve this we chose python as our

    programming language because the MEDINA preprocessor has been developed

    using Tcl/tk scripting language and python has many modules which are basically

    written in Tcl/Tk so python was chosen.

  • INTRODUCTION

    5 | P a g e

    1.2 PROJECT METHODOLOGY

    As we have seen the shortcomings of the existing process, now we have thought of

    a new way to do this process. The new methodology was to have a GUI which was

    built in Python so that the script is encrypted.

    Project Plan and Definition

    Study of project background

    Challenges in the quality check process

    Development of an algorithm

    Development of a Graphical User Interface for the quality

    check process

    Development of GUI for errors and fatal error checks

    Algorithm for creating the report and sending a copy as

    an email

    implementation

    results

  • ALGORITHM FOR THE QUALITY CHECK GUI

    6 | P a g e

    3. ALGORITHM FOR THE QUALITY CHECK GUI

    At first Ill discuss the tasks which are to be achieved by the GUI, they are as

    follows:

    1. The first and foremost import is the script should be encrypted and it shouldnt be

    accessed by all the users.

    2. It should run the quality check process in the background in Medina.

    3. The tool should take the *.prot and *.log files and analyze them for creating the report.

    4. It should display information of the Inertia, Summary and Mesh Summary.

    5. The tool should be able to do check bif command.

    6. The tool should also check the errors in various result files and it should give the

    messages.

    The tool should be able to do the above tasks, so now for creating the GUIs main

    window the following algorithm is designed:

    The first step is to create the buttons in Medina GUI. It can be done by using the Usr

    confg button in the Medina GUI. It is shown in the following picture

    Figure2a: Using usr confg button to create buttons on the MEDINA GUI

  • GRAPHICAL USER INTERFACE

    7 | P a g e

    Now after creating the required buttons on the medina GUI we need to start building the

    code to design the layout and the methods behind the buttons

    I used the Tkinter module of the Python2.7 version to design the GUI

    The first step is to create the Main window of the qc_tool GUI. It has the quality check

    automation button which when pressed should run the checks automatically in the

    MEDINA GUI in the background

    Then we should import the *.prot and*.log files to the tool and then with the check status

    function the GUI compares and lists out what checks are done and what checks are not

    done in the process and their respective remarks as a table

    After importing the required files using Inertia and Summary, Mesh summary

    method buttons to display respective tables in the message box.

    Using Extra function button to create a second dialog box which will do the fatal error

    checks is developed using the Tkinter module.

    As the algorithm has been developed we need to start designing and program the

    GUI, the detailed process is given in the following section.

    4. GRAPHICAL USER INTERFACE

    The GUI which will do the quality checks process is made by the help of Tkinter

    module which is in Python v.2.7. The GUI was built with the help of Tkinter

    because its been made of Tcl/Tk which is the common GU interface builder and

    the Medina pre-processor supports the Tcl/Tk scripting.

    Basically the GUI main window has 6 frames totally; the first frame which is at top

    left has two buttons which will give the Help file for the tool both in English and

    German. Then at the top middle region it has importing buttons which will import

    different files which are used for the quality check process like the *.prot and *.log

    files. After this section to the right you can see a green button which will start the

    quality check process when we click it.

    The region below the importing files section is the status box which will display

    the status at different steps when different functions are executed. Now right to the

  • GRAPHICAL USER INTERFACE

    8 | P a g e

    status box you can find a stack of buttons like Check, Check bif, Inertia,

    Summary, Mesh Summary. These buttons will do the desired functions which are

    discussed in the section 3. Below this there are buttons like report which will

    create a report and will send a copy to the Daimler mail and extra functions will

    display one more window which will deal with errors in the result files. Below the

    status box you can see a message box which will display all the messages and

    results of different functions performed.

    The picture of the main window is shown in the following figure: This is qc_tool

    v1.0

    The main window has the following buttons:

    1. Importing section where we can import *.prot, *.log file and *.bif file

    2. The help buttons shows the help file in English and German

    3. The status box shows the messages whether the file has been imported or not

    4. The message box displays the results.

    5. The extra functions button displays another dialog box which have the fatal error

    checks and msg error checks.

  • GRAPHICAL USER INTERFACE

    9 | P a g e

    Figure 3: QC_toolv1.0 main window

    Help file

    Message box

    Status box

    For the INERTIA, Mesh Summary and Summary

    buttons to work first we should do the check and the outputs

    of these functions are displayed in message box

    This displays the checks which are not done

    Check button display the checks which are done as a table in the

    message

    This REPROT button creates a report and sends a copy to mail

    Button which initiates quality checks

  • GRAPHICAL USER INTERFACE

    10 | P a g e

    The figure6 shows us the extra function window where we have 3 frames in total. The top frame

    is the importing region where we can import different result files like *.f06,*.msg,*.res from

    their particular location. Now at the bottom right we can find a stack of buttons which will

    perform the error checks associated with respective files. Left to the stack of buttons you can see

    a message box which displays the outputs of different functions. The picture of this window is

    shown below in figure 7.

    Figure 4: QC_toolv1.0 extra functions window

    Check button displays fatal errors in an *.f06 file

    Check button displays errors in an *.msg file

    Check button displays errors in an *.res file

    This button creates a report as a

    text file

    Message box

  • Bugs in QC_tool v1.0

    11 | P a g e

    5. Bugs in QC_tool v1.0

    The QC_ tool v1.0 has many bugs in it which are listed below:

    The first major bug in the tool is the report is not getting updated when the changes are

    made in the medina preprocessor

    The layout is very vaguely constructed and cannot resize with the change in the screen

    size

    There are no search options for the error checks in the extra functions window

    The checks which are done are reported as in a plain text format not as a table

    Its not having custom quality checks option

    The user is bit confused with many buttons available at one place

    So when the testing of QC_tool v1.0 was done these are the major bug issues

    reported by the users. So in order to address all these issues I started designing the

    QC_tool v2.0 using qt4 designer instead of using the basic Tkinter module of

    python. Now to design the GUI we need the Qt4 designer and PyQt4 bindings to

    be installed in our workstation. With the help of Qt4 designer we can design the

    layout with the help of drag and drop options. The picture of Qt4 designer is shown

    below:

    Figure 5: Qt4 designer showing drag and drop action

  • Bugs in QC_tool v1.0

    12 | P a g e

    So now using the Qt4 designer we can design any tool with ease. Now after

    creating the layout in the Qt4 designer itll be .ui format, to convert this we need

    PyQt4 bindings. The Pyqt4 bindings have a wrapper function called pyuic4 which

    will convert the existing .ui design file to a .py file where we can edit the code and

    convert the layout into an app by incorporating the functions and also the signals

    and slots.The command which is used in converting the .ui file to .py file is to be

    typed in linux shell as follows:

    Pyuic4 x Qc_toolv2.0 o qc_toolv2.0.py

    The above command will create the py file in the current working directory. The

    flags which are in the command are very important because they are responsible

    for creating the .py file. The x flag which will make .py file that can be run using

    python2.7 command and the o flag will give the output file as

    desired.Now when the .py file is ready we need to connect the buttons in the GUI

    using the signal slot connection methods. This can be done by first developing the

    methods necessary and then connecting by the following command in the .py file.

    Using the below command we can connect any button to any method. The first

    argument is the object name of the button, second argument is the signal whether

    pressed or clicked based on the input and the the third argument is the function

    name, which defines what function the button has to do.

    QtCore.QObject.connect

    (self.pushButton_12,QtCore.SIGNAL("clicked()"),self.checkBox_13.click)

    Using this command we can connect all the buttons to respective functions and then we

    can see the output in the message boxes or linux console.

    With the help of these software we can make any kind of GUI we want. In the next

    section Ill discuss the steps and process developed in designing the Qc_toolv2.0.

  • Developing the QC_toolv2.0

    13 | P a g e

    6. Developing the QC_toolv2.0

    The layout of the QC_tool v2.0 is developed in the Qt4 designer and the layout is

    as follows:

    Figure 6: QC_toolv2.0 layout (developed in Qt4designer)

    This layout has many advantages:

    Has separate section tabs for each of the functions

    The layout is more elegant and the look of the tool is attractive

    The user has lot of clarity when using it because the functions are segregated into tabs

    and can be easily accessed.

    The report generated will be in tabular format.

    This layout can handle material database as well.

    Has the check bif and check bdf functions incorporated as a separate tab.

    It has custom quality check as a separate section

    The pictures of the other tabs are given below:

  • Developing the QC_toolv2.0

    14 | P a g e

    Figure 7: Custom quality check section

    Figure 8: Check BIF/Check BDF section

  • Developing the QC_toolv2.0

    15 | P a g e

    Figure 9: Extra functions tab with search options

    Now as the layout is ready we can use the pyuic4 command to convert into the .py

    file and then use the signal slot mechanism to connect the buttons to the functions.

    Now Ill discuss the functions of each tab briefly:

    TAB 1: this is the main tab of the GUI where the quality check process is done.

    The button start medina process will start the medina gui in the background and

    then we can import the bif file, once the bif file is imported the automated process

    will start and all the checks done will be written in the protocol file and in the log

    file.

    Now we need to import using the import button and then hit the check_status

    button in the gui then the status box and message box will be populated like the

    one in the figure below:

  • Developing the QC_toolv2.0

    16 | P a g e

    Figure 10: Quality check tab with messages printed in the status/message box

    In the status box we can see the status of various checks that are done in a tabular

    view. In the message box we can see the model info and if use the other buttons

    then the related tables will be printed in the message box.

    Now using the report button we can create a report in desired format and send a

    copy to the DAIMLER mail.

    TAB 2: This has custom quality check section where the user can select a

    command by selecting the check box in the selector window. This section also has

    the list of unchecked commands below; these are the commands which cannot be

    checked using the GUI. The user can use the command prompt of the medina gui

    to do the unchecked commands.

    The user after using this selections if he wanted to create a report he can use the

    create report button which will append the contents of the message box to the

    already created report file.

    The picture of the custom quality check section is shown as follows:

  • Developing the QC_toolv2.0

    17 | P a g e

    Figure 11: custom quality check section displaying the checked commands in

    message box

    TAB 3: this tab has the check bif and check bdf functionalities which is used

    before and after preprocessor to check the quality of mesh and the FE model.

    TAB 4: this is the extra functionalities tab which has search options as well. After

    finishing the analysis we get *.f06 file for NASTRAN and *.msg file for ABAQUS

    and *.res for PERMAS. These result files are needed to be analyzed, basically to

    know whether the file has any FATAL errors or not. If there are no fatal errors then

    we should look at the Eigen frequency table for structure and fluid and fluid-

    structure coupled interaction.

    To do this we have to import the *.fo6 file an then hit the check_fatal button

    which will display the messages in the message box whether the file has any fatal

    errors or not, if there arent any fatal errors then itll display the eigen value table

    as shown in the picture:

  • Developing the QC_toolv2.0

    18 | P a g e

    Figure 12: Extra functions tab (showing the Eigen frequency table for *.fo6 file)

    In this tab the user has many choices to perform basically on the analysis of result

    files which should be done manually by opening the files and browsing them

    throughout for FATAL errors, this is eliminated because the code does the

    browsing and also displays the result table. The result table is the Eigen frequency

    table

    Similarly the msg section and res section also have the same capabilities. Another

    important function is this check_fatal does is it can identify the FLUID modes

    and STRUCURE modes and also the coupled modes. It can also identify whether

    RESVEC is done or not mainly in the structure Eigen modes.

  • Conclusion to the QC_tool development

    19 | P a g e

    7. Conclusion to the QC_tool development

    This report basically deals with the development of GUI using the python

    programming language. It also describes the steps to develop the QC_tool using

    the Tkinter module and then it basically discusses about the bugs when the GUI is

    developed by hard coding. Then it discusses about the new version of QC_tool

    v2.0 which was developed using the qt4 designer and then with pyqt4 bindings.

    Thereby I suggest that using the qt4 designer for making the layouts of the

    necessary GUIs and then using the signal and slot mechanism of the pyqt4

    bindings to develop the functionalities is the better approach to design and work

    with the GUIs.

    The QC_tool v2.0 has been tested within the team and has got good feedbacks

    because it has got many functions under one hood and also back-ups the report

    which the user does by sending a copy to the DAIMLER mail account.

    So finally the QC_toolv2.0 has finished its testing phase and is ready to be

    distributed as a python package to all the users in the DAIMLER group.

  • Introduction to Mass - Inertia Compensation

    20 | P a g e

    8. Introduction to Mass - Inertia Compensation

    The process designed to develop the inertia-compensation tool is as follows.

    Project Plan and Definition

    Study of project background

    learning the fundamentals of VBA programming

    Development of an algorithm

    Development of a Graphical User Interface for the mass-inertia compensation method

    implementation

    results into excel worksheet

  • Introduction to Mass - Inertia Compensation

    21 | P a g e

    Introduction to Mass Inertia Compensation method:

    Quantities to be calculated in the Inertia compensation method are:

    To find compensation CG for the FE Model

    To find compensation inertia for the FE Model

    Process for finding the compensation CG for the FE model:

    Let , & be the centre of gravity for the given CAD model and , , be

    the centre of gravity for the FE Model.

    - Mass of the CAD model

    - Mass of the FE model

    $ - Compensation mass, So that

    $

    Let , & be the Compensation CG (CG of the compensation mass)

    After the addition of mass $ to the FE model mass would be equal to and

    new CG (for X) would be equal to

    =

    +

    = (($ )+( ))

    , , = , &

  • Introduction to Mass - Inertia Compensation

    22 | P a g e

    Equating the expression to CG coordinates i.e.

    = (($ ) + ( ))

    = (($ ) + ( ))

    = (($ ) + ( ))

    Now cross multiplying and rearranging we get the following equations:

    =(( ))

    $

    =(( ))

    $

    =(( ))

    $

    By using the above equations we get the compensated mass center of gravity

    coordinates.

    , ,

    , &

    , &

  • Introduction to Mass - Inertia Compensation

    23 | P a g e

    Procedure for finding Inertia compensation is as following

    First steps are to get the following properties:

    To find compensation for moment of inertia

    To find compensation for product of inertia

    It is the inertia defined for the compensation mass so that target inertia values can

    be obtained for the FE model. Now we will find the compensation of moment of

    inertia:

    Let current inertia be

    Here is the mass moment of inertia with respect to CG of the FE model and let

    be the mass moment of inertia with respect to CG of the entire model (FE +

    compensated mass)

    = + (( )

    2 + ( )

    2)

    The above expression obtained from Parallel axis theorem which says the moment

    of inertia of a rigid body about any arbitrary axis is equal to the sum of moment of

    inertia about its CG and product of the mass and square of the distance between the

    CG and arbitrary axis.

    Inertia of the entire model = Inertia of the FE Model + Inertia defined for

    compensated mass

    So Inertia defined for compensated mass ($I) = Inertia of the entire model - Inertia

    of the FE Model

    i.e., $I = Target Inertia

    = I

    So now we can get the following equations:

  • Introduction to Mass - Inertia Compensation

    24 | P a g e

    $ = ( + (( )

    2 + ( )

    2))

    $ = ( + (( )

    2 + ( )

    2))

    $ = ( + (( )

    2 + ( )

    2))

    By using the above equations we get the compensated moment of inertia.

    Applying parallel axis theorem to product of inertia, Let is product of inertia

    with respect to CG of the entire model and with respect to its own CG.

    = (

    + ( ) ( ))

    = (

    + ( ) ( ))

    = (

    + ( ) ( ))

    And

    $ =

    $ =

    $ =

    By using the above equations we can get the compensated product moment of

    inertia.

    A case study has been taken in order to illustrate the effect of compensated mass in

    FE analysis

  • Introduction to Mass - Inertia Compensation

    25 | P a g e

    Figure 13: Normal mode analysis of an engine block

    To find the effect of compensation inertia on dynamic cases, a problem has been

    considered which normal mode analysis of an engine block is done.

    Two cases considered for analysis

    Engine block with inertia compensation

    Engine block without inertia compensation

    Figure 14: RESULT of using Inertia-Compensation

  • Introduction to Mass - Inertia Compensation

    26 | P a g e

    So from the results we can say that there is significant change in the frequencies of

    the normal modes of the engine so it is very important to consider the compensated

    mass and its moment of inertia to achieve correct results.

    Therefore the process has to be performed for every FE model before analysis. So

    calculating every equation and finding the values is a tedious and time consuming

    task. So a decision has been taken to develop a GUI tool in excel where the user

    can enter the values and get the results as a table. The development of inertia

    compensation tool has been discussed in the next section. In the next section the

    total process for the development of the VBA tool is described.

  • Inertia Compensation tool using VBA

    27 | P a g e

    9. Inertia Compensation tool using VBA

    The inertia compensation tool has been developed in excel visual basic

    programming. The main software we need is the Microsoft excel 2010. To develop

    the tool the code has to be written in the vba editor of Excel.

    To open the VBA editor the following steps have to be performed:

    Open MS-excel 2010 and then go to FILE tab Options then you get the following

    window.

    Now select the Developer option in the customize ribbon section as shown above.

    Now we will get the Developer tab in the main EXCEL gui.

  • Inertia Compensation tool using VBA

    28 | P a g e

    There we can see the Visual Basic button if you click that the visual basic editor opens.

    Now the VB editor looks like the picture below.

    Then click on INSERT tab and insert a USER form because we are developing a GUI

    form.

    Then the user form looks like the figure below

    Then using the toolbox we can drag and drop widgets into the user form white space

    After dragging and dropping the necessary widgets we can see the GUI user form as

    below

    The main widgets used are Label, textbox, command button and frame

    The label is used to setup text on the GUI form, the textbox is used for entering the input

    and the command buttons help in taking the user inserted values and processing the

    values and returning the output

  • Inertia Compensation tool using VBA

    29 | P a g e

    The frame is used for arranging and differentiating the sections and aligning the widgets

    in a proper format

    After inserting the widgets and aligning the widgets and when we run the user form the

    user form looks like the one in the figure.

    Figure 15: Mass-Inertia Compensation Tool

    In the top section of the GUI the user has to enter the appropriate values and then when

    he hits the Calculated compensated properties button then the result comes in the output.

    Now for inserting the functions for various buttons vba code has been written and has

    been embedded to the button call.

    An example has been taken to show the working of the tool.

    Following is the DATA for an engine block:

  • Inertia Compensation tool using VBA

    30 | P a g e

    Target mass ( in Tonnes) 3.65E-01

    Current mass ( in Tonnes) 3.13E-01

    Centre of gravity

    Target CG

    -671.582

    -11.681

    150.106

    Current CG

    -6.66E+02

    -1.07E+01

    1.66E+02

    Inertia

    Target Inertia (diagonal)

    I

    x

    y

    z

    x

    1.32E+06

    7.99E+04

    -8.36E+04

    y

    7.99E+04

    4.52E+06

    -8.79E+00

    z

    -8.36E+04

    -8.79E+00

    4.22E+06

    Current Inertia

    I'

    x

    y

    z

    x

    1.08E+04

    6.92E+02

    -5.92E+02

    y

    6.92E+02

    3.85E+04

    -1.32E+02

    z

    -5.92E+02

    -1.32E+02

    3.56E+04

    This is the data we need in beforehand to calculate the compensated properties.

    Now Ill enter these values in the tool and then press calculate compensated

    properties button then we get the result values as shown below.

  • Inertia Compensation tool using VBA

    31 | P a g e

    Then when we hit tabulate the excel sheet will show a table with the calculated

    values as below:

    Result Values

    Compensation mass ( in Tonnes) 0.052

    Xm Ym Zm

    Compensation Center of Gravity -705.1813462

    -17.58586538

    54.43634615

    Compensated Moment of Inertia Ixx Iyy Izz

    1309120.629 4481411.177 4184389.946

    Ixy Iyz Ixz

    79206.28603 118.3296996 -83035.76946

    So this tool will help in calculating the compensated mass-inertia properties easily.

  • Image insert tool using VBA in PowerPoint

    32 | P a g e

    10. Image insert tool using VBA in PowerPoint

    The image insert tool is the tool developed by me in power point vba to basically

    insert number of images from a folder into a particular slide based on the users

    input.

    This tool has been developed in the power point vba using macros and the user

    form option in the vb editor.

    The main reason to develop this tool is to basically enhance the post-processing

    analysis speed and to eliminate the manual insertion and cropping of pictures

    which takes lot of time. This tool basically automates the image inserting process

    and there by reduces time for spending on such a tedious task.

    The process designed to develop the image insert tool is as follows:

    This tool is developed by using the user form in the vba editor as shown in the

    previous section during the development of inertia compensation tool. To get the

    learning the fundamentals of VBA

    programming in power point

    Development of an algorithm

    Development of a Graphical User Interface

    for the image_insert implementation

    inserting images into the current working

    presentation slide

  • Image insert tool using VBA in PowerPoint

    33 | P a g e

    layout desired drag and drop the needed widgets in to the user form and then align

    them. The tool is shown in the figure below.

    ]

    Figure 16: Image Insert Tool

    The GUI widgets used here are frame, command button , list box and labels

    The working of the tool is as follows:

    o When we invoke the tool through the button in the power point GUI the above

    tool window pops up.

    o Now in the text box beside the label folder path is the place where we need to

    enter the path to the folder where images are located. It can be done even by

    browsing using the button browse and show list.

    o Then the list of images which are in the folder appears in the list box.

    o Now the user can select the images and use the >>>> button to push them into

    another list box.

    o Then the user can enter the number of images to be inserted in the text box beside

    the label No of images to be inserted.

  • Image insert tool using VBA in PowerPoint

    34 | P a g e

    o Then the user can hit the insert into slide button to insert the images in to the

    slide.

    An example is illustrated below which follows the above steps.

    Open the image insert tool in the power point GUI using the image insert button

    Then select the folder where the images are located.

    After doing the above steps the tool looks like the one in the figure below.

    Figure 17: Usage of Image Insert tool

    Then select the images you want in the slide and then hit >>>>.

    The button

  • Image insert tool using VBA in PowerPoint

    35 | P a g e

  • Image insert tool using VBA in PowerPoint

    36 | P a g e

    Then enter the number of images to be inserted in the text box then hit insert into slide

    button.

    Then the GUI appears like the one in the figure below and a new slide is created with

    four images aligned and ordered.

    The slide appears to be the one in the figure below. This is for four images in the slide

    similarly the same process can be followed to insert 2, 3, 5, 6, 7, 8 images.

    Sample Output after using the tool

  • Software selector tool in python

    37 | P a g e

    11. Software selector tool in python

    The Software selector is a tool basically developed in python which gives a user

    interface to select and open various CAE tools available in MBRDI. This tool will

    eliminate the task of opening the terminal and then entering the software name and

    then opening the version the user want which will speed up the process. One more

    advantage is if the user wants to open other softwares he can just click the button

    on the user interface button and then the software will open. This is lot better than

    the user opening multiple consoles and then typing the software arguments in the

    command line.

    The process adopted to design this tool is as follows:

    Project Plan and Definition

    Study of project background

    Development of an algorithm

    Development of a Graphical User using the qt designer

    binding the buttons with the functions

    creating a distribution using pytinstaller

    distributing it as software selector

  • Software selector tool in python

    38 | P a g e

    The software selector user interface has been developed in qt4 designer and the

    layout of the software selector is shown in the figure below.

    Figure 18: Software Selector tool (CAE tool selector)

    This is the software selector GUI and the qt4 widgets which it contains are

    Qbuttons, Qgroupbox, Qtextbox, and Qcombobox. The layout was first created in

    the qt4 designer

    The code written to bind the buttons was done by using pyqt4 bindings for python.

    At first the layout developed in qt4 designer needs to be converted into .py script

    that can be done by pyuic4 command as I mentioned earlier in the report in the

    section of developing the Qc_tool. This command will convert the

    software_selector.ui to Software_selector.py then we can include the methods

    needed to be called from the buttons.

  • Software selector tool in python

    39 | P a g e

    The Software_selector.py contains a main class Ui_Dialog which will have all

    functions and has main function named Setupui which will initialize the GUI

    when the program is run from the shell. The function retaranslateui will help in

    automatic changing the layout corresponding to the operating system used.

    The working of the GUI is explained in the following steps:

    The Software_selector.py icon is available as a desktop icon to every person in the CAE

    department.

    Double click the icon which is on the desktop and then the GUI gets invoked and then

    use the help for first time users. The help will be displayed in the text box in the GUI.

    The help file is as follows:

    o Use the customize button during the first time opening of the tool

    o All the softwares installed in your system will be visible in drop down menus

    o Then after selecting the versions you need then hit save to save the selections you

    made and close the tool.

    o Reopen the tool and directly use it without using the customizing option.

    Another advantage of this tool is that even if the tool crashes the softwares doesnt close

    which is not the case of the terminal if it crashes the software working in the present

    terminal closes

    Illustration of the above steps is shown in the figure below.

    Here in the software selector if anyone software is not installed in a user system

    then itll show NONE in the dropdown list .When we hit the button help itll

    display message in the text box. And after selecting the user defined softwares the

    user should save and close the GUI and the reopen it to use it directly. If any

    software gets installed or is removed or updated the GUI gets automatically

    updated when the user closes it and reopens it again.

  • Software selector tool in python

    40 | P a g e

    Text box which will display help and

    also error messages if any error occurs.

    If this button is clicked then the version list frame

    gets highlighted and the user can chose the

    software from the drop down list

    This save button will create the

    session saved by the user in a

    secure location and invokes that

    session when the user invokes the

    GUI next time. This session is

    preserved until the user makes

    some changes in the version list.

  • MAT10 Card generator tool using VBA

    41 | P a g e

    12. MAT10 Card generator tool using VBA

    The MAT10 card generator tool has been coded in excel VBA which basically

    takes in the input properties like the Average Density and Average Temperature at

    various section of the intake and exhaust systems and calculates properties like

    Bulk Modulus and Speed of Sound. This tool helps in saving time to generate

    MAT10 cards by doing it automatically when the user enters the input properties.

    The process developed to design this tool is:

    The MAT10 generator tool has been developed using vba macros which will be

    discussed in the following sections.

    The following pictures will show the layout of the tool in excel worksheet:

    Project Plan and Definition

    Study of project background

    Development of an algorithm

    Development of a Form controls which will intiate

    Macros

    binding the buttons with the Macro functions

    creating a distributable Vba excel sheet

    distributing it as MAT10 card generator tool

  • MAT10 Card generator tool using VBA

    42 | P a g e

    Figure 19: MAT10 card generator tool

    This is the main layout of the tool. The user should enter the properties in the Enter

    Material Values column where he can add rows and values depending on the data

    the user has. Now after entering the data the user has to click the Calculate

    Properties button where the intermediate properties gets calculated and then a

    table is generated given on the worksheet under the column calculated properties.

    The table is as follows:

    Now the properties which are calculated are to be added to a material ID based on

    the system in which it is present. For that the user has to select from the options

    which are available next to the calculated properties table. The following picture

    shows the available system to which the MAT10 cards can be created.

  • MAT10 Card generator tool using VBA

    43 | P a g e

    After selecting the type of system the Material Id list appears in the column right

    next to the select system option. After that the user should hit the Process to

    card table button which will fill the processed table below the processed final

    table column and then the user should select the Material Id and assign it to the

    respective property. Now the user can export the card table to a text file. The

    following picture shows the processed final table:

    Now the user should use the button Export to a file then the table gets saved to

    *.txt file. A sample *.txt (MAT10) card file is shown below:

    In this way the tool generates MAT10 cards which can be used as input for

    NASTRAN solver.

  • Folder List Tool for Engines (Incorporated In SAM)

    44 | P a g e

    13. Folder List Tool for Engines (Incorporated In SAM)

    This tool is basically developed in python which is incorporated in software called

    SAM. This tool basically lists the Engines based on the maturity level and lists

    based on the date modified. The development of this tool cannot be discussed

    further because of the confidentiality clause. The layout of this tool is as follows:

    Figure 20: Folder list tool For Engines

  • Conclusion

    45 | P a g e

    14. Conclusion The tools which I have developed have been submitted to the DAIMLER AG in

    Germany and also have been used in the MBRDI office. The tools which I developed

    have enhanced the pre-processing procedures. To summarize in total where the tools I

    developed are used is described in the following flow chart.

    Use CAE Tool Selector to open various softwares

    Helps in Reducing time for opening the softwares 1. Starting tool

    Use Hypermesh or ANSA to develop FE Model

    If we are doing Vibration Analysis then use Mass Inertia Compensation tool for Inertia Compensation

    2. Modelling

    Use QC Tool (Tab-1) to do the Quality Check for a FE Model

    Use QC Tool(Tab-2) to do a custom Quality check

    3. Quality Check

    Use QC Tool (Tab-3) to do a FMDB Quality Check 4. ChBif/ChBdf

    Use Card Generator tool for generating input deck for inlet, exhaust and Vehicle cavity systems

    5. Input Deck Preparation

    Submit Jobs and for tailing jobs Use CAE Tool SelectorAQS JOB and Scjobsubmit

    6. Abaqus/Nastran Solver

    Use Q C Tool (Tab-4) for fatal error check

    Use Fatal tool from terminal ( used for looking at the Eigen frequencies also)

    7. Result File

    Image Insert tool for rapid Insertion of images into the PowerPoint 8. Post Processing

  • References

    46 | P a g e

    In the above described stages the tools which I developed significantly reduced time

    involved in manual tasks by automating them. Thereby the total time for result file

    generation has reduced a lot.

    15. References

    https://www.udacity.com/

    http://stackoverflow.com/

    http://www.tutorialspoint.com/

    https://www.edx.org/

    Python Google classes