Monday, October 9, 2017

Get Things Done Better; Pound the Rock, Find a Sledgehammer, Build a Howitzer


The stonecutter's credo of "pound the rock" is a popular theme in business and in sports.

"I go and look at a stonecutter hammering away at his rock perhaps a hundred times without as much as a crack showing in it. Yet at the hundred and first blow it will split in two, and I know it was not that blow that did it, but all that had gone before."
-Jacob Riis

It makes a lot of sense.  When working at something, follow a good process and don't give up, even when progress seems slow.  By persevering and trusting the process, the job will get done and be done well.
I have found this credo to be useful and true, so I've added to it.  My philosophy for getting things done is:

"POUND THE ROCK, FIND A SLEDGEHAMMER, BUILD A HOWITZER"

"Pound the rock" means following the process, and sticking to it.  For instance, in an engineering project, it means going through all the experiments planned and looking at all the results.   Sticking to the plan requires a good, clear plan, and a buy-in from the team.  


POUND THE ROCK
"Find a sledgehammer" means that while pounding the rock, think about how to get it done a little faster, a little better.  Improvements of 10% to 50% can be found by speeding up the slowest step or reducing the number of steps needed or automating a few steps.


FIND A SLEDGEHAMMER
"Build a Howitzer" means developing a method where the task is done in one or a few steps.  Blast that rock into tiny pieces in one, single step!  The user must have a clear vision of how to do the task and all the typical inputs, settings and outputs.  This requires changes outside of the specific task.  Inputs must change and be standardized to make the task simple and repeatable.  The task itself must be automated and set up to handle the most common scenarios.  The outputs must be well-defined and ready to pass to the next task with no edits.
BUILD A HOWITZER
As a signal integrity engineer, I'm constantly running simulations with field solvers.  Here's how the process looks in a specific scenario.

"Pound the rock" Simulation Method
> Make a new simulation file
> Load all the physical objects, typically a .STP file from the mechanical engineer
> Setup the materials for each object
> Setup the energy sources (aka ports)
> Setup the solve
> Run the solve, typically on a big compute array
> Extract the results, typically s-parameter files
> Final output = s-parameter file -> Goes to next task of analyzing the results
TOTAL STEPS: ~50 mouse clicks and a few entries typed in
TOTAL ENGINEERING TIME: ~30 minutes

"Find the Sledgehammer" Simulation Method
> Run a script/macro to make a new simulation file and load the .STP file
> Setup the materials for each object
> Setup the energy sources (aka ports)
> Run a script/macro to setup the solve
> Run the solve, typically on a big compute array, and automatically export s-parameter files when complete
> Final output = s-parameter file -> Goes to next task of analyzing the results
TOTAL STEPS: ~20 mouse clicks and a few entries typed in
TOTAL ENGINEERING TIME: ~10 minutes

"Build a Howitzer" Simulation Method
> Run a tool that takes a .STP file, and a settings file, press GO !
Makes a new simulation file and load the .STP file
Sets up materials based on the settings and lookup table
Sets up the energy sources (aka ports)
Puts in the solve settings
Queues the solve on the compute array
Exports s-parameter file with a clear, descriptive filename, and a detailed, standardized header file
Runs continuity, causality and reciprocity checkers on the data to verify good data
Puts the s-parameter file in a specified location, ready for the analysis task
FINISH THE JOB IN ONE STEP
> This method requires some infrastructure and standards to work well, especially for the input mechanical geometry file
3D geometry file must follow a naming convention such that the tool can match objects to materials
mechanical object to material lookup must be built; such as any object MAT12345_sigA2.... is assigned to Copper
mechanical object names must be labeled to indicate signal and ground metal; such as MAT12345_sigA2... = signal, MAT12345_gndC1... = ground
tool must be able to both read the settings file and implement those settings in the solver;
For instance: read start frequency and stop frequency from a text file, then run a script to setup those frequencies in the solver
TOTAL STEPS: 1 mouse click and 2 filenames
TOTAL ENGINEERING TIME: 1 minute


TIME SAVINGS CHART
What howitzers do you need to build?
What would it take?  What standardization?  What changes are needed for how the task is done?  What changes are needed before and after the task?
It's not easy to build the howitzer, but there's always a way to do it.  I encourage everyone to think about it and start building one!

Saturday, October 7, 2017

Improve Productivity with RULES OF THE TOOLS

Webster's dictionary defines "TOOL" as "something used in performing an operation." Tools make tasks easier and faster or even make work possible when it would otherwise not be.  Using the right tool for the job makes tasks much more productive and less frustrating. Many repeated tasks, such as saving data and making reports, are a great fit for a computer tool to do the work.  If you have a good tool, learn it, master it and use it.  If you don't have one, then write your own !


RULES OF THE TOOLS
- Tool structure has 3 pieces
        Inputs: 
        1. Go into the engine for every output and can change                                constantly.       
            These are like parts in an assembly line.

        2. Settings:
                  Tell the engine what to do for each instance.  
            These change regularly, but not constantly.
        3.  Engine:
             Takes the inputs, reads the settings, does the work and                             produces the outputs.
             This can be updated to improve features or speed.


- Tool operation has no more than 3 steps
1. Read the settings
2. Put in the inputs
3. GO !  (Get the outputs)

- Use what you already have
  > Many software programs already have some scripting and macro features.  Use these features to make a tool
  > Microsoft office tools (word, excel, powerpoint...) have macro features.  Lab equipment has control commands.  Simulation software, such as HFSS, ADS, and CST, have scripting commands.
  > Matlab, Perl, and python are general software tools that can be used to make almost any other tool.
  > Think big!  Make a script/macro that completes typical tasks in a single click

- Must do something useful in the default condition
> new users just press go and something happens
> choose the most common usage for the default settings

- Has production mode and engineering mode
> production = fast, easy, 3 or 4 settings, then go
> production mode produces outputs which are ready to publish with no edits
> engineering = lots of optional settings, batch mode, can do almost everything the user might want
> optimize for the most common uses, handle the exceptions
> always build-in features for batch mode and command-line only usage


- Self-documenting, no instructions needed
> intuitive, like iphone/ipad
> context help pop-ups for new users, like build-and-wait smartphone games
> the tool tries to guess right, on the first try, about what the user wants, using contextual clues

- Expandable to add useful features without a major rewrite
> modular, abstraction layers
> easy for users to write their own code and enhance the tool
> built for crowdsourcing / open sourcing / improvement suggestions from users

- Automatically check as much as possible as quickly as possible
> use quick, automatic checkers to find problems with inputs and settings, before producing an output
> check any user inputs for typos and entries that don't make sense
> check measurements to verify valid results and find common problems before saving data
> work to make the checks very fast, on the order of milliseconds;  checkers that take as much time as the measurement, are not worth much

- Setup for continuous improvement; faster, better, cheaper
> always put information in a log file after every output, including date and time, operator and any other useful information
> always have metrics to measure progress and continuously monitor them through the log file
> make it like production, count production units, s4p's, reports, plots, designs, etc // continuously monitor speed, accuracy, etc.
> identify the slow steps in the process and figure out how to speed them up
> identify features that will significantly improve the engine accuracy, ease-of-use or add a new feature

- Build it in phases
> Phase 1: do something simple, useful, save 25% of repeated work
> Phase 2: add flexibility, speed, automation, save 50% of repeated work
> Phase 3: more speed, more features, has a way of doing 90% of user's tasks

Here's an EXAMPLE of using these rules to build a tool.


TOOL SNAPSHOT:  HERE'S WHAT IT LOOKS LIKE
I worked in a lab that measured cables.  Each was measured in a range of frequencies on the network analyzer and in the time-domain on the TDR/Scope.  The frequency data was stored in s-parameter files the time-domain waveforms were stored in CSV files.  In order to produce a production report for each cable, the data was cut and pasted, and screenshots were taken.  Then all the results were manually combined into a report.  All the files were saved manually; click-click-click on the mouse to get the equipment to save a file.  Then the user had to type in the name of the file.  For an 8-pair cable bundle, this required 8 s4p files, 8 CSV files and 16 screenshots.  In the worst case, it took 1.5 hours to measure the 8 pairs and make a report.  

I led a team to improve the process and make a tool that controlled the equipment, saved the data and generated a report.  Now the 8 pair measurements take 8 minutes total to save results and generate a report.  Also, the files have a clear directory structure and filename convention so they can be located and identified easily.  This makes it easy to make another tool to scan thousands or millions of files and extract useful data.

LAB TOOL DETAILS:
1. Inputs 
device under test
part number
unique tracking info (serial number, batch code etc)

2. Settings
measurement setup
frequency range
pass/fail specifications

3. Engine
runs checkers to verify that the measurement is ready and valid
performs a VNA frequency sweep
saves the data using a specific directory and filename
generates a report showing device information, pass/fail results, and plots

LAB TOOL WORKFLOW:
> CLEAR the entries from the previous measurement, in order to reduce the chance of mis-labeled data
> Enter part number and unique tracking info
> Press DATA button, which runs checkers and saves files
> Press REPORT button, which takes the saved data and generates a report
DONE !

EXAMPLE CODE FOR CHECKING THE INPUTS:
Check the inputs, make sure they make sense before spending time on data or files or analysis.

******* Excel Macro **********
pn = Range("B4") ' part number entry
rev = Range("B5") ' revision entry
Label = Range("B12") ' label entry
dataclr = Range("CZ1") ' load dataclear flag

If dataclr = 0 Then  ' check that old information is cleared before saving new data
  MsgBox ("Users must << CLEAR PRODUCT INFO >> before running this command.")
  End  ' if data is not clear, stop the tool immediately
End If

' Error checking, Make sure all the spreadsheet entries are filled
If (StrComp(Range("B4"), "") = 0) Or (StrComp(Range("B4"), " ") = 0) Or (Len(Range("B4")) < 10) Then
  MsgBox ("Please check the  << PART NUMBER >>  entry.")
  flag = 1
End If

If (StrComp(Range("B5"), "") = 0) Or (StrComp(Range("B5"), " ") = 0) Then
  MsgBox ("Please check the  << REVISION >>  entry.")
  flag = 1
End If

If flag Then
  MsgBox ("Some information is missing.  Please check the product number, lot, batch ... entries and re-start the macro.")
  End  ' if the labels don't follow the standard, stop the tool immediately
End If

In order to speed up and simplify the process, the part number points to a look-up table, in a spreadsheet, that loads in all the settings and specifications.  The settings and specifications are updated occasionally for new revisions or to adjust the frequency range of the measurements.  It takes only a few seconds to edit or create a spec.

EXAMPLE CODE TO SETUP THE NETWORK ANALYZER:
******* Excel Macro **********
Dim pna
Dim cset
Dim calsets
Dim myChan
Dim TRL_cal_ID As String
Dim E_cal_ID As String
Dim Filename1 As String
Dim Filename2 As String

Sheets("Test GUI").Select
E_cal_ID = Range("B13") ' get the desired calibration ID from the chart
MsgBox ("ECAL SET:  " + E_cal_ID), OK

'create the Network Analyzer object
Set pna = CreateObject("AgilentPNA835x.Application")
pna.Preset 'clear and reset the equipment to a known state

Set calsets = pna.GetCalManager.calsets ' get the calset collection
Set chan1 = pna.ActiveChannel ' set the active channel

chan1.SelectCalSet E_cal_ID, 1 ' set the calibration ID
chan1.ErrorCorrection = True ' Turn on calibration
Set fixture = chan1.Fixturing
GHz = 1000000000#

StartFrequency = Range("I70") ' get start frequency from the chart
StopFrequency = Range("I71") ' get stop frequency from the chart
NumberofPoints = Range("I72") ' get number of frequency points from the chart

Set measures = pna.Measurements ' create list of measurements
Set win3 = pna.ActiveNAWindow ' create window for plots
Set meas1 = pna.ActiveMeasurement  ' get object for active measurements

chan1.StartFrequency = StartFrequency * 1000000# ' set start frequency
chan1.StopFrequency = StopFrequency * 1000000000# ' set stop frequency
chan1.NumberofPoints = NumberofPoints         ' set number of frequency points
chan1.IFBandwidth = 1000 ' set IF bandwidth

Sync = False                    ' Grab one set of data and pause
chan1.Single Sync
set pna = Nothing ' close the network analyzer object


When the SAVE button button is pressed, the tool goes through a few quick checks before saving data.
The checkers include:
> data entry check - were the results cleared and a valid set of inputs entered?  (part number, production code, batch, and container)
> settings check - is the network analyzer set to the right start and stop frequencies
> continuity check - read S21 and S43 dB at the lowest frequency (typicall 10MHz) and check that the value is at least -3dB
> reflections check single-ended - single-ended reflections S11, S22, S33 and S44 are below -6dB max value over frequency, and they are consistent (within 1dB of each other at the lowest frequency)
> reflection check differential - check the quality of the device attachment to the fixture by checking SDD11 and SDD22 max value (-10dB or better) in the relevant frequency range

EXAMPLE CODE TO CHECK AND SAVE THE DATA:
******* Excel Macro **********
''' DATA CHECKERS
Set pnachk = CreateObject("AgilentPnA835x.application")
Set chanchk = pnachk.ActiveChannel
Set measureschk = pnachk.Measurements
Set measchk = measureschk(5)
s21 = measchk.GetData(2, 1)
Set measchk = measureschk(6)
s43 = measchk.GetData(2, 1)

startfreq = chanchk.StartFrequency
stopfreq = chanchk.StopFrequency

' CHECK CONTINUITY, THAT POINT A IS CONNECTED TO POINT B
If s21(1) < -3 Or s43(1) < -3 Then
    MsgBox (">>> Please check the PORT ORDER and the wire connections. <<< " & vbNewLine & vbNewLine & "(Through paths S21, S43 Fail continuity check.)" & vbNewLine & vbNewLine & "DATA WILL NOT BE SAVED.")
    Set pnachk = Nothing  ' close pna object
    Set chan1chk = Nothing
    Set measureschk = Nothing
    Set measchk = Nothing
    End
End If

' Reflections checkers, if the reflections vary too much across the ports, then the measurement is not accurate
Set measchk = measureschk(1)
s11 = measchk.GetData(2, 1)
Set measchk = measureschk(2)
s22 = measchk.GetData(2, 1)
Set measchk = measureschk(3)
s33 = measchk.GetData(2, 1)
Set measchk = measureschk(4)
s44 = measchk.GetData(2, 1)

mx1 = Application.Max(s11(1), s22(1), s33(1), s44(1))
mn1 = Application.Min(s11(1), s22(1), s33(1), s44(1))

If (mx1 - mn1) > 2 Then
    If MsgBox(">>> Please check the ground connection and signal path. <<<" & vbNewLine & vbNewLine & "(Reflections S11,22,33,44 show too much variation.)" & vbNewLine & vbNewLine & "DO YOU WANT TO FORCE A MEASUREMENT ANYWAY?", vbYesNo, "Confirm") = vbNo Then
        MsgBox ("Data file not saved.")
        Set pnachk = Nothing  ' close pna object
        Set chan1chk = Nothing
        Set measureschk = Nothing
        Set measchk = Nothing
        End ' if checker fails, stop the measurement
    End If
End If

' if the checkers pass, make a measurement sweep and save the data
filepath_s4p = Range("D7") ' get the directory path from chart
filename_s4p = Range("D9") ' get the filename from the chart

fullname_s4p = filepath_s4p & pair_filename
checklen = Len(Dir(fullname_s4p))  ' check if the file already exists
    
If checklen Then
  If MsgBox("S-parameter s4p file already exists. (" & fullname_s4p & "         Do you want to save a new file?", vbYesNo, "Confirm") = vbNo Then
    MsgBox ("S4P file not saved.")
    Range("cz1") = "0"
    End
  End If
End If

Range("D11") = "Measuring... Please Wait"   ' message to user

chanchk.IFBandwidth = 1000
chanchk.Single True ' do a single sweep and stop
Set meas = measureschk(1)
Ports = Array(1, 2, 3, 4) 'List the port numbers desired
meas.WriteSnpFileWithSpecifiedPorts Ports, fullname_s4p 'save s4p file


Set pnachk = Nothing ' close the network analyzer object

If any checker fails, the tool stops and does not save the measurement.
After the checkers pass, the tools saves the .s4p s-parameter file using a specific, standardized naming convention.
When the REPORT button is pressed, the tool grabs the most recent set of .s4p files, and creates a report showing unique tracking info for the device measured, PASS/FAIL results, and relevant plots.
By default, the report requires no edits before publishing. The user may add any custom edits as needed, especially for engineering experiments.
REPORT OUTPUT

BEFORE & AFTER TIMING

Time cost:
BEFORE
Setup measurement: 30 seconds x 8 = 4 minutes
Measure data and save files: 2 minutes x 8 = 16 mins
Extract CSV files and screenshots:         4 minutes x 8 = 32 mins
Copy and paste CSV files and screenshots into report = 15 mins
---------------------------------------------------------------------------
TYPICAL TOTAL TIME = 67 mins

AFTER
Setup measurement: 30 seconds x 8 = 4 minutes
Measure data and save files: 20 seconds x 8 = 160 seconds
Generate report: = 1 minute
---------------------------------------------------------------------------
TYPICAL TOTAL TIME = 8 minutes

After implementing this tool and workflow, lab throughput went from about 400 s4p's per week to about 1000 s4p's.  Another benefit was that the lab tasks became easier, so there was more time and energy for development work in addition to the production work.

It takes a noticeable amount of time to build the first tool, at least a few hours.  It may take longer to build the tool, than to do the task the old way a few times.  However, it pays back time by an order of magnitude each time the tool is used.  It only takes a few uses to pay back the development time, then it starts paying time dividends with every use !

PRODUCTIVITY CHART, BEFORE AND AFTER IMPLEMENTATION OF TOOL

What tools do you wish you had to do your job?
What if you wrote your own tool?

Sunday, October 1, 2017

Are you like Edison or Tesla?




One of the great stories of engineering history is of Edison and Tesla.  Much virtual ink has been spilled in arguing over which was the better engineer, Edison or Tesla.  There's also a popular concept, at least among engineers and nerds, that Tesla was a genius and Edison was an evil villain who stole ideas and oppressed Tesla.  Tesla was forced to leave Edison's company and was never able to financially capitalize on his amazing inventions.  This thesis usually ends with the classic line that "Tesla died penniless and alone."

An interesting part of the story is their differing personalities and engineering styles.  These differences lead to conflict when they worked together and ultimately, they could not get along.
Edison was a great technology visionary and inventor.  He had strong business and communication skills, thus was able to raise money for his businesses and popularize his ideas.  He built a large team to research and development projects; completing thousands of experiments and optimizing a design.  He's the inventor of the light bulb and phonograph, founder of General Electric Corporation, holder of 1,093 patents.  He developed and improved the telephone and telegraph into everyday machines.

Tesla was a brilliant scientist and engineer.  He worked out amazing ideas and plans by himself and had a vision for inventions way ahead of his time.  He invented the AC motor, AC power transmission (the basis for modern power grids), radio, the remote control, hydroelectric power plants.  Some say he predicted solar energy, ocean wave energy, interplanetary communications and electronic satellites.  He was primarily interested in ideas, science and inventions.  He had little interest in business maneuverings to make money from his inventions.


TESLA STUDYING


The central story of Edison and Tesla's conflict is AC vs. DC power; the "War of the Currents."  Edison had developed and invested in a DC power distribution system for his lightbulbs and other electric-powered devices.  For electric motors, Edison favored DC current, which necessitated a long tube of magnets and linear motion for the mechanical power of the motor.  Tesla, while working with Edison, focused on AC power transmission and AC motors.  He postulated that a round structure with AC current was the best choice for motors.  Edison demanded that DC current was the best power system, while Tesla calculated that AC power was far superior for sending electrical energy over long distances.  The two clashed on this projected and ultimately could not work together.  In a few years Tesla joined Westinghouse, and won the war of the currents with AC motors and transformers.  History shows that Tesla was right about motors and power over long distances, and, to be fair, Edison was right that DC power is extremely useful for powering devices.

It is said that after Tesla proved the AC motor concept at Westinghouse, Edison still could have completed development of the AC motor at GE.  But he was too stubborn and continued working on the long, thin DC motor.  Meanwhile, Tesla helped Westinghouse grow into a massive, successful corporation.  Of course, Edison and General Electric found success with many other products and inventions.  So they both did well.

Let's dig into their personalities a bit more.  Edison was an optimizer and a driver.  He took ideas, experimented and improved them until they worked well.  He built a research and development group and pushed them to grind through many interations and make improvements until a product was viable.  He invented, or at least popularized, the modern corporate structure of research and development teams.  Tesla once said if Edison had to find a needle in a haystack, "he would simply pick up each piece of straw till he found the needle." (From Tesla, I assume this was not a compliment.)


EDISON EXPERIMENTING

Tesla was a brilliant scientist and futurist.  He could envision and invent things that few others could see.  His ideas were big and disruptive.  He was opinionated and eccentric.  He often worked alone with minimal notes, similar to the stereotype of a mad scientist.  With the aforementioned needle in a haystack problem, Tesla would likely think about it for weeks, and spend lots of money building equipment.  Then he would turn on the giant magnetic that he built, and instantly pull the needle out of the haystack.

Let's summarize their personality traits.

EDISON CHARACTERISTICS
What's good?
Optimizer, driver, build a team, make a product, make profit, persevere, able to persuade others to see his vision

What's bad?
Aggressive to make himself look bad and others look bad, stubborn, slow to admit he's wrong

TESLA CHARACTERISTICS
What's good?
brillant engineer and futurist, generator of big, disruptive ideas, technically correct most of the time

What's bad?
struggled to turn inventions into practical products, unwilling/unable to communicate his ideas to others, was not good at working in teams

So, which one do you identify with the most?  Which one do you wish you were more like?  How can we learn from each of them?

Imagine if Edison and Tesla found a way to work together well?  They could have built Edison-Tesla Corp; the combination of GE, Westinghouse and Motorola all rolled into one company.  Imagine if Edison supported Tesla's AC motor idea and pursued it when the concept was proven?  Imagine if Edison was a little more flexible with Tesla and allowed him to explore more of his ideas.  Imagine if Tesla was able to communicate the AC motor idea in a way that Edison could understand? Imagine if Tesla was able to make some explanations or side experiments, just to help Edison see the value of the AC motor?

If Edison and Tesla had found a way to work together, they could have built Tesla cars 100 years before Elon Musk !