EPTF_CLL_ExecCtrl_Functions.ttcn 576 KB
Newer Older
Elemer Lelik's avatar
Elemer Lelik committed
1
2
///////////////////////////////////////////////////////////////////////////////
//                                                                           //
balaskoa's avatar
balaskoa committed
3
// Copyright (c) 2000-2018 Ericsson Telecom AB                               //
Elemer Lelik's avatar
Elemer Lelik committed
4
5
//                                                                           //
// All rights reserved. This program and the accompanying materials          //
balaskoa's avatar
balaskoa committed
6
// are made available under the terms of the Eclipse Public License v2.0     //
Elemer Lelik's avatar
Elemer Lelik committed
7
// which accompanies this distribution, and is available at                  //
balaskoa's avatar
balaskoa committed
8
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html                                 //
Elemer Lelik's avatar
Elemer Lelik committed
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////
//  Module: EPTF_CLL_ExecCtrl_Functions
// 
//  Purpose:
//    This module contains the implementation of EPTF_CLL_ExecCtrl functions.
// 
//  Module depends on:
//    <EPTF_CLL_Common_Definitions>
//    <EPTF_CLL_Base_Functions>
//    <EPTF_CLL_FBQ_Definitions>
//    <EPTF_CLL_LGenBase_Definitions>
//    <EPTF_CLL_LGenBase_ConfigDefinitions>
//    <EPTF_CLL_LGenBase_ConfigFunctions>
//    <EPTF_CLL_LGenBase_PhaseDefinitions>
//    <EPTF_CLL_ExecCtrl_Definitions>
//    <EPTF_CLL_ExecCtrlTimeProfile_Definitions>
//    <EPTF_CLL_ExecCtrl_ScenarioFunctions>
//    <EPTF_CLL_ExecCtrl_LoggingFunctions>
//    <EPTF_CLL_HashMapStr2Int_Functions>
//    <EPTF_CLL_HashMapInt2Int_Functions>
//    <EPTF_CLL_Scheduler_Definitions>
//    <EPTF_CLL_RBTScheduler_Functions>
//    <EPTF_CLL_Variable_Definitions>
//    <EPTF_CLL_Variable_Functions>
//    <EPTF_CLL_LGenBaseStats_Definitions>
//    <EPTF_CLL_LGenBaseStats_Functions>
//    <EPTF_CLL_Logging_Definitions>
//    <EPTF_CLL_Logging_Functions>
//    <EPTF_CLL_ExecCtrl_ScenarioDefinitions>
//    <EPTF_CLL_ExecCtrlClient_Functions>
//    <EPTF_CLL_ExecCtrl_PhaseFunctions>
//    <EPTF_CLL_StatMeasure_Functions>
//    <EPTF_CLL_StatHandler_Functions>
//    <EPTF_CLL_StatHandlerClient_Functions>
//    <EPTF_CLL_StatHandlerClient_Definitions>
//    <TCCFileIO_Functions>
//    <TCCDateTime_Functions>
//    <EPTF_CLL_HashMap_Functions>
//
//  Module Parameters:
//    tsp_debug_EPTF_ExecCtrl_Functions - boolean - enable/disable debug logs
//    tsp_EPTF_ExecCtrl_maxKillTime - float - max time to wait for all LGens to stop
//    tsp_EPTF_ExecCtrl_finalTestReportFile - charstring - name of the file where the final test report is saved. Default: EPTF_ExecCtrl_FinalTestReport_%Y-%m-%d_%H.%M.%S.txt
//    tsp_EPTF_ExecCtrl_UIHandler_disableAutoEnablingOfManualControlModeWhenStopButtonIsPressed - *boolean* - Disable to return to manual control mode when stop button is pressed
//
//  Current Owner:
//    Jozsef Gyurusi (ethjgi)
// 
//  Last Review Date:
//    2009-02-03
//
//  Detailed Comments:
//    This module contains the interface functions for the EPTF_CLL_ExecCtrl.
//
//    Public functions:
//       <f_EPTF_ExecCtrl_init_CT>
//       <f_EPTF_ExecCtrl_checkManualLGenStarted> *new
//       <f_EPTF_ExecCtrl_start>
//       <f_EPTF_ExecCtrl_getManualControl>
//       <f_EPTF_ExecCtrl_setManualControl>
//       <f_EPTF_ExecCtrl_getTimePeriodForTcDeltaStats>
//       <f_EPTF_ExecCtrl_setTimePeriodForTcDeltaStats>
//       <f_EPTF_ExecCtrl_loadConfig>
//       <f_EPTF_ExecCtrl_checkReadyToRun>
//       <f_EPTF_ExecCtrl_waitForCondition>
//       <f_EPTF_ExecCtrl_setTimeFormat>
//       <f_EPTF_ExecCtrl_startTimeProfiles>
//       <f_EPTF_ExecCtrl_stopTimeProfiles>
//       <f_EPTF_ExecCtrl_startAllScenarios>
//       <f_EPTF_ExecCtrl_startAllScenarioGroups>
//       <f_EPTF_ExecCtrl_stopAllScenarioGroups>
//       <f_EPTF_ExecCtrl_terminateAllScenarioGroups> *new
//       <f_EPTF_ExecCtrl_stopCurrentPhaseForAllScenarioGroups>
//       <f_EPTF_ExecCtrl_stopAllScenarios>
//       <f_EPTF_ExecCtrl_terminateAllScenarios> *new
//       <f_EPTF_ExecCtrl_checkAllScenarios> *new
//       <f_EPTF_ExecCtrl_setCps_TC>
//       <f_EPTF_ExecCtrl_setCps_SC>
//       <f_EPTF_ExecCtrl_getCPSToReach_TC>
//       <f_EPTF_ExecCtrl_setCPSToReach_TC>
//       <f_EPTF_ExecCtrl_getCPSToReach_SC>
//       <f_EPTF_ExecCtrl_setCPSToReach_SC>
//       <f_EPTF_ExecCtrl_getTCWeight>
//       <f_EPTF_ExecCtrl_setTCWeight>
//       <f_EPTF_ExecCtrl_Regulator_addRegulator>
//       <f_EPTF_ExecCtrl_Regulator_getRegulatorId>
//       <f_EPTF_ExecCtrl_Regulator_setTotalCps>
//       <f_EPTF_ExecCtrl_Regulator_getTotalCps>
//       <f_EPTF_ExecCtrl_Regulator_getRegulatedItemId>
//       <f_EPTF_ExecCtrl_Regulator_getRegulatorName>
//       <f_EPTF_ExecCtrl_Regulator_setRegulatorName>
//       <f_EPTF_ExecCtrl_Regulator_logAll>
//       <f_EPTF_ExecCtrl_registerScenarioStateChangedCallback>
//       <f_EPTF_ExecCtrl_registerTrafficCaseStateChangedCallback>
//       <f_EPTF_ExecCtrl_enableStartStopScenario>
//       <f_EPTF_ExecCtrl_disableStartStopScenario>
//       <f_EPTF_ExecCtrl_scenarioIsNotInScenarioGroup>
//       <f_EPTF_ExecCtrl_isDisabledStartStopScenario>
//       <f_EPTF_ExecCtrl_getStartStopScenarioIdx>
//       <f_EPTF_ExecCtrl_enableStartStopTC>
//       <f_EPTF_ExecCtrl_disableStartStopTC>
//       <f_EPTF_ExecCtrl_isDisabledStartStopTC>
//       <f_EPTF_ExecCtrl_getStartStopTCIdx>
//       <f_EPTF_ExecCtrl_startScenarioOnLGens>
//       <f_EPTF_ExecCtrl_stopScenarioOnLGens>
//       <f_EPTF_ExecCtrl_resetScenarioOnLGens>
//       <f_EPTF_ExecCtrl_stopScenarioGroupOnLGens>
//       <f_EPTF_ExecCtrl_startTCOnLGens>
//       <f_EPTF_ExecCtrl_stopTCOnLGens>
//       <f_EPTF_ExecCtrl_singleShotTc>
//       <f_EPTF_ExecCtrl_scenarioEnabled>
//       <f_EPTF_ExecCtrl_behavior>
//       <f_EPTF_ExecCtrl_exit>
//       <f_EPTF_ExeCtrl_enableUIHandlerProgress>
//       <f_EPTF_ExecCtrl_resetFSMStat>
//       <f_EPTF_ExecCtrl_LGenPool_createLGens>
//       <f_EPTF_ExecCtrl_nrOfClients>
//       <f_EPTF_ExecCtrl_LGenPool_dumpInstanceDB>
//       <f_EPTF_ExecCtrl_addLGenFunctionsFromDeclarators>
//       <f_EPTF_ExecCtrl_getLGenCompRefsOfPool>
//       <f_EPTF_ExecCtrl_checkCreatorFnNameOfPool>
//       <f_EPTF_ExecCtrl_registerFinalTestReportGeneratorFn>
//       <f_EPTF_ExecCtrl_deregisterFinalTestReportGeneratorFn>
//       <f_EPTF_ExecCtrl_generateFinalTestReport>
//       <f_EPTF_ExecCtrl_registerFSMStatsCreatedCallback>
//       <f_EPTF_ExecCtrl_deregisterFSMStatsCreatedCallback>
//       <f_EPTF_ExecCtrl_getFSMStatisticsOfTcs>
//       <f_EPTF_ExecCtrl_setStartDelay_TC>
//       <f_EPTF_ExecCtrl_startScenarioOnLGensByName>
//       <f_EPTF_ExecCtrl_stopScenarioOnLGensByName>
//       <f_EPTF_ExecCtrl_Regulator_findRegulatorsForScenario>
//       <f_EPTF_ExecCtrl_StatHandler_getVarIdx>
//       <f_EPTF_ExecCtrl_StatHandler_getVarNameByStatName>
//       <f_EPTF_ExecCtrl_StatHandler_getAuxVars>
//
//    All other functions in this module are private! 
//
///////////////////////////////////////////////////////////////


module EPTF_CLL_ExecCtrl_Functions {

//=========================================================================
// Import Part
//=========================================================================

import from EPTF_CLL_Common_Definitions all;

import from EPTF_CLL_Base_Functions all;

import from EPTF_CLL_LGenBase_Definitions all;
import from EPTF_CLL_LGenBase_ConfigDefinitions all;
import from EPTF_CLL_LGenBase_ConfigFunctions all;
import from EPTF_CLL_LGenBase_PhaseDefinitions all;

import from EPTF_CLL_ExecCtrl_Definitions all;
import from EPTF_CLL_ExecCtrlTimeProfile_Definitions all;
import from EPTF_CLL_ExecCtrl_ScenarioFunctions all;
import from EPTF_CLL_ExecCtrl_LoggingFunctions all;
import from EPTF_CLL_HashMapStr2Int_Functions all;
import from EPTF_CLL_HashMapInt2Int_Functions all;

import from EPTF_CLL_Scheduler_Definitions all;
import from EPTF_CLL_RBTScheduler_Functions all;

import from EPTF_CLL_Variable_Definitions all;
import from EPTF_CLL_Variable_Functions all;

import from EPTF_CLL_LGenBaseStats_Definitions all;
import from EPTF_CLL_LGenBaseStats_Functions all;

import from EPTF_CLL_Logging_Definitions all;
import from EPTF_CLL_Logging_Functions all;

import from EPTF_CLL_ExecCtrl_ScenarioDefinitions all;
import from EPTF_CLL_ExecCtrl_PhaseDefinitions all;
import from EPTF_CLL_ExecCtrl_PhaseFunctions all;
import from EPTF_CLL_ExecCtrl_DSFunctions all;
import from EPTF_CLL_StatMeasure_Functions all;
import from EPTF_CLL_StatHandler_Definitions all;
import from EPTF_CLL_StatHandler_Functions all;
import from EPTF_CLL_StatHandlerClient_Functions all;
import from EPTF_CLL_StatHandlerClient_Definitions all;

import from EPTF_CLL_StatManager_Functions all;

import from TCCFileIO_Functions all;
import from TCCDateTime_Functions all;

import from EPTF_CLL_DataSource_Definitions all;
import from EPTF_CLL_DataSourceClient_Functions all;

import from EPTF_CLL_HashMap_Functions all;

import from EPTF_CLL_FBQ_Functions all;

friend module EPTF_CLL_ExecCtrlUIHandler_Functions, EPTF_CLL_ExecCtrl_DSFunctions;
friend module EPTF_CLL_ExecCtrlClient_Functions;


//modulepar boolean tsp_EPTF_ExecCtrl_StatHandler_wait4response := true; // sets the StatHandler Wait4Resp flag

//=========================================================================
// Functions
//========================================================================

///////////////////////////////////////////////////////////
//  Group: EPTF_ExecCtrl
// 
//  Purpose:
//    Functions related to EPTF_ExecCtrl feature
//
///////////////////////////////////////////////////////////
group EPTF_ExecCtrl {

  modulepar boolean tsp_debug_EPTF_ExecCtrl_Functions := false;
  modulepar float tsp_EPTF_ExecCtrl_maxKillTime := 30.0; // max time to wait for all LGens to stop
  modulepar charstring tsp_EPTF_ExecCtrl_finalTestReportFile := "EPTF_ExecCtrl_FinalTestReport_%Y-%m-%d_%H.%M.%S.txt"; // name of the file where the final test report is saved. Default: EPTF_ExecCtrl_FinalTestReport_%Y-%m-%d_%H.%M.%S.txt
  //  Set it to empty string to disable final test report generation
  modulepar boolean tsp_EPTF_ExecCtrl_generateOwnReport := true; // If enabled ExecCtrl will write the traffic case statistics into the final test report. Default: true

  const charstring c_EPTF_ExecCtrl_Regulator_totalValue := "Regulator.totalValue"; // name of the variable that indicates the regulator targetLoad
  const charstring c_EPTF_ExecCtrl_Regulator_targetLoad := "Regulator.targetLoad"; // name of the variable that indicates the regulator targetLoad
  const charstring c_EPTF_ExecCtrl_Regulator_currentLoad := "Regulator.currentLoad"; // name of the variable that indicates the regulator currentLoad
  const charstring c_EPTF_ExecCtrl_Regulator_status := "Regulator.status"; // name of the variable that indicates the regulator status
  const charstring c_EPTF_ExecCtrl_Regulator_enable := "Regulator.enable"; // name of the variable that indicates the regulator enable flag

  modulepar boolean tsp_EPTF_ExecCtrl_UIHandler_disableAutoEnablingOfManualControlModeWhenStopButtonIsPressed := false;

  const EPTF_StatusLED c_EPTF_ExecCtrl_UIVars_StatusLED_init := { color := led_black, text := "NA" };
  const EPTF_StatusLED c_EPTF_ExecCtrl_UIVars_GroupFinishCondStatusLED_init := { color := led_black, text := " -- " };

  ///////////////////////////////////////////////////////////
  //  Function: f_EPTF_ExecCtrl_init_CT
  // 
  //  Purpose:
  //    Init EPTF_ExecCtrl feature
  //
  //  Parameters:
  //    - pl_selfName - *in charstring* - the name of the component
  //    - pl_nrOfClients - *in integer* - the number of the <EPTF_ExecCtrlClient_CT> components created by the user
  //       (this is the size of the default pool)
  //    - pl_createLGenPools - *in boolean - if true, LGens in LGens pools are created automatically during init, otherwise
  //       the function <f_EPTF_ExecCtrl_LGenPool_createLGens> has to be called after the init function. Default: true
  //    - pl_loadModulepars - *in boolean - if true, module parameters are automatically loaded. Default: true
  //    - pl_autoStart - *in boolean - if true, ExecCtrl is started automatically by calling <f_EPTF_ExecCtrl_start>. Default: true
  //    - pl_dataSource_compRef - *in* <EPTF_DataSource_CT> - DataSource component reference. Optional, if given, ExecCtrl will be able to behave 
  //       as a DataSource Client. It means that datas can be requested from it and it will provide them in variables. This component can 
  //       be for example the UIHandler component.
  //    - pl_nofExternalStatHandlers - *in integer* - if >0: ExecCtrl TC and FSM statistics will be calculated on a separate StatHandler component,
  //       for 0: ExecCtrl will calculate the stats
  //       Note, that using external StatHandler component increases the internal traffic on the Variable interface (between ExecCtrl and StatHandler)
  //       Default: 0, which means that ExecCtrl will use its internal StatHandler (No extra internal traffic)
  //    - pl_usePullModeForStats - *in* *boolean* - If true pull mode is used for StatHandler statistics (default: false)
  // 
  //  Return Value:
  //    -
  //
  //  Errors & assertions:
  //    - pl_nrOfClients shall be non-negative. 
  //
  //  Detailed Comments:
  //    The pl_nrOfClients parameter shall specify the number of LGens in the default LGen pool.
  //    The default LGen pool is the collection of LGens created by the user.
  //    All other LGens are created automatically by the LGenPool functionality, and
  //    the number of those LGens should not be added to this parameter.
  //
  ///////////////////////////////////////////////////////////
  public function f_EPTF_ExecCtrl_init_CT
  (
    in charstring pl_selfName,
    in integer pl_nrOfClients,
    in boolean pl_createLGenPools := true,
    in boolean pl_loadModulepars := true,
    in boolean pl_autoStart := true,
    in EPTF_DataSource_CT pl_dataSource_compRef := null,
    in integer pl_nofExternalStatHandlers := 0,
    in boolean pl_usePullModeForStats := false
  ) runs on EPTF_ExecCtrl_CT {
    if (v_ExecCtrl_initialized) {
      return; // already initialized
    }
    v_ExecCtrl_initialized := true; // should be here to prevent cleanup from not being called
    v_ExecCtrl_readyToRun := false;
    v_ExecCtrl_allLGensCreated := false;
    v_EPTF_ExecCtrl_startTime := -1.0;
    v_EPTF_ExecCtrl_timeFormat := tsp_EPTF_ExecCtrl_timeFormat;

    v_EPTF_ExecCtrl_ScenarioGroupPhaseChangedCallbackFns := {};
    v_EPTF_ExecCtrl_ScenarioStateChangedCallbackFns := {};
    v_EPTF_ExecCtrl_TrafficCaseStateChangedCallbackFns := {};
    v_EPTF_ExecCtrl_onGroupFinishCallbackFns := {};
    v_EPTF_ExecCtrl_finalTestReportGeneratorFns := {};
    v_EPTF_ExecCtrl_finalTestReport := "";

    if (tsp_EPTF_ExecCtrl_generateOwnReport) {
      f_EPTF_ExecCtrl_setGenerateOwnReport(true);
    }

    v_ExecCtrl_endOfTest := false;

    v_ExecCtrl_pendingMsgCounter := 0;
    v_ExecCtrl_pendingByeCounter := 0;

    v_ExecCtrl_FSMStats := {};
    v_EPTF_ExecCtrl_fsmStatsCreatedCallbackFns := {};
    v_ExecCtrl_processingCreateFSMStats := false;

    v_ExecCtrl_progressBarUIHandler_Idx := -1;
    v_ExecCtrl_progressEnabled := true;
    v_ExecCtrl_progressBarUIHandler_updateSent := false;

    f_EPTF_Base_init_CT(pl_selfName);
    f_EPTF_FBQ_init_CT(pl_selfName);
    f_EPTF_Var_init_CT(pl_selfName);
    f_EPTF_StatMeasure_init_CT(pl_selfName);

    v_ExecCtrl_dataSourceCompRef := pl_dataSource_compRef;
    v_EPTF_ExecCtrl_nofExternalStatHandlers := pl_nofExternalStatHandlers;
    v_EPTF_ExecCtrl_statHandler_comprefList := {};
    v_EPTF_ExecCtrl_statHandler_autoSelector := 0;
    v_ExecCtrl_statHandlerHash := f_EPTF_str2int_HashMap_New(c_ExecCtrl_statHandlerHashMapName);
    v_ExecCtrl_usePullModeForStats := pl_usePullModeForStats;
    f_ExecCtrl_ExternalStatHandler_startNew();

    f_EPTF_StatHandlerClient_init_CT(pl_selfName);
    f_EPTF_Scheduler_init_CT(pl_selfName);
    f_EPTF_Logging_init_CT(pl_selfName);
    f_EPTF_HashMap_init_CT (pl_selfName); 
    f_EPTF_DataSourceClient_init_CT(pl_selfName, pl_dataSource_compRef);

    v_ExecCtrl_regulatedItemsHash := f_EPTF_str2int_HashMap_New(c_ExecCtrl_regulatedItemsHashMapName);

    if(pl_dataSource_compRef != null){
      v_ExecCtrl_dataSourceCompRef := pl_dataSource_compRef;
      f_EPTF_DataSourceClient_registerSetDataValue(c_ExecCtrl_DataSource_sourceId, f_EPTF_Base_selfName(), refers(f_EPTF_ExecCtrl_DSProcessSetDataValue));
      f_EPTF_DataSourceClient_registerData(c_ExecCtrl_DataSource_sourceId, f_EPTF_Base_selfName(), refers(f_EPTF_ExecCtrl_DSProcessData));
      f_EPTF_DataSourceClient_registerDataValue(c_ExecCtrl_DataSource_sourceId, f_EPTF_Base_selfName(), refers(f_EPTF_ExecCtrl_DSProcessDataValue), pl_dataSource_compRef);
      f_EPTF_DataSourceClient_registerCondition(c_ExecCtrl_DataSource_sourceId, f_EPTF_Base_selfName(), refers(f_EPTF_ExecCtrl_conditionHandler_isWeightedSc),c_ExecCtrl_conditionIsWeightedSc);
      f_EPTF_DataSourceClient_registerCondition(c_ExecCtrl_DataSource_sourceId, f_EPTF_Base_selfName(), refers(f_EPTF_ExecCtrl_conditionHandler_isInScGroup), c_ExecCtrl_conditionIsInScGroup);
    }

    v_ExecCtrl_loggingMaskId := f_EPTF_Logging_registerComponentMasks(tsp_EPTF_ExecCtrl_loggingComponentMask, c_EPTF_ExecCtrl_loggingEventClasses, EPTF_Logging_CLL);
    if(tsp_debug_EPTF_ExecCtrl_Functions) {
      f_EPTF_Logging_enableLocalMask(v_ExecCtrl_loggingMaskId, c_EPTF_ExecCtrl_loggingClassIdx_Debug);
    } else {
      f_EPTF_Logging_disableLocalMask(v_ExecCtrl_loggingMaskId, c_EPTF_ExecCtrl_loggingClassIdx_Debug);
    }

    if (pl_loadModulepars) {
      f_EPTF_ExecCtrl_loadConfigFromModulepars();
    }

    // add vars for automated GUI elements
    f_EPTF_ExecCtrl_UIVars_InitGUILayout_vars();

    f_EPTF_ExecCtrl_initEventStatus();

    f_EPTF_Base_assert(%definitionId&": Checking number of ExecCtrlClients", pl_nrOfClients>=0);

    v_ExecCtrl_nrOfClients := pl_nrOfClients;
    v_ExecCtrl_started := false;
    v_EPTF_ExecCtrl_EntityResourceInfo_Buffer := {};
    f_EPTF_Base_registerCleanup(refers(f_EPTF_ExecCtrl_cleanup_CT));

    f_EPTF_ExecCtrl_registerOnGroupFinishCallbackFn(refers(f_EPTF_ExecCtrl_setLEDForOnGroupFinishCallBack));

    v_EPTF_ExecCtrl_defaultAltstep := activate(as_EPTF_ExecCtrl_MgmtIf());

    if (pl_autoStart) {
      f_EPTF_ExecCtrl_start(pl_createLGenPools);
    } else {
      if (pl_createLGenPools) {
        f_EPTF_ExecCtrl_warning(%definitionId& ": LGen pools are not created: Auto-start is disabled!");
      }
    }
    f_EPTF_ExecCtrl_Subscribe2ExitButton_vars();
    v_EPTF_ExecCtrl_SampledAtSync_vars := {};		// TR HQ88308 - Sampled & sync variables on old GUI for refresh
    // TR HR20548 - Reset All statistics button
    f_EPTF_StatHandler_registerStatisticsResetFunction(refers(f_EPTF_ExecCtrl_resetStatFunctions));
    f_EPTF_StatHandlerClient_registerResetFunction(refers(f_EPTF_ExecCtrl_resetStatFunctions));

  }

  // this StatHandlert will process all ExecCtrl statistics (TC, FSM)
  // Using External StatHandler will increase internal traffic on Variable interface
  private function f_ExecCtrl_ExternalStatHandler_behaviour(
    in EPTF_DataSource_CT pl_dataSource_compRef,
    in integer pl_statHandlerId
  ) runs on EPTF_ExecCtrl_StatHandler_CT {
    f_EPTF_StatHandler_init_CT("ExecCtrl_ExternalStatHandler_Comp_"&log2str(pl_statHandlerId),pl_dataSource_compRef);
    f_EPTF_StatManager_init_CT(f_EPTF_Base_selfName(),pl_dataSource_compRef);
    f_EPTF_Base_wait4Shutdown();
  }

  // starts new StatHandlera or initializes the local
  private function f_ExecCtrl_ExternalStatHandler_startNew() runs on EPTF_ExecCtrl_CT {
    if (v_EPTF_ExecCtrl_nofExternalStatHandlers==0) {
      // use local
      f_EPTF_StatHandler_init_CT(f_EPTF_Base_selfName(), v_ExecCtrl_dataSourceCompRef); // Set pl_dataSource_compRef
      f_EPTF_StatManager_init_CT(f_EPTF_Base_selfName(), v_ExecCtrl_dataSourceCompRef);
      v_EPTF_ExecCtrl_statHandler_comprefList := {self};
      return;
    }
    for(var integer i:=0; i<v_EPTF_ExecCtrl_nofExternalStatHandlers; i:=i+1) {
      var EPTF_ExecCtrl_StatHandler_CT vl_externalStatHandler := EPTF_ExecCtrl_StatHandler_CT.create;
      vl_externalStatHandler.start(f_ExecCtrl_ExternalStatHandler_behaviour(v_ExecCtrl_dataSourceCompRef,i));
      v_EPTF_ExecCtrl_statHandler_comprefList[i] := vl_externalStatHandler;
    }
  }
  
  ///////////////////////////////////////////////////////////
  //  Function: f_EPTF_ExecCtrl_StatHandler_getVarIdx
  //
  //  Purpose:
  //    Function for getting the id/index of the variable of a statistic.
  //
  //  Parameters:
  //    pl_statName - *in*  *charstring* - name of the stat
  //
  //  Return Value:
  //    *integer* - index of variable for the stat
  //
  //  Errors & assertions:
  //    -
  //
  //  Detailed Comments:
  //    override function <f_EPTF_StatHandler_getVarIdx>
  //
  ///////////////////////////////////////////////////////////
  public function f_EPTF_ExecCtrl_StatHandler_getVarIdx(
    in charstring pl_statName
  ) runs on EPTF_ExecCtrl_CT return integer {

    var integer vl_statVarIdx;
    var EPTF_StatHandler_CT vl_statHandler := f_EPTF_ExecCtrl_findStatHandler(pl_statName);
    if (vl_statHandler==self) {
      var integer vl_statId := f_EPTF_StatHandler_getId(pl_statName);
      vl_statVarIdx := f_EPTF_StatHandler_getVarIdx(vl_statId);
    } else {
      // get var idx from remote statHandler
      // the stat variable name and the stat name is the same;
      var EPTF_Var_SubscriptionMode vl_subscriptionModeForVars := sampled;
      if (v_ExecCtrl_usePullModeForStats) {
        vl_subscriptionModeForVars := pull;
      }
      f_EPTF_Var_subscribeRemote(
            pl_remoteCompRef := vl_statHandler,
            pl_remoteProviderVarName := pl_statName,
            pl_subscriptionMode :=  vl_subscriptionModeForVars,
            pl_idx := vl_statVarIdx,
            pl_localName := pl_statName&"_Local"
      );
    }
    return vl_statVarIdx;
  }

  /////////////////////////////////////////////////////////////////////////////
  //  Function: f_EPTF_ExecCtrl_StatHandler_getVarNameByStatName
  //
  //  Purpose:
  //    Function for getting the variable name for a statistic name.
  //
  //  Parameters:
  //    pl_statName - *in*  *charstring* - name of statistic
  //    pl_varName - *out*  *charstring* - the variable name for a statistic name
  //
  //  Return Value:
  //    *boolean* - true if success
  //
  //  Errors & assertions:
  //    -
  //
  //  Detailed Comments:
  //    override function <f_EPTF_StatHandler_getVarNameByStatName>
  //
  /////////////////////////////////////////////////////////////////////////////
  public function f_EPTF_ExecCtrl_StatHandler_getVarNameByStatName(
    in charstring pl_statName,
    out charstring pl_varName)
  runs on EPTF_ExecCtrl_CT
  return boolean
  {
    var integer vl_varIdx := f_EPTF_ExecCtrl_StatHandler_getVarIdx(pl_statName);
    if(vl_varIdx < 0) { return false; }
    pl_varName := f_EPTF_Var_getName(vl_varIdx);
    return true;
  }

  ///////////////////////////////////////////////////////////
  //  Function: f_EPTF_ExecCtrl_StatHandler_getAuxVars
  //
  //  Purpose:
  //    Function for getting the auxiliary Variable indices of a statistic.
  //
  //  Parameters:
  //    pl_statName - *in*  *charstring* - name of the stat
  //
  //  Return Value:
  //    <EPTF_IntegerList> - list of auxiliary Var indices
  //
  //  Errors & assertions:
  //    -
  //
  //  Detailed Comments:
  //    override function f_EPTF_StatHandler_getAuxVars
  //
  ///////////////////////////////////////////////////////////
  public function f_EPTF_ExecCtrl_StatHandler_getAuxVars(
    in charstring pl_statName
  ) runs on EPTF_ExecCtrl_CT return EPTF_IntegerList {

    var EPTF_IntegerList vl_auxVars;
    var EPTF_StatHandler_CT vl_statHandler := f_EPTF_ExecCtrl_findStatHandler(pl_statName);
    if (vl_statHandler==self) {
      var integer vl_statId := f_EPTF_StatHandler_getId(pl_statName);
      vl_auxVars := f_EPTF_StatHandler_getAuxVars(vl_statId);
    } else {
      // get aux var idxs from remote statHandler and subscribe to them
      var EPTF_CharstringList vl_auxVarNames := f_EPTF_StatHandlerClient_getAuxVariables(pl_statName,vl_statHandler);
      var EPTF_Var_SubscriptionMode vl_subscriptionModeForVars := sampled;
      if (v_ExecCtrl_usePullModeForStats) {
        vl_subscriptionModeForVars := pull;
      }
      for(var integer i:=0, size:=sizeof(vl_auxVarNames); i<size; i:=i+1) {
        f_EPTF_Var_subscribeRemote(
            pl_remoteCompRef := vl_statHandler,
            pl_remoteProviderVarName := vl_auxVarNames[i],
            pl_subscriptionMode :=  vl_subscriptionModeForVars,
            pl_idx := vl_auxVars[i]
        )
      }
    }
    return vl_auxVars;
  }

  // override function f_EPTF_StatHandlerClient_declareStat
  private function f_EPTF_ExecCtrl_StatHandlerClient_declareStat(
    in charstring pl_statName,
    in EPTF_StatHandler_StatMethod pl_statMethod,
    in EPTF_Var_DirectContent pl_statResetValue
  ) runs on EPTF_ExecCtrl_CT return boolean {
    
    var EPTF_StatHandler_CT vl_statHandler := f_EPTF_ExecCtrl_findStatHandler(pl_statName);
    
    var integer vl_statHandlerCompIdx := -1;
    if (vl_statHandler==null) {
      if (v_EPTF_ExecCtrl_nofExternalStatHandlers==0) {
        vl_statHandlerCompIdx := 0;
      } else {
        vl_statHandlerCompIdx := v_EPTF_ExecCtrl_statHandler_autoSelector mod v_EPTF_ExecCtrl_nofExternalStatHandlers;
      }
      vl_statHandler := v_EPTF_ExecCtrl_statHandler_comprefList[vl_statHandlerCompIdx];
    } else {
      // stat already declared
      return true;
    }
        
    var boolean vl_success := f_EPTF_StatHandlerClient_declareStat(
      pl_statName := pl_statName,
      pl_statMethod := pl_statMethod,
      pl_statResetValue := pl_statResetValue,
      pl_statHandler := vl_statHandler,
      pl_wait4response := true
    );
        
    if (vl_success) {
      // subscribe statVar so that DS handler does not need f_EPTF_Var_subscribeRemote which would cause long call stack there
      var EPTF_Var_SubscriptionMode vl_subscriptionModeForVars := sampled;
      if (v_ExecCtrl_usePullModeForStats) {
        vl_subscriptionModeForVars := pull;
      }
      var integer vl_idx;
      f_EPTF_Var_subscribeRemote(
            pl_remoteCompRef := vl_statHandler,
            pl_remoteProviderVarName := pl_statName,
            pl_subscriptionMode :=  vl_subscriptionModeForVars,
            pl_idx := vl_idx,
            pl_localName := pl_statName&"_Local"
      );
      
      // store statHandler compRef for the statName:
      f_EPTF_str2int_HashMap_Insert(v_ExecCtrl_statHandlerHash, pl_statName, vl_statHandlerCompIdx);

      if (v_EPTF_ExecCtrl_nofExternalStatHandlers>0) {

        v_EPTF_ExecCtrl_statHandler_autoSelector := v_EPTF_ExecCtrl_statHandler_autoSelector + 1;

      }
    }

    return vl_success;
  }
  
  // override function f_EPTF_StatHandlerClient_registerAggregatedStat
  private function f_EPTF_ExecCtrl_StatHandlerClient_registerAggregatedStat(
    in EPTF_StatHandler_CT pl_sourceStatHandler,
    in charstring pl_sourceStatName,
    in charstring pl_targetStatName,
    in EPTF_Var_SubscriptionMode pl_subscriptionMode := sampledAtSync,
    in boolean pl_wait4response := true//tsp_EPTF_ExecCtrl_StatHandler_wait4response
  ) runs on EPTF_ExecCtrl_CT return boolean {
    var EPTF_StatHandler_CT vl_statHandler := self;
    
    if (v_EPTF_ExecCtrl_nofExternalStatHandlers>0) {
      vl_statHandler := f_EPTF_ExecCtrl_findStatHandler(pl_targetStatName);
      if (vl_statHandler==null) {
        return false;
      }
    }

    return f_EPTF_StatHandlerClient_registerAggregatedStat(
      pl_sourceStatHandler := pl_sourceStatHandler,
      pl_sourceStatName := pl_sourceStatName,
      pl_targetStatName := pl_targetStatName,
      pl_subscriptionMode := pl_subscriptionMode,
      pl_wait4response := pl_wait4response,
      pl_statHandler := vl_statHandler
    );
  }
  
  // override function f_EPTF_StatHandlerClient_getStatVariableRef
  private function f_EPTF_ExecCtrl_StatHandlerClient_getStatVariableRef(
    in charstring pl_statName
  ) runs on EPTF_ExecCtrl_CT return charstring {
    var EPTF_StatHandler_CT vl_statHandler := self;

    if (v_EPTF_ExecCtrl_nofExternalStatHandlers>0) {
      vl_statHandler := f_EPTF_ExecCtrl_findStatHandler(pl_statName);
      if (vl_statHandler==null) {
        return "";
      }
    }
    
    return f_EPTF_StatHandlerClient_getStatVariableRef(
      pl_statName := pl_statName,
      pl_statHandler := vl_statHandler
    );
  }
  
  //override function f_EPTF_StatHandlerClient_registerStat
  private function f_EPTF_ExecCtrl_StatHandlerClient_registerStat(
    in EPTF_CharstringList pl_providerVarList,
    in charstring pl_statName,
    in EPTF_Var_SubscriptionMode pl_subscriptionMode := sampledAtSync,
    in boolean pl_wait4response := true,//tsp_EPTF_ExecCtrl_StatHandler_wait4response,
    in EPTF_Var_CT pl_sourceCompRef := null,
    in integer pl_refreshRate := 0
  ) runs on EPTF_ExecCtrl_CT return boolean {
    var EPTF_StatHandler_CT vl_statHandler := self;

    if (v_EPTF_ExecCtrl_nofExternalStatHandlers>0) {
      vl_statHandler := f_EPTF_ExecCtrl_findStatHandler(pl_statName);
      if (vl_statHandler==null) {
        return false;
      }
    }
    
    return f_EPTF_StatHandlerClient_registerStat(
      pl_providerVarList := pl_providerVarList,
      pl_statName := pl_statName,
      pl_subscriptionMode := pl_subscriptionMode,
      pl_wait4response := pl_wait4response,
      pl_sourceCompRef := pl_sourceCompRef,
      pl_statHandler := vl_statHandler,
      pl_refreshRate := pl_refreshRate
    );
  }
  
  friend function f_EPTF_ExecCtrl_findStatHandler(
    in charstring pl_statName
  ) runs on EPTF_ExecCtrl_CT return EPTF_StatHandler_CT {
    var integer vl_idx;
    if (not f_EPTF_str2int_HashMap_Find(
        v_ExecCtrl_statHandlerHash,
        pl_statName,
        vl_idx
    )) {
      return null;
    }
    return v_EPTF_ExecCtrl_statHandler_comprefList[vl_idx];
  }
  
  ///////////////////////////////////////////////////////////
  //  Function: f_EPTF_ExecCtrl_checkManualLGenStarted
  // 
  //  Purpose:
  //    Checks if LGens that are created manually (not in LGenPool) have started
  //
  //  Parameters:
  //    -
  //
  //  Return Value:
  //    boolean   -   true if all manual LGens have started, false if not
  //
  //  Errors & assertions:
  //
  //  Detailed Comments:
  //    After this function is called, no more user created LGen will start.
  //    If LGen pools are created before user created LGens i.e. when start was called
  //    before the manual LGens are created, this function will return true when all
  //    LGens have been created.
  //
  ///////////////////////////////////////////////////////////
  public function f_EPTF_ExecCtrl_checkManualLGenStarted() runs on EPTF_ExecCtrl_CT return boolean {
    return ((not v_ExecCtrl_started) and sizeof(v_EPTF_ExecCtrl_EntityResourceInfo_Buffer) == v_ExecCtrl_nrOfClients) or v_ExecCtrl_allLGensCreated;
  }

  ///////////////////////////////////////////////////////////
  //  Function: f_EPTF_ExecCtrl_start
  // 
  //  Purpose:
  //    Start the ExecCtrl operation
  //
  //  Parameters:
  //    - pl_createLGenPools - *in boolean - if true, LGens in LGens pools are created automatically, otherwise
  //       the function <f_EPTF_ExecCtrl_LGenPool_createLGens> has to be called later. Default: true
  //
  //  Return Value:
  //    -
  //
  //  Errors & assertions:
  //
  //  Detailed Comments:
  //    After this function is called, configuration data cannot be loaded i.e.
  //    config loaded by f_EPTF_ExecCtrl_loadConfig will be ignored.
  //
  ///////////////////////////////////////////////////////////
  public function f_EPTF_ExecCtrl_start(in boolean pl_createLGenPools := true) runs on EPTF_ExecCtrl_CT {
    // Init R3 DB:
    f_EPTF_ExecCtrl_initTypeDB();
    f_EPTF_ExecCtrl_loadTypeDB(
      v_ExecCtrl_ScenarioDeclarators,
      v_ExecCtrl_tcTypeDeclarators,
      v_ExecCtrl_ScenarioDeclarators2,
      v_ExecCtrl_tcTypeDeclarators2,
      v_ExecCtrl_ScenarioDeclarators3,
      v_ExecCtrl_ScenarioDeclaratorsR3
    );

    f_EPTF_ExecCtrl_initInstanceDB();
    f_EPTF_ExecCtrl_loadInstanceDB(
      v_ExecCtrl_EntityGrpDeclarators,
      v_ExecCtrl_Scenarios2Grps,
      v_ExecCtrl_scenario2EntityGroups
    );
    // R3 end

    f_EPTF_ExecCtrl_initSc2grp();

    f_EPTF_ExecCtrl_initScTimeProfileListDB();

    f_EPTF_ExecCtrl_Phase_init();

    //create scenario groups
    f_EPTF_ExecCtrl_Phase_createScenarioGroups();

    f_EPTF_ExecCtrl_Regulator_init(v_EPTF_ExecCtrl_RegulatorNames,v_EPTF_ExecCtrl_RegulatedItemsCFG); // this should be done at last

    f_EPTF_ExecCtrl_EntityGroupDistribution_init(v_EPTF_ExecCtrl_entityGroupDistributionCFG);

    f_EPTF_ExecCtrl_debug(log2str("value of v_ExecCtrl_tcTypeDeclarators = ", v_ExecCtrl_tcTypeDeclarators));

    f_EPTF_ExecCtrl_LGenPool_initInstanceDB();
    f_EPTF_ExecCtrl_LGenPool_loadInstanceDB(
      v_EPTF_ExecCtrl_LGenPool_Declarators,
      v_EPTF_ExecCtrl_EntityGroup2LGenPools
    );
    f_EPTF_ExecCtrl_LGenFunctions_initInstanceDB();
    f_EPTF_ExecCtrl_addLGenFunctionsFromDeclarators(v_EPTF_ExecCtrl_lgenCreatorFn_list);

    v_ExecCtrl_started := true;
    f_EPTF_ExecCtrl_loadBuffered_EntityResourceInfo();

    if (pl_createLGenPools) {
      f_EPTF_ExecCtrl_LGenPool_createLGens();
    }

    if(v_ExecCtrl_nrOfClients==0 and v_ExecCtrl_allLGensCreated) {
      if (pl_createLGenPools) {
        t_ExecCtrl_allLGensCreated.stop;
      }
      f_EPTF_ExecCtrl_readyToRun();
    }
  }

  ///////////////////////////////////////////////////////////
  //  Function: f_EPTF_ExecCtrl_getManualControl
  // 
  //  Purpose:
  //    Gets the manual control mode
  //
  //  Parameters:
  //
  //  Return Value:
  //    boolean - manual control mode
  //
  //  Errors & assertions:
  //
  //  Detailed Comments:
  //
  ///////////////////////////////////////////////////////////
  public function f_EPTF_ExecCtrl_getManualControl() runs on EPTF_ExecCtrl_CT return boolean
  {
    return v_ExecCtrl_manualControl;
  }

  ///////////////////////////////////////////////////////////
  //  Function: f_EPTF_ExecCtrl_setManualControl
  // 
  //  Purpose:
  //    Sets the manual control mode (overwrites config setting)
  //
  //  Parameters:
  //    pl_manualControl - *in boolean* - true to enable manual control mode, false to disable (automatic start of scenarios)
  //
  //  Return Value:
  //    -
  //
  //  Errors & assertions:
  //
  //  Detailed Comments:
  //    It is not called in <f_EPTF_ExecCtrl_init_CT>.
  //    This function should be called before initializing the ExecCtrl component with its init function <f_EPTF_ExecCtrl_init_CT>.
  //
  ///////////////////////////////////////////////////////////
  public function f_EPTF_ExecCtrl_setManualControl(in boolean pl_manualControl) runs on EPTF_ExecCtrl_CT
  {
    v_ExecCtrl_manualControl := pl_manualControl;
  }

  ///////////////////////////////////////////////////////////
  //  Function: f_EPTF_ExecCtrl_getTimePeriodForTcDeltaStats
  // 
  //  Purpose:
  //    Gets The time period when delta stats are refreshed
  //
  //  Parameters:
  //
  //  Return Value:
  //    float - Time period when delta stats are refreshed.
  //
  //  Errors & assertions:
  //
  //  Detailed Comments:
  //
  ///////////////////////////////////////////////////////////
  public function f_EPTF_ExecCtrl_getTimePeriodForTcDeltaStats() runs on EPTF_ExecCtrl_CT return float
  {
    return v_EPTF_ExecCtrl_timePeriodForTcDeltaStats;
  }

  ///////////////////////////////////////////////////////////////////////////////
  //  Function: f_EPTF_ExecCtrl_setTimePeriodForTcDeltaStats
  // 
  //  Purpose:
  //    Tells that the ExecCtrl's Time period when delta stats are refreshed.
  // 
  //  Parameters:
  //    pl_gtimePeriodForTcDeltaStats - *float* - Time period when delta stats are refreshed.
  //
  //  Return Value:
  //    -
  // 
  ///////////////////////////////////////////////////////////////////////////////  
  public function f_EPTF_ExecCtrl_setTimePeriodForTcDeltaStats(in float pl_gtimePeriodForTcDeltaStats) runs on EPTF_ExecCtrl_CT
  {
    v_EPTF_ExecCtrl_timePeriodForTcDeltaStats := pl_gtimePeriodForTcDeltaStats;
  }

  ///////////////////////////////////////////////////////////
  //  Function: f_EPTF_ExecCtrl_loadConfig
  // 
  //  Purpose:
  //    Loads additional config data and appends them to existing data
  //
  //  Parameters:
  //    pl_EPTF_LGenBase_TcMgmt_EntityGrpDeclaratorList - *in* <EPTF_LGenBase_TcMgmt_EntityGrpDeclaratorList>
  //    pl_EPTF_LGenBase_TcMgmt_Scenarios2GrpList - *in* <EPTF_LGenBase_TcMgmt_Scenarios2GrpList>
  //
  //    pl_EPTF_LGenBase_ScenarioDeclaratorList - *in* <EPTF_LGenBase_ScenarioDeclaratorList> 
  //    pl_EPTF_LGenBase_tcTypeDeclaratorList - *in* <EPTF_LGenBase_tcTypeDeclaratorList> 
  //
  //    pl_EPTF_LGenBase_TcMgmt_tcTypeDeclaratorList - *in* <EPTF_LGenBase_TcMgmt_tcTypeDeclaratorList>
  //    pl_EPTF_LGenBase_TcMgmt_ScenarioDeclaratorList - *in* <EPTF_LGenBase_TcMgmt_ScenarioDeclaratorList>
  //
  //    pl_EPTF_LGenBase_TcMgmt_WeightedScenarioDeclaratorList - *in* <EPTF_LGenBase_TcMgmt_WeightedScenarioDeclaratorList>
  //
  //    pl_EPTF_ExecCtrl_TimeProfileDescrList - *in* <EPTF_ExecCtrl_TimeProfileDescrList>
  //    pl_EPTF_ExecCtrl_TimeProfileList - *in* <EPTF_ExecCtrl_TimeProfileList>
  //    pl_EPTF_ExecCtrl_TimeProfile2TcList - *in* <EPTF_ExecCtrl_TimeProfile2TcList>
  //
  //    pl_EPTF_LGenBase_ScenarioTypeDeclaratorList - *in* <EPTF_LGenBase_ScenarioTypeDeclaratorList> *optional* - Scenario Declator appeared in R3
  //    pl_EPTF_ExecCtrl_ScenarioInstanceTypeList - *in* <EPTF_ExecCtrl_ScenarioInstanceTypeList> - scenario instance decl
  //
  //    pl_EPTF_ExecCtrl_LGenPool_Declarators - *in* <EPTF_ExecCtrl_LGenPool_Declarators> - LGen Pool declarators
  //    pl_EPTF_ExecCtrl_EntityGroup2LGenPool_List - *in* <EPTF_ExecCtrl_EntityGroup2LGenPool_List> - Entity group to LGen Pool declarators
  //
  //    pl_EPTF_ExecCtrl_LGenFunction_Entry_List - *in* <EPTF_ExecCtrl_LGenFunction_Entry_List> - the LGen creator functions to register
  //
  //    pl_EPTF_ExecCtrl_PhaseList_Declarators - *in* <EPTF_LGenBase_PhaseList_Declarators> - list of phaseLists
  //    pl_EPTF_ExecCtrl_ScenarioGroup_Declarators - *in* <EPTF_ExecCtrl_ScenarioGroup_Declarators> - list of scenario groups
  //
  //    pl_EPTF_ExecCtrl_RegulatorNames - *in* <EPTF_ExecCtrl_RegulatorNames> - list of regulator names
  //    pl_EPTF_ExecCtrl_RegulatedItems - *in* <EPTF_ExecCtrl_RegulatedItems> - list of regulated items
  //
  //    pl_EPTF_ExecCtrl_EntityGroupDistributionTypeList - *in* <EPTF_ExecCtrl_EntityGroupDistributionTypeList> - list of entity group distributions
  //
  //  Return Value:
  //    -
  //
  //  Errors & assertions:
  //
  //  Detailed Comments:
  //    All parameters are optional. If specified, the value of that parameter is appended to the corresponding data already loaded.
  //    This function can be called more than once with different arguments. It is not called in <f_EPTF_ExecCtrl_init_CT>.
  //    If you have your own tsp-s, this function can be used to load them into the ExecCtrl database. The ExecCtr
  //    should know about all declarators in the system.
  //    This function should be called before the <f_EPTF_ExecCtrl_start> function is called on the ExecCtrl component.
  //    This function can be called before the ExecCtrl is initialized with its init function <f_EPTF_ExecCtrl_init_CT>.
  //
  ///////////////////////////////////////////////////////////
  public function f_EPTF_ExecCtrl_loadConfig(
    in EPTF_LGenBase_TcMgmt_EntityGrpDeclaratorList pl_EPTF_LGenBase_TcMgmt_EntityGrpDeclaratorList :={},
    in EPTF_LGenBase_TcMgmt_Scenarios2GrpList pl_EPTF_LGenBase_TcMgmt_Scenarios2GrpList :={},

    in EPTF_LGenBase_ScenarioDeclaratorList pl_EPTF_LGenBase_ScenarioDeclaratorList :={},
    in EPTF_LGenBase_tcTypeDeclaratorList pl_EPTF_LGenBase_tcTypeDeclaratorList :={},

    in EPTF_LGenBase_TcMgmt_tcTypeDeclaratorList pl_EPTF_LGenBase_TcMgmt_tcTypeDeclaratorList :={},
    in EPTF_LGenBase_TcMgmt_ScenarioDeclaratorList pl_EPTF_LGenBase_TcMgmt_ScenarioDeclaratorList :={},

    in EPTF_LGenBase_TcMgmt_WeightedScenarioDeclaratorList pl_EPTF_LGenBase_TcMgmt_WeightedScenarioDeclaratorList :={},

    in EPTF_ExecCtrl_TimeProfileDescrList pl_EPTF_ExecCtrl_TimeProfileDescrList := {},
    in EPTF_ExecCtrl_TimeProfileList pl_EPTF_ExecCtrl_TimeProfileList := {},
    in EPTF_ExecCtrl_TimeProfile2TcList pl_EPTF_ExecCtrl_TimeProfile2TcList := {},

    in EPTF_LGenBase_ScenarioTypeDeclaratorList pl_EPTF_LGenBase_ScenarioTypeDeclaratorList := {},
    in EPTF_ExecCtrl_ScenarioInstanceTypeList pl_EPTF_ExecCtrl_ScenarioInstanceTypeList := {},

    in EPTF_ExecCtrl_LGenPool_Declarators pl_EPTF_ExecCtrl_LGenPool_Declarators := {},
    in EPTF_ExecCtrl_EntityGroup2LGenPool_List pl_EPTF_ExecCtrl_EntityGroup2LGenPool_List := {},

    in EPTF_ExecCtrl_LGenFunction_Entry_List pl_EPTF_ExecCtrl_LGenFunction_Entry_List := {},

    in EPTF_LGenBase_PhaseList_Declarators pl_EPTF_ExecCtrl_PhaseList_Declarators := {},
    in EPTF_ExecCtrl_ScenarioGroup_Declarators pl_EPTF_ExecCtrl_ScenarioGroup_Declarators := {},

    in EPTF_ExecCtrl_RegulatorNames pl_EPTF_ExecCtrl_RegulatorNames := {},
    in EPTF_ExecCtrl_RegulatedItems pl_EPTF_ExecCtrl_RegulatedItems := {},

    in EPTF_ExecCtrl_EntityGroupDistributionTypeList pl_EPTF_ExecCtrl_EntityGroupDistributionTypeList := {}

  ) runs on EPTF_ExecCtrl_CT {
    if (v_ExecCtrl_started) {
      f_EPTF_ExecCtrl_warning(log2str(%definitionId&": Config not loaded: ExecCtrl was already started"));
      return;
    }
    // load pl_EPTF_LGenBase_TcMgmt_EntityGrpDeclaratorList:
    for(var integer i:=0, size := sizeof(pl_EPTF_LGenBase_TcMgmt_EntityGrpDeclaratorList); i<size; i:=i+1) {
      var integer vl_currentSize := sizeof(v_ExecCtrl_EntityGrpDeclarators);
      v_ExecCtrl_EntityGrpDeclarators[vl_currentSize] := pl_EPTF_LGenBase_TcMgmt_EntityGrpDeclaratorList[i];
    }
    // load pl_EPTF_LGenBase_TcMgmt_Scenarios2GrpList:
    for(var integer i:=0, size := sizeof(pl_EPTF_LGenBase_TcMgmt_Scenarios2GrpList); i<size; i:=i+1) {
      var integer vl_currentSize := sizeof(v_ExecCtrl_Scenarios2Grps);
      v_ExecCtrl_Scenarios2Grps[vl_currentSize] := pl_EPTF_LGenBase_TcMgmt_Scenarios2GrpList[i];
    }


    // load pl_EPTF_LGenBase_ScenarioDeclaratorList:
    for(var integer i:=0, size := sizeof(pl_EPTF_LGenBase_ScenarioDeclaratorList); i<size; i:=i+1) {
      var integer vl_currentSize := sizeof(v_ExecCtrl_ScenarioDeclarators);
      v_ExecCtrl_ScenarioDeclarators[vl_currentSize] := pl_EPTF_LGenBase_ScenarioDeclaratorList[i];
    }
    // load pl_EPTF_LGenBase_tcTypeDeclaratorList:
    for(var integer i:=0, size := sizeof(pl_EPTF_LGenBase_tcTypeDeclaratorList); i<size; i:=i+1) {
      var integer vl_currentSize := sizeof(v_ExecCtrl_tcTypeDeclarators);
      v_ExecCtrl_tcTypeDeclarators[vl_currentSize] := pl_EPTF_LGenBase_tcTypeDeclaratorList[i];
    }


    // load pl_EPTF_LGenBase_TcMgmt_tcTypeDeclaratorList:
    for(var integer i:=0, size := sizeof(pl_EPTF_LGenBase_TcMgmt_tcTypeDeclaratorList); i<size; i:=i+1) {
      var integer vl_currentSize := sizeof(v_ExecCtrl_tcTypeDeclarators2);
      v_ExecCtrl_tcTypeDeclarators2[vl_currentSize] := pl_EPTF_LGenBase_TcMgmt_tcTypeDeclaratorList[i];
    }
    // load pl_EPTF_LGenBase_TcMgmt_ScenarioDeclaratorList:
    for(var integer i:=0, size := sizeof(pl_EPTF_LGenBase_TcMgmt_ScenarioDeclaratorList); i<size; i:=i+1) {
For faster browsing, not all history is shown. View entire blame