pyconkr 20150627_simulation_on_optical_image_stabilizer_using_python
TRANSCRIPT
Simulation on Optical Image Stabilizer using Python
부제 : control library로 바로 해보는 system simulation
HyungKwan Kim
Today’s presenter is
• 김형관 주임
• LG Innotek (12’ 4~ 현재)
• Mobile OIS Camera 개발자
• G4/G3/G2/G-Flex2/Nexus5 (OIS engineering)
• MS in EE (Computer Vision, ITS)
© 2015 HyungKwan Kim
contents
• What is the Optical Image Stabilizer(OIS)?
• Motivation – Why? and Why Python?
• Library for System Simulation in Python
• Transfer Function & Bode Plot
• Generate Filters, PID, Time Delay
• Make Serial/Parallel/Feedback Connections
• Modelling Gyro & Actuator
• Let the system make “response”
• Measure the performance(Gain Cal., Trace Error)
• Usage of the simulation @ work
시스템 설계에 필요한 기본 요소 세팅
한땀, 한땀 이어서 시스템으로 완성
평가 및 활용
OIS 갂단한 설명
© 2015 HyungKwan Kim
What is the Optical Image Stabilizer?
이미지 센서
렌즈
손떨림에 의한 광경로 변동
밀린 stroke만큼 Lens를 Shift시켜
떨림을 보정
흔들린 사진(떨림각:2도) 삼각대 촬영(무진동) © 2015 HyungKwan Kim
What is the Optical Image Stabilizer?
렌즈
홀센서 Y-axis
홀센
서 X
-axis
자이로 드라이버 컨트롤러
이미지 센서
• Very basic feedback system using Gyro, Hall, Actuator.
• Simple but enough to practice a closed-loop simulation
© 2015 HyungKwan Kim
Motivation – Why Simulation?
• Closed-loop System Quality Control
현 Actuator Spec. 하에 안정성이 충분히 확보되는가? *
Step Response에 의한 정상상태 도달은 충분히 빠른가?
Gyro 열특성상, 품질 마짂은 얼마나 두어야 하는가?
• 샘플 제작 없이, 다양한 조합, 다양한 조건의 모듈 성능 검토 필요
A사 컨트롤러는 B사에 비해 추종오차가 얼마나 적을것인가? *
가격이 저렴한 A사의 Gyro의 노이즈는 성능에 영향을 줄 정도로 유의한가?
• Analystic Industrial Inspection
PCB 실장시 발생하는 SMT Rotation Angle은 얼마나 허용되는가?
Calibration 장비 정확도는 최소 얼마이상 확보되야 하는가?
• User에게 실제 의미가 있는 Spec. 정립 필요
성능이 얼마나 나와야 체감할 수 있을까?
감성평가가 가능한 이미지를 생성할 수 없을까? *
*표시 항목은 후반부에 결과 공유
© 2015 HyungKwan Kim
Motivation – Why Python?
• It is free
M사의 프로그램도 좋지만… 돈도 돈이고 사내 구입 프로세스도 번거롭죠
각 Filter들을 Fully Customize가능하고, Fully Open된 홖경이 더 끌렸습니다.
• and easy to write code, easy to debug
출근길에 떠오른 idea를 퇴근 젂에 확인해 볼 수 있다는 점
C로는 쉽지 않죠?
• and even effective to debug one’s thought
컴파일 없는 즉각적인 실행, 시각화.
사고의 흐름을 놓치지 않게 하고, 잘못된 직관은 금방 바로 잡고.
© 2015 HyungKwan Kim
Block Diagram of OIS
Gyro HPF/LPF
Servo Filter (PID)
Sine Wave
Gyro Phase Delay
Actuator (cmk
model)
Gyro Gain
Servo Gain
Integrator dps->deg.
Hall Filter
+ -
© 2015 HyungKwan Kim
Library for System Simulation in Python
• Control Systems Library for Python (Murray, Caltech)
젂달 함수를 이용한 시스템 시뮬레이션
직렬, 병렬, 피드백 커넥션 함수 제공
Time Response(Impulse, Step 등) 계산 가능
Documentation도 충실하며, 지속적인 업데이트
• Getting Started
1. http://sf.net/projects/python-control/files lib 다운로드
2. python setup.py install
3. source code 상에서 import
© 2015 HyungKwan Kim
Make Transfer Function & Bode Plot • General Form of Transfer Function
• Make Instance of Transfer Function F = control.tf([1, a0, a1, … , an], [1, b0, b1, … , bn])
• Make Bode Plot plt.figure() control.bode_plot(tf, freq_range)
𝑠𝑛 + 𝑎0 ∗ 𝑠𝑛−1 + ⋯ + 𝑎𝑛
𝑠𝑛 + 𝑏0 ∗ 𝑠𝑛−1 + ⋯ + 𝑏𝑛
• Transfer Function of HPF
• Make Transfer Function of HPF(10Hz)
• Make Bode Plot
𝐺 𝑠 = 𝑠 + 1
𝑠 + 𝑓
© 2015 HyungKwan Kim
Block Diagram of OIS
Gyro HPF/LPF
Servo Filter (PID)
Sine Wave
Gyro Phase Delay
Actuator (cmk
model)
Gyro Gain
Servo Gain
Integrator dps->deg.
Hall Filter
+ -
© 2015 HyungKwan Kim
Generate Filters, PID, Time Delay LPF
(Low Pass Filter)
𝐺 𝑠 =
1
𝑠 + 𝑓𝑐 𝐺 𝑠 =
𝑠 + 𝑓𝑙
𝑠 + 𝑓ℎ 𝐺 𝑠 =
𝑠 + 𝑓ℎ
𝑠 + 𝑓𝑙
𝐺 𝑠 = 𝑠2 +
𝐴𝑄
𝑓𝑝𝑠 + 𝑓𝑝2
𝑠2 +1
𝐴𝑄𝑓𝑝𝑠 + 𝑓𝑝
2
LBF (Low Boost Filter)
HBF (High Boost Filter)
PKF (Peaking Filter)
P (Proportional)
I (Integrator)
D (Derivate)
𝐺 𝑠 = 𝐺𝑎𝑖𝑛
0 ∙ 𝑠 + 1 𝐺 𝑠 =
1
𝑠 𝐺 𝑠 = 𝑠
HPF (High Pass Filter)
𝐺 𝑠 =
𝑠 + 1
𝑠 + 𝑓𝑐
© 2015 HyungKwan Kim
Block Diagram of OIS
Gyro HPF/LPF
Servo Filter (PID)
Sine Wave
Gyro Phase Delay
Actuator (cmk
model)
Gyro Gain
Servo Gain
Integrator dps->deg.
Hall Filter
+ -
© 2015 HyungKwan Kim
• Make the transfer function of time delay
𝑠𝑛 + 𝑎0 ∗ 𝑠𝑛−1 + ⋯ + 𝑎𝑛
𝑠𝑛 + 𝑏0 ∗ 𝑠𝑛−1 + ⋯ + 𝑏𝑛
Generate Filters, PID, Time Delay
N-deg. Pade estimation
(−1.0)𝑠 + 2.0
(1.0)𝑠 + 2.0 𝑒− 1.0 𝑠
𝑒−𝑡𝑠
© 2015 HyungKwan Kim
Block Diagram of OIS
Gyro HPF/LPF
Servo Filter (PID)
Sine Wave
Gyro Phase Delay
Actuator (cmk
model)
Gyro Gain
Servo Gain
Integrator dps->deg.
Hall Filter
+ -
© 2015 HyungKwan Kim
w/ white noise w/ ZRO Shift
• Generate Wave Choose the frequency that simulates hand shaking
• Add Degrading Factors Sensitivity shift over temperature Zero rate offset shift over static noise ( sqrt/root(Hz) )
2Hz 6Hz 10Hz
Modelling Gyro
w/ Sensitivity Change © 2015 HyungKwan Kim
Modelling Actuator • Spring-Damper Model (c-m-k model)
• Add Degrading Factors
𝐺 𝑠 =𝑤𝑛
2
𝑠2 + 2 ∗ 𝑡𝑎𝑢 ∗ 𝑠 + 𝑤𝑛2
Figure from http://ocw.mit.edu Freq(wn)=60, ampQ1(1/(2tau))=30db
Q1 amp-range variation Add harmonics Q1 f-range variation
© 2015 HyungKwan Kim
Block Diagram of OIS
Gyro HPF/LPF
Servo Filter (PID)
Sine Wave
Gyro Phase Delay
Actuator (cmk
model)
Gyro Gain
Servo Gain
Integrator dps->deg.
Hall Filter
+
-
System Of
Single Transfer Function
© 2015 HyungKwan Kim
Make Serial/Parallel/feedback connections
From http://www.cds.caltech.edu/~murray/books/AM05/pdf/am06-xferfcns_16Sep06.pdf, Chapter 8. Transfer Functions, p. 253,
Gain + LPF = HBF꼴, 역시 제대로 표현 됨.
Make Serial/Parallel/feedback connections
Serial Connection
Parallel Connection
= G G2 HPF
G1 HBF
= G
G2 Gain
G1 LPF
HBF x HPF 이며, 곱셈에 따라서 Gain 수렴 지점 두 곳이 제대로 표현 됨.
© 2015 HyungKwan Kim
Make Serial/Parallel/feedback connections
feedback Connection = G
G1 HPF
G2 HBF
+ -
© 2015 HyungKwan Kim
Block Diagram of OIS
System Total
Transfer Function
Gyro HPF/LPF
P I D
Sine Wave
Gyro Phase Delay
Actuator (cmk
model)
Gyro Gain
Servo Gain
Integrator dps->deg.
Hall Filter
+
-
Servo Total
Transfer Function
Gyro Total
Transfer Function
Hall Filter
+
-
By Serial, Parallel
Connection
By Feedback
Connection
© 2015 HyungKwan Kim
Let the system make “response”
LPF( 𝒇𝒄 : 6Hz)
HPF(𝒇𝒄 : 6Hz)
INPUT SINWAVE
2Hz 6Hz 10Hz
© 2015 HyungKwan Kim
Measure the performance (Gain Cal., Trace Error) • Gain Calibration
(minimize the gap between Input sinwave & output lens position
• Trace error OIS 성능(dB) 홖산
Gain:0.18 Gain:0.20 Gain:0.22
Input(Hand Shake) & Output(Lens Position)
Trace Error (Hand Shake
–Lens Position)
OIS 성능(=20*log10(hand_shake
/trace_error))
© 2015 HyungKwan Kim
Usage#2 – controller chip maker별 OIS성능 비교
Minimal Performance 23.0 dB
A사
B사 Minimal Performance 14.8 dB
© 2015 HyungKwan Kim
Usage#3 - 시뮬레이션 된 OIS 성능을 화상으로 확인
OIS Off OIS ON Grade B
OIS ON Grade A
Very useful when to decide “Target Spec.”
© 2015 HyungKwan Kim
Usage#3 - 시뮬레이션 된 OIS 성능을 화상으로 확인
Overlaping images cropped with the offset of trace-error during pre-set exposure time
Trace error overlaping
offset
© 2015 HyungKwan Kim
transfer functions, coefficients on this presentation are not necessirily reflecting the real characteristics of the product for confidential reason.
© 2015 HyungKwan Kim