lect 11: hybrid system modeling and simulation
TRANSCRIPT
Lect 11: Hybrid System Modeling and Simulation
2 of 31
© 2014 Tag Gon Kim
EE612: Lect. 11 Hybrid System M&S
Hybrid (combined) Modeling Framework
Systems Taxonomy: State vs observation time CS, SDS, DS, DES
Combination of more than two systems in different types listed above
To specify different level of abstraction
Most common in EE: CS (analog) + DS (digital) system
Required is interface between different type (eg. ADC or DAC)
Top-down design/step-wise refinement
Hybrid System in combination of DES + CS
DES Specification of what to do high level behavior of system
CS Specification of how to do lower level detailed behavior
Interface between two
E/A converter: event-to-analog converter
A/E converter: analogy-to-event converter
Application of DES+CS hybrid system
Electro-Mechanical System (CS: Mechanical; DES: Electronics)
Hybrid Control System (CS: PID Controller; DES: Planning/scheduling)
Manufacturing System (CS: Machines; DES: Scheduler)
Mixed Mode Circuit (CS: Analog Circuit; DES: Digital Circuit)
Defense Modeling (CS: Engineering(H/W) Model, DES: Engagement(Process) Model)
Hybrid System Modeling
참고 문헌
JD-18(2001)
JD-19(2001)
CF-70(2001)
© 2014 Tag Gon Kim
3 of 31
EE612: Lect. 11 Hybrid System M&S
Continuous System
Modeling: Differential Equation
Simulation Method: Numerical Analysis with uniform/non-uniform time steps
Representative M&S Tool: MATLAB
Discrete Event System
Modeling: DEVS Equation
Simulation Method: Event scheduling with time advances in a random interval
Representative M&S Tool: DEVSim++
dQ/dt = f(Q, X) = AQ + BX Y = g(Q, X) = CQ + DX
Co
nti
nu
ou
s S
yst
em
Dis
cre
te E
ven
t
Syst
em
Input State Output System Model
Differential Equation
DEVS Equation
q’ = dint(q) dext (q, x )
y = l(q)
time(t)
state(Q)
t
X(t) Y(t)
t
time(t)
state( Q)
t
Xe Ye
t
x3 x2 x3 x4 x5
e1 e2 ek
s1
s2
sk
y2 y4 y3
Simulator
Equation Solver
(eg: MATLAB)
Execution algorithm
for DEVS model
(eg: DEVSim++)
Systems M&S: Continuous vs Discrete Event System
© 2014 Tag Gon Kim
4 of 31
EE612: Lect. 11 Hybrid System M&S
(I) Combined one Formalism (II) Two Formalisms
State Transition
Function
Output Function
Discrete
OUTPUT
Continuous
OUTPUT
Discrete
INPUT
Continuous
INPUT
disc contS S
Discrete
OUTPUT
Continuous
OUTPUT
Discrete
INPUT
Continuous
INPUT
DES
Model
Conti.
Model
E/S S/E
Feature
No use of existing M&S Tools
and Models Use of existing M&S Tools and Model Reuse
New M&S Tools Required Existing M&S Tools
New M&S Theory Existing M&S Theory and Interface Theory
Hybrid M&S Methods
5 of 31
© 2014 Tag Gon Kim
EE612: Lect. 11 Hybrid System M&S
DEVSim++ Engine MATLAB Engine
DEVS Models Differential
Equations
MATLAB DEVSim++
HLA/RTI
HLA/RTI Based Distributed Simulation Environment
KHLAAdaptor KHLAAdaptor
© 2014 Tag Gon Kim
6 of 31
EE612: Lect. 11 Hybrid System M&S
PlusSim Architecture for Hybrid System M&S
Use of existing continuous and discrete event M&S Tools
Distributed simulation using well-defined I/F between CS and DES
Pug-and-Play for both CS and DES in a Single Processor Environment
MATLAB Engine
Differential Equations
MATLAB
DEVSim++ Engine
DEVS Model
DEVSim++
PlugSim
Interface Interface
Time synchronization
Data Exchange
DES M&S Env. CS M&S Env.
Interoperation
Object Model
(IOM)
PlugSim Based Centralized Simulation Environment
Process Communication
Using shared memory
Or TCP
참고 문헌
CF-112(2011)
© 2014 Tag Gon Kim
7 of 31
EE612: Lect. 11 Hybrid System M&S
IOM
Input/Output Data Declaration for Models to be plugged in
Data Mapping Table for Interface in Hybrid Simulation
Use of a pre-define template
Plug-in CS/DES simulators
DEVS Model MATLAB Model
Interface Interface Data1
Data1
Data2
Data3
Data2
Data3
IOM
Name of Data From To
Data1 DEVS MATLAB
Data2 MATLAB DEVS
Data3 MATLAB DEVS
Time Synch Data Exchange PlugSim
Interoperation Object Model (IOM)
8 of 31
© 2014 Tag Gon Kim EE612: Lect. 11 Hybrid System M&S
Issues in hybrid simulation engine
Data exchange S/E, E/S conversion function
Data type mismatch needs type conversion
How do we convert the mismatched data?
Time synchronization Presimulation
Time advance needs the minimum next simulation time between CS and DES models
How do we know the minimum?
output : Event
output: Signal(time function)
input: Signal(time function)
Discrete Event
Model Continuous Model
Hybrid Model
input : Event
I/O Type Mismatch between CS and DES
9 of 31
© 2014 Tag Gon Kim
EE612: Lect. 11 Hybrid System M&S
Interface Between CS and DES: Conversion Function
2:SEf
:ESg
ESSE gfcf ,
: Event-to-(Analog)Signal conversion function (E/S Converter)
: (Analog)Signal-to-Event conversion function (S/E Converter)
gES CS DES
t1
e4
t t3
e2
t2 t1 t3 t4
e1
e3 e2
e6
t t2 t1 t4 t3 t
fSE CS DES
t2 t1 t3 t4 t
Conversion Function: cf
Transformation between Analog and Event
∑: a set of events (input and output of DES)
Ω: a set of time segmented functions (input and output of CS in time interval)
© 2014 Tag Gon Kim
10 of 31
EE612: Lect. 11 Hybrid System M&S
Next Time Schedule in Hybrid Simulation
DES Model CS Model
Next event time
(known from model)
Next event time
(No knowledge before
Execution of CS model)
Pre-Simulation
Identification of
a next event
time in CS model
Next event time
(computed from simulation of CS model)
Time synch module
- Find the minimum
event time between
the two
- Execution of one
with the minimum
Time synch algorithm
© 2014 Tag Gon Kim
11 of 31
EE612: Lect. 11 Hybrid System M&S
Time advance for hybrid simulation
tN = min{tNcs, tNDES}, tNcs is computed by pre-simulation
Pre-Simulation: Identification of a next event time in CS
Time Synch by Pre-Simulation (1/2)
DES DES
CS CS
Sdisc Sdisc
Scont Scont
t
t t
t
Scheduler Scheduler
tNDES tNDES
t2
tNDES t2
threshold
tNDES
© 2014 Tag Gon Kim
12 of 31
EE612: Lect. 11 Hybrid System M&S
Time synch by Pre-Simulation (2/2)
DES Model PlugSim CS Model
time advance request (tN, done)
time adv. grant (*, tN)
time advance request(tN1, done)
Output
Pre-Simulation(tN)
tN
Pre-Simulation(tN1)
tN1
No output(tN)
Output(t2)
13 of 31
© 2014 Tag Gon Kim
EE612: Lect. 11 Hybrid System M&S
Example 1 using HLA/RTI: Target Tracking System (TTS)
missile
HDM
environment
controller
CCM
missile position event
target
fSE
gES
hitting event
DAM
HM
HDM: High level Decision Model
14 of 31
© 2014 Tag Gon Kim
EE612: Lect. 11 Hybrid System M&S
Example 1: CS(CCM) Model of TTS Using MATLAB
Controller Model:
control equations
max
0
ff
f
y
x
mg
mgf
f
f
y
x22
max )(
mgvszk
vszk
f
f
yyyy
xxxx
y
x
)(
)(
g
f
f
m
m
v
v
s
s
m
km
k
v
v
s
s
y
x
y
x
y
x
y
x
y
x
0
0
0
10
01
00
00
000
000
1000
0100
20
10
50
0
0
0
0
0
y
x
y
x
v
v
s
s
Missile model: missile kinetic behavior equations
15 of 31
© 2014 Tag Gon Kim
EE612: Lect. 11 Hybrid System M&S
Example1: Simulation Result
Processor 1:
DEVSim++
RTI Exec Processor 2:
MATLAB
Missile
Position
Trajectory
16 of 31
© 2014 Tag Gon Kim
EE612: Lect. 11 Hybrid System M&S
Example 2 using HLA/RTI : Mobile Robot System (MRS) W
landmark
Human
Operator Joystick
Environments Mobile
Robot
x, y, Φ
landmarks
message vd, wd
handling
events
fSE
gES
DES CS
fx, fy
landmarks
events
17 of 31
© 2014 Tag Gon Kim
EE612: Lect. 11 Hybrid System M&S
Example 2: Continuous System in MRS
PID
Controller Motors
PWS
kinematics
Vehicle
kinematics
Inverse
PWS
Kinematics
u1
u2
v w
θd1
Continuous Systems
vd, wd
x, y, Φ
θd2
θ1
θ2
Joystick fx, fy
18 of 31
© 2014 Tag Gon Kim
EE612: Lect. 11 Hybrid System M&S
Example 2: MATLAB Model of CS in MRS
Joystick
Two Motors
19 of 31
© 2014 Tag Gon Kim
EE612: Lect. 11 Hybrid System M&S
Example 2: Environment of landmarks points
W
landmarks
right turn point
crossroad point
point
straight point
end point
straight point
straight point
left turn point
20 of 31
© 2014 Tag Gon Kim
EE612: Lect. 11 Hybrid System M&S
Example 2: Simulation of MRS
W
right turn point crossroad point
straight point
end point
straight point
straight point
left turn point
21 of 31
© 2014 Tag Gon Kim
EE612: Lect. 11 Hybrid System M&S
어뢰 탐색
회피 기동
어뢰 발사
투하 후
탐색
Example 3 using PlugSim: AntiTorpedo Simulation
22 of 31
© 2014 Tag Gon Kim
EE612: Lect. 11 Hybrid System M&S
Simulation
Result
Plug-in Simulator
• change of dynamics of torpedo
Example 3: AntiTorpedo Model
Discrete Event System (DEVS Model)
Continuous System (MATLAB + Algorithm)
23 of 31
© 2014 Tag Gon Kim
EE612: Lect. 11 Hybrid System M&S
Example 3: Simulation Result of AntiTorpedo Model
© 2014 Tag Gon Kim
24 of 31
EE612: Lect. 11 Hybrid System M&S
PlugSim
Interoperation Environment for A Single Computer Environment
Case Study 목적
이산 사건 모델과 연속 모델을 이용한 하이브리드 시뮬레이션 실험
Example 4 using PlugSim : 시나리오 (1/ 2)
표적 확인
표적 탐지/획득
발사통제
표적 요격
임무 종료
아군 함정
목표 진지
Alarm1
: Missile 속도(빠르게)
조절
Alarm2
: Missile 속도(느리게)
조절
© 2014 Tag Gon Kim
25 of 31
EE612: Lect. 11 Hybrid System M&S
Example 4: 시나리오 (2/ 2)
Case Study 상세 시나리오
아군 함정이 (100,100,0)에서 목표(0,0,0)를 향해서 이동
아군 함정의 탐지 거리 (35.5km) 이내에 적군이 탐지 되면 Missile 발사
Missile은 3차원 운동 방정식을 이용해 포물선 형태로 목표를 향해 접근
Missile 모델은 목표와의 거리를 판단하여 특정 조건이 만족 되면(물체와의 거리) 경보(Alrarm)를 울려 Missile Control 모델에게 알려 Missile 속도를 제어
Alarm1(원거리) : Missile의 속도 증가
Alarm2(근거리) : Missile의 속도 감소
미사일이 목표에 근접하면 명중 판단 이후, 시뮬레이션 종료
하이브리드 모델
Missile 모델(연속 모델) + 전함 모델(이산 사건 모델)로 구성
하이브리드 시뮬레이션 환경
PlugSim기반의 하이브리드 시뮬레이션 환경
© 2014 Tag Gon Kim
26 of 31
EE612: Lect. 11 Hybrid System M&S
Example 4: 연속 시스템 모델 설계
Missile 모델 (연속 모델)
Missile의 운동 모델을 3차원 방정식으로 표현
MATLAB/SIMULINK를 이용하여 구현
Missile의 3차원 운동 방정식을
MATLAB/Simulink로 구현
© 2014 Tag Gon Kim
27 of 31
EE612: Lect. 11 Hybrid System M&S
Example 4: 이산사건 시스템 모델 설계 (1/5)
전함 모델 – Coupled Model (DEVS)
alarm1
alarm2
Destroy
Adjust
C2 Model
Missile Control Model
Maneuver Model
Detect Model
alarm1
alarm2
Destroy
Detected
Adjust
Adjust
Position
Destroy
Destroy
© 2014 Tag Gon Kim
28 of 31
EE612: Lect. 11 Hybrid System M&S
C2 모델 – Atomic model
내,외부 전황 상황을 판단해 전함 제어
Example 4: 이산사건 시스템 모델 (2/5)
alarm1
alarm2
Destroy
adjust
WAIT @Infinity
COMMAND @tc
?alarm1 || ?alarm2 || ?detected
!adjust
?Destroy
Detected
Destroyed @0
!destroy
destroy
© 2014 Tag Gon Kim
29 of 31
EE612: Lect. 11 Hybrid System M&S
Example 4: 하이브리드 시뮬레이션 구조
Warship Model
(DEVS 모델)
Missile Model
(MATLAB 모델)
PlugSim
하이브리드 시뮬레이션 구조
PlugSim : 하이브리드 시뮬레이션의 데이터 교환 및 시간 동기화
Interface Interface adjust
adjust
alarm1
alarm2
destroy
alarm1
alarm2
destroy
공유 객체
모델
데이터 이름 데이터 타입 From To
adjust double, double, double Warship Missile
alarm1 Event Missile Warship
alarm2 Event Missile Warship
destroy Event Missile Warship
모델들의 IOM 참조
IOM
© 2014 Tag Gon Kim
30 of 31
EE612: Lect. 11 Hybrid System M&S
Example 4: S/E, E/S 변환기
Warship Model
(DEVS 모델)
Missile Model
(MATLAB 모델)
Interface Interface
ZPos
XPos t
Adjust
(Detect)
Alarm1
:ESg
E/S Converter
2:SEf
S/E Converter
Adjust
(Alarm1)
Alarm2
Adjust
(Alarm2)
Destroy
Alarm1
Alarm2
Destroy
© 2014 Tag Gon Kim
31 of 31
EE612: Lect. 11 Hybrid System M&S
Example 4: 시뮬레이션 결과
하이브리드 시뮬레이션 결과 비교
하이브리드 시뮬레이션을 통해서 이산사건 모델에서 연속 시스템의 제어 가능
연속 모델의 이산사건 기반 제어는 Run-time 에서 연속 모델(Missile Model)이 일정한
조건(ex. 거리, 환경변수 값)을 만족하면 이산사건 모델(Missile Control Model)에 보고.
보고를 받은 이산사건 모델은 미사일 운동방정식(파라미터) 변경을 명령 함
새로운 형태의 무기체계 개발을 위한 M&S 기술
< Missile Control Model이 있는 경우> < Missile Control Model이 없는 경우>
Alarm1 : 거리 22km
Alarm2 : 거리 3km
연속시스템의 이벤트
식별 지점
하이브리드 모델 시뮬레이션 연속 시간 모델 시뮬레이션