yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Quintiq file version 2.0
#parent: #root
Method LibMon_CollectInfo () const
{
  Description: 'Collect model specific information.'
  TextBody:
  [*
    /*
    Send the following information to monitoring library:
    - # of total scenarios
    - # of online scenarios
    - average # of objects across onlines scenarios (refer to method LibMon_SignificantObjects for the list)
    */
    
    // Retrieve all macroplans keys.
    macroplansObjectInfos := MDSEditor::Editor().ObjectInfos( typeof( MacroPlan ).ShortName() );
    
    // Get online datasets.
    options := DatasetFindOptions::Construct().Kind( typeof( MacroPlan ).ShortName() );
    macroplans := MDSMacroPlan::Find( options );
    
    // Publish the info of total and online scenarios to monitoring library
    this->LibMon_SendInfo( ScenarioManager::LibMon_Scenario_ID() + ScenarioManager::LibMon_ID_AllScenarios(), macroplansObjectInfos.Elements( relsize ) );
    this->LibMon_SendInfo( ScenarioManager::LibMon_Scenario_ID() + ScenarioManager::LibMon_ID_OnlineScenarios(), macroplans->GroupAll()->Size() );
    
    // Now, we go through all the object types we wanna sample
    // Retrieve their count from macroplans
    traverse( ScenarioManager::LibMon_SignificantObjects(), Elements, e )
    {
      // Numbers of this object from all macroplans
      numbers := macroplans->LibMon_ColIectInfo( e )->GroupAll();
      this->LibMon_SendInfo( ScenarioManager::LibMon_MacroPlan_ID() + e, numbers ); 
    }
  *]
}