c/c++ based simulation techniquesc3%d6%c7%f6... · 2012-03-20 · e1-data path of ap upper layer...
TRANSCRIPT
II
IIII
IIIIII
IVIV
네트워크 시뮬레이션 개요
4 KRnet 2008
Presentation OverviewPresentation Overview
목적– 이동통신시스템의 시스템 레벨 시뮬레이션 및 알고리즘 시뮬레이션을 위한 방법론 및
기본 C/C++ 테크닉 소개
대상– 이동통신시스템의 SW 구현을 원하는 자– 이동통신시스템의 시스템 레벨 시뮬레이션을 원하는 자– 제안한 통신 알고리즘의 시뮬레이션을 원하는 자– 시뮬레이션에 필요한 기본 C/C++ 테크닉의 습득을 원하는 자
소개 내용– 시뮬레이션의 개요
• 이동통신 시스템 개요• 시뮬레이션 과정
– C/C++ 기반 시뮬레이션 방법론• 시스템 설계 방법론• C/C++ 시뮬레이션 테크닉
– C/C++ 기반 시뮬레이션 예제• HiperLAN Type2 MAC protocol simulation• WiBro System level simulation
– 시뮬레이션 툴 소개• SDL
5 KRnet 2008
Why Simulation…?Why Simulation…?
High complexityHardware-dependent Hard to understand
Systems Algorithms
Simulation(Modeling & SW 구현)
Conceptually simpleSoftware-orientedReusable
1. Performance Analysis 2. Behavioral Analysis3. Test-bed Development
• Objectives: Numerical Analysis와비교HW 구현전테스트, 리스크감소시스템최적화
• Modeling/Simulation Tools: 1. CHILL, SDL, ObjectTime (Modeling language)2. C/C++, MATLAB (Numerical tool 제공)3. Network Simulator (NS-2, OPNET, etc.)
• Signal Processing• Medium Access Control• Network• Artificial Intelligence
• Communication• Network• Economy• …
6 KRnet 2008
Communication ProtocolCommunication Protocol
OSI model
- Traffic modeling (HTTP, FTP, Voice, Video)Network process to application
Data
7. Application
- MAC protocol- Random access control algorithm- Scheduling algorithm, etc.
Physical addressing (MAC & LLC)
Frame 2. Data link
- Channel modeling- Link level simulation- Signal processing algorithm, etc.
Media, signal and binary transmission
Bit1. Physical
- IP packet modeling- Routing algorithm- Congestion control algorithm
Path determination and logical addressing (IP)
Packet 3. Network
- Connection management- TCP/UDP modeling- TCP algorithm
End-to-end connections and reliability (TCP)
Segment/Datagram
4. Transport
- Session SynchronizationInterhostcommunication
5. Session
- Security Control- Meta data format
Data representation and encryption
6. Presentation
SimulationFunctionData unitLayer
7 KRnet 2008
Communication AlgorithmCommunication Algorithm
Net
wor
kPh
ysic
alD
ata
link
Radio Resource Management(CAC, Res Alloc.)
Scheduling (RR, PF, QoS)
Medium Access Control(Random access control)
Modem
Duplexing
Multiple Antenna (Diversity, Multiplexing, BF,
Multiuser diversity)
Multiple Access (xDMA)
Channel Equalization
Channel Estimation
Interference Cancellation
Synchronization
Multiuser Detection
Channel Coding
ARQ
QoS mapper/classifier
Handover Algorithm
Sleep/Idle mode
Handover Signaling
Mobility Management(Registration, Mobile IP, etc.)
AAA
Security
Basic Algorithms & Functions
Algorithmentity
Functionalentity
8 KRnet 2008
Communication PathCommunication Path
9 KRnet 2008
Wireless Channel (1)Wireless Channel (1)
Object– Receiver에서 SINR (Signal-to-noise-and-interference ratio)를 알고자 함
Link budget– PRX = PTX + GTX - LTX - LFS - LM + GRX – LRX
• PRX = received power (dBm) • PTX = transmitter output power (dBm) • GTX = transmitter antenna gain (dBi)• LTX = transmitter losses (coax, connectors...) (dB) • LFS = free space loss or path loss (dB)• LM = miscellaneous losses (fading margin, body loss, polarization mismatch,
other losses...) (dB)• GRX = receiver antenna gain (dBi)• LRX = receiver losses (coax, connectors...) (dB)
Transmitter Receiver
10 KRnet 2008
Wireless Channel (2)Wireless Channel (2)
Path loss– LFS = 10n log(d) [dB]
• n: path loss exponent• d: distance
Fading margin– Long-term fading (Shadowing)
• log-normal distribution
– Short-term fading• Rayleigh distribution: outdoor, 다중 반사파가 직접파보다 셀 때
• Rician distribution: indoor, 다중 반사파보다 직접파의 세기가 강할때
⎥⎥⎦
⎤
⎢⎢⎣
⎡ −−= 2
2
2)(
exp2
1)(y
y
y
myyp
σσπ
⎥⎦
⎤⎢⎣
⎡−= 2
2
2 2exp)(
rr
rrrpσσ
⎟⎟⎠
⎞⎜⎜⎝
⎛ −⎥⎦
⎤⎢⎣
⎡ +−= 202
22
2 2exp)(
rrr
arIarrrpσσσ
11 KRnet 2008
Wireless Channel (3)Wireless Channel (3)
Noise– Thermal noise를 가정
– Pnoise = -174 + 10 log(Δf) [dBm]
Interference– 원하는 신호가 아닌 다른 모든 신호의 합
– Wrap around 방식 사용: multi-tier 고려
SINR & Capacity– SINR = S/(I+N)– Link level에서의 이론적인 capacity
• Shannon Limit에 의해 maximum boundary가 결정
• C = BW log2(1+SINR)
– System level에서의 실제 capacity • Physical layer: 알고리즘에 따라 수신한 SINR을 BER/PER로 매핑
• MAC layer: 알고리즘에 따라 PER을 이용하여 실제 throughput, delay 등 파악
∑∀≠
=iji
RXPI,
Interference 고려를위한셀구성방식
1st tier
2nd tier
12 KRnet 2008
Simulation StepSimulation Step
Requirements Specification and
Analysis
Modelingand
DesignCoding
andUnit Testing
Integrationand
System TestingResultand
Maintenance
(What?)
(How?)
(Do it)
(Test it)
(Deliver it)
Waterfall Model
C/C++ 기반 시뮬레이션 방법론
14 KRnet 2008
Simulation Process (1)Simulation Process (1)
Algorithm Level Simulation Problemformulation
Setting objectivesPerformance index
Modelconstruction
Datacollection
Coding
Verified?
Validated?
Experimentdesign
Experimentations
Output analysis
Yes
Yes
No
No
Design
Implem
entation
15 KRnet 2008
Simulation Process (2)Simulation Process (2)
시스템다이어그램
블록다이어그램
프로세스다이어그램
테스트 / 디버깅
결과도출
코드생성
시뮬레이션
Design
Implem
entation
• Model Design: Top-down Approach• Model Implementation: Bottom-up Approach
System Level Simulation
16 KRnet 2008
시스템/블록 다이어그램 설계시스템/블록 다이어그램 설계
BS system
Network
MAC
PHY
…
• 일반적으로통신을하는두 entity는대칭적인시스템 layer를가짐• 세부프로세스는다름
Proc_Routing
Proc_classify
…
Proc_Schedule
Proc_Access…
Proc_TX
Proc_RX…
MS system
Network
MAC
PHY
…
…
시스템레벨
블록레벨
프로세스레벨
17 KRnet 2008
프로세스 다이어그램프로세스 다이어그램
프로세스
– Coding이 용이하도록 순서도 작성
– SDL (Specification and Description Language) 이용 가능
18 KRnet 2008
프로그램 구조프로그램 구조
Main function ManagementCommon Shared
Local variables
Algorithm process
Function process
Global variables
Common functions
Macro
Math functions
Initiation
Termination
Local variables
Scheduling
Traffic generation Statistics / Result
Structure
Coordination
Event Mng.
Timer Mng.
Signal Mng.Local function
Sub-functions
Library
Node 수 (Tx, Rx)에따라 multiple로존재가능
Measurement
19 KRnet 2008
Event Handler (1)Event Handler (1)
Untimed event – Signaling 처리 (Virtual time)– Unordered/partial ordered
Timed event– Timer 처리 (Real time)– Totally ordered
S2S1 S3
State/event sequence Timed state/event sequence
e1 e1 e2 e2S2S1 S3
e1 e1:T1 e2:T2 e2
Time variables– t: current time– tL: time of last event– tN: time of next event– e: elapsed time
Messages– (x,t): external input event arrival at time t– (*,t): internal event notifying that schedule time comes– (y,t): output event generated at time t– (done, tN): synchronization event notifying next event time is tN
두개의 event를 handling 하는 coordinator 존재
20 KRnet 2008
Event Handler (2)Event Handler (2)
Coordination– Timed event와 untimed event가 논리적인 흐름에 따라 수행되도록 스케쥴
링 해줌
– Timed event• Periodic: 주기적인 시간에 따라 발생함
• Non-periodic: event에 따라 발생함
– Untimed event• Signaling process: logically 시간의 흐름이 없다고 가정
time
Timed event
Untimed event
P1 P1 P1 P1 P1
S1
S2
S1
S2
S3
P2
S1
P2
21 KRnet 2008
Verification & ValidationVerification & Validation
Verification– SDL과 code의 확인
– 코드 debugging
Validation– 알고리즘 별 numerical analysis 수행하여 비교
– 다양한 test vector를 만들어 시스템 레벨에서 검증 가능
22 KRnet 2008
C/C++ Technique (1)C/C++ Technique (1)
Structure– packet, signaling message, event 등의 다양한 정해진 형태의 변수
를 구조체로 정의
– struct packet 의 예
ID address size data
typedef struct { // packet struct 정의char ID;int address[2];unsigned int size;double data;
} packet;
packet format
packet IP_pkt; // packet 타입의 IP packet 선언
IP_pkt.ID = 1; // member 변수의 값 입력IP_pkt.address = 0x12AB;IP_pkt.size = 15;IP_pkt.double = xxxx;
23 KRnet 2008
C/C++ Technique (2)C/C++ Technique (2)
Global variable– 모든 file, 함수에서 사용하는 변수를 선언
– “global.h”와 같은 header file을 만들어 사용
Pointer– int *ptr1, ptr2; – *ptr1: 포인터가 가리키는 번지에 들어있는 값을 나타냄
– &ptr2: 변수가 기억되어 있는 메모리의 번지를 나타냄
동적 메모리 할당
– Traffic 관리 및 event handler 관리에 사용
– void *malloc (size_t size);– void *calloc (size_t ntimes, size_T size);– void free (void *block)
// file: global.hint glo; char key;
#include <global.h>void func(){
int local;char ch;
}
24 KRnet 2008
C/C++ Technique (3)C/C++ Technique (3)
Linked list– Timer/signal event 관리에 적합
– Node와 Node pointer로 구성
struct node {int data;struct node* next;
};
Insertion Deletion
C/C++ 기반 시뮬레이션 예제
26 KRnet 2008
ExamplesExamples
Example 1– HiperLAN Type2 MAC protocol simulation
Example 2– WiBro System level simulation
27 KRnet 2008
E1- Data Path of MTE1- Data Path of MT
Upper Layer (LLC)
Physical LayerTxDataRxData
Management
MmRequest
MmIndicate
UnitData=SA//DA//LLCdata
FragData = Segment(UnitData) :
LCHs의 Array
TxDataOctet_String형
태 RxDataOctet_String형
태
Downlink Data 분리(SCH, LCH)
Broadcast 메시지 분리
(BCH, FCH, ACH)
Broadcast Downlink
RxBuffer 에 LCH 저장
LCHsSCH (ARQ)
TxBuffer저장LCH의 Array
Resource Request
전송(RCH)
Uplink Data 전송
(SCH, LCH)
Tx_Coordination_STA
MAC
Protocol_Control_STA
Uplink
UnitData Indication
UnitData로 부터 (SA, DA, LLCdata)추
출
FragDataf로 부터 SA, DA 추출
Rx Ack
Data
Management
802.11a의FramControl
첨가
28 KRnet 2008
E1- Data Path of APE1- Data Path of AP
Upper Layer (LLC)
Physical Layer
TxDataRxData
Management
MmRequest
MmIndicate
UnitData=SA//DA//LLCdata
FragData = Segment(UnitData) :
LCHs의 Array
TxDataOctet_String형
태 RxDataOctet_String형
태
Uplink Data 분리(SCH, LCH)
RCH 메시지 수신(RCH)
RCH Uplink
단말 MACID별 RxBuffer 에
LCH 저장
LCHsSCH (ARQ)
MACID별 TxBuffer저장(LCH의 Array)
Broadcast정보 전송
(BCH, FCH, ACH)
Downlink Data 전송
(SCH, LCH)
Tx_Coordination_AP
MAC
Protocol_Control_AP
Uplink
UnitData Indication
UnitData로 부터 (SA, DA, LLCdata)추
출
FragDataf로 부터 SA, DA 추출
Rx Ack
Data
Management
802.11a의FramControl 첨가
29 KRnet 2008
E1- SDL of All SystemE1- SDL of All System
30 KRnet 2008
E1- 프로그램 구조E1- 프로그램 구조
DummyPhy_Proc()
main()
MSDU_from_LLC_AP()
Rx_CHs_AP()Tx_CHs_AP()
Scheduling()
Rx_Coordination_AP()Tx_Coordination_AP()
Prepare_MPDU_AP()
MSDU_to_LLC_AP() MSDU_from_LLC_STA()
Rx_CHs_STA() Tx_CHs_STA()
Tx_RR()
Rx_Coordination_STA() Tx_Coordination_STA()
Prepare_MPDU_STA()
MSDU_to_LLC_STA()
LLC
AP
PHY
STA
MANAGEMENT
Reset_STA()Reset_AP()
Reset
Event_Out()ViewEvent()
ViewEventName()ViewEventState()
ExeEvent()
Event
InitSignalQ()SetSignalEvent()GetSignalEvent()
Signal
InitTimer()GetTimerEvent()SetTimerEvent()
SetTimerEvent_AP()ViewTimerQ()
ViewTimerQ_AP()Now(),Now_AP()
Timer
31 KRnet 2008
E2- Link-Level vs. System-Level (1)E2- Link-Level vs. System-Level (1)
Link-Level:– Goal: Study different signal
transmission and reception schemes
– Single Link– Single Cell– Single Base Station– Emphasis on PHY– Some MAC
System-Level:– Goal: Application level
performance– Multiple users– Multiple cells– Multiple Base Stations– Emphasis on all layers
PHY abstracted
PHY
MAC
Network
Application
MAC
Network
Application
PHY
※ Ref: Raj Jain et al, " WiMAX System Level Modeling,” http://www.cse.wustl.edu/~jain/wimax/gc07.htm
32 KRnet 2008
E2- Link-Level vs. System-Level (2)E2- Link-Level vs. System-Level (2)
Link-LevelSimulator
System-LevelSimulator
SystemPlanning
Transmitter structure
Channel impulse response
Receiver structure
Network layout
Cell configuration
Propagation model
Mobility model
Traffic model
Service requirements
SINR vs PER table
Performances
ConfigurationRequirements
33 KRnet 2008
E2- System-Level ComponentsE2- System-Level Components
MAC
Network
Application
PHY
System Topography (Cell size, Height, Cell size, User density)
Traffic generation (VoIP, VoD), QoS requirement
TCP/UDP, IP, RTP, Buffering, Handover
Scheduling, ARQ, Interference from other systems
Channel model, Coding, Antenna (MIMO), Multiple access
34 KRnet 2008
E2- TopologyE2- Topology
Target cell을 중심으로 계산
N-th tier의 interference 고려
단말은 각 cell에 uniform-randomly 분포
Base station
Terminal
Target Cell
1st tier
2nd tier
35 KRnet 2008
E2- Interference ModelingE2- Interference Modeling
Downlink SINR– 동일시간에 동일한 downlink
자원을 사용하는 타 기지국으로부터의 시그널이interference로 작용
S
I1 I2
I6
I5 I4
I3
Uplink SINR– 동일시간에 동일한 uplink 자
원을 사용하는 타 기지국내의단말로부터의 시그널이interference로 작용
S
I2I1
I3
I4I5
I6
36 KRnet 2008
E2- Traffic ModelingE2- Traffic Modeling
Simplified traffic model– Ref: 3GPP2, “1xEV-DV Evaluation Methodology – Addendum (V6),” 2001
37 KRnet 2008
E2- Simulation 구조E2- Simulation 구조
38 KRnet 2008
E2- Link Level 결과 (1) E2- Link Level 결과 (1)
Link level simulation 결과
– SINR vs. PER 결과 도출
– PER 결과를 MAC layer에 report
39 KRnet 2008
E2- Link Level 결과 (2)E2- Link Level 결과 (2)
Link level simulation 결과
– 사용자 분포에 따른 평균적인 AMC 사용 비율을 구하여 MAC layer에 반영
0.00364QAM 5/6
0.04264QAM 2/3
0.02416QAM 3/4
0.2397516QAM 2/30.06416QAM 2/3
0.111516QAM 1/20.15616QAM 1/2
0.10158316QAM 1/30.057QPSK 2/3
0.136667QPSK 1/20.228QPSK 1/2
0.180333QPSK 1/30.206QPSK 1/3
0.15425QPSK 1/60.15QPSK 1/6
0.075917QPSK 1/120.07QPSK 1/12
UL 사용자 비율DL 사용자 비율
40 KRnet 2008
E2- System Level 결과E2- System Level 결과
Performance Measures– Throughput
• Total MAC throughput• MAC throughput of each session (VoIP, Video, HTTP, FTP)• MAC overhead (PHY throughput / MAC throughput)
– Delay• Average delay of all sessions (VoIP, Video, HTTP, FTP)• Average delay of each session (VoIP, Video, HTTP, FTP)• Handover delay
– Downlink & Uplink Resources• Assigned uplink resources to the SS & Used uplink resources by the
SS• Assigned downlink resources to the SS
– Etc.• Transmitted packet sizes of downlink & uplink• Original packet sizes of each traffic generator (VoIP, Video, HTTP,
FTP)• Band AMC effect• HARQ effect
기타 시뮬레이션 툴
42 KRnet 2008
SDL (1)SDL (1)
SDL– Specification and Description Language– International standard by ITU-T(Z.100)– Object-oriented language– Message based description– Complete operational semantics and execution model– Independent of implementation language– Systems can be realized in both software and hardware
SDL components– Architecture: Blocks– Behavior: Processes– Communication: Signals and Channels – Data and Functions: Abstract Data Types
43 KRnet 2008
SDL (2)SDL (2)
Graphical and textual representation이 존재
– SDL-PR(Phrasal Representation): textual syntax만을 사용
– SDL-GR(Graphical Representation): graphical component뿐만 아니라 textual representation에서 사용되는 것과 동일한 textual part를 사용
SDL은 FSM을 기반으로 만들어졌으며 각 state는 임의의 순간에 SIGNAL을 받거나 전송할 수 있도록 정의 되어 있음
Real Time System 설계에 적합
44 KRnet 2008
SDL (3)SDL (3)
SDL 시스템은 시스템 내의 중요한 요소들이 서로 어떻게 상호작용 하는지보이기 위해 최소한 하나 이상의 Block으로 구성되고 그 Block은 하나 이상의 Process를 포함하며 Process내에 자세한 동작이 기술됨
아래 그림은 system X안에 block Y가 존재하고, block Y안에 process Z가 존재하는 것을 보여줌 (c1,c2는 channel명이고 r1,r2는 signal route)
system X;channel c1 …… end channel c1;channel c2 …… end channel c2;block Y;
signalroute r1 ……;signalroute r2 ……;process Z referenced;……
endblock Y;……
endsystem X;
SDL-GR SDL-PR
system X
block Y
process Zc1 r1 r2 c2
.... .................... .... ....
.........
.........
.........
.........
45 KRnet 2008
SDL (4)SDL (4)
Four main hierarchical levels in SDL: system, block, process, and procedure
System Example Block Bl1
Process Proc2 Procedure Pr1
C1
C3
Bl1
Bl2
C2
............
...... ......
......
......
......
Proc1
Proc2
R1
R3
R2
......
......
......
Pr1
State1
......
Pr1
46 KRnet 2008
SDL (5)SDL (5)
Communication
Proc1 Proc2R1 R2
......
Block Bl1
Proc1 Proc2
SIGNALSig1(Integer);
Sig1
Signal declaration
Sending process Signal list
Receivingprocess
Sig1(5) Sig1
(Number)
DCLNumber Integer;
Output symbol Input symbol
47 KRnet 2008
Data Properties Data Properties
PreDefined data– Integer, Real, Boolean, Character, Duration, Time, etc.
ConstantsUser defined data typeANY– 지정된 데이터 타입의 Random 값을 리턴
• var:= ANY(Integer);ARRAY
48 KRnet 2008
System SpecificationSystem Specification
A Complete specification in SDL– A system must have at least a block specification– Pre-defined types are to be defined at system level
Three parts– System declaration part– Block interaction part– Process body
Syntax of a system specification– Graphical representation– Textual representation
system X
block Y
process Zc1 r1 r2 c2
.... .................... .... ....
.........
.........
.........
.........
49 KRnet 2008
Process BodyProcess Body
Syntax states and transitions– Graphical representation: uses flow chart– Textual representation: uses textual code
Declaration of variables– dcl <var name> type [:= <expression>;
예: dcl x1, x2 Integerdcl st Boolean:=true;
50 KRnet 2008
Time & DurationTime & Duration
Time– Processes in SDL may access global time by using the pre-
defined expression Nowdcl x1 Time;dcl diff Duration;
51 KRnet 2008
Process 의 구현Process 의 구현
System Example Block Bl1
Process Proc2 Procedure Pr1
C1
C3
Bl1
Bl2
C2
............
...... ......
......
......
......
Proc1
Proc2
R1
R3
R2
......
......
......
Pr1
State1
......
Pr1
프로세서의 표시
신호의 흐름을 표시
신호의 내용을 표시함
변수 선언부
프로세스의 시작을 나타내는 state
입력을 나타내는 기호
프로시져의 호출
프로시져의 구현
Operation을 수행:a:= a+1;
SET(timer);Reset(timer);
종료
52 KRnet 2008
System
Block
Process
53 KRnet 2008
사용되는 signal:Init -> 처음에 ENV_Tx channel을 통해 Transmitter에 넘겨줌.
Data(Integer) 에서 Data는 변수 이름, 괄호 안은 그 타입
C 언어의 struct와 같은 개념
54 KRnet 2008
Process를 의미함
55 KRnet 2008
56 KRnet 2008
시작
상태를 나타냄
Init signal을 입력으로 받아들임:C 언어의 함수의 call by value와 유사
In C statement:Total = con_sig.Tot_num;
타이머를 셋트함타이머는 inter라는 시간동안 지난후 expire
비교 분기문
Ch2를 통해 data(0)의 값을 출력
57 KRnet 2008
58 KRnet 2008
Flexible Integrations with Other LanguagesFlexible Integrations with Other Languages
SDL Suite는 C와 C++ code와의 인터페이스를 지원
이때 C와 C++ code는 UML Suite로부터 생성되거나 개발자에 의해 만들어진 것임
각 sub-system에 따라 최적의 implementation을 위해 C++혹은 SDL을이용하는 것이 가능
Requirements capture and analysis
C++ SDL
Final application, e.g. UMTS product
Data handlingAlgorithms
CommunicationEvent-Triggered
C++ code generation UML to SDL translation
C++interface
59 KRnet 2008
Message Sequence ChartMessage Sequence Chart
동작 확인: MSC
A_SUBSCR B_SUBSCREXCHANGE
OFF_HOOK
RING_TONE
FIRST_DIGIT
LAST_DIGIT
CALL
OFF_HOOK
ON_HOOK
Message Instance
감사합니다.