計算機仿真中的HLA技術中的餐館例子分析 (4) Consumption

相比起來,Consumption聯邦與Production聯邦很相似,都採用NER方式推進時間,其lookahead也都是0.01。

 

程序結構也非常相似。

 

Consumption聯邦也由多個java文件組成。包括:Consumption.java, ConsumptionFrame.java,ConsumptionInternalError.java,  ConsumptionNames.java, FedAmbImpl.java (consumption)。

其中,frame是GUI類,FedAmbImpl包括所有回調函數。

--------------------------------------------------------------------------------------------------------------------------------------

 

主函數很簡單

 

 

  public static void main(String[] args) {

 Properties props = parseArgs(args);

    loadProperties(props);

    Consumption consumption = new Consumption(props);

    consumption.mainThread();

  }

 

主要功能是從命令行或者配置文件中讀取相關參數,產生Consumption對象,運行mainThread線程

---------------------------------------------------------------------------------------------------------

 

主要的功能都在mainThread函數中

 

(1)取得相關配置信息,判斷是否有federation execution實例運行,沒有則創建,然後加入join

 

(2)設置時間受限和時間調節。這裏首先設置了時間受限,同時在設置時間受限和時間調節時,使用了barrier機制來協調各個線程(barrier機制在例子中多次使用,這裏不討論其細節)。

 

(3)獲取相關對象類,屬性,交互類的handle,存儲下來以備後續使用。--getHandles();

 

(4)發佈對象類及其相關屬性,

 

    //publish Serving position because we'll update it

    _rti.publishObjectClass(_ServingClass, _positionAttributeAsSet);

    //publish Diner class because we register them

    _rti.publishObjectClass(_DinerClass, _DinerAttributes);

    //publish the interaction because it's our job to send it

    _rti.publishInteractionClass(_SimulationEndsClass);

 

顯然, 發佈對象包括Serving類及其position屬性,Dinner類及其屬性, 發佈SimulationEnds交互類。注意,Serving對象類被多個聯邦發佈,consumption聯邦發佈Serving對象類,因爲該聯邦將從Transport聯邦獲取Serving對象類某實例的position屬性的所有權。

 

(5)訂閱對象類及其相關屬性,

 

 

    _rti.subscribeObjectClassAttributes(_BoatClass, _BoatAttributes);

    _rti.subscribeObjectClassAttributes(_ServingClass, _positionAttributeAsSet);

 

 

訂閱包括Boat對象類及其屬性,Serving對象類及其屬性。

 

(6)處理第一個同步點ReadyToPolulate,發出同步點已經achieved請求。使用barrier機制阻塞線程,結束阻塞後輸出已經同步信息。

 

(7)調用makeInitialInstances函數,根據numberofDiner進行循環,循環體如下:

       {

       構造dinername和position,獲取dinerHandle(同時註冊diner對象類的實例),將diner對象加入local table中

 

       _dinerTable.add(

        dinerHandle,

        dinerName,

        position,

        Diner.LOOKING_FOR_FOOD,

        "",

        0);

 

      更新相應對象類實例的屬性值:

 

      LogicalTime sendTime = new LogicalTimeDouble(0.0);

      sendTime.setTo(_logicalTime);

      sendTime.increaseBy(_lookahead);

      EventRetractionHandle erh =

        _rti.updateAttributeValues(dinerHandle, sa, null, sendTime);

 

 

      填充相應的_consumptionTimes[serial]數組元素

     } //循環結束

 

(8)處理第二個同步點ReadyToRun,發出同步點已經achieved請求。使用barrier機制阻塞線程,結束阻塞後輸出已經在該同步點同步的信息。

 

(9)調用rti函數enableAsynchronousDelivery,目的是instructs the LRC to begin delivering receive-ordered events to the federate even while no time-advancement service is in progress,其實就是consumption這個時間受限聯邦成員要求在時間批准狀態下也能接收RO事件。

 

(10)進入時間推進的主循環。循環結束條件是該聯邦收到simulationEnds交互。基本的消息循環流程:consumption聯邦收到的所有RTI的回調都會進入callbackQueue排隊。然後在消息循環裏面逐一取出消息來處理。

 

下面是主循環代碼:

 

 

    timeLoop:

      while (!_simulationEndsReceived) {

        _userInterface.setTimeStateAdvancing();

        LogicalTime timeToMoveTo = _internalQueue.getTimeAtHead();

        //_userInterface.post("NER to " + timeToMoveTo);

        _rti.nextEventRequest(timeToMoveTo);

        //process all the events & callbacks we receive from the RTI

        boolean wasTimeAdvanceGrant;

        do {

          Callback callback = _callbackQueue.dequeue();

          wasTimeAdvanceGrant = callback.dispatch();

          //_userInterface.post("After dispatch " + _logicalTime);

        } while (!wasTimeAdvanceGrant);

        updateInternalStateAtNewTime();

        if (_simulationEndsReceived) break timeLoop;

        //process callbacks not requiring advance while in granted state

        while (!_dinerTable.isTimeAdvanceRequired()) {

          Callback callback = _callbackQueue.dequeue();

          callback.dispatch();

        }

     }

 

 

主循環流程解釋如下:

 

while(沒有收到simulationEnds交互) 

{

    界面顯示聯邦開始時間推進;

     從_internalQueue隊列中取出隊頭事件所包含的時間(對consumption聯邦而言,只有獲得某Serving的所有權之後,纔會在_internalQueue中插入一個FinishEatingSushiEvent,這個evnet所附帶的時間是_logicalTime+某diner喫完這個sush的平均時間);

     請求時間推進NER到上一條語句所取出的時間上,對consumption聯邦而言,其實就是取出某diner喫完一個sushi後的logicTime時間。

     do{

           從callbackQueue中取出一個事件,返回給callback對象;

           調用callback對象的dispatch函數,返回一個布爾量wasTimeAdvanceGrant

           判斷是否收到_simulationEnds交互,如果收到,退出循環;

     while (!wasTimeAdvanceGrant);

————————————————————————————————————————————————checkInternalQueue()函數

     從internalQueue中取出(並刪除)所有小於等於當前時間的事件處理掉,此例中就是取出可能的FinishEatingSushiEvent,並開始調用RTI函數attributeOwnershipAcquisition請求刪除該Serving實例:

      _rti.attributeOwnershipAcquisition(

        _dinerTable.getServing(_diner),

        _privilegeToDeleteObjectAttributeAsSet,

        null);

     後面在AOAN的dispatch函數中,判斷ownership是否得到,如果得到,則開始刪除該Serving

        else if (_attributes.equals(_privilegeToDeleteObjectAttributeAsSet)) {

          finishDestroyingServing();

        }

 

    並更新某diner的狀態;  --checkInternalQueue()函數

————————————————————————————————————————————————checkInternalQueue()函數

    更新_dinerTable中的diner對象類實例信息,並調用rti.updateAttributeValues(diner._handle, sa, null, sendTime);在聯邦中更新diner對象實例信息。

    根據當前_servings中所有的sushi信息,發送updateAttributeValues請求或者直接刪除對象實例_rti.deleteObjectInstance(serving._handle, null, sendTime);

    判斷是否消耗了足夠多的sushi,如果足夠多,則發出SimulationEnds交互。

}        

 

(11)處理第三個同步點ReadyToResign,發出同步點已經achieved請求。使用barrier機制阻塞線程,結束阻塞後輸出已經在該同步點同步的信息。然後結束該聯邦的運行。

---------------------------------------------------------------------------------------------------------------------------

下面從consumption運行的log文件來進行動態分析

 

RTIambassador created

Federation execution restaurant_1 already exists.

Joined as federate 5

Enabling time constraint...

...constraint enabled at time<0.0>

Enabling time regulation...

...regulation enabled at time<0.0>

Waiting for ReadyToPopulate...

�5.10)startRegistrationForObjectClass:3

�5.12)turnInteractionsOn:4

�5.10)startRegistrationForObjectClass:7

...federation synchronized.

Waiting for ReadyToRun...

...federation synchronized.

//之前無話,跟前面的聯邦運行情況基本相同,尤其跟production基本類似。

 

NER to time<INF> 

// 進入時間推進循環,明顯看到剛開始時,_internalQueue中沒有事件,因此返回的推進時間是INF,即尋求推進到結束時間

 

This is DiscoverObjectInstanceCallback's dispatch  B_3_0   105

Discovered Boat 105(B_3_0)

This is DiscoverObjectInstanceCallback's dispatch  B_3_1   113

Discovered Boat 113(B_3_1)

This is DiscoverObjectInstanceCallback's dispatch  B_3_2   114

Discovered Boat 114(B_3_2)

This is DiscoverObjectInstanceCallback's dispatch  B_3_3   115

Discovered Boat 115(B_3_3)

This is DiscoverObjectInstanceCallback's dispatch  B_3_4   116

Discovered Boat 116(B_3_4)

This is DiscoverObjectInstanceCallback's dispatch  B_3_5   118

Discovered Boat 118(B_3_5)

This is DiscoverObjectInstanceCallback's dispatch  B_3_6   120

Discovered Boat 120(B_3_6)

This is DiscoverObjectInstanceCallback's dispatch  B_3_7   121

Discovered Boat 121(B_3_7)

//以上爲外部事件及其處理情況,發現了8個Boat對象實例。

 

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@147917a

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@11e67ac

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@3f96ee

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@44f787

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@126d3df

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@b1a4e2

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@149a794

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@1d2b9b7

//以上爲外部事件處理,反射所發現對象實例的屬性。

 

This is GrantEvent's dispatch  time<0.01>

//接收到time grant事件,時間推進到0.01

 

This is before second while     //這個輸出是爲了定位第二個while語句

 

NER to time<INF>

//仍舊沒有內部事件,NER仍舊推進到結束時間

 

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@1827d1

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@1be2893

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@1d87b85

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@118958e

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@22d166

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@17779e3

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@167e3a5

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@15bc6c8

//接收外部事件,更新8個Boat對象實例的屬性值

 

This is GrantEvent's dispatch  time<1.01>

//time grant to 1.01

 

This is before second while 

NER to time<INF>

////仍舊沒有內部事件,NER仍舊推進到結束時間

 

This is DiscoverObjectInstanceCallback's dispatch  S_4_0   125

Discovered Serving 125(S_4_0)

//發現了所訂閱的一個Serving對象實例

 

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@111ded2

//反射新發現的Serving對象實例的相關屬性值

 

This is GrantEvent's dispatch  time<1.51>

//time grant to  1.51

 

This is before second while 

NER to time<INF>

////仍舊沒有內部事件,NER仍舊推進到結束時間

 

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@b51404

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@1db484d

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@94cb8b

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@118278a

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@cc0e01

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@1a1c42f

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@1570945

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@121b59a

This is GrantEvent's dispatch  time<2.01>

//time grant to 2.01

 

This is before second while 

NER to time<INF>

This is DiscoverObjectInstanceCallback's dispatch  S_4_1   126

Discovered Serving 126(S_4_1)

//又發現了一個Serving對象實例

 

This is ReflectAttributeValuesEvent's dispatch  126   se.pitch.prti.prti302@1381960

//反射其屬性值

 

This is GrantEvent's dispatch  time<2.3099999999999996>

//time grant to 2.3099999999999996

 

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@8c5ea2

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@1579a30

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@4bfe6b

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@14b6bed

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@366573

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@19da967

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@6e8f94

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@633d51

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@569c60

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@3468f4

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@6db724

This is GrantEvent's dispatch  time<3.01>

This is before second while 

NER to time<INF>

This is DiscoverObjectInstanceCallback's dispatch  S_4_2   127

Discovered Serving 127(S_4_2)

This is DiscoverObjectInstanceCallback's dispatch  S_4_3   128

Discovered Serving 128(S_4_3)

This is DiscoverObjectInstanceCallback's dispatch  S_4_4   129

Discovered Serving 129(S_4_4)

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@1c297a3

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@717323

This is ReflectAttributeValuesEvent's dispatch  127   se.pitch.prti.prti302@3e1bc8

This is GrantEvent's dispatch  time<3.11>

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@313170

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@1db9852

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@6504bc

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@16089a5

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@c16b18

This is DiscoverObjectInstanceCallback's dispatch  S_4_5   130

Discovered Serving 130(S_4_5)

This is ReflectAttributeValuesEvent's dispatch  130   se.pitch.prti.prti302@16de067

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@4d2af2

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@3e97df

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@15b0333

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@878c4c

This is GrantEvent's dispatch  time<4.01>

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@118223d

This is ReflectAttributeValuesEvent's dispatch  127   se.pitch.prti.prti302@1700391

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@fa39d7

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@4eeaaf

This is ReflectAttributeValuesEvent's dispatch  127   se.pitch.prti.prti302@1c18a4c

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@15e92d7

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@c92507

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@19e09a4

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@e5355f

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@132ae7

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@65b738

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@1dfd868

This is GrantEvent's dispatch  time<5.01>

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@14275d4

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@45e228

This is ReflectAttributeValuesEvent's dispatch  127   se.pitch.prti.prti302@2b249

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@106daba

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@1021f34

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@10e434d

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@12fb0af

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@1f8bd0d

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@c06258

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@789869

This is GrantEvent's dispatch  time<6.01>

This is before second while 

NER to time<INF>

This is DiscoverObjectInstanceCallback's dispatch  S_4_6   131

Discovered Serving 131(S_4_6)

This is ReflectAttributeValuesEvent's dispatch  131   se.pitch.prti.prti302@cffc79

This is GrantEvent's dispatch  time<6.31>

This is before second while 

NER to time<INF>

This is DiscoverObjectInstanceCallback's dispatch  S_4_7   132

Discovered Serving 132(S_4_7)

This is ReflectAttributeValuesEvent's dispatch  132   se.pitch.prti.prti302@c3e82b

This is GrantEvent's dispatch  time<6.319999999999999>

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@2b349d

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@1dafbaf

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@1c1c92b

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@17e4dee

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@12e7c6a

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@ea5461

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@49cf9f

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@bc5596

This is ReflectAttributeValuesEvent's dispatch  127   se.pitch.prti.prti302@970c0e

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@987197

This is GrantEvent's dispatch  time<7.01>

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@1a7f9dc

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@104e28b

This is ReflectAttributeValuesEvent's dispatch  127   se.pitch.prti.prti302@1b54362

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@15b0e2c

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@ff9053

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@5c7734

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@96212a

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@5b675e

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@df83e5

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@4c6320

This is GrantEvent's dispatch  time<8.01>

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@ffd135

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@1000bcf

This is ReflectAttributeValuesEvent's dispatch  127   se.pitch.prti.prti302@754fc

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@15c998a

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@6458a6

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@1f82ab4

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@1bb9696

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@9b6220

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@1474e45

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@63a721

This is GrantEvent's dispatch  time<9.01>

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@1401d28

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@3a6e5c

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@238016

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@ae4646

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@187b287

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@951a0

This is ReflectAttributeValuesEvent's dispatch  127   se.pitch.prti.prti302@1ce1bea

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@8acfc3

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@979f67

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@62610b

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@d12eea

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@15f157b

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@17b40fe

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@e7f6eb

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@103de90

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@d72200

This is GrantEvent's dispatch  time<10.01>

This is before second while 

NER to time<INF>

This is DiscoverObjectInstanceCallback's dispatch  S_4_8   133

Discovered Serving 133(S_4_8)

This is ReflectAttributeValuesEvent's dispatch  133   se.pitch.prti.prti302@1f9338f

This is GrantEvent's dispatch  time<10.52>

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@1a80aea

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@1dc64a5

This is ReflectAttributeValuesEvent's dispatch  127   se.pitch.prti.prti302@53c3f5

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@101ac93

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@15f1f9c

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@1474ea

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@107bd0d

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@10ca208

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@61f533

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@12922f6

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@9f0d

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@ca3783

This is GrantEvent's dispatch  time<11.01>

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@2a6ff

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@21d23b

This is ReflectAttributeValuesEvent's dispatch  127   se.pitch.prti.prti302@7124af

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@1f7708

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@1bfbfb8

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@1c3e9ba

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@125d61e

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@10c6cfc

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@c72243

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@19a8416

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@155d3a3

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@1b994de

This is GrantEvent's dispatch  time<12.01>

This is before second while 

NER to time<INF>

This is DiscoverObjectInstanceCallback's dispatch  S_4_9   134

Discovered Serving 134(S_4_9)

This is ReflectAttributeValuesEvent's dispatch  134   se.pitch.prti.prti302@57e787

This is GrantEvent's dispatch  time<12.12>

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@7b4703

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@1732ed2

This is ReflectAttributeValuesEvent's dispatch  127   se.pitch.prti.prti302@1071521

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@1fc3c84

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@e93999

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@be76c7

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@682406

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@115126e

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@6d2380

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@11daa0e

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@879860

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@24de7d

This is GrantEvent's dispatch  time<13.01>

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@1f21c50

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@20f237

This is ReflectAttributeValuesEvent's dispatch  127   se.pitch.prti.prti302@132021a

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@2803d5

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@113981b

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@1672bbb

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@6833f2

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@12a73d9

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@1bdb58

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@dd75a4

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@1568654

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@18d30fb

This is GrantEvent's dispatch  time<14.01>

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@14d921a

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@1b32627

This is ReflectAttributeValuesEvent's dispatch  127   se.pitch.prti.prti302@8dcd5d

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@1a5af9f

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@1bfa3d3

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@9c82f4

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@159780d

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@d8ca48

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@c8570c

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@caf0ed

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@18f6559

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@146b6db

This is GrantEvent's dispatch  time<15.01>

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@717d91

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@eafb71

This is ReflectAttributeValuesEvent's dispatch  127   se.pitch.prti.prti302@4ab2f

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@ad2c30

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@1302fc5

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@903025

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@48f675

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@2c9103

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@1e46a68

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@105eb6f

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@1a3ca10

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@26f9e5

//之前都是重複動作,請求時間推進到INF,不斷髮現新的Serving對象實例,反射其屬性值,時間不斷推進。

 

This is AOANcallback's dispatch  127   HashSet( 100 )

直到這裏,收到回調函數,表示本聯邦已經獲取到對象實例某屬性的控制權( 對象類實例 S_4_2   127)

Transferring serving S_4_2 to diner D_5_2   //dispatch函數中調用transferServingToDiner()函數,顯示這條信息

This is before _internalQueue.enqueue and the _consumptionTimes is interval<6.0>  and the _eventTime is  time<21.009999999999998>

The _logicalTime is  time<15.01>

This is GrantEvent's dispatch  time<16.01>

//time grant  to 16.01

 

This is before second while 

NER to time<21.009999999999998>

//注意此時NER time不是INF了,而是一個具體的數值。這裏應該是_internalQueue中出現了一個內部事件,此內部事件應該是diner D_5_2喫S_4_2,而這個時間所附帶的時間應該是diner D_5_2喫東西的平均時間。

 

This is ReflectAttributeValuesEvent's dispatch  130   se.pitch.prti.prti302@ed32c4

This is ReflectAttributeValuesEvent's dispatch  126   se.pitch.prti.prti302@9fea8a

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@df2d38

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@11e831

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@1a2f02e

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@d75c47

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@eb67e8

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@f2ea42

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@1f1cbf6

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@504ec1

This is ReflectAttributeValuesEvent's dispatch  126   se.pitch.prti.prti302@628704

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@11a4bd4

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@16877f8

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@19c7c21

This is ReflectAttributeValuesEvent's dispatch  130   se.pitch.prti.prti302@996cca

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@b57e9a

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@18adae2

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@1283052

This is GrantEvent's dispatch  time<17.01>

//時間繼續推進,每次1秒

 

This is before second while 

NER to time<21.009999999999998>

//NER to time 保持不變,第一個sushi還沒有喫完,下面重複此操作,直到時間推進到21.009999999999998

 

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@873723

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@425743

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@16ef705

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@1b7c76

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@883357

This is ReflectAttributeValuesEvent's dispatch  126   se.pitch.prti.prti302@1e2afb2

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@17cfd38

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@d480ea

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@15b8520

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@18105e8

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@1aacd5f

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@16d8196

This is ReflectAttributeValuesEvent's dispatch  130   se.pitch.prti.prti302@56b93a

This is GrantEvent's dispatch  time<18.01>

This is before second while 

NER to time<21.009999999999998>

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@9fe84e

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@4c71d2

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@c4bc34

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@2006a0

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@9300cc

This is ReflectAttributeValuesEvent's dispatch  126   se.pitch.prti.prti302@1198ff2

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@1397e5c

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@196e136

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@9bad5a

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@1250ff2

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@3a0ab1

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@940f82

This is ReflectAttributeValuesEvent's dispatch  130   se.pitch.prti.prti302@864e43

This is GrantEvent's dispatch  time<19.01>

This is before second while 

NER to time<21.009999999999998>

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@69a4cb

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@1c20eb7

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@1541147

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@3a835d

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@1867df9

This is ReflectAttributeValuesEvent's dispatch  126   se.pitch.prti.prti302@b86944

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@107108e

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@cfe049

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@18e18a3

This is ReflectAttributeValuesEvent's dispatch  130   se.pitch.prti.prti302@1f38fc6

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@1642bd6

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@15bfdbd

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@6f8b2b

This is GrantEvent's dispatch  time<20.01>

This is before second while 

NER to time<21.009999999999998>

This is DiscoverObjectInstanceCallback's dispatch  S_4_10   135

Discovered Serving 135(S_4_10)

This is DiscoverObjectInstanceCallback's dispatch  S_4_11   136

Discovered Serving 136(S_4_11)

This is ReflectAttributeValuesEvent's dispatch  136   se.pitch.prti.prti302@1c6e818

This is ReflectAttributeValuesEvent's dispatch  135   se.pitch.prti.prti302@1afb0c7

This is GrantEvent's dispatch  time<20.020000000000003>

This is before second while 

NER to time<21.009999999999998>

This is GrantEvent's dispatch  time<21.009999999999998>

//時間終於推進到了21.009999999999998,此後在調用updateInternalStateAtNewTime()函數時,將從_internalQueue隊列中刪除對應的FinishEatingSushiEvent,並調用其dispatch,請求刪除該Serving對象實例。

This is FinishEatingSushiEvent's dispatch  time<21.009999999999998>   2

 

This is before second while 

NER to time<INF>

//之後,_internalQueue中又空了。因此,NER請求又是結束時間

 

This is AOANcallback's dispatch  127   HashSet( 1 )

//所有權轉移請求後的callback,應該是對幾行前刪除Serving請求(其實是對屬性_privilegeToDeleteObjectAttributeAsSet的所有權的請求)的迴應。

 

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@89e2f1

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@18a9fc8

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@2515

This is ReflectAttributeValuesEvent's dispatch  130   se.pitch.prti.prti302@d0357a

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@166f9b9

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@19518cc

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@18efaea

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@1fb3211

This is ReflectAttributeValuesEvent's dispatch  126   se.pitch.prti.prti302@940b84

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@18041e0

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@16504fa

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@129e5e9

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@1b5391b

This is GrantEvent's dispatch  time<21.01>

//time grant to 21.01

 

Deleted serving 127  

//刪除127 sushi Serving, 在time grant之後的updateServings函數調用中處理serving刪除,調用_rti.deleteObjectInstance(serving._handle, null, sendTime);。

 

This is before second while 

NER to time<INF>

This is ReflectAttributeValuesEvent's dispatch  105   se.pitch.prti.prti302@44d990

This is ReflectAttributeValuesEvent's dispatch  113   se.pitch.prti.prti302@278e83

This is ReflectAttributeValuesEvent's dispatch  114   se.pitch.prti.prti302@fd66a5

This is ReflectAttributeValuesEvent's dispatch  128   se.pitch.prti.prti302@5dfaf1

This is ReflectAttributeValuesEvent's dispatch  126   se.pitch.prti.prti302@61cd2

This is ReflectAttributeValuesEvent's dispatch  120   se.pitch.prti.prti302@14e4e31

This is ReflectAttributeValuesEvent's dispatch  130   se.pitch.prti.prti302@1ef7de4

This is ReflectAttributeValuesEvent's dispatch  121   se.pitch.prti.prti302@3228a1

This is ReflectAttributeValuesEvent's dispatch  125   se.pitch.prti.prti302@10980e7

This is ReflectAttributeValuesEvent's dispatch  129   se.pitch.prti.prti302@639bf1

This is ReflectAttributeValuesEvent's dispatch  118   se.pitch.prti.prti302@1931579

This is ReflectAttributeValuesEvent's dispatch  115   se.pitch.prti.prti302@166bfd8

This is ReflectAttributeValuesEvent's dispatch  116   se.pitch.prti.prti302@bd09e8

This is GrantEvent's dispatch  time<22.01>

This is before second while 

-------------------------------------------------------------------------------------------------------------

從上面運行中可以看出,consumption聯邦的主要時間推進循環是:時間開始推進,直到某diner發現某serving對象實例已經足夠靠近(通過反射serving的position屬性值),這時diner發出AOAIA請求,請求獲取該Serving對象實例的position屬性的所有權。當RTI通過AOAN回調告知所有權可以獲取時,consumption聯邦在_internalQueue中加入一個FinishEatingSushiEvent事件。然後聯邦在時間推進循環中,聯邦從_internalQueue中獲取FinishEatingSushiEvent事件的時間,並請求推進(NER)到該時間。然後聯邦在時間推進循環中持續發出該NER請求。直到收到一次time grant並且granted的time跟前面請求推進的時間相等。此時,聯邦刪除_internalQueue隊列中的FinishEatingSushiEvent事件,並刪除被喫掉的Serving對象實例。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章