che 117
Download
Skip this Video
Download Presentation
ChE 117

Loading in 2 Seconds...

play fullscreen
1 / 9

ChE 117 - PowerPoint PPT Presentation


  • 75 Views
  • Uploaded on

ChE 117. Motivation Lots of Tools Excel • Mathematica MathCAD • Calculators Matlab • Polymath Can’t always use “Canned Programs” i.e. binary phase equilibria Data manipulation Process control and data acquisition Excel macro language (VBA) Web pages.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' ChE 117' - ketan


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
che 117

ChE 117

Motivation

Lots of Tools

Excel •Mathematica

MathCAD • Calculators

Matlab • Polymath

Can’t always use “Canned Programs”

i.e. binary phase equilibria

Data manipulation

Process control and data acquisition

Excel macro language (VBA)

Web pages

slide2

Programming language: Visual Basic

    • Interface with Excel (VBA)
    • Similar to Fortran, C, C++, etc
    • PC-based DAQ (data acquisition) and control
    • High-level language (vs assembly)
  • What is: Visual Basic .NET
    • Computer interface
    • List of instructions
    • Contains Interpreter

VB  machine language “on the fly”

slide3

Input

Manipulate

Output

  • What is a Program?
    • Road map
    • Set of instructions
    • Good for repetition
  • Example: convert °F to °C or °C to °F
    • GUI
    • ID Parts!
slide4

Example Program (manipulation)

    • Average 3 numbers (10, 12, 15)
    • Sub Avg()
    • n1 = 10
    • n2 = 12
    • n3 = 15
    • avge = (n1 + n2 + n3) / 3
    • MsgBox avge
    • End Sub
slide5

Decisions (“If” statements)

    • Sub test2()
    • label = "F"
    • TF = 212
    • If label = "F" Then
    • TC = (TF + 460) / 1.8 - 273
    • MsgBox TC
    • End If
    • End Sub
  • “If – Then – Else - Endif
    • Sub test3()
    • label = "C"
    • Tin = 100
    • If label = "F" Then
    • Tout = (Tin + 460) / 1.8 - 273
    • Else
    • Tout = (Tin + 273) * 1.8 - 460
    • End If
    • MsgBox Tout
    • End Sub
slide6

Loops (“If” statements)

  • Add numbers 1 - 10
    • Sub looper1()
    • sum = 1
    • n = 1
    • 10 If n < 10 Then
    • n = n + 1
    • sum = sum + n
    • GoTo 10
    • End If
    • MsgBox sum
    • End Sub
  • Loops (For – Next)
    • Sub looper2()
    • sum = 0
    • For i = 1 To 10
    • sum = sum + i
    • Next i
    • MsgBox sum
    • End Sub
ms excel visual basic vba vb 6

Worksheets

Modules

sub & function procedures

Chart Sheets

User Forms

and objects

(VBA code)

Workbook

VB Editor / Modules

MS Excel & Visual Basic (VBA ~ VB.6)
  • Excel Environment
slide8

Example Program (manipulation)

  • Set up macro to calculate an average… use example as template.
  • Run the macro
  • Set up Form Button to run macro
slide9

Problem Solving Exercise (in groups)

  • Set up macro to convert 100 kg to lbs or lbs to kg
  • Display result in msgbox
  • Run the macro
  • Set up Form Button to run macro
ad