Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering...

38
Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013

Transcript of Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering...

Page 1: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Lecture 2: Systems Engineering

EEN 112: Introduction to Electrical and Computer Engineering

Professor Eric Rozier, 1/23/2013

Page 2: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

CROSSING THE RIVER…

Page 3: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Farmer, Wolf, Goat, Cabbage

FW

GC

A farmer needs to transport a wolf, a goat, and a cabbage across the river.

• Boat has two seats• Farmer must drive…

• If left alone…• The wolf will eat the

goat.• The goat will eat the

cabbage.

Page 4: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Farmer, Wolf, Goat, Cabbage

FW

GC

As a group, formulate a solution to transport everything across the river, without anything being eaten.

Page 5: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

What do we learn from this exercise?

• Sometimes we have to move backwards to move forwards.

• Even simple systems need thought to formulate a plan for accomplishing their goals.

We call this plan, an algorithm.

Page 6: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

ALGORITHMS

Page 7: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Algorithms

• al-Khwarizmi– Persian mathematician,

astronomer, and geographer born780 A.D.

– Invented a few things…• Decimal system• Algebra• Trigonometry

Page 8: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Algorithms

• al-Khwarizmi also introduced the idea of solving problems using step-by-step procedures for calculations.

• Algorithms – A method of solving a problem or accomplishing a task expressed as a finite list of well defined instructions.– Starting from an initial state and an initial input, the

instructions describe a computation that, when executed will proceed through a finite number of well defined successive states, eventually producing output, and terminating at a final ending state.

Page 9: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

States, Inputs, and Outputs

• States are a way of measuring the condition of a system, and it’s environment.

• Inputs are a way of getting information to a system.

• Outputs are a way of getting information from a system.

Page 10: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Algorithms

• Algorithms let us define, formally, what we want machines and automated systems to do.

• Algorithms are written to have precise meanings, and to be generally applicable.

Page 11: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Systems Engineering and Cyberphysical Systems

• We build systems to do jobs, solve problems, and accomplish tasks.

• Often these systems are cyberphysical systems, i.e. they combine computational components with the real world.

• An algorithm is a way of telling the components how to do their job, and how to work together.

Page 12: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Example System: Thermostat

• Thermostat– What is the goal?– What problem does it

solve?– How would we

characterize the state?– What would the inputs

and outputs be?

Page 13: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Example System: Thermostat

• Thermostat– What is the goal?– What problem does it

solve?– How would we

characterize the state?– What would the inputs

and outputs be?– Break into groups

• Define the problem• Define what the thermostat

needs to do

Page 14: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Example System: Thermostat

• Thermostat– Regulate temperature– Specification

• Must be able to sense temperature

• Based on the temperature must be able to signal cooling or warming the room, or to do nothing.

• State: temperature, heating state, cooling state

Page 15: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Example System: Thermostat

• Thermostat– Pseudocode algorithm

• tempLow = L• tempHigh = H• loop()

– Test temperature, store the value in T

– If (T < L) send a heating signal

– If (T > H) send a cooling signal

Page 16: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Example System: Thermostat

Thermostat

Heater Air Conditioner

Signal: Heat Signal: Cool

Sensor

Page 17: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

• Some important points…– Four systems here, each with their

implementations…– Need to communicate with each other…

Thermostat

Heater Air Conditioner

Signal: Heat Signal: Cool

Sensor

Page 18: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Networking and Communication

• Systems communicate via signals, over wires, or wirelessly via electromagnetic radiation.

• In our thermostat system, the heater and cooler can be switched on or off by a pure signal on the wire. I.e., if electrons are flowing, turn on, if not, turn off!

Page 19: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Networking and Communication

• But how do we get information from the sensor?

• It needs to send a number… how do we do that?

Page 20: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Networking and Communication

• What if we encode the signal into pulses?

• Detect if the value is above or below some threshold, and decide it represents a 1, or a 0.

• Strings of 1’s and 0’s can be interpreted as a number.

Page 21: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Some simple things we can represent with 1’s and 0’s

• True or false…– 1 – true– 0 – false– We already were doing this with pure signals.

Page 22: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Some simple things we can represent with 1’s and 0’s

• Integers

• Examples– 00000000 – 0 - 00000010 - 2– 00000001 – 1 - 00001010 – 10– 00000011 – 3 - 10010011 – 147

7 6 5 4 3 2 1 0

128 64 32 16 8 4 2 1

Page 23: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Negative numbers and real numbers are more complex…

We will cover those later…

Page 24: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Boolean Algebra

• Using true/false values in complicated ways

• Thermostat system– Let’s make a change to the basic system– Add a switch with values “Heat” and “Cool”– Cool the room if T > H and Switch is set to “Heat”– Heat the room if T < L and Switch is set to “Cool”

Page 25: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Boolean Algebra

• Gets back to gators and grades…• Represent truth as 1, and false as 0

– We can operate on values using the following basic operators:

• AND• OR• NOT

Page 26: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

AND

• X AND Y

X=0 X=1

Y=0 0 0

Y=1 0 1

Page 27: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

OR

• X OR Y

X=0 X=1

Y=0 0 1

Y=1 1 1

Page 28: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

NOT

• NOT X

X=0 X=1

1 0

Page 29: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Abbreviations

• ^ - And• v – Or• ! – Not

• !X ^ Y

X=0 X=1

Y=0 0 0

Y=1 1 0

Page 30: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Commutative laws

• X ^ Y = Y ^ X• X v Y = Y v X

Page 31: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Associative laws

• X ^ (Y ^ Z) = (X ^ Y) ^ Z• X v (Y v Z) = (X v Y) v Z

Page 32: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Distributive laws

• X ^ (Y v Z) = (X ^ Y) v (X ^ Z)• X v (Y ^ Z) = (X v Y) ^ (X v Z)

Page 33: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Some exercises

• !x ^ !y• !(x ^ y)• !x ^ x• (x v y) ^ !(x ^ y)

Page 34: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Realization as electronic components

AND OR NOT

Page 35: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Realization as electronic components

AND OR NOT

Page 36: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Derived operators

• X XOR Y– (x v y) ^ !(x ^ y)– Exclusive Or

• X Y– (!X v Y)– Implication

• X = Y– (!X XOR Y)

Page 37: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

De Morgan’s Laws

• The negation of a conjunction, is the disjunction of the negations– !(X ^ Y) <-> (!X) v (!Y)– !(X v Y) <-> (!X) ^ (!Y)

Page 38: Lecture 2: Systems Engineering EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 1/23/2013.

Homework

• Prove the equivalence of the expressions in De Morgan’s Laws with truth tables (show they are the same!)