Lecture 1: Course Introduction Overview of Computers and their Applications in MAE B Burlingame 3 February, 2016 Heavily based on work by Dr. Buff Furman, SJSU The Plan for Today Welcome to ME 30 Learning objectives Highlights from the syllabus (aka, ‘greensheet’) Overview of computers and their applications in MAE Data Types and Variables Binary representations of phenomena Bit, Bytes, and numbering schemes Base conversion My Background Industry experience California Native Hobbies: build things, fix things, literature, cycling, scuba diving Why Engineering? Grew up in Manteca, CA (one of those places where they still grow food) Personal Microsoft Corporation – Principal Hardware Engineer Consumer Electronics Development UltimateTV Xbox Xbox 360 Kinect Xbox One, Kinect II HoloLens Surface Book Engineering is the highest form of creation open to man. We get to harness the possibilities crafted by science to creatively enhance life’s experience Why am I in this class in the middle of a work day? To help foster as many awesome engineers as possible The more brains we have to create a more interesting world, the more interesting the world shall become Syllabus Highlights and Where to Find Things Syllabus available at http://me30.org (last_first@me30.org, ex: Burlingame_bryan@me30.org) Office Hours TBD Course information Course goals and learning objectives Textbook Lab Kit Programming in C (4th Edition) by Stephen G Kochan Needed this week Policies and protocol Grading Resources Course schedule Back Announcements Homework 1 posted tonight, due in two weeks in class Generally, two weeks per homework covering the lesson of the day and the following week’s lesson All homework and labs should be printed and a hardcopy turned in, a digital copy should be turned in to instructure If you have a laptop, bring it to lab Focus of ME 30 Solving problems with computers Gain familiarity with other software used by MEs and AEs for technical computing Learn the process for formulating a computational solution to a problem Practice the process Matlab Excel Learn structured programming using the C language Get prepared for learning about mechatronics Where and How are Computers Used in MAE? 1 Technical and Personal Communication Email Word processing (reports, procedures, etc.) Presentations Conferencing Computation and Analysis Arithmetic Equation solving Data analysis and visualization Multiphysics and numerical modeling sin(r)/r Where and How are Computers Used in MAE? 2 Design Solid modeling (ME 165) Finite Element Analysis (FEA) (ME 160) Dynamic modeling and simulation (ME 147, ME 187, ME 190) Design tradeoffs and analytical modeling of mechanical components and systems (ME 154, ME 157) Gathering Information Web searches Patent searches Databases Vendor and other websites Datasheets Where and How are Computers Used in MAE? 3 Testing and Experimental Work Laboratory and Factory Automation and Control Dynamic systems (ME 187, ME 190) Instrumentation and Product Design Data acquisition from sensors (ME 120) Embedded controllers (ME 106, ME 190) http://las.perkinelmer.com/Content/Images /smallImages/janusLabAuto.jpg MRP, Inventory, and Document Control Drawings Procedures Bill of Materials (BOM) Specifications Engineering change orders (ECOs) http://www.plm.automation.siemens.com/en_us/products/teamcent er/solutions_by_product/mechatronics_process_management.shtm The Bottom Line Mechanical and aerospace engineers use computers widely You need to know how to use computers to be successful ME 30 will help you especially in the area of computation and analysis Exposure to Matlab and Excel Focus will be on the C language I hope it will also whet your appetite to learn about mechatronics Next --> Networking Introduce yourself to someone you DO NOT know Find out one thing about them that they like to do in their spare time Two minutes! Back What and Why? Data => pieces of information we deal with in the problem solving process Why is it important to know about data types? Need to know about data types to effectively use a programming language It’s all just bits the lowest level! What would you rather work with… int i; float r; i = 3; r = cos(2*i*PI); or… 00000010 10000000 00000000 00000110 10000010 10000000 01111111 11111100 11001010 00000001 00000000 00000000 etc. 12 Kinds of Data (simplified view) The basic kinds of data that we will mostly use: Numeric Integers: Real (floating point) numbers: Character (are enclosed by single quotes in C) All letters, numbers, and special symbols String (are enclosed by double quotes in C) Are combinations of more than one character Ex. ‘A’, ‘+’, ‘5’ Ex. “programming”, “ME 30” Logical (also called ‘Boolean’ named after George Boole an English mathematician from the early 1800’s) True or False (1 or 0) 13 Constants and Variables Constant A data element that never changes in your program 5, 62.37, 4.219E-6, “record_string”, ‘$’ i = j + 7; /* which one is the constant? */ first_letter = ‘a’; /* which one is the constant? */ Variable A data element that can take on different values Its name represents a location (address) in memory i = j + 7; second_letter = ‘b’; /* which are variables? */ /* which is the variable? */ Values are ‘assigned’ using a single equal sign ( = ) Read the statement: i = j + 7; Binary Representations Computers only contain two values On/Off (High/Low, 0/1, etc.) Binary number only have two value 0/1 Base 2 numbering system A bit: A number in base 2 (binary digit) How computers do what they do? Humans are the translators The machine just presents information Think, what is a letter? Just a squiggle, humans give meaning Binary Representations Everything in a PC is encoded in binary Computers are finite, so are their representations RGB for colors 24 bit color (8 bits for red, 8 for green, 8 for blue) TIFF Music Midi – Instrument + note MP3 – Sound waves compressed Cruise Control Voltage level going to an actuator Binary to Decimal Binary number only have two value 0/1 Base 2 numbering system A bit: A number in base 2 (binary digit) Decimal numbers have ten values 0 – 9 Base ten numbering system Think scientific notation 6.02E23 = 6 * 1023 + 0 * 1022 + 2 * 1021 010101012 = 8510= 1 * 27 + 1 * 26 + 1 * 24 + 1 * 22 + 1 * 20 Range? Largest 8 bit value: 111111112 = 25510 Largest 16 bit value: 11111111111111112 = 6553510 Negative Values Recall: The computer only deals in 0/1 Humans provide context Sign bit The first bit represents sign 11010101 = -213, 01010101 = 213 1’s Complement Flip the bits (change 1’s into 0’s) 10101010 = - 213, 01010101 = 213 Negative Values (Cont) 2’s Complement Take 1’s complement, add one 01010100 Start (8410 in this example) 10101011 Flip bits 10101100 Add one (notice the carries) Binary to Hexadecimal Hexadecimal (base 16) is a convenient numbering system 0 – 9, A – F (A = 1010, B = 1110, etc Observe 24 = 16, allows four bits (a nyble) to be grouped 11002 = 1210 = 0xC16 Binary to Hexadecimal Convert Binary to Hex 1100001110011111b Binary to Hexadecimal Convert Binary to Hex 1100 0011 1001 1111 b 12 3 9 15 d C 3 9 F h (grouping 4 bits) C39Fh 12 * 163 + 3 * 162 + 9 * 161 + 15 * 160 = 50,079 Representations Decimal (default) Binary Hexadecimal 108 0’01101100 0x6C 108d 0110 1100b 6Ch 10810 0110 11002 6C16 108 dec 0110 1100 bin 6C hex Group by 3s with a comma Group by 4s with a space or an underbar Generally don’t group Spoken short form Decimal to binary Many ways, this is how I do it 120 120 < 128, 0 in 7th position 120 > 64, 1 in 6th position 120 – 64 = 56 56 > 32, 1 in 5th position 56 – 32 = 24 24 > 16, 1 in 4th position 24 – 16 = 8 8 = 8, 1 in 3rd position 8–8=0 Binary Decimal 1 1 10 2 100 4 1000 8 10000 16 100000 32 1000000 64 10000000 128 Once we hit zero, all other values are zero 0111 1000 Why do I do it this way? It is quick when I don’t have a calculator. Your mileage may vary References Nicholas, P. (1994). Digital Design. Minneapolis/St. Paul: West Publishing Company Kochran, S. (2014). Programming in C 4th Edition. Upper Saddle River, NJ: Addison-Wesley