HLA - Time Management 陳昱豪
Outline Basic Concepts of HLA Simulations Time Management 簡介
Basic Concepts of HLA Simulations Federate的規則—TM方面 Continuous vs. Discrete Simulations Simulation Time Steps Time steps & Pseudocode
HLA 簡介 HLA (High Level Architecture)是一個整合介面,用來結合各種不同的電腦模擬單位成為一個整體模擬環境。 三個重要名詞定義: Federation:由各個模擬單位所組合而成的模擬系統。 Federate:各個獨立的模擬單位。 Federation execution:federation的執行期間
HLA 元件與服務 HLA定義六種型態的服務群組 Federation Rules Interface Specification Object Model Template (OMT) HLA定義六種型態的服務群組
Federate的規則—TM方面 規則 10: 模擬時間管理(Time Management) Federates 必須能夠處理其所模擬的當地時間(local time),使得此時間可以與Federation內其他federate的時間相互協調進行資料的交換: 一個Federation的所有模擬系統(federates)必須能夠處理其所模擬的當地時間,彷彿它們是在使用同一個模擬時間系統內。 一個模擬系統的內部可以依其需要來管理模擬時間,只要它能與Federation內的其它模擬系統達到一致便可以。
Continuous vs. Discrete Simulations
Simulation Time Steps
Time steps & Pseudocode
Time Management 簡介 Time Management目的 Time Management 是用來協調Federates之間的Logical time Time Management的另一個觀點 Time Management設法適合滿足單一 Federation所使用的各種技術
Time Management目的 協調模擬時間來完成演習進行: 控制演習邏輯時間的進行以及協調邏輯時間與真實時間的關係。 將事件的發生依時間關係來傳遞。 支援演習模擬當中的事件因果關係。 支援federates之間不同的訊息排序方式與網路傳送需求。
Time Management 是用來協調Federates之間的Logical time 最基本問題是確保下面兩者情況之一的成立: 沒有一個federate會收到它的過去時間所發生的事件(保守的方式)。 當一個federate收到它的過去時間所發生的事件使得現在的狀態變成不正確,但是因為federate的推演已經超過該時間點使得它必須倒推回到(roll back) 該時間點 (樂觀的方式) 。
Time Management的另一個觀點 另一種方式就是完全忽略時間的管理(也就是DIS類型的“即時性”模擬系統所使用的方式) ,而將收到該事件的時間視為該事件的發生時間 -- Federate時間是由它的host wall clock所產生。 此法不會保證事件的因果關係會被遵守。 如果網路傳輸延遲時間能保證限制於某定量時間內,此方法尚可被人類感官所接受。 HLA介面規格將Time management特徵化為由每一個federate來自行設定兩個布耳變數(Boolean switches): Time-regulating Time-constrained
Time Management設法適合滿足單一 Federation所使用的各種技術
HLA 模擬時間原理 Time in Distributed Simulations Simulations Supported by the HLA The Need for Time Management Time Stamps Logical Time Logical View of TM Services Time Management Mechanisms
Time in Distributed Simulations Physical time Time in the physical system, that is, the system being modeled by the simulation Simulation time The simulator’s representation of physical time Wallclock time Time when the simulator is executed
Simulations Supported by the HLA Scaled real-time simulations(Time-Step) Have a linear relation ΔT=S*ΔW where ΔW is a duration in wallclock time, ΔT the corresponding duration in simulation time, and S is a scale factor If S=1, we have a real-time simulation As-fast-as-possible simulations(Event-driven) When one attempts to complete the simulation as quickly as possible, so execution is not paced to have a direct relationship to wallclock time
The Need for Time Management A simulator may incorrectly reproduce temporal aspects of the real world system being modeled Repeated executions of the simulation with the same initial state and external inputs might give entirely different results
Time Stamps Temporal anomalies are eliminated by assigning a time stamp (in simulation time) to each event and ensuring that events are delivered to the federate in time-stamp order (TSO) The time management services ensure a federate will not receive an event in its past, i.e., an event with time stamp less than its current federate time
Logical Time Federate time is the current simulation time of a federate Logical time is how federate time is called for federates that can send or receive TSO messages to distinguish these federates from those deriving federate time directly from wallclock time During the execution of a federation, different federates may have different logical time values
Logical View of TM Services
Time Management Mechanisms Event-driven The federate processes events in time-stamp order Time-stepped Each time advance of the federate is in fixed time step Parallel discrete-event simulation Federates on multiprocessor systems are synchronized using a conservative or an optimistic protocol Wallclock-time driven Federate time is derived directly from wallclock time
Thanks for listening!!