automating the lee model. major components simulator code –verifying outputs –verifying model...
Post on 20-Jan-2016
214 Views
Preview:
TRANSCRIPT
Automating the Lee Model
Major Components
• Simulator code– Verifying outputs– Verifying model equations– Graphical User interface
• Auto-tuning the model parameters– Simple pre-processing of trace data– Optimization of fit of current curves– Tuning of genetic algorithm code
Simulator Code
• Rebuilding the simulation code– Port Excel VBA to C#– Object Oriented Design
• 5 models – Corona, Axial, Radial, Radial RS, Radiative, Expanded Axial
• Provide for future modifications
– Runs in < 1sec– Export results to Excel – Graphical interface
• Ease of use to run with new parameters and view results• Advanced graphing• Predefined tuned models
Object Oriented Design
MeasuredCurrent
Axial Model Radial ModelExpandedColumn
ModelReflectedShock
ModelRadiative
Model
Metrics Simulator
ConfigPanel ResultsPanelGAConfigPanel TuningPanel GaphsPanel
AutoFit
GAFit
GA
ParametersIniFileConfigIniFile
IniFile
Views (GUI)
Lee Model
CoronaModel
Setup
PlasmaFocusMachine
ModelResults
Constants
1
1
MainForm
1
1
1
Fitting
ZedGraphLibrary
Base
Chromosome
Graphical output
NEW EXISTING
Machine Configuration
Simulation Results
Detailed Graphs
Auto-tuning problem
• Defining what is a good-fit– Formulating a numerical problem– Coefficient of determination, R2 (inadequate)– Other visual cues of good fit
• Finding the model parameters that “fits”– Optimization search algorithm
• Local maxima problem• Genetic algorithm
Goodness of fit
• R2 definition
R2 = 1- SSreg / SStot
whereSSreg = Sum (Imeas- Icomp )2
i.e. sum of errors
squared
SStot = Sum ( I - Imean)2 normalization factor
• Curve features– Peak– Slope– End of radial phase
Peak
End of Radial Phase
Slope of radial phase
Locating features on current trace
• Peak – easy
• End of radial phase– Take 2nd difference– Take maximum difference as the point
• Slope– Calculate slope from end of pinch to mid-
radial phase
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
-0.5 0 0.5 1 1.5 2
Series1
Most linear portionfrom mid slope to end
Fitness Function• Fitness, R2’
R2’ = w1 * R2 + w2 * ME + w3 * PE + w4 * SEw1, w2, w3, w4 are weights,w1 = 1w3 = peak current / (peak current – pinch current) w4 = 2 * w3w2 = 1.2 * w4
• ME is the maximum current errors (peaks), ME = (1 - ME1) + (1 - ME2)
ME1 = computed peak current – measured peak current measured peak current – measured pinch current
ME2 = computed peak time – measured peak time measured peak time – measured pinch time
• PE is similarly calculated.• The radial slope error is calculated as follows:-
SE = 1 - computed peak current – mid-radial current pinch time – mid-radial time
Genetic AlgorithmCreate Population
of sets of parameters
(genes)
Rank the Population using Fitness function
Save the best gene (set with
best fit)
Generate new population using
mutation and crossover
Add best gene from previous pop
Add a narrorw cluster of genes to
new population
• Create population
• Rank using fitness function
• Select parents for new population
• Create new population using – Mutation– Crossover
• Add fittest genes from last pop
GA Concepts
– Population– Chromosome– Genes– Mutation – Cross-over– Elitism
Optimization strategy
massf, currf, massfr, currfr
massf, currf
Fit Axial Phase by maximizing r2
using massf, currf
Fit Radial Phase by maximizing r2
using massfr, currfr
Fit overall curve by maximizing r2
using all 4 parameters
massf, currf
massfr, currfr
Initial Guess
Find the graph features to fit
using the second order difference
Pre-process measured data
• Preprocess measured current
• Local optimization stages– Axial for fitness F( massf, currf)– Radial for fitness F( massfr, currfr)
• Global optimization stage– Whole model for fitness F( massf, currf,
massfr, currfr)
• Repeat above as “stages”
Results
00.10.20.30.40.50.60.70.80.9
1
Tunin
g R0
stage
Tunin
g R0
stage
Final s
tage
Final s
tage
Final s
tage
Tunin
g R0
stage
Tunin
g R0
stage
Final s
tage
Final s
tage
Final s
tage
massf
currf
massfr
currfr
fitness
0
0.2
0.4
0.6
0.8
1
1.2
Tunin
g R0
stage
Tunin
g R0
stage
Tunin
g R0
stage
Tunin
g R0
stage
Tunin
g R0
stage
Tunin
g R0
stage
Final s
tage
Final s
tage
Final s
tage
Final s
tage
Final s
tage
Final s
tage
Final s
tage
Final s
tage
Final s
tage
massf
currf
massfr
currfr
f itness
top related