| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // Copyright (c) 2000-2019 Ericsson Telecom AB // |
| // // |
| // All rights reserved. This program and the accompanying materials // |
| // are made available under the terms of the Eclipse Public License v2.0 // |
| // which accompanies this distribution, and is available at // |
| // https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html // |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Module: EPTF_CLL_ExecCtrlUIHandler_Functions |
| // |
| // Purpose: |
| // This module contains the implementation of EPTF_CLL_ExecCtrlUIHandler functions. |
| // |
| // Module Parameters: |
| // tsp_debug_EPTF_ExecCtrl_UIHandler - *boolean* - if true, logging is enabled |
| // for the component locally as well |
| // tsp_EPTF_ExecCtrl_UIHandler_generateReport - *boolean* - If enabled ExecCtrl_UIHandler will write the traffic case statistics into the final test report. Default: false |
| // tsp_EPTF_ExecCtrl_UIHandler_noCPSChart - *boolean* - the Traffic Case CPS Chart is not displayed on the GUI. Default: false |
| // tsp_EPTF_ExecCtrl_UIHandler_noDensityChart - *boolean* - the Traffic Case FSM Stats Density Chart is not displayed on the GUI. Default: false |
| // tsp_ExecCtrl_UIHandler_densityChartOrientation - <XULOrientation> - Default: vertical. The orientation of the density chart on the Statistics/FSMStats tab |
| // tsp_ExecCtrl_UIHandler_densityChartLabelType - <DistributionchartLabeltype> - Default: percentage. The type of values displayed above the columns of the Statistics/FSMStats tab density chart |
| // tsp_EPTF_ExecCtrlClient_UIHandler_createClientTab - *boolean* - if false client tab is not displayed on the GUI. Default: true |
| // tsp_EPTF_ExecCtrl_UIHandler_CPSChart_maxPointsCurrent - *integer* - max points on the CPS Chart for current CPS. Default: 2048 |
| // tsp_EPTF_ExecCtrl_UIHandler_CPSChart_maxPointsTarget - *integer* - max points on the CPS Chart for target CPS. Default: 2048 |
| // tsp_ExecCtrlClient_UIHandler_maxNofRows_FSMStats - *integer* - max number of rows in a column on the FSMStats tab (if there is no more columns, the number ow rows are increased). Default: 8 |
| // tsp_ExecCtrlClient_UIHandler_maxNofCols_FSMStats - *integer* - max number of columns on the FSMStats tab. Default: 3 |
| // tsp_EPTF_ExecCtrlUIHandler_trafficCaseStatusLedMaxColoumns - *integer* - max number of columns on the "Traffic case states in scenario" tab |
| // |
| // Module depends on: |
| // <EPTF_CLL_Common_Definitions> |
| // <EPTF_CLL_UIHandler_Definitions> |
| // <EPTF_CLL_UIHandler_MsgDefinitions> |
| // <EPTF_CLL_UIHandlerClient_Functions> |
| // <EPTF_CLL_Logging_Definitions> |
| // <EPTF_CLL_Logging_Functions> |
| // <EPTF_CLL_LoggingUI_Definitions> |
| // <EPTF_CLL_LoggingUI_Functions> |
| // <EPTF_CLL_LoggingUIClient_Functions> |
| // <EPTF_CLL_Base_Functions> |
| // <EPTF_CLL_ExecCtrl_Functions> |
| // <EPTF_CLL_ExecCtrl_Definitions> |
| // <EPTF_CLL_ExecCtrl_ScenarioFunctions> |
| // <EPTF_CLL_ExecCtrl_ScenarioDefinitions> |
| // <EPTF_CLL_ExecCtrlClient_Functions> |
| // <EPTF_CLL_ExecCtrlUIHandler_Definitions> |
| // <EPTF_CLL_ExecCtrl_CLIFunctions> |
| // <XTDP_PDU_Defs> |
| // <EPTF_CLL_Variable_Functions> |
| // <EPTF_CLL_LGenBase_Definitions> |
| // <EPTF_CLL_LGenBaseStats_Definitions> |
| // <EPTF_CLL_LGenBaseStats_Functions> |
| // <EPTF_CLL_LGenBaseStatsUI_Definitions> |
| // <EPTF_CLL_LGenBaseStatsUI_Functions> |
| // <EPTF_CLL_StatHandlerClient_Functions> |
| // <EPTF_CLL_StatHandlerClient_Definitions> |
| // <EPTF_CLL_StatHandlerUI_Functions> |
| // <EPTF_CLL_StatMeasure_Functions> |
| // <EPTF_CLL_CLI_Definitions> |
| // <XTDP_Images> |
| // <TCCEncoding_Functions> |
| // <EPTF_CLL_DataSource_Definitions> |
| // |
| // Public functions: |
| // <f_EPTF_ExecCtrl_UIHandler_init_CT> |
| // <f_EPTF_ExecCtrl_UIHandler_setRefreshRates> |
| // <f_EPTF_ExecCtrl_UIHandler_checkGuiDone> |
| // <f_EPTF_ExecCtrl_UIHandler_behavior> |
| // <f_EPTF_ExecCtrl_UIHandler_createGUI> |
| // <f_EPTF_ExecCtrl_UIHandler_removeGUI> |
| // <f_EPTF_ExecCtrl_UIHandler_ispresentGUI> |
| // <f_EPTF_ExecCtrlClient_UIHandler_init_CT> |
| // <f_EPTF_ExecCtrlClient_UIHandler_setRefreshRates> |
| // |
| // Current Owner: |
| // EFLOATT |
| // |
| // Last Review Date: |
| // 2010-xx-xx |
| /////////////////////////////////////////////////////////////////////////////// |
| module EPTF_CLL_ExecCtrlUIHandler_Functions |
| { |
| |
| //=========================================================================== |
| // Import part |
| //=========================================================================== |
| import from EPTF_CLL_Common_Definitions all; |
| |
| import from EPTF_CLL_UIHandler_Definitions all; |
| import from EPTF_CLL_UIHandler_MsgDefinitions all; |
| import from EPTF_CLL_UIHandlerClient_Functions all; |
| import from EPTF_CLL_Logging_Definitions all; |
| import from EPTF_CLL_Logging_Functions all; |
| import from EPTF_CLL_LoggingUI_Definitions all; |
| import from EPTF_CLL_LoggingUIClient_Functions all; |
| import from EPTF_CLL_Base_Functions all; |
| import from EPTF_CLL_ExecCtrl_Functions all; |
| import from EPTF_CLL_ExecCtrl_Definitions all; |
| import from EPTF_CLL_ExecCtrl_PhaseDefinitions all; |
| import from EPTF_CLL_ExecCtrl_PhaseFunctions all; |
| import from EPTF_CLL_ExecCtrl_ScenarioFunctions all; |
| import from EPTF_CLL_ExecCtrl_ScenarioDefinitions all; |
| import from EPTF_CLL_ExecCtrlClient_Functions all; |
| import from EPTF_CLL_ExecCtrl_CLIFunctions all; |
| import from EPTF_CLL_ExecCtrlUIHandler_Definitions all; |
| |
| import from EPTF_CLL_Variable_Functions all; |
| |
| import from EPTF_CLL_LGenBase_Definitions all; |
| import from EPTF_CLL_LGenBaseStats_Functions all; |
| import from EPTF_CLL_LGenBaseStatsUI_Definitions all; |
| import from EPTF_CLL_LGenBaseStatsUI_Functions all; |
| |
| import from EPTF_CLL_StatHandlerClient_Functions all; |
| import from EPTF_CLL_StatHandlerUI_Functions all; |
| |
| import from EPTF_CLL_CLI_Definitions all; |
| |
| import from EPTF_CLL_DataSource_Definitions all; |
| |
| friend module EPTF_CLL_ExecCtrl_DSFunctions; |
| //=========================================================================== |
| // Module parameters |
| //=========================================================================== |
| modulepar { |
| boolean tsp_debug_EPTF_ExecCtrl_UIHandler := false; |
| boolean tsp_EPTF_ExecCtrl_UIHandler_generateReport := false; // If enabled ExecCtrl_UIHandler will write the traffic case statistics into the final test report. Default: false |
| } |
| |
| modulepar boolean tsp_EPTF_ExecCtrl_UIHandler_noCPSChart := false; // the Traffic Case CPS Chart is not displayed on the GUI |
| modulepar boolean tsp_EPTF_ExecCtrl_UIHandler_noDensityChart := false; // the Traffic Case FSM Stats Density Chart is not displayed on the GUI |
| modulepar boolean tsp_EPTF_ExecCtrlClient_UIHandler_createClientTab := true; // if false client tab is not displayed on the GUI |
| modulepar integer tsp_EPTF_ExecCtrl_UIHandler_CPSChart_maxPointsCurrent := 2048; // max points on the CPS Chart for current CPS |
| modulepar integer tsp_EPTF_ExecCtrl_UIHandler_CPSChart_maxPointsTarget := 2048; // max points on the CPS Chart for target CPS |
| |
| modulepar integer tsp_ExecCtrlClient_UIHandler_maxNofRows_FSMStats := 8; // max number of rows in a column on the FSMStats tab (if there is no more columns, the number ow rows are increased) |
| modulepar integer tsp_ExecCtrlClient_UIHandler_maxNofCols_FSMStats := 3; // max number of columns on the FSMStats tab |
| modulepar integer tsp_EPTF_ExecCtrlUIHandler_trafficCaseStatusLedMaxColoumns := 6; // max number of columns on the "Traffic case states in scenario" tab |
| |
| modulepar EPTF_ExecCtrl_timeFormat tsp_EPTF_ExecCtrlUIHandler_timeFormat := SECONDS; // declares the time format on the GUI |
| |
| modulepar EPTF_LGenBaseStatsUI_columnDescriptorList tsp_ExecCtrl_LGenBaseStatsUI_columnDescriptorList := { |
| {"Tc", c_EPTF_LGenBaseStatsUI_tcColTcName, false}, |
| {"En.", c_EPTF_LGenBaseStatsUI_tcColEnabled, false}, |
| {"State", c_EPTF_LGenBaseStatsUI_tcColStateName, false}, |
| {"Info", c_EPTF_LGenBaseStatsUI_tcColUserData, false}, |
| {"Start", c_EPTF_LGenBaseStatsUI_tcColStartBtn, false}, |
| {"Stop", c_EPTF_LGenBaseStatsUI_tcColStopBtn, false}, |
| {"Pause", c_EPTF_LGenBaseStatsUI_tcColPauseBtn, false}, |
| {"Abort", c_EPTF_LGenBaseStatsUI_tcColAbortBtn, false}, |
| {"Single shot", c_EPTF_LGenBaseStatsUI_tcColSingleShotBtn, true}, |
| {"Traffic type", c_EPTF_LGenBaseStatsUI_tcColTrafficType, false}, |
| {"CPS", c_EPTF_LGenBaseStatsUI_tcColCpsToReach, false}, |
| {"Weight", c_EPTF_LGenBaseStatsUI_tcColWeight, false}, |
| {"Last CPS", c_EPTF_LGenBaseStatsUI_tcColLastCps, false}, |
| {"Running", c_EPTF_LGenBaseStatsUI_tcColNrOfRunningEntities, false}, |
| {"Available", c_EPTF_LGenBaseStatsUI_tcColNrOfAvailableEntities, false}, |
| {"Not finished", c_EPTF_LGenBaseStatsUI_tcColNrOfNotFinishedEntities, false}, |
| {"Starts", c_EPTF_LGenBaseStatsUI_tcColNrOfStarts, false}, |
| {"Success", c_EPTF_LGenBaseStatsUI_tcColNrOfSuccesses, false}, |
| {"Fail", c_EPTF_LGenBaseStatsUI_tcColNrOfFails, false}, |
| {"Erroneous", c_EPTF_LGenBaseStatsUI_tcColNrOfErrors, false}, |
| {"Timeout", c_EPTF_LGenBaseStatsUI_tcColNrOfTimeouts, false}, |
| {"Max.running", c_EPTF_LGenBaseStatsUI_tcColMaxRunning, false}, |
| {"Min.available", c_EPTF_LGenBaseStatsUI_tcColMinAvailable, false}, |
| {"Max.busy", c_EPTF_LGenBaseStatsUI_tcColMaxBusy, false}, |
| {"Fin.traffic", c_EPTF_LGenBaseStatsUI_tcColReceivedAnswers, false}, |
| {"Range loops", c_EPTF_LGenBaseStatsUI_tcColRangeLoops, false} |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Module parameter: |
| // tsp_LGenBaseStatsUI_columnDescriptorList |
| // |
| // Detailed description: |
| // This parameter describes the contents of the scenario panel |
| // on the GUI if the pl_scColumnDescriptorList parameter of |
| // the function <f_EPTF_LGenBaseStatsUI_init> has no value. |
| /////////////////////////////////////////////////////////// |
| modulepar EPTF_LGenBaseStatsUI_scColumnDescriptorList tsp_ExecCtrl_LGenBaseStatsUI_scColumnDescriptorList := { |
| {"Scenario", c_EPTF_LGenBaseStatsUI_scColName, false}, |
| {"En.", c_EPTF_LGenBaseStatsUI_scColEnabled, false}, |
| {"State", c_EPTF_LGenBaseStatsUI_scColStateName, false}, |
| {"Start", c_EPTF_LGenBaseStatsUI_scColStartBtn, false}, |
| {"Stop", c_EPTF_LGenBaseStatsUI_scColStopBtn, false}, |
| {"Pause", c_EPTF_LGenBaseStatsUI_scColPauseBtn, false}, |
| {"Abort", c_EPTF_LGenBaseStatsUI_scColAbortBtn, false}, |
| {"Restore", c_EPTF_LGenBaseStatsUI_scColRestoreBtn, false}, |
| {"Single shot", c_EPTF_LGenBaseStatsUI_scColSingleShotBtn, true}, |
| {"CPS", c_EPTF_LGenBaseStatsUI_scColCPS, false}, |
| {"Traffic type", c_EPTF_LGenBaseStatsUI_scColTrafficType, false}, |
| {"Lock CPS", c_EPTF_LGenBaseStatsUI_scColLockCPS, false} |
| } |
| |
| //=========================================================================== |
| // Functions |
| //=========================================================================== |
| |
| /////////////////////////////////////////////////////////// |
| // Group: EPTF_ExecCtrl_UIHandler |
| // |
| // Purpose: |
| // Functions related to EPTF_ExecCtrl_UIHandler feature |
| // |
| /////////////////////////////////////////////////////////// |
| group EPTF_ExecCtrl_UIHandler { |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_init_CT |
| // |
| // Purpose: |
| // Initializes the EPTF_ExecCtrl_UIHandler_CT component |
| // |
| // Parameters: |
| // pl_selfName - *in* *charstring* - 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_uiHandler_compRef - *in* <EPTF_UIHandler_CT> - the UIHandler component reference |
| // pl_EPTF_GUI_Main_Tabbox_WidgetId - *in* *charstring* - the widget id of the tabbox where the ExecCtrl panel will be placed |
| // If empty (=="") no GUI is created |
| // pl_loggingUi_compRef - *in* <EPTF_LoggingUI_CT> - the LoggingUI component reference. Defualt: null (no logging UI) |
| // 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_CLI_compRef - *in template* <EPTF_CLI_CT> - the CLI component to use to register the commands into (default: null) |
| // If the value is null: use pl_uiHandler_compRef as CLI; omit: no execCtrl CLI; else: use the CLI given |
| // pl_commandPrefix - *in charstring* - common prefix of all execCtrl commands (default: "") |
| // pl_loadModulepars - *in boolean - if true, module parameters are automatically loaded. Default: true |
| // pl_autoStart - *in boolean - if true, ExecCtrl is started automatically. Default: true |
| // pl_dataSource_compRef - *in* <EPTF_DataSource_CT> - Optional, DataSource component reference, needed for ExecCtrl to be able to behave |
| // as a DataSource Client. If not given, pl_uiHandler_compRef will behave as datasource component, if given, than this 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: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////// |
| public function f_EPTF_ExecCtrl_UIHandler_init_CT( |
| in charstring pl_selfName, |
| // in boolean pl_newWindow := false, |
| in integer pl_nrOfClients, |
| in EPTF_UIHandler_CT pl_uiHandler_compRef, |
| in charstring pl_EPTF_GUI_Main_Tabbox_WidgetId, |
| in EPTF_LoggingUI_CT pl_loggingUi_compRef := null, |
| in boolean pl_createLGenPools := true, |
| in template EPTF_CLI_CT pl_CLI_compRef := null, |
| in charstring pl_commandPrefix := "", |
| 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_UIHandler_CT |
| { |
| if (v_EPTF_ExecCtrl_UIHandler_initialized) { |
| return; // already initialized |
| } |
| |
| if(pl_loggingUi_compRef != null) { |
| f_EPTF_LoggingUIClient_init_CT(pl_selfName, pl_loggingUi_compRef, pl_uiHandler_compRef); |
| } else { |
| f_EPTF_Logging_init_CT(pl_selfName); |
| } |
| v_ExecCtrl_UIHandler_loggingMaskId := f_EPTF_Logging_registerComponentMasks(tsp_EPTF_ExecCtrl_UIHandler_loggingComponentMask, c_EPTF_ExecCtrl_loggingEventClasses, EPTF_Logging_CLL); |
| if(tsp_debug_EPTF_ExecCtrl_UIHandler) { |
| f_EPTF_Logging_enableLocalMask(v_ExecCtrl_UIHandler_loggingMaskId, c_EPTF_ExecCtrl_loggingClassIdx_Debug); |
| } else { |
| f_EPTF_Logging_disableLocalMask(v_ExecCtrl_UIHandler_loggingMaskId, c_EPTF_ExecCtrl_loggingClassIdx_Debug); |
| } |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| //refresh rates: |
| v_ExecCtrl_UIHandler_refreshRate_ScGrpStatus := tsp_EPTF_ExecCtrl_UIHandler_refreshRate_ScGrpStatus; // default |
| v_ExecCtrl_UIHandler_refreshRate_CPSChart := tsp_EPTF_ExecCtrl_UIHandler_refreshRate_CPSChart; // default |
| v_ExecCtrl_UIHandler_refreshRate_TCStats := tsp_EPTF_ExecCtrl_UIHandler_refreshRate_TCStats; // default |
| v_ExecCtrl_UIHandler_refreshRate_TimeElapsed := tsp_EPTF_ExecCtrl_UIHandler_refreshRate_TimeElapsed; // default |
| v_ExecCtrl_UIHandler_refreshRate_EntityResourcesTab := tsp_EPTF_ExecCtrl_UIHandler_refreshRate_EntityResourcesTab; // default |
| v_ExecCtrl_UIHandler_refreshRate_targetCPS := tsp_EPTF_ExecCtrl_UIHandler_refreshRate_targetCPS; // default |
| v_ExecCtrl_UIHandler_refreshRate_currentCPS := tsp_EPTF_ExecCtrl_UIHandler_refreshRate_currentCPS; // default |
| v_ExecCtrl_UIHandler_refreshRate_regulatedItem := tsp_EPTF_ExecCtrl_UIHandler_refreshRate_regulatedItem; // default |
| |
| // initialize UI component |
| f_EPTF_UIHandlerClient_init_CT(pl_selfName, pl_uiHandler_compRef); // default altsteps |
| // if requested, window is cleared |
| // if(pl_newWindow){ |
| // f_EPTF_UIHandler_clearGUI(); |
| // f_EPTF_UIHandler_addWindow(); |
| // } |
| |
| f_EPTF_StatHandlerUI_init_CT( |
| pl_selfName, |
| "", //pl_uiParentWidgetId |
| pl_uiHandler_compRef, |
| pl_loggingUi_compRef |
| ); |
| f_EPTF_StatHandlerClientUI_init_CT(pl_selfName, self, pl_uiHandler_compRef, pl_loggingUi_compRef); |
| |
| // initialize ExecCtrl: |
| if (isvalue(pl_CLI_compRef)) { |
| var EPTF_CLI_CT vl_CLICompRef := valueof(pl_CLI_compRef); |
| if (vl_CLICompRef==null) { |
| // null: use UIHandler as CLI: |
| vl_CLICompRef := pl_uiHandler_compRef; |
| f_EPTF_ExecCtrl_UIHandler_debug(log2str(%definitionId, ": No CLI component is given, using the UIHandler (",vl_CLICompRef,") as CLI")); |
| } |
| if (pl_dataSource_compRef == null){ |
| f_EPTF_ExecCtrl_CLI_init_CT(pl_selfName, pl_nrOfClients, pl_createLGenPools, vl_CLICompRef, pl_commandPrefix, pl_loadModulepars, pl_autoStart := pl_autoStart, pl_dataSource_compRef := pl_uiHandler_compRef,pl_nofExternalStatHandlers:=pl_nofExternalStatHandlers,pl_usePullModeForStats:=pl_usePullModeForStats); |
| } else { |
| f_EPTF_ExecCtrl_CLI_init_CT(pl_selfName, pl_nrOfClients, pl_createLGenPools, vl_CLICompRef, pl_commandPrefix, pl_loadModulepars, pl_autoStart := pl_autoStart, pl_dataSource_compRef := pl_dataSource_compRef,pl_nofExternalStatHandlers:=pl_nofExternalStatHandlers,pl_usePullModeForStats:=pl_usePullModeForStats); |
| } |
| } else { |
| // omit: no CLI is used: |
| if (pl_dataSource_compRef == null){ |
| f_EPTF_ExecCtrl_CLI_init_CT(pl_selfName, pl_nrOfClients, pl_createLGenPools, null, pl_loadModulepars := pl_loadModulepars, pl_autoStart := pl_autoStart, pl_dataSource_compRef := pl_uiHandler_compRef,pl_nofExternalStatHandlers:=pl_nofExternalStatHandlers,pl_usePullModeForStats:=pl_usePullModeForStats); |
| } else { |
| f_EPTF_ExecCtrl_CLI_init_CT(pl_selfName, pl_nrOfClients, pl_createLGenPools, null, pl_loadModulepars := pl_loadModulepars, pl_autoStart := pl_autoStart, pl_dataSource_compRef := pl_dataSource_compRef,pl_nofExternalStatHandlers:=pl_nofExternalStatHandlers,pl_usePullModeForStats:=pl_usePullModeForStats); |
| } |
| } |
| f_EPTF_ExecCtrl_UIHandler_debug("f_EPTF_DataSourceClient_registerData: source:" & c_ExecCtrl_DataSource_sourceId & " ptcname: " & f_EPTF_Base_selfName()); |
| |
| v_EPTF_GUI_Main_Tabbox_WidgetId := pl_EPTF_GUI_Main_Tabbox_WidgetId; |
| // add automated GUI elements |
| //f_EPTF_ExecCtrl_UIHandler_createEmptyGui(v_EPTF_GUI_Main_Tabbox_WidgetId); |
| |
| t_ExecCtrl_UIHandler_readyToRun.start; |
| activate(as_EPTF_ExecCtrl_UIHandler_mainHandler()); |
| |
| f_EPTF_ExecCtrl_setRemoveStatisticsDependencyOfLGenCallback(refers(f_EPTF_ExecCtrl_removeStatisticsDependencyOfLGen)); |
| v_EPTF_ExecCtrl_UIHandler_guiDone := false; |
| v_ExecCtrl_pendingGuiDoneCounter := 0; |
| |
| f_EPTF_ExecCtrl_registerScenarioGroupPhaseChangedCallback(refers(f_EPTF_ExecCtrl_UIHandler_scenarioGroupPhaseChangedCallback)); |
| |
| if (tsp_EPTF_ExecCtrl_UIHandler_generateReport) { |
| f_EPTF_ExecCtrl_UIHandler_warning(log2str(%definitionId, ": tsp_EPTF_ExecCtrl_UIHandler_generateReport is outdated, please use tsp_EPTF_ExecCtrl_generateReport instead")); |
| } |
| |
| // initialize logging UI component (same as UI component) |
| // f_EPTF_LoggingUI_init_CT( |
| // "UIHandler", self, c_EPTF_GUI_Main_Tabbox_WidgetId); |
| |
| f_EPTF_Base_registerCleanup(refers(f_EPTF_ExecCtrl_UIHandler_cleanup_CT)); |
| |
| f_EPTF_ExecCtrl_setTimeFormat(tsp_EPTF_ExecCtrlUIHandler_timeFormat); // overwrite ExecCtrl setting |
| v_EPTF_ExecCtrl_UIHandler_initialized := true; |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "----- EPTF_ExecCtrl_UIHandler_CT INIT DONE -------"); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_checkGuiDone |
| // |
| // Purpose: |
| // Returns true when the creation of the GUI is finished |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // boolean - true when the creation of the GUI is finished |
| // |
| // Detailed Comments: |
| // |
| /////////////////////////////////////////////////////////// |
| public function f_EPTF_ExecCtrl_UIHandler_checkGuiDone() |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| return boolean { |
| return v_EPTF_ExecCtrl_UIHandler_guiDone; |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: as_EPTF_ExecCtrl_UIHandler_mainHandler |
| // |
| // Purpose: |
| // The main handler of the <EPTF_ExecCtrl_UIHandler_CT>. |
| /////////////////////////////////////////////////////////// |
| //altstep as_EPTF_ExecCtrl_UIHandler_mainHandler() runs on EPTF_ExecCtrl_UIHandler_CT { |
| // [] EPTF_guiPortIf.receive(tr_ASP_XTDP_exitTTCNButtonPressed) |
| // { |
| // f_EPTF_ExecCtrl_UIHandler_debug( |
| // "----- Exit button had been pressed ----"); |
| // } |
| // [] EPTF_guiPortIf.receive(tr_ASP_XTDP_snapshotButtonPressed) |
| // { |
| // f_EPTF_ExecCtrl_UIHandler_debug( |
| // "---- Snapshot button had been pressed ----") |
| // |
| // var charstring vl_layout := f_EPTF_UIHandler_snapshot(); |
| // f_EPTF_UIHandler_saveLayout(vl_layout); |
| // repeat; |
| // } |
| //} |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_cleanup_CT |
| // |
| // Purpose: |
| // This function should be registered as a cleanup function to properly shutdown the <EPTF_ExecCtrl_UIHandler_CT >component. |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // The function is registered by <f_EPTF_Base_registerCleanup> as a cleanup function in the init function for the EPTF_ExecCtrl_UIHandler_CT component. |
| // This function makes it possible to be able to shut down the |
| // <EPTF_ExecCtrl_UIHandler_CT> component gracefully. |
| // |
| /////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_cleanup_CT() runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| if (v_EPTF_ExecCtrl_UIHandler_initialized == false) { |
| return; |
| } |
| // deinitialize component |
| if (f_EPTF_ExecCtrl_UIHandler_ispresentGUI()) { |
| f_EPTF_UIHandlerClient_removeElementFromGUI(c_EPTF_GUI_Main_hbox_WidgetId); |
| } |
| |
| f_EPTF_ExecCtrl_setRemoveStatisticsDependencyOfLGenCallback(null); |
| v_EPTF_ExecCtrl_UIHandler_guiDone := false; |
| |
| v_EPTF_ExecCtrl_UIHandler_initialized := false; |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "----- EPTF_ExecCtrl_UIHandler_CT CLEANUP DONE -------"); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_setRefreshRates |
| // |
| // Purpose: |
| // Function to load custom refresh rates for GUI display |
| // |
| // Parameters: |
| // *in integer* - pl_refreshRate_ScGrpStatus - refresh rate for the Scenario group status LEDs |
| // *in integer* - pl_refreshRate_CPSChart - refresh rate for the CPS Chart |
| // *in integer* - pl_refreshRate_TCStats - refresh rate for the Traffic Case stats |
| // *in integer* - pl_refreshRate_TimeElapsed - refresh rate for the Time Elapsed text |
| // *in integer* - pl_refreshRate_EntityResourcesTab - refresh rate for the Entity resource data on the ClientResources tab |
| // *in integer* - pl_refreshRate_targetCPS - refresh rate for the target CPS values |
| // *in integer* - pl_refreshRate_currentCPS - refresh rate for the Current CPS values |
| // *in integer* - pl_refreshRate_regulatedItem - refresh rate for the RegulatedItems table on the Regulator tab |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // This function has to be called right after the init function, |
| // before the GUI is started to be created. |
| // Values corresponding to parameters not specified will not be updated |
| // |
| /////////////////////////////////////////////////////////// |
| public function f_EPTF_ExecCtrl_UIHandler_setRefreshRates( |
| in integer pl_refreshRate_ScGrpStatus := -1, // default value: keeps the refresh rate unchanged |
| in integer pl_refreshRate_CPSChart := -1, // default value: keeps the refresh rate unchanged |
| in integer pl_refreshRate_TCStats := -1, // default value: keeps the refresh rate unchanged |
| in integer pl_refreshRate_TimeElapsed := -1, // default value: keeps the refresh rate unchanged |
| in integer pl_refreshRate_EntityResourcesTab := -1, // default value: keeps the refresh rate unchanged |
| in integer pl_refreshRate_targetCPS := -1, // default value: keeps the refresh rate unchanged |
| in integer pl_refreshRate_currentCPS := -1, // default value: keeps the refresh rate unchanged |
| in integer pl_refreshRate_regulatedItem := -1 // default value: keeps the refresh rate unchanged |
| ) runs on EPTF_ExecCtrl_UIHandler_CT { |
| if (pl_refreshRate_ScGrpStatus!=-1) { |
| v_ExecCtrl_UIHandler_refreshRate_ScGrpStatus := pl_refreshRate_ScGrpStatus; |
| } |
| if (pl_refreshRate_CPSChart!=-1) { |
| v_ExecCtrl_UIHandler_refreshRate_CPSChart := pl_refreshRate_CPSChart; |
| } |
| if (pl_refreshRate_TCStats!=-1) { |
| v_ExecCtrl_UIHandler_refreshRate_TCStats := pl_refreshRate_TCStats; |
| } |
| if (pl_refreshRate_TimeElapsed!=-1) { |
| v_ExecCtrl_UIHandler_refreshRate_TimeElapsed := pl_refreshRate_TimeElapsed; |
| } |
| if (pl_refreshRate_EntityResourcesTab!=-1) { |
| v_ExecCtrl_UIHandler_refreshRate_EntityResourcesTab := pl_refreshRate_EntityResourcesTab; |
| } |
| if (pl_refreshRate_targetCPS!=-1) { |
| v_ExecCtrl_UIHandler_refreshRate_targetCPS := pl_refreshRate_targetCPS; |
| } |
| if (pl_refreshRate_currentCPS!=-1) { |
| v_ExecCtrl_UIHandler_refreshRate_currentCPS := pl_refreshRate_currentCPS; |
| } |
| if (pl_refreshRate_regulatedItem!=-1) { |
| v_ExecCtrl_UIHandler_refreshRate_regulatedItem := pl_refreshRate_regulatedItem; |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| /////////////////////////////////////////////////////////////////////////////// |
| /// |
| /// GUI layout creation functions |
| /// |
| |
| |
| /** |
| template WidgetList t_EPTF_ExecCtrl_labelAndFloatValue_WidgetList( |
| in charstring pl_textlabel, |
| in charstring pl_id, |
| in float pl_numericvalue := 0.0, |
| in boolean pl_readonly := true, |
| in float pl_flex := 1.0 |
| ) := { |
| { |
| hbox := { |
| id := pl_id&".main", |
| flex := pl_flex, |
| disabled := false, |
| orient := "horizontal", |
| widgets := { |
| { |
| textlabel := { |
| id := omit, |
| flex := 0.0, |
| disabled := false, |
| style := omit, |
| textvalue := pl_textlabel&":" |
| } |
| }, |
| { |
| spacer := { |
| flex := 0.5, |
| id := omit |
| } |
| }, |
| { |
| numericalwidget := { |
| id := pl_id, |
| flex := 1.0, |
| disabled := omit, |
| widgetType := floatField, |
| numericvalue:= pl_numericvalue, // initial value |
| readonly := pl_readonly, |
| spinner := omit, |
| slider := omit, |
| minvalue := omit, |
| maxvalue := omit, |
| stepsize := omit |
| } |
| } |
| } |
| } |
| } |
| } with { optional "implicit omit" }/*/ |
| |
| |
| /** |
| template WidgetList t_EPTF_ExecCtrl_labelAndIntegerValue_WidgetList( |
| in charstring pl_textlabel, |
| in charstring pl_id, |
| in float pl_numericvalue := 0.0, |
| in boolean pl_readonly := true, |
| in float pl_flex := 1.0 |
| ) := { |
| { |
| hbox := { |
| id := pl_id&".main", |
| flex := pl_flex, |
| disabled := false, |
| orient := "horizontal", |
| widgets := { |
| { |
| textlabel := { |
| id := omit, |
| flex := 0.0, |
| disabled := false, |
| style := omit, |
| textvalue := pl_textlabel&":" |
| } |
| }, |
| { |
| spacer := { |
| flex := 0.5, |
| id := omit |
| } |
| }, |
| { |
| numericalwidget := { |
| id := pl_id, |
| flex := 1.0, |
| disabled := omit, |
| widgetType := integerField, |
| numericvalue:= pl_numericvalue, // initial value |
| readonly := pl_readonly, |
| spinner := omit, |
| slider := omit, |
| minvalue := omit, |
| maxvalue := omit, |
| stepsize := omit |
| } |
| } |
| } |
| } |
| } |
| } with { optional "implicit omit" }/*/ |
| |
| |
| const charstring c_EPTF_ExecCtrl_UIHandler_led_initStr := "[led:black]NA"; |
| |
| |
| |
| // connects the widges on the Statistics tab to variables |
| private function f_EPTF_ExecCtrl_UIHandler_connectVarsToStatisticsTab() |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| // reset progressbar: |
| f_EPTF_ExecCtrl_updateProgressbar(0.0, "Loading current values"); |
| |
| var charstring vl_currentName; // name of variable to connect |
| var charstring vl_widgetId; // name of widgetId to connect to |
| var integer vl_idx; // index of var vl_currentName |
| |
| // go through all entity groups: |
| for(var integer eg:=0; eg<f_EPTF_ExecCtrl_numEntityGroups(); eg:=eg+1) { |
| var charstring vl_eGrpName := f_EPTF_ExecCtrl_eGrp_name(eg); |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".nofLGens"; |
| vl_currentName := vl_widgetId; |
| |
| // count number of LGens deployed on: |
| var integer vl_numLGensDeployed:=0; |
| var EPTF_ExecCtrl_EntityGroupDistributionList vl_lgenList := f_EPTF_ExecCtrl_eGrp_lgenList(eg); |
| for(var integer lg:=0; lg<sizeof(vl_lgenList);lg:=lg+1) { |
| if (vl_lgenList[lg].eCount == 0 ) { |
| continue; // nothing to do |
| } |
| vl_numLGensDeployed:=vl_numLGensDeployed+1; |
| } |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / EntityGroups / nofLGens) connected to widgetId: "&vl_widgetId |
| ); |
| |
| //number of active entities: |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".nofActiveEntities"; |
| vl_currentName := vl_widgetId; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / EntityGroups / nofLGens) connected to nofActiveEntities: "&vl_widgetId |
| ); |
| |
| } |
| |
| // go through all scenarios: |
| for(var integer sc:=0; sc<f_EPTF_ExecCtrl_numScenarios(); sc:=sc+1) { |
| f_EPTF_ExecCtrl_updateProgressbar(100.0/int2float(f_EPTF_ExecCtrl_numScenarios())); |
| |
| var integer vl_eGrpIdx := f_EPTF_ExecCtrl_getScenarioEGroupIdx(sc); |
| var charstring vl_eGrpName := f_EPTF_ExecCtrl_eGrp_name(vl_eGrpIdx); |
| var charstring vl_scTypeName := f_EPTF_ExecCtrl_getScenarioName(sc); |
| var charstring vl_scName := f_EPTF_ExecCtrl_getScenarioInstanceName(sc); |
| |
| // Scenario status |
| vl_currentName := "ExecCtrl.scenarioStatus."&vl_eGrpName&"."&vl_scTypeName; |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".StatusLED"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Scenario status) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| |
| // Scenario TargetCPS |
| if (f_EPTF_ExecCtrl_isWeightedScenario(sc)) { |
| vl_currentName := "Traffic.ScenarioCPS." & vl_eGrpName&"."& int2str(sc); |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TargetCPS"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| sampledAtSync,v_ExecCtrl_UIHandler_refreshRate_targetCPS); // referred variable |
| |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId&".main"); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Scenario TargetCPS) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| |
| // regulator: |
| if (f_EPTF_ExecCtrl_Regulator_getNofRegulators()>0) { |
| var charstring vl_regulatorName := ""; |
| vl_currentName := "Traffic.Regulator." & vl_eGrpName&"."& int2str(sc); |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TargetCPSRegulator.Name"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Scenario TargetCPS regulator) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| } |
| |
| } // if f_EPTF_ExecCtrl_isWeightedScenario(sidx) |
| |
| // scenario group: |
| if (not f_EPTF_ExecCtrl_scenarioIsNotInScenarioGroup(sc)) { |
| var integer vl_scGrpIdx := f_EPTF_ExecCtrl_ScenarioGroup_get_byScIndex(sc); |
| var charstring vl_scGrpName := f_EPTF_ExecCtrl_getScenarioGroupInstanceName(vl_scGrpIdx); |
| |
| // StartPhase: |
| vl_currentName := "Var."&f_EPTF_ExecCtrl_UIVars_getScenarioGroupTableName_FromScenarioGroupDB(vl_scGrpIdx) & ".GroupPhase"; |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".SCGrp."&vl_scGrpName&".StartPhase"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Scenario group StartPhase) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| // Mode: |
| vl_currentName := "Var."&f_EPTF_ExecCtrl_UIVars_getScenarioGroupTableName_FromScenarioGroupDB(vl_scGrpIdx) & ".GroupMode"; |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".SCGrp."&vl_scGrpName&".Mode"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Scenario group StartPhase) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| // GroupStatusLED: |
| vl_currentName := "Var."&f_EPTF_ExecCtrl_UIVars_getScenarioGroupTableName_FromScenarioGroupDB(vl_scGrpIdx) & ".GroupStatus"; |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".SCGrp."&vl_scGrpName&".GroupStatusLED"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); // TR HQ88308 -> sampledAtSync,v_ExecCtrl_UIHandler_refreshRate_ScGrpStatus); // realtime does not work |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Scenario group status) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| |
| // GroupStart |
| vl_currentName := "Var."&f_EPTF_ExecCtrl_UIVars_getScenarioGroupTableName_FromScenarioGroupDB(vl_scGrpIdx) & ".GroupStart"; |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".SCGrp."&vl_scGrpName&".GroupStart"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Scenario group start) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| |
| // TerminateGroup |
| vl_currentName := "Var."&f_EPTF_ExecCtrl_UIVars_getScenarioGroupTableName_FromScenarioGroupDB(vl_scGrpIdx) & ".TerminateGroup"; |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".SCGrp."&vl_scGrpName&".TerminateGroup"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Scenario group stop) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| |
| // GroupReset |
| vl_currentName := "Var."&f_EPTF_ExecCtrl_UIVars_getScenarioGroupTableName_FromScenarioGroupDB(vl_scGrpIdx) & ".GroupReset"; |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".SCGrp."&vl_scGrpName&".GroupReset"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Scenario group reset) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| |
| // ScenarioStatusLED |
| vl_currentName := "Var."&f_EPTF_ExecCtrl_UIVars_getScenarioGroupTableName_FromScenarioGroupDB(vl_scGrpIdx) &"."&vl_scName& ".ScenarioStatus"; |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".SCGrp."&vl_scGrpName&".ScenarioStatusLED"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); // TR HQ88308 -> sampledAtSync,v_ExecCtrl_UIHandler_refreshRate_ScGrpStatus); // realtime does not work |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Scenario status in scenariogroup) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| } |
| |
| // Control buttons (start/stop/reset): |
| // start scenario button: |
| //vl_currentName := "ExecCtrl.startScenario."&vl_eGrpName&"."&vl_scTypeName; // this is the name in the TrafficCase table |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".ControlButtons.Start"; |
| vl_currentName := vl_widgetId; |
| |
| vl_idx := f_EPTF_Var_getId(vl_currentName); |
| f_EPTF_Var_addPostProcFn( |
| vl_idx, { refers(f_EPTF_ExecCtrl_UIHandler_startScenario), {sc}} ); |
| |
| f_EPTF_UIHandlerClient_subscribeMe( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| // stop scenario button: |
| //vl_currentName := "ExecCtrl.stopScenario."&vl_eGrpName&"."&vl_scTypeName; // this is the name in the TrafficCase table |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".ControlButtons.Stop"; |
| vl_currentName := vl_widgetId; |
| |
| vl_idx := f_EPTF_Var_getId(vl_currentName); |
| f_EPTF_Var_addPostProcFn( |
| vl_idx, { refers(f_EPTF_ExecCtrl_UIHandler_stopScenario), {sc}} ); |
| |
| f_EPTF_UIHandlerClient_subscribeMe( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| // call f_EPTF_ExecCtrl_UIHandler_startStopScenario_scenarioStateChangedCallback to initialize button status: |
| vl_currentName := "ExecCtrl.scenarioStatus."&vl_eGrpName&"."&vl_scTypeName; |
| vl_idx := f_EPTF_Var_getId(vl_currentName); |
| if (vl_idx != -1) { |
| var EPTF_StatusLED vl_EPTF_StatusLED := f_EPTF_Var_getStatusLEDValue(vl_idx); |
| f_EPTF_ExecCtrl_UIHandler_startStopScenario_scenarioStateChangedCallback(vl_eGrpName,vl_scTypeName,vl_EPTF_StatusLED.text); |
| } |
| |
| // reset scenario button: |
| //vl_currentName := "ExecCtrl.startScenario."&vl_eGrpName&"."&vl_scTypeName; // this is the name in the TrafficCase table |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".ControlButtons.Reset"; |
| vl_currentName := vl_widgetId; |
| |
| vl_idx := f_EPTF_Var_getId(vl_currentName); |
| f_EPTF_Var_addPostProcFn( |
| vl_idx, { refers(f_EPTF_ExecCtrl_UIHandler_resetScenario), {sc}} ); |
| |
| f_EPTF_UIHandlerClient_subscribeMe( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| // connect traffic case widgets: |
| for(var integer tc:=0; tc<f_EPTF_ExecCtrl_getScenarioTcIdxListSize(sc); tc:=tc+1) { |
| var integer vl_tcIdx := f_EPTF_ExecCtrl_getScenarioTcIdx(sc,tc); |
| var charstring vl_tcName := f_EPTF_ExecCtrl_tcNameOfTcOfSc(sc,tc) |
| |
| // traffic case GroupFinishStatusLED: |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TC."&vl_tcName&".GroupFinishStatusLED"; |
| vl_currentName := vl_widgetId; |
| |
| f_EPTF_UIHandlerClient_subscribeMe( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Traffic case group finish status) connected to widgetId: "&vl_widgetId |
| ); |
| |
| // traffic case StatusLED on scenario tab: |
| vl_currentName := "ExecCtrl.trafficCaseStatus."&vl_eGrpName&"."&vl_scTypeName&"."&vl_tcName; |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".tcStatusLEDs"&".TC."&vl_tcName&".StatusLED"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime);//sampledAtSync); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / ScenarioTab / Traffic case status) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| |
| // traffic case StatusLED on traffic case tab: |
| // vl_currentName is the same! |
| //vl_currentName := "ExecCtrlClient.trafficCaseStatus."&vl_eGrpName&"."&vl_scTypeName&"."&vl_tcName; |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TC."&vl_tcName&".StatusLED"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime);//sampledAtSync); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Traffic case status) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| |
| // traffic case start checkbox on scenario tab: |
| vl_currentName := "ExecCtrl.startTC."&vl_eGrpName&"."&vl_scTypeName&"."&vl_tcName; |
| |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".tcStatusLEDs"&".TC."&vl_tcName&".Start"; |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime);//sampledAtSync); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Scenario / Traffic case start) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| |
| // traffic case start checkbox on traffic case tab: |
| // vl_currentName is the same! |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TC."&vl_tcName&".Start"; |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime);//sampledAtSync); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Traffic case start) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| // traffic case stop checkbox on scenario tab: |
| vl_currentName := "ExecCtrl.stopTC."&vl_eGrpName&"."&vl_scTypeName&"."&vl_tcName; |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".tcStatusLEDs"&".TC."&vl_tcName&".Stop"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime);//sampledAtSync); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Scenario / Traffic case stop) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| |
| // traffic case stop checkbox on traffic case tab: |
| // vl_currentName is the same! |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TC."&vl_tcName&".Stop"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime);//sampledAtSync); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Traffic case stop) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| |
| // TargetCPSOrWeight: |
| vl_currentName := "Traffic.TCCPS." & vl_eGrpName&"."& int2str(sc) & "." & int2str(tc); |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TC."&vl_tcName&".TargetCPSOrWeight"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Traffic case targetCPS or weight) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| |
| // regulator: |
| if (f_EPTF_ExecCtrl_Regulator_getNofRegulators()>0) { |
| var charstring vl_regulatorName := ""; |
| vl_currentName := "Traffic.Regulator." & vl_eGrpName&"."& int2str(sc)&"."&int2str(tc); |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TC."&vl_tcName&".TargetCPSRegulator.Name"; |
| |
| if (f_EPTF_Var_getId(vl_currentName) != -1) { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Scenario TargetCPS regulator) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| } |
| f_EPTF_ExecCtrl_UIHandler_connectVarsToStatisticsTabForTc(vl_tcIdx); |
| } // for tc |
| f_EPTF_ExecCtrl_UIHandler_createStatsForSc(sc); |
| } // for sc |
| //f_EPTF_ExecCtrl_UIHandler_createStatsForAllTcs(); |
| } |
| |
| // private function f_EPTF_ExecCtrl_UIHandler_createStatsForAllTcs_vars() runs on EPTF_ExecCtrl_UIHandler_CT { |
| // f_EPTF_ExecCtrl_updateProgressbar(0.0, "Creating traffic case statistics"); |
| // for(var integer tcidx:=0; tcidx<f_EPTF_ExecCtrl_numTrafficCases(); tcidx:=tcidx+1) { |
| // f_EPTF_ExecCtrl_updateProgressbar(100.0/int2float(f_EPTF_ExecCtrl_numTrafficCases())); |
| // f_EPTF_ExecCtrl_UIHandler_connectVarsToStatisticsTabForTc_vars(tcidx); |
| // } |
| // } |
| // |
| // private function f_EPTF_ExecCtrl_UIHandler_createStatsForAllTcs() runs on EPTF_ExecCtrl_UIHandler_CT { |
| // f_EPTF_ExecCtrl_updateProgressbar(0.0, "Loading traffic case statistics"); |
| // for(var integer tcidx:=0; tcidx<f_EPTF_ExecCtrl_numTrafficCases(); tcidx:=tcidx+1) { |
| // f_EPTF_ExecCtrl_updateProgressbar(100.0/int2float(f_EPTF_ExecCtrl_numTrafficCases())); |
| // f_EPTF_ExecCtrl_UIHandler_connectVarsToStatisticsTabForTc(tcidx); |
| // } |
| // } |
| |
| private function f_EPTF_ExecCtrl_UIHandler_createStatsForSc(in integer pl_scIdx) |
| runs on EPTF_ExecCtrl_UIHandler_CT { |
| if (not f_EPTF_ExecCtrl_isWeightedScenario(pl_scIdx)) { |
| return; // for non-weighted scenarios there is no CPS stat |
| } |
| var integer vl_eGrpIdx := f_EPTF_ExecCtrl_getScenarioEGroupIdx(pl_scIdx); |
| |
| var charstring vl_eGrpName := f_EPTF_ExecCtrl_eGrp_name(vl_eGrpIdx); |
| var charstring vl_scTypeName := f_EPTF_ExecCtrl_getScenarioName(pl_scIdx); |
| var charstring vl_scName := f_EPTF_ExecCtrl_getScenarioInstanceName(pl_scIdx); |
| var charstring vl_namePrefix := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName; |
| var charstring vl_statName; |
| |
| // declare stats: |
| f_EPTF_ExecCtrl_UIHandler_debug("Declaring SC statistics for "&vl_namePrefix); |
| |
| // CurrentCPS: |
| vl_statName := vl_namePrefix&".CurrentCPS"; |
| if(not f_EPTF_StatHandlerClientUI_bindStatToWidget( |
| pl_statName := vl_statName, |
| pl_widgetId := vl_statName, |
| pl_statHandler_compRef := self, |
| pl_wait4response := true, |
| pl_subscriptionMode := sampledAtSync, |
| pl_refreshRate := v_ExecCtrl_UIHandler_refreshRate_currentCPS |
| )) {/*cannot happen*/}; |
| } |
| |
| private function f_EPTF_ExecCtrl_UIHandler_createStatsForTc(in integer pl_tcIdx) |
| runs on EPTF_ExecCtrl_UIHandler_CT { |
| var integer vl_scIdx := f_EPTF_ExecCtrl_getScenarioIdxForTc(pl_tcIdx); |
| var integer vl_tcOfScenarioIdx := f_EPTF_ExecCtrl_getTcOfScenarioIdx(pl_tcIdx); |
| var integer vl_eGrpIdx := f_EPTF_ExecCtrl_getScenarioEGroupIdx(vl_scIdx); |
| |
| var charstring vl_eGrpName := f_EPTF_ExecCtrl_eGrp_name(vl_eGrpIdx); |
| var charstring vl_scTypeName := f_EPTF_ExecCtrl_getScenarioName(vl_scIdx); |
| var charstring vl_tcName := f_EPTF_ExecCtrl_tcNameOfTcOfSc(vl_scIdx,vl_tcOfScenarioIdx) |
| var charstring vl_namePrefix := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TC."&vl_tcName; |
| var charstring vl_statName; |
| |
| // declare stats: |
| f_EPTF_ExecCtrl_UIHandler_debug("Declaring TC statistics for "&vl_namePrefix); |
| |
| // CurrentCPS: |
| vl_statName := vl_namePrefix&"."&c_EPTF_ExecCtrl_tcStatNames[c_EPTF_ExecCtrl_tcStatId_CurrentCPS]; // c_EPTF_ExecCtrl_tcStatId_CurrentCPS == 0 |
| if(not f_EPTF_StatHandlerClientUI_bindStatToWidget( |
| pl_statName := vl_statName, |
| pl_widgetId := vl_statName, |
| pl_statHandler_compRef := self, |
| pl_wait4response := true, |
| pl_subscriptionMode := sampledAtSync, |
| pl_refreshRate := v_ExecCtrl_UIHandler_refreshRate_currentCPS |
| )) { |
| f_EPTF_ExecCtrl_UIHandler_error(log2str(%definitionId&": Cannot bind Stat ", vl_statName, " To Widget: ", vl_statName)); |
| } |
| |
| // all integer stats except CurrentCPS and ExecTime |
| for(var integer st:=0; st<sizeof(c_EPTF_ExecCtrl_tcStatNames);st:=st+1) { |
| if (st==c_EPTF_ExecCtrl_tcStatId_CurrentCPS |
| or st==c_EPTF_ExecCtrl_tcStatId_ExecTime) { |
| continue; // they are handled differently |
| } |
| vl_statName := vl_namePrefix&"."&c_EPTF_ExecCtrl_tcStatNames[st]; |
| if(not f_EPTF_StatHandlerClientUI_bindStatToWidget( |
| pl_statName := vl_statName, |
| pl_widgetId := vl_statName, |
| pl_statHandler_compRef := self, |
| pl_wait4response := true, |
| pl_subscriptionMode := sampledAtSync, |
| pl_refreshRate := v_ExecCtrl_UIHandler_refreshRate_TCStats |
| )) { |
| f_EPTF_ExecCtrl_UIHandler_error(log2str(%definitionId&": Cannot bind Stat ", vl_statName, " To Widget: ", vl_statName)); |
| }; |
| } |
| } |
| |
| |
| private function f_EPTF_ExecCtrl_UIHandler_createStatsForTcCPSChart(in integer pl_tcIdx) |
| runs on EPTF_ExecCtrl_UIHandler_CT { |
| var integer vl_scIdx := f_EPTF_ExecCtrl_getScenarioIdxForTc(pl_tcIdx); |
| var integer vl_tcOfScenarioIdx := f_EPTF_ExecCtrl_getTcOfScenarioIdx(pl_tcIdx); |
| var integer vl_eGrpIdx := f_EPTF_ExecCtrl_getScenarioEGroupIdx(vl_scIdx); |
| |
| var charstring vl_eGrpName := f_EPTF_ExecCtrl_eGrp_name(vl_eGrpIdx); |
| var charstring vl_scTypeName := f_EPTF_ExecCtrl_getScenarioName(vl_scIdx); |
| var charstring vl_tcName := f_EPTF_ExecCtrl_tcNameOfTcOfSc(vl_scIdx,vl_tcOfScenarioIdx) |
| var charstring vl_namePrefix := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TC."&vl_tcName; |
| var charstring vl_statName,vl_currentName,vl_widgetId; |
| |
| if (tsp_EPTF_ExecCtrl_UIHandler_noCPSChart) { |
| f_EPTF_UIHandlerClient_removeElementFromGUI(c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TC."&vl_tcName&".TrafficCaseStats.CPSChart.tab"); |
| return; |
| } |
| |
| // CurrentCPS: |
| vl_statName := vl_namePrefix&"."&c_EPTF_ExecCtrl_tcStatNames[c_EPTF_ExecCtrl_tcStatId_CurrentCPS]; // c_EPTF_ExecCtrl_tcStatId_CurrentCPS == 0 |
| |
| // bind CurrentCPS to chart widget: |
| if(not f_EPTF_StatHandlerClientUI_bindStatToWidget( |
| pl_statName := vl_statName, |
| pl_widgetId := vl_namePrefix&".CPSChart.currentCPS", |
| pl_statHandler_compRef := self, |
| pl_wait4response := true, |
| pl_additionalWidget := true, |
| pl_subscriptionMode := sampledAtSync, |
| pl_refreshRate := v_ExecCtrl_UIHandler_refreshRate_CPSChart |
| )) { |
| f_EPTF_ExecCtrl_UIHandler_error(log2str(%definitionId&": Cannot bind Stat ", vl_statName, " To Widget: ", vl_statName)); |
| } |
| |
| // bind TargetCPS to chart widget: |
| if (f_EPTF_ExecCtrl_isWeightedScenario(vl_scIdx)) { |
| // weighted scenario: |
| vl_currentName := "Traffic.ScenarioCPS." & vl_eGrpName&"."& int2str(vl_scIdx); |
| |
| } else { |
| // non-weighted scenario: |
| vl_currentName := "Traffic.TCCPS." & vl_eGrpName&"."& int2str(vl_scIdx) & "." & int2str(vl_tcOfScenarioIdx); |
| } |
| vl_widgetId := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TC."&vl_tcName&".CPSChart.targetCPS"; |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Variable "&vl_currentName&" (Statistics / Traffic case CPSChart.targetCPS or weight) connected to widgetId: "&vl_widgetId |
| ); |
| } |
| |
| private function f_EPTF_ExecCtrl_UIHandler_createVarsForGroupFinishCondStatusLEDsForTc(in integer pl_tcIdx) runs on EPTF_ExecCtrl_UIHandler_CT { |
| var integer vl_scIdx := f_EPTF_ExecCtrl_getScenarioIdxForTc(pl_tcIdx); |
| var integer vl_tcOfScenarioIdx := f_EPTF_ExecCtrl_getTcOfScenarioIdx(pl_tcIdx); |
| var integer vl_eGrpIdx := f_EPTF_ExecCtrl_getScenarioEGroupIdx(vl_scIdx); |
| |
| var charstring vl_eGrpName := f_EPTF_ExecCtrl_eGrp_name(vl_eGrpIdx); |
| var charstring vl_scTypeName := f_EPTF_ExecCtrl_getScenarioName(vl_scIdx); |
| var charstring vl_tcName := f_EPTF_ExecCtrl_tcNameOfTcOfSc(vl_scIdx,vl_tcOfScenarioIdx) |
| var charstring vl_namePrefix := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TC."&vl_tcName; |
| |
| var charstring vl_currentName; // name of variable to connect |
| var charstring vl_widgetId; // name of widgetId to connect to |
| var integer vl_idx; // index of vars |
| |
| |
| // create GroupFinishCondStatusLED for all groupFinisih conditions: |
| for(var integer st:=0; st<sizeof(c_EPTF_ExecCtrl_tcStatNames);st:=st+1) { |
| var EPTF_ExecCtrl_GrpFinishConditionType vl_grpFinishConditionType := f_EPTF_ExecCtrl_UIVars_tcStatId2GrpFinishConditionType(st); |
| if (vl_grpFinishConditionType == c_EPTF_ExecCtrl_groupFinishConditionUnknown) { |
| continue; // no conditions for these stats |
| } |
| |
| // GroupFinishCondStatusLED: |
| vl_widgetId := vl_namePrefix&".GroupFinishCondStatusLED."&c_EPTF_ExecCtrl_tcStatNames[st]; |
| vl_currentName := vl_widgetId; |
| |
| f_EPTF_UIHandlerClient_subscribeMe( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| } |
| } |
| |
| private function f_EPTF_ExecCtrl_UIHandler_connectVarsToStatisticsTabForTc(in integer pl_tcIdx) |
| runs on EPTF_ExecCtrl_UIHandler_CT { |
| var integer vl_scIdx := f_EPTF_ExecCtrl_getScenarioIdxForTc(pl_tcIdx); |
| var integer vl_tcOfScenarioIdx := f_EPTF_ExecCtrl_getTcOfScenarioIdx(pl_tcIdx); |
| var integer vl_eGrpIdx := f_EPTF_ExecCtrl_getScenarioEGroupIdx(vl_scIdx); |
| |
| var charstring vl_eGrpName := f_EPTF_ExecCtrl_eGrp_name(vl_eGrpIdx); |
| var charstring vl_scTypeName := f_EPTF_ExecCtrl_getScenarioName(vl_scIdx); |
| var charstring vl_tcName := f_EPTF_ExecCtrl_tcNameOfTcOfSc(vl_scIdx,vl_tcOfScenarioIdx) |
| var charstring vl_namePrefix := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TC."&vl_tcName; |
| |
| var charstring vl_currentName; // name of variable to connect |
| var charstring vl_widgetId; // name of widgetId to connect to |
| var integer vl_eIdx_Idx, vl_enableLog_Idx, vl_idx; // index of vars |
| |
| // entityStats: |
| f_EPTF_ExecCtrl_UIHandler_createStatsForTc(pl_tcIdx); |
| |
| // CPS Chart: |
| f_EPTF_ExecCtrl_UIHandler_createStatsForTcCPSChart(pl_tcIdx); |
| |
| // group finish conditions: |
| f_EPTF_ExecCtrl_UIHandler_createVarsForGroupFinishCondStatusLEDsForTc(pl_tcIdx); |
| |
| // ExecTime: |
| vl_widgetId := vl_namePrefix&".ExecTime"; |
| vl_currentName := vl_widgetId; |
| |
| vl_idx := f_EPTF_ExecCtrl_getTrafficCaseExecTimeStatId(pl_tcIdx); |
| |
| f_EPTF_UIHandlerClient_subscribeMe( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| sampled,v_ExecCtrl_UIHandler_refreshRate_TCStats); |
| |
| // single shot params/button |
| |
| // entity index: |
| vl_widgetId := vl_namePrefix&".SingleShotTc.EIdx"; |
| vl_currentName := vl_widgetId; |
| |
| f_EPTF_UIHandlerClient_subscribeMe( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| // enableLog checkbox: |
| vl_widgetId := vl_namePrefix&".SingleShotTc.EnableLog"; |
| vl_currentName := vl_widgetId; |
| |
| f_EPTF_UIHandlerClient_subscribeMe( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| // singleShot button: |
| vl_widgetId := vl_namePrefix&".SingleShotTc.Start"; |
| vl_currentName := vl_widgetId; |
| |
| f_EPTF_UIHandlerClient_subscribeMe( |
| vl_currentName, |
| "GUI." & vl_widgetId, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| |
| } |
| |
| |
| // removes the status depency of scenario and traffic case statistics that |
| // the LGen was used |
| private function f_EPTF_ExecCtrl_removeStatisticsDependencyOfLGen(in integer pl_lgenIdx) |
| runs on EPTF_ExecCtrl_UIHandler_CT { |
| f_EPTF_Base_assert(%definitionId&": Invalid LGen index "&int2str(pl_lgenIdx)& |
| ". Valid index range: (0.."&int2str(f_EPTF_ExecCtrl_numLGens()-1)&").", |
| pl_lgenIdx >= 0 and pl_lgenIdx < f_EPTF_ExecCtrl_numLGens()); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug(%definitionId&": Deregistering statistics sources in of LGen: "& f_EPTF_ExecCtrl_getLGenName(pl_lgenIdx)); |
| |
| |
| // remove its status(LED) dependency from the scenario/traffic case status(LED)s it was running: |
| // go through the scenarios/traffic cases of this LGen: |
| for(var integer eg:=0; eg<f_EPTF_ExecCtrl_getLGenNumEGroups(pl_lgenIdx);eg:=eg+1) { |
| var integer vl_eGrpIdx := f_EPTF_ExecCtrl_getLGenEGrpIdx(pl_lgenIdx,eg); |
| var integer vl_lgenIdxInEGrp := f_EPTF_ExecCtrl_getLGenIdxInEGrp(pl_lgenIdx,eg); |
| |
| var EPTF_ExecCtrl_EntityGroupDistributionList vl_lgenList := f_EPTF_ExecCtrl_eGrp_lgenList(vl_eGrpIdx); |
| if (vl_lgenList[vl_lgenIdxInEGrp].eCount == 0 ) { |
| continue; // do not send packet to LGen if there is no entity on the LGen |
| } |
| |
| // go through all scenarios: |
| var EPTF_IntegerList vl_eGrpScenarios := f_EPTF_ExecCtrl_eGrp_scenarios(vl_eGrpIdx); |
| for(var integer sc:=0; sc<sizeof(vl_eGrpScenarios);sc:=sc+1) { |
| var integer vl_scIdx := vl_eGrpScenarios[sc]; |
| |
| var charstring vl_clientVarName; |
| var charstring vl_varName; |
| var integer vl_clientVarIdx; |
| var integer vl_mainVarIdx |
| // go through the traffic cases of the scenario: |
| for(var integer tc:=0; tc<f_EPTF_ExecCtrl_getScenarioTcIdxListSize(vl_scIdx); tc:=tc+1) { |
| var integer vl_tcOfScenarioIdx := tc; |
| |
| // remove traffic case status dependency: |
| // register sources: |
| // name of source variable on the LGen: |
| var charstring vl_eGrpName := f_EPTF_ExecCtrl_eGrp_name(vl_eGrpIdx); |
| var charstring vl_scTypeName := f_EPTF_ExecCtrl_getScenarioName(vl_scIdx); |
| var charstring vl_tcName := f_EPTF_ExecCtrl_tcNameOfTcOfSc(vl_scIdx,tc) |
| var charstring vl_lgenDataSourceVarName := f_EPTF_LGenBaseStats_getNamePrefix(vl_eGrpName,vl_scTypeName,vl_tcName); |
| var charstring vl_namePrefix := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".TC."&vl_tcName; |
| |
| // all TC stats |
| for(var integer st:=0; st<sizeof(c_EPTF_ExecCtrl_tcStatNames);st:=st+1) { |
| if (st==c_EPTF_ExecCtrl_tcStatId_ExecTime) { |
| continue; // it is handled differently |
| } |
| var charstring vl_statName := vl_namePrefix&"."&c_EPTF_ExecCtrl_tcStatNames[st]; |
| f_EPTF_StatHandlerClient_deregisterStat( |
| pl_statName := vl_statName, |
| pl_sourceCompRef := f_EPTF_Var_downcast(f_EPTF_Base_downcast(f_EPTF_ExecCtrl_getLGenCompRef(pl_lgenIdx))) |
| ); |
| } |
| |
| // remove SC statistics dependency: |
| // CurrentCPS |
| if (f_EPTF_ExecCtrl_isWeightedScenario(vl_scIdx)) { |
| vl_namePrefix := c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName; |
| var charstring vl_statName := vl_namePrefix&"."&c_EPTF_ExecCtrl_tcStatNames[c_EPTF_ExecCtrl_tcStatId_CurrentCPS]; |
| // for non-weighted scenarios there is no CPS stat |
| f_EPTF_StatHandlerClient_deregisterStat( |
| pl_statName := vl_statName, |
| pl_sourceCompRef := f_EPTF_Var_downcast(f_EPTF_Base_downcast(f_EPTF_ExecCtrl_getLGenCompRef(pl_lgenIdx))) |
| ); |
| } |
| } // for tc |
| } // for sc |
| } // for eg |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_SubscribeVars2GUI |
| // |
| // Purpose: |
| // Subscribes execution control related variables to GUI |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // Execution control related params and statistics handled here |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_SubscribeVars2GUI() |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| // Subscribe for entity group widgets |
| // f_EPTF_ExecCtrl_UIHandler_WaitingForDynamicGUI( |
| // c_EPTF_ExecCtrl_EntityGrpTabId); |
| f_EPTF_ExecCtrl_UIHandler_SubscribeVars2EntityGroupsTab(); |
| |
| // Subscribe for resource widgets |
| // f_EPTF_ExecCtrl_UIHandler_WaitingForDynamicGUI( |
| // c_EPTF_ExecCtrl_ResourceTabId); |
| f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ResourceTab(); |
| |
| // Subscribe for EntityGroupDistribution widgets |
| // f_EPTF_ExecCtrl_UIHandler_WaitingForDynamicGUI( |
| // c_EPTF_ExecCtrl_GroupDistributionTabId); |
| f_EPTF_ExecCtrl_UIHandler_SubscribeVars2EGrpDistributionTab(); |
| |
| // Subscribe for scenario and traffic case widgets |
| // f_EPTF_ExecCtrl_UIHandler_WaitingForDynamicGUI( |
| // c_EPTF_ExecCtrl_TrafficTabId_Scenario); |
| // f_EPTF_ExecCtrl_UIHandler_WaitingForDynamicGUI( |
| // c_EPTF_ExecCtrl_TrafficTabId_TC); |
| f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ScenarioTab(); |
| |
| // Subscribe for Regulated Items case widgets |
| f_EPTF_ExecCtrl_UIHandler_SubscribeVars2RegulatedItemsTab(); |
| f_EPTF_ExecCtrl_UIHandler_SubscribeVars2RegulatorsTargetValueTab(); |
| |
| } |
| |
| |
| |
| private function f_EPTF_ExecCtrl_appendScenarioGroups() |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| for (var integer i:=0; i<f_EPTF_ExecCtrl_getScenarioGroupInstanceDataNum(); i:=i+1) |
| { |
| f_EPTF_ExecCtrl_updateProgressbar(50.0/int2float(f_EPTF_ExecCtrl_getScenarioGroupInstanceDataNum())); |
| } |
| } |
| |
| |
| |
| private function f_EPTF_ExecCtrl_UIHandler_Subscribe2TimeElapsed() runs on EPTF_ExecCtrl_UIHandler_CT { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| f_EPTF_UIHandlerClient_subscribeMe( |
| c_EPTF_ExecCtrl_TimeElapsed, |
| "GUI." & c_EPTF_ExecCtrl_TimeElapsed, |
| c_EPTF_runtimeGuiTimeElapsedWidgetId, |
| sampledAtSync,v_ExecCtrl_UIHandler_refreshRate_TimeElapsed); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (Time elapsed) name: " |
| &c_EPTF_ExecCtrl_TimeElapsed); |
| |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_Subscribe2ExitButton |
| // |
| // Purpose: |
| // Subscribe variable to exit button and adds test management |
| // post processing functions |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_Subscribe2ExitButton() runs on EPTF_ExecCtrl_UIHandler_CT { |
| // Exit button |
| f_EPTF_UIHandlerClient_subscribeMe( |
| c_EPTF_ExecCtrl_Exit, |
| "GUI." & c_EPTF_ExecCtrl_Exit, |
| c_EPTF_runtimeGuiExitButtonWidgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (Exit button) name: " |
| &c_EPTF_ExecCtrl_Exit); |
| |
| f_EPTF_UIHandlerClient_enableGUIElement( |
| c_EPTF_runtimeGuiExitButtonWidgetId); |
| |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_Subscribe2TestMgmtButtons |
| // |
| // Purpose: |
| // Subscribe variables to test management buttons and adds test management |
| // post processing functions |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_Subscribe2TestMgmtButtons() |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| var integer vl_idx; |
| |
| // Start button |
| vl_idx := f_EPTF_Var_getId(c_EPTF_ExecCtrl_Start); |
| f_EPTF_Var_addPostProcFn( |
| vl_idx, { refers(f_EPTF_ExecCtrl_UIHandler_start), {}} ); |
| f_EPTF_UIHandlerClient_subscribeMe( |
| c_EPTF_ExecCtrl_Start, |
| "GUI." & c_EPTF_ExecCtrl_Start, |
| c_EPTF_runtimeGuiStartTestButtonWidgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (Start button) name: " |
| &c_EPTF_ExecCtrl_Start); |
| |
| // Stop button |
| vl_idx := f_EPTF_Var_getId(c_EPTF_ExecCtrl_Stop); |
| f_EPTF_Var_addPostProcFn( |
| vl_idx, { refers(f_EPTF_ExecCtrl_UIHandler_stop), {}} ); |
| f_EPTF_UIHandlerClient_subscribeMe( |
| c_EPTF_ExecCtrl_Stop, |
| "GUI." & c_EPTF_ExecCtrl_Stop, |
| c_EPTF_runtimeGuiStopTestButtonWidgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (Stop button) name: " |
| &c_EPTF_ExecCtrl_Stop); |
| |
| // Terminate button |
| vl_idx := f_EPTF_Var_getId(c_EPTF_ExecCtrl_Terminate); |
| f_EPTF_Var_addPostProcFn( |
| vl_idx, { refers(f_EPTF_ExecCtrl_UIHandler_terminate), {}} ); |
| f_EPTF_UIHandlerClient_subscribeMe( |
| c_EPTF_ExecCtrl_Terminate, |
| "GUI." & c_EPTF_ExecCtrl_Terminate, |
| c_EPTF_runtimeGuiTerminateTestButtonWidgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (Terminate button) name: " |
| &c_EPTF_ExecCtrl_Terminate); |
| |
| /* // uncomment it when needed: |
| // RunTest(Enable test) button |
| f_EPTF_UIHandlerClient_subscribeMe( |
| c_EPTF_ExecCtrl_RunTest, |
| "GUI." & c_EPTF_ExecCtrl_RunTest, |
| c_EPTF_runtimeGuiRunTestButtonWidgetId); |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (RunTest button) id: " |
| &int2str(vg_ExecCtrl_UIHandler_buttonIdxDB.runTest_k)); |
| */ |
| |
| // Snapshot button |
| f_EPTF_UIHandlerClient_subscribeMe( |
| c_EPTF_ExecCtrl_Snapshot, |
| "GUI." & c_EPTF_ExecCtrl_Snapshot, |
| c_EPTF_runtimeGuiSnapshotButtonWidgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (Snapshot button) name: " |
| &c_EPTF_ExecCtrl_Snapshot); |
| |
| // enable start button |
| if (f_EPTF_ExecCtrl_startTime()<0.0) { // test is not running |
| f_EPTF_UIHandlerClient_enableGUIElement( |
| c_EPTF_runtimeGuiStartTestButtonWidgetId); |
| } else { |
| f_EPTF_UIHandlerClient_enableGUIElement( |
| c_EPTF_runtimeGuiStopTestButtonWidgetId); |
| } |
| f_EPTF_UIHandlerClient_enableGUIElement( |
| c_EPTF_runtimeGuiTerminateTestButtonWidgetId); |
| f_EPTF_UIHandlerClient_enableGUIElement( |
| c_EPTF_runtimeGuiSnapshotButtonWidgetId); |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_UpdateVarsOnGUI |
| // |
| // Purpose: |
| // Update dynamic execution control state variable subscriptions to GUI |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_UpdateVarsOnGUI() |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| /*if (v_ExecCtrl_cfgState != c_ExecCtrl_Cfg_CONFIGURED) { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Stats NOT updated till exec control state changes to CONFIGURED!"); |
| }*/ |
| |
| /*f_EPTF_ExecCtrl_UIHandler_WaitingForDynamicGUI( |
| c_EPTF_ExecCtrl_TrafficTabId_Scenario);*/ |
| // f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ResourceTab(); |
| |
| /*f_EPTF_ExecCtrl_UIHandler_WaitingForDynamicGUI( |
| c_EPTF_ExecCtrl_TrafficTabId_TC);*/ |
| //f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ScenarioTab_Scenario(); |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_SubscribeVars2EntityGroupsTab |
| // |
| // Purpose: |
| // Subscribe entity group related variables to GUI |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_SubscribeVars2EntityGroupsTab() |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| f_EPTF_ExecCtrl_updateProgressbar(0.0, "Preparing Entity Groups panel"); |
| var charstring vl_currentName, vl_widgetId; |
| var integer vl_idx; |
| var integer vl_size := f_EPTF_ExecCtrl_numEntityGroups(); |
| for (var integer i := 0; i < vl_size; i := i + 1) |
| { |
| f_EPTF_ExecCtrl_updateProgressbar(100.0/int2float(vl_size)); |
| f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(c_EPTF_ExecCtrl_EntityGrpTabId); |
| // Entity name |
| vl_currentName := "EntityGroup." & int2str(i); |
| vl_widgetId := c_EPTF_ExecCtrl_EntityGrpTabId & "." & int2str(i) & ".0"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (EG / Entity group) name: " |
| &vl_currentName); |
| |
| // Entity type |
| vl_currentName := "EntityType." & int2str(i); |
| vl_widgetId := c_EPTF_ExecCtrl_EntityGrpTabId & "." & int2str(i) & ".1"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (EG / Entity type) name: " |
| &vl_currentName); |
| |
| // Entity number of entity group |
| vl_currentName := "EntityNum." & int2str(i); |
| vl_widgetId := c_EPTF_ExecCtrl_EntityGrpTabId & "." & int2str(i) & ".2"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (EG / Entity num) name: " |
| &vl_currentName); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ResourceTab |
| // |
| // Purpose: |
| // Subscribe resource related variables to GUI |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ResourceTab() |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| f_EPTF_ExecCtrl_updateProgressbar(0.0, "Preparing Client Resources panel"); |
| var charstring vl_currentName, vl_widgetId; |
| var integer vl_offset := 0; |
| var integer vl_sizeLG := f_EPTF_ExecCtrl_numLGens(); |
| for (var integer lgenidx := 0; lgenidx < vl_sizeLG; lgenidx := lgenidx + 1) |
| { |
| f_EPTF_ExecCtrl_updateProgressbar(50.0/int2float(vl_sizeLG)); |
| // LGen name |
| //if (vg_ExecCtrl_UIHandler_resourceDB[lgenidx].lgen_k == -1) |
| { |
| f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(c_EPTF_ExecCtrl_ResourceTabId); |
| vl_currentName := "Resource.LGenName." & int2str(lgenidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_ResourceTabId & "." & int2str(vl_offset) & ".0"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (RES / LGen name) name: " |
| &vl_currentName); |
| } |
| |
| var integer vl_sizeAvail := f_EPTF_ExecCtrl_getLGenResourceListNum(lgenidx); |
| |
| if (vl_sizeAvail==0) { |
| // Increase offset for each group |
| vl_offset := vl_offset + 1; |
| } |
| |
| // Resource info (entity group - available - allocated) |
| for (var integer eidx := 0; eidx < vl_sizeAvail; eidx := eidx + 1) |
| { |
| if (eidx != 0) { |
| f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(c_EPTF_ExecCtrl_ResourceTabId); |
| } |
| // Entity type |
| //if (vg_ExecCtrl_UIHandler_resourceDB[lgenidx].resStatus[eidx].entity_k == -1) |
| { |
| vl_currentName := "Resource.EntityType." & int2str(lgenidx) & "." & int2str(eidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_ResourceTabId & "." & int2str(vl_offset) & ".1"; |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Available list: " & f_EPTF_ExecCtrl_getLGenResourceList2Str(lgenidx)); |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (RES / Entity type) name: " |
| &vl_currentName); |
| } |
| |
| // Available and allocated number of entity types |
| //if (vg_ExecCtrl_UIHandler_resourceDB[lgenidx].resStatus[eidx].max_k == -1) |
| { |
| vl_currentName := "Resource.EntityAvailNum." & int2str(lgenidx) & "." & int2str(eidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_ResourceTabId & "." & int2str(vl_offset) & ".2"; |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Available list: " & f_EPTF_ExecCtrl_getLGenResourceList2Str(lgenidx)); |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| sampledAtSync,v_ExecCtrl_UIHandler_refreshRate_EntityResourcesTab); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (RES / Entity Max available num) name: " |
| &vl_currentName); |
| |
| vl_currentName := "Resource.EntityAllocNum." & int2str(lgenidx) & "." & int2str(eidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_ResourceTabId & "." & int2str(vl_offset) & ".3"; |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Allocated list: " & f_EPTF_ExecCtrl_getLGenResourceList2Str(lgenidx)); |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| sampledAtSync,v_ExecCtrl_UIHandler_refreshRate_EntityResourcesTab); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (RES / Entity Current available num) name: " |
| &vl_currentName); |
| } |
| |
| // Increase offset for each group |
| vl_offset := vl_offset + 1; |
| } |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_SubscribeVars2EGrpDistributionTab |
| // |
| // Purpose: |
| // Subscribe entity group distribution related variables to GUI |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_SubscribeVars2EGrpDistributionTab() |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| var charstring vl_currentName, vl_widgetId; |
| var integer vl_offset := 0; |
| var integer vl_sizeEGrp := f_EPTF_ExecCtrl_numEntityGroups(); |
| for (var integer eGrpIdx := 0; eGrpIdx < vl_sizeEGrp; eGrpIdx := eGrpIdx + 1) |
| { |
| f_EPTF_ExecCtrl_updateProgressbar(50.0/int2float(vl_sizeEGrp)); |
| // EGrpName name |
| //if (vg_ExecCtrl_UIHandler_eGrpDistributionDB[eGrpIdx].eGrp_k == -1) |
| { |
| f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(c_EPTF_ExecCtrl_GroupDistributionTabId); |
| vl_currentName := "EGrpDistr.EGrpName." & int2str(eGrpIdx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_GroupDistributionTabId & "." & int2str(vl_offset) & ".0"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (EGrpDistr / EGrp name) name: " |
| &vl_currentName); |
| } |
| |
| var EPTF_ExecCtrl_EntityGroupDistributionList vl_lgenList := f_EPTF_ExecCtrl_eGrp_lgenList(eGrpIdx); |
| var integer vl_sizeLGen := sizeof( |
| vl_lgenList); |
| |
| // Resource info (entity group - available - allocated) |
| if (vl_sizeLGen==0) { |
| // Increase offset for each group |
| vl_offset := vl_offset + 1; |
| } |
| for (var integer lgenIdx := 0; lgenIdx < vl_sizeLGen; lgenIdx := lgenIdx + 1) |
| { |
| if (lgenIdx != 0) { |
| f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(c_EPTF_ExecCtrl_GroupDistributionTabId); |
| } |
| var integer vl_lgenIdx := vl_lgenList[lgenIdx].lgenIdx; |
| // LGen name |
| //if (vg_ExecCtrl_UIHandler_eGrpDistributionDB[eGrpIdx].lgenList[lgenIdx].lgen_k == -1) |
| { |
| vl_currentName := "EGrpDistr.LGenName." & int2str(eGrpIdx) & "." & int2str(lgenIdx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_GroupDistributionTabId & "." & int2str(vl_offset) & ".1"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (EGrpDistr / LGen name) name: " |
| &vl_currentName); |
| } |
| |
| // EGroup size and offset |
| //if (vg_ExecCtrl_UIHandler_eGrpDistributionDB[eGrpIdx].lgenList[lgenIdx].eCount_k == -1) |
| { |
| vl_currentName := "EGrpDistr.ECount." & int2str(eGrpIdx) & "." & int2str(lgenIdx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_GroupDistributionTabId & "." & int2str(vl_offset) & ".2"; |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Available list: " & log2str(vl_lgenList[lgenIdx])); |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| sampledAtSync,v_ExecCtrl_UIHandler_refreshRate_EntityResourcesTab); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (EGrpDistr / ECount ) name: " |
| &vl_currentName); |
| |
| vl_currentName := "EGrpDistr.EOffset." & int2str(eGrpIdx) & "." & int2str(lgenIdx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_GroupDistributionTabId & "." & int2str(vl_offset) & ".3"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| sampledAtSync,v_ExecCtrl_UIHandler_refreshRate_EntityResourcesTab); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (EGrpDistr / Entity Offset) name: " |
| &vl_currentName); |
| } |
| |
| // Increase offset for each group |
| vl_offset := vl_offset + 1; |
| } |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ScenarioTab |
| // |
| // Purpose: |
| // Subscribe scenario and traffic case related variables to GUI |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ScenarioTab() |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ScenarioTab_Scenario(); |
| f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ScenarioTab_TrafficCase(); |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ScenarioTab_Scenario |
| // |
| // Purpose: |
| // Subscribe scenario related variables to GUI |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ScenarioTab_Scenario() |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| f_EPTF_ExecCtrl_updateProgressbar(0.0, "Preparing Traffic Cases panel"); |
| |
| var charstring vl_currentName, vl_widgetId; |
| var integer vl_idx, vl_offset := 0; |
| var integer vl_sizeLG := f_EPTF_ExecCtrl_numLGens(); |
| for (var integer lgenidx := 0; lgenidx < vl_sizeLG; lgenidx := lgenidx + 1) |
| { |
| f_EPTF_ExecCtrl_updateProgressbar(50.0/int2float(vl_sizeLG)); |
| // LGen name |
| //if (vg_ExecCtrl_UIHandler_ScenarioDB[lgenidx].lgen_k == -1) |
| { |
| f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(c_EPTF_ExecCtrl_TrafficTabId_Scenario); |
| vl_currentName := "Scenario.LGenName." & int2str(lgenidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_Scenario & "." & int2str(vl_offset) & ".0"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (SCEN / LGen name) name: " |
| &vl_currentName); |
| } |
| |
| var integer sidx := -1; |
| if (f_EPTF_ExecCtrl_getLGenNumEGroups(lgenidx)==0) { |
| // Increase offset for each group |
| vl_offset := vl_offset + 1; |
| } |
| for(var integer eg:=0; eg<f_EPTF_ExecCtrl_getLGenNumEGroups(lgenidx); eg:=eg+1) { |
| var integer vl_eGrpIdx := f_EPTF_ExecCtrl_getLGenEGrpIdx(lgenidx,eg); |
| var EPTF_IntegerList vl_eGrpScenarios := f_EPTF_ExecCtrl_eGrp_scenarios(vl_eGrpIdx); |
| if (sizeof(vl_eGrpScenarios)==0) { |
| // Allocated of entity group |
| sidx := sidx + 1; |
| // Resource info (entity group - available - allocated) |
| if (eg != 0) { |
| f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(c_EPTF_ExecCtrl_TrafficTabId_Scenario); |
| } |
| |
| //if (vg_ExecCtrl_UIHandler_ScenarioDB[lgenidx].scenStatus[sidx].scenGrp_k == -1) |
| { |
| vl_currentName := "Scenario.ScenarioGroup." & int2str(lgenidx) & "." & int2str(sidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_Scenario & "." & int2str(vl_offset) & ".1"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (SCEN / Scenario group) name: " |
| &vl_currentName); |
| } |
| |
| vl_offset := vl_offset+1; |
| //continue; // the for cycle is not executed, continue is not necessary |
| } |
| for(var integer sc:=0; sc<sizeof(vl_eGrpScenarios);sc:=sc+1) { |
| var integer vl_scIdx := vl_eGrpScenarios[sc]; |
| sidx := sidx + 1; |
| |
| // Resource info (entity group - available - allocated) |
| if (sidx != 0) { |
| f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(c_EPTF_ExecCtrl_TrafficTabId_Scenario); |
| } |
| |
| // Allocated of entity group |
| //if (vg_ExecCtrl_UIHandler_ScenarioDB[lgenidx].scenStatus[sidx].scenGrp_k == -1) |
| { |
| vl_currentName := "Scenario.ScenarioGroup." & int2str(lgenidx) & "." & int2str(sidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_Scenario & "." & int2str(vl_offset) & ".1"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (SCEN / Scenario group) name: " |
| &vl_currentName); |
| } |
| |
| // Scenario name |
| //if (vg_ExecCtrl_UIHandler_ScenarioDB[lgenidx].scenStatus[sidx].scenName_k == -1) |
| { |
| vl_currentName := "Scenario.ScenarioName." & int2str(lgenidx) & "." & int2str(sidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_Scenario & "." & int2str(vl_offset) & ".2"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (SCEN / Scenario name) name: " |
| &vl_currentName); |
| } |
| |
| // Scenario status |
| //if (vg_ExecCtrl_UIHandler_ScenarioDB[lgenidx].scenStatus[sidx].scenStatus_k == -1) |
| { |
| |
| // lgen status |
| // vl_currentName := "Scenario.LGenStatus." & int2str(lgenidx) & "." & int2str(sidx); |
| vl_currentName := "Scenario.LGenStatus." & f_EPTF_ExecCtrl_getLGenName(lgenidx) & "." &f_EPTF_ExecCtrl_eGrp_name(vl_eGrpIdx)& |
| "."&f_EPTF_ExecCtrl_getScenarioName(vl_scIdx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_Scenario & "." & int2str(vl_offset) & ".3"; |
| |
| // FIXME: update the function ExecCtrl_Functions.f_EPTF_ExecCtrl_subscribeScenarioState |
| //if (vg_ExecCtrl_UIHandler_ScenarioDB[lgenidx].scenStatus[sidx].scenStatus_k == -1) |
| { |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| "StatusLED." & vl_currentName, |
| "GUI.StatusLED." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| vl_offset := vl_offset + 1; |
| continue; |
| } |
| |
| // f_EPTF_UIHandlerClient_subscribeMe ( |
| // "StatusLED." & vl_currentName, |
| // "GUI.StatusLED." & vl_currentName, |
| // vl_widgetId, |
| // realtime); |
| // |
| // f_EPTF_ExecCtrl_UIHandler_debug( |
| // "Last subscribed to GUI variable (SCEN / LGen status) name: " |
| // &vl_currentName); |
| |
| } |
| |
| // Increase offset for each group |
| // vl_offset := vl_offset + 1; |
| } // sc |
| } // eg |
| } |
| } |
| |
| ////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow |
| // |
| // Purpose: |
| // Function to create a xul definition of a new row in the table of traffic cases |
| // |
| // Parameters: |
| // pl_myWidgetID - *in* *charstring* - the widget ID of the TabPanel |
| // pl_myLabel - *in* *charstring* - the label of the TabPanel |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - (none) |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////// |
| |
| private function f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(in EPTF_UIHandler_WidgetIdString pl_parentWidgetId) |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| |
| } |
| |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ScenarioTab_TrafficCase |
| // |
| // Purpose: |
| // Subscribe traffic case related variables to GUI |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ScenarioTab_TrafficCase() runs on EPTF_ExecCtrl_UIHandler_CT{ |
| f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(c_EPTF_ExecCtrl_TrafficTabId_TC); |
| f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ScenarioTab_TrafficCase2(); |
| f_EPTF_ExecCtrl_registerScenarioStateChangedCallback(refers(f_EPTF_ExecCtrl_UIHandler_startStopScenario_scenarioStateChangedCallback)); |
| } |
| |
| |
| private function f_EPTF_ExecCtrl_UIHandler_SubscribeVars2ScenarioTab_TrafficCase2() |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| var integer vl_offset := 0; |
| var charstring vl_currentName, vl_widgetId; |
| var integer vl_idx; |
| var integer vl_sizeScen := f_EPTF_ExecCtrl_numScenarios(); |
| var integer vl_sizeTCs; |
| |
| for (var integer sidx := 0; sidx < vl_sizeScen; sidx := sidx + 1) |
| { |
| f_EPTF_ExecCtrl_updateProgressbar(50.0/int2float(vl_sizeScen)); |
| var integer vl_eGrpIdx := f_EPTF_ExecCtrl_getScenarioEGroupIdx(sidx); |
| var charstring grpName := f_EPTF_ExecCtrl_eGrp_name(vl_eGrpIdx); |
| var charstring scenName := f_EPTF_ExecCtrl_getScenarioName(sidx); |
| |
| // Scenario name |
| vl_currentName := "Traffic.ScenarioName." & grpName&"." & int2str(sidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_TC & "." & int2str(vl_offset) & ".0"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (TC / Scenario name) name: " |
| &vl_currentName); |
| |
| // Scenario type |
| vl_currentName := "Traffic.ScenarioType." & grpName&"."& int2str(sidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_TC & "." & int2str(vl_offset) & ".1"; |
| |
| var charstring vl_type := "Decl"; |
| if (f_EPTF_ExecCtrl_isWeightedScenario(sidx)) { |
| vl_type := "Weighted"; |
| } |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (TC / Scenario type) name: " |
| &vl_currentName); |
| |
| // Scenario status |
| vl_currentName := "ExecCtrl.scenarioStatus."&grpName&"."&scenName; |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_TC & "." & int2str(vl_offset) & ".2"; |
| |
| // FIXME: fix in f_EPTF_ExecCtrl_subscribeScenarioState needed |
| if (f_EPTF_Var_getId(vl_currentName) == -1) { |
| vl_offset := vl_offset + 1; |
| f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(c_EPTF_ExecCtrl_TrafficTabId_TC); |
| continue; |
| } |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (TC / Scenario status) name: " |
| &vl_currentName); |
| |
| // Start Scenario |
| vl_currentName := "ExecCtrl.startScenario."&grpName&"."&scenName; |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_TC & "." & int2str(vl_offset) & ".3"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (TC / Start Scenario) name: " |
| &vl_currentName); |
| |
| // this scenario cannot be started here if it belongs to a scenario group: |
| if (f_EPTF_ExecCtrl_scenarioIsNotInScenarioGroup(sidx)) { |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| } |
| |
| // Stop Scenario |
| vl_currentName := "ExecCtrl.stopScenario."&grpName&"."&scenName; |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_TC & "." & int2str(vl_offset) & ".4"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (TC / Stop Scenario) name: " |
| &vl_currentName); |
| |
| // this scenario cannot be stopped here if it belongs to a scenario group: |
| if (f_EPTF_ExecCtrl_scenarioIsNotInScenarioGroup(sidx)) { |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| } |
| |
| if (f_EPTF_ExecCtrl_isWeightedScenario(sidx)) { |
| // Scenario CPS |
| vl_currentName := "Traffic.ScenarioCPS." & grpName&"."& int2str(sidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_TC & "." & int2str(vl_offset) & ".5"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| sampledAtSync,v_ExecCtrl_UIHandler_refreshRate_targetCPS); |
| |
| // f_EPTF_Var_subscribeRemote( |
| // self, //v_UIHandlerClient_DefaultUIHandler, // uihandler |
| // "Traffic.ScenarioCPS." & grpName&"."& int2str(sidx), // remote var name |
| // realtime, // subscription mode |
| // vl_idx, // local variable index |
| // "SC3."&c_EPTF_ExecCtrl_CPS& grpName&"."& int2str(sidx)); // local variable name |
| // f_EPTF_Var_addPostProcFn( |
| |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (TC / Scenario CPS) name: " |
| &vl_currentName); |
| |
| } // f_EPTF_ExecCtrl_isWeightedScenario(sidx) |
| vl_sizeTCs := f_EPTF_ExecCtrl_numTcOfScenario(sidx); |
| for (var integer tcidx := 0; tcidx < vl_sizeTCs; tcidx := tcidx + 1) |
| { |
| // Traffic case (of current scenarios) |
| vl_currentName := "Traffic.TC." & grpName&"."& int2str(sidx) & "." & int2str(tcidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_TC & "." & int2str(vl_offset) & ".6"; |
| |
| var charstring tcName := f_EPTF_ExecCtrl_tcNameOfTcOfSc(sidx,tcidx) |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (TC / TC name) name: " |
| &vl_currentName); |
| |
| // Start Traffic case |
| vl_currentName := "ExecCtrl.startTC."&grpName&"."&scenName&"."&tcName; |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_TC & "." & int2str(vl_offset) & ".7"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (TC / Start TC) name: " |
| &vl_currentName); |
| |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| |
| // Stop Traffic case |
| vl_currentName := "ExecCtrl.stopTC."&grpName&"."&scenName&"."&tcName; |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_TC & "." & int2str(vl_offset) & ".8"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (TC / Stop TC) name: " |
| &vl_currentName); |
| |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| |
| if (not f_EPTF_ExecCtrl_isWeightedScenario(sidx)) { |
| |
| // Traffic case start delay time |
| vl_currentName := "Traffic.TCDelay."& grpName&"." & int2str(sidx) & "." & int2str(tcidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_TC & "." & int2str(vl_offset) & ".9"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (TC / TC start delay) name: " |
| &vl_currentName); |
| } |
| |
| // Traffic case target CPS (call per second) |
| vl_currentName := "Traffic.TCCPS." & grpName&"."& int2str(sidx) & "." & int2str(tcidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_TC & "." & int2str(vl_offset) & ".10"; |
| |
| |
| // f_EPTF_Var_subscribeRemote( |
| // self, //v_UIHandlerClient_DefaultUIHandler, // uihandler |
| // "Traffic.TCCPS." & grpName&"."& int2str(sidx) & "." & int2str(tcidx), // remote var name |
| // realtime, // subscription mode |
| // vl_idx, // local variable index |
| // c_EPTF_ExecCtrl_CPS& grpName&"."&int2str(sidx)&"."&int2str(tcidx)); // local variable name |
| // f_EPTF_Var_addPostProcFn( |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (TC / TC target CPS) name: " |
| &vl_currentName); |
| |
| // TimeProfile |
| if (not f_EPTF_ExecCtrl_isWeightedScenario(sidx) |
| or (tcidx==0 and f_EPTF_ExecCtrl_isWeightedScenario(sidx))) { |
| vl_currentName := "Traffic.TimeProfile." & grpName&"."& int2str(sidx) & "." & int2str(tcidx); |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_TC & "." & int2str(vl_offset) & ".11"; |
| |
| var charstring vl_timeProfileName := f_EPTF_ExecCtrl_getTimeProfileNameForTC(sidx,tcidx); |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (TC / TC time profile) name: " |
| &vl_currentName); |
| }// if |
| |
| // Regulator |
| if (not f_EPTF_ExecCtrl_isWeightedScenario(sidx) |
| or (tcidx==0 and f_EPTF_ExecCtrl_isWeightedScenario(sidx))) { |
| vl_widgetId := |
| c_EPTF_ExecCtrl_TrafficTabId_TC & "." & int2str(vl_offset) & ".12"; |
| |
| var charstring vl_regulatorName := ""; |
| var EPTF_ExecCtrl_RegulatedItemName vl_idName; |
| var integer vl_scGrpidx := f_EPTF_ExecCtrl_ScenarioGroup_get_byScIndex(sidx); |
| if (vl_scGrpidx==-1) { |
| if (f_EPTF_ExecCtrl_isWeightedScenario(sidx)) { |
| vl_idName := {cps_SC := {grpName,scenName}}; |
| vl_currentName := "Traffic.Regulator." & grpName&"."& int2str(sidx); |
| } else { |
| vl_idName := {cps_TC := {grpName,scenName,tcName}}; |
| vl_currentName := "Traffic.Regulator." & grpName&"."& int2str(sidx) & "." & int2str(tcidx); // tc idx shall be there for non-weighted Sc |
| } |
| } else { |
| // for scenarios in scenario groups: it shows the regulator in the current phase |
| var EPTF_ExecCtrl_PhaseList_Instance phaseList := f_EPTF_ExecCtrl_getScenarioGroupInstanceGroupPhaseList(vl_scGrpidx); |
| |
| // put regulator in CURRENT PHASE to the GUI: |
| var charstring vl_phaseName := f_EPTF_ExecCtrl_getScenarioGroupInstanceActualPhaseName(vl_scGrpidx); |
| if (f_EPTF_ExecCtrl_isWeightedScenario(sidx)) { |
| vl_idName := {cps_SCInPhase := {grpName,scenName, vl_phaseName}}; |
| vl_currentName := "Traffic.Regulator." & grpName&"."& int2str(sidx); |
| } else { |
| vl_idName := {cps_TCInPhase := {grpName,scenName,tcName, vl_phaseName}}; |
| vl_currentName := "Traffic.Regulator." & grpName&"."& int2str(sidx) & "." & int2str(tcidx); // tc idx shall be there for non-weighted Sc |
| } |
| } |
| var integer vl_regulatedItemId := f_EPTF_ExecCtrl_Regulator_getRegulatedItemId(vl_idName); |
| if (vl_regulatedItemId==-1) { |
| // add new regulated item: |
| vl_regulatedItemId := f_EPTF_ExecCtrl_Regulator_addRegulatedItem(vl_idName,""); |
| } |
| vl_regulatorName := f_EPTF_ExecCtrl_Regulator_getRegulatorName(vl_regulatedItemId); |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (TC / TC regulator) name: " |
| &vl_currentName); |
| |
| }// if |
| |
| // Increase offset |
| vl_offset := vl_offset + 1; |
| f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(c_EPTF_ExecCtrl_TrafficTabId_TC); |
| } |
| // vl_offset := vl_offset + 1; |
| // f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(c_EPTF_ExecCtrl_TrafficTabId_TC); |
| } |
| |
| |
| } |
| |
| // update the "Traffic.Regulator" variables with the regulators corresponding to the actual phase if phase of the scenario group changes |
| private function f_EPTF_ExecCtrl_UIHandler_scenarioGroupPhaseChangedCallback(in charstring pl_sgName, in integer pl_actualPhaseIdx) runs on EPTF_ExecCtrl_CT { |
| var integer vl_sgIdx := f_EPTF_ExecCtrl_ScenarioGroup_getIdx(pl_sgName); |
| var charstring vl_actualPhase := v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList.phases[pl_actualPhaseIdx].name; |
| |
| // start/stop regulators for all scenarios and traffic cases in the scenario group: |
| for (var integer i:=0; i<sizeof(v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].scenarios); i:=i+1) { |
| var integer vl_scIdx := v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].scenarios[i].idx; |
| |
| var integer vl_eGrpIdx := f_EPTF_ExecCtrl_getScenarioEGroupIdx(vl_scIdx); |
| |
| var charstring vl_eGrpName := f_EPTF_ExecCtrl_eGrp_name(vl_eGrpIdx); |
| var charstring vl_scenName := f_EPTF_ExecCtrl_getScenarioName(vl_scIdx); |
| |
| //get the regulator for the scenario CPS in the current phase: |
| var integer vl_regulatedItemId := f_EPTF_ExecCtrl_Regulator_getRegulatedItemId( |
| { cps_SCInPhase := { vl_eGrpName, vl_scenName, vl_actualPhase } } |
| ); |
| if (vl_regulatedItemId!=-1) { |
| // set the regulator name for the current phase |
| var charstring vl_varName := "Traffic.Regulator." & vl_eGrpName&"."& int2str(vl_scIdx); |
| var integer vl_idx := f_EPTF_Var_getId(vl_varName); |
| var charstring vl_regulatorName := f_EPTF_ExecCtrl_Regulator_getRegulatorName(vl_regulatedItemId); |
| f_EPTF_Var_adjustContent(vl_idx,{charstringVal := vl_regulatorName}); |
| } |
| |
| // go through all traffic cases |
| for (var integer tcOfSc:=0; tcOfSc<f_EPTF_ExecCtrl_numTcOfScenario(vl_scIdx); tcOfSc:=tcOfSc+1) { |
| var charstring vl_tcName := f_EPTF_ExecCtrl_tcNameOfTcOfSc(vl_scIdx,tcOfSc); |
| |
| vl_regulatedItemId := f_EPTF_ExecCtrl_Regulator_getRegulatedItemId( |
| { cps_TCInPhase := { vl_eGrpName, vl_scenName, vl_tcName, vl_actualPhase } } |
| ); |
| |
| if (vl_regulatedItemId!=-1) { |
| // set the regulator name for the current phase |
| var charstring vl_varName := "Traffic.Regulator." & vl_eGrpName&"."& int2str(vl_scIdx) & "." & int2str(tcOfSc); |
| var integer vl_idx := f_EPTF_Var_getId(vl_varName); |
| var charstring vl_regulatorName := f_EPTF_ExecCtrl_Regulator_getRegulatorName(vl_regulatedItemId); |
| f_EPTF_Var_adjustContent(vl_idx,{charstringVal := vl_regulatorName}); |
| } |
| |
| } |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_startStopScenario_scenarioStateChangedCallback |
| // |
| // Purpose: |
| // A scenarioStateChangedCallback to automatically uncheck the start/stop flags if task fulfilled |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_startStopScenario_scenarioStateChangedCallback(in charstring pl_eGrpName, in charstring pl_scName, in charstring pl_state) runs on EPTF_ExecCtrl_UIHandler_CT { |
| |
| var charstring vl_currentName; |
| var integer vl_idx; |
| if (pl_state==c_EPTF_LGenBase_stateNames[c_EPTF_LGenBase_tcStateRunning]) { |
| // disables startScenario: |
| // enables stopScenario: |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "**********STOP SCENARIO ENABLED***********"); |
| vl_currentName := "ExecCtrl.startScenario."&pl_eGrpName&"."&pl_scName; |
| vl_idx := f_EPTF_Var_getId(vl_currentName); |
| f_EPTF_Var_adjustContent(vl_idx,{boolVal := false}); |
| |
| // this scenario cannot be stopped if it belongs to a scenario group: |
| |
| var integer vl_scIdx := f_EPTF_ExecCtrl_getScenarioIdx(pl_eGrpName,pl_scName); |
| f_EPTF_Base_assert(%definitionId&": Cannot find scenario "&pl_scName&" of entity group "&pl_eGrpName&" in database.", vl_scIdx != -1); |
| if (f_EPTF_ExecCtrl_scenarioIsNotInScenarioGroup(vl_scIdx)) { |
| // Manage Statistics/Scenario control buttons enabled state |
| f_EPTF_UIHandlerClient_enableGUIElement( |
| c_EPTF_ExecCtrl_statisticsRoot&".EG."&pl_eGrpName&".SC."&pl_scName&".ControlButtons.Stop"); |
| f_EPTF_UIHandlerClient_disableGUIElement( |
| c_EPTF_ExecCtrl_statisticsRoot&".EG."&pl_eGrpName&".SC."&pl_scName&".ControlButtons.Start"); |
| f_EPTF_UIHandlerClient_disableGUIElement( |
| c_EPTF_ExecCtrl_statisticsRoot&".EG."&pl_eGrpName&".SC."&pl_scName&".ControlButtons.Reset"); |
| } |
| |
| |
| } |
| if (pl_state==c_EPTF_LGenBase_stateNames[c_EPTF_LGenBase_tcStateStopped] |
| or pl_state==c_EPTF_LGenBase_stateNames[c_EPTF_LGenBase_tcStateFinished] |
| or pl_state==c_EPTF_LGenBase_stateNames[c_EPTF_LGenBase_tcStatePaused] |
| or pl_state==c_EPTF_LGenBase_stateNames[c_EPTF_LGenBase_tcStateAborted] |
| or pl_state==c_EPTF_LGenBase_stateNames[c_EPTF_LGenBase_tcStateTerminated] |
| or pl_state==c_EPTF_LGenBase_stateNames[c_EPTF_LGenBase_tcStateIdle]) { |
| // pl_state=="Idle" or pl_state=="Stopped" or pl_state=="Stopping" or pl_state=="Finished" or pl_state=="Paused" or pl_state=="Aborted" |
| // enables startScenario: |
| // disables stopScenario: |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "**********START SCENARIO ENABLED***********"); |
| vl_currentName := "ExecCtrl.stopScenario."&pl_eGrpName&"."&pl_scName; |
| vl_idx := f_EPTF_Var_getId(vl_currentName); |
| f_EPTF_Var_adjustContent(vl_idx,{boolVal := false}); |
| |
| // this scenario cannot be started if it belongs to a scenario group: |
| |
| var integer vl_scIdx := f_EPTF_ExecCtrl_getScenarioIdx(pl_eGrpName,pl_scName); |
| f_EPTF_Base_assert(%definitionId&": Cannot find scenario "&pl_scName&" of entity group "&pl_eGrpName&" in database.", vl_scIdx != -1); |
| if (f_EPTF_ExecCtrl_scenarioIsNotInScenarioGroup(vl_scIdx)) { |
| // Manage Statistics/Scenario control buttons enabled state |
| f_EPTF_UIHandlerClient_disableGUIElement( |
| c_EPTF_ExecCtrl_statisticsRoot&".EG."&pl_eGrpName&".SC."&pl_scName&".ControlButtons.Stop"); |
| f_EPTF_UIHandlerClient_enableGUIElement( |
| c_EPTF_ExecCtrl_statisticsRoot&".EG."&pl_eGrpName&".SC."&pl_scName&".ControlButtons.Start"); |
| f_EPTF_UIHandlerClient_enableGUIElement( |
| c_EPTF_ExecCtrl_statisticsRoot&".EG."&pl_eGrpName&".SC."&pl_scName&".ControlButtons.Reset"); |
| } |
| } |
| } |
| |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_SubscribeVars2RegulatedItemsTab |
| // |
| // Purpose: |
| // Subscribe entity group related variables to GUI |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_SubscribeVars2RegulatedItemsTab() |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| f_EPTF_ExecCtrl_updateProgressbar(0.0, "Preparing Regulator panel"); |
| var charstring vl_currentName, vl_widgetId; |
| var integer vl_idx; |
| var integer vl_size := f_EPTF_ExecCtrl_Regulator_nofRegulatedItems(); |
| for (var integer i := 0; i < vl_size; i := i + 1) |
| { |
| f_EPTF_ExecCtrl_updateProgressbar(80.0/int2float(vl_size)); |
| f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(c_EPTF_ExecCtrl_RegulatedItemsTabId); |
| |
| // Item type |
| vl_currentName := "RegulatedItemType." & int2str(i); |
| vl_widgetId := c_EPTF_ExecCtrl_RegulatedItemsTabId & "." & int2str(i) & ".0"; |
| |
| var charstring vl_tmpstr := ""; |
| var EPTF_ExecCtrl_RegulatedItemName vl_idName := f_EPTF_ExecCtrl_Regulator_itemId2ItemName(i); |
| |
| if (ischosen(vl_idName.cps_TC)) { |
| vl_tmpstr := "TrafficCase CPS" |
| } |
| if (ischosen(vl_idName.cps_SC)) { |
| vl_tmpstr := "Scenario CPS" |
| } |
| if (ischosen(vl_idName.cps_TCInPhase)) { |
| vl_tmpstr := "TrafficCase CPS @ Phase" |
| } |
| if (ischosen(vl_idName.cps_SCInPhase)) { |
| vl_tmpstr := "Scenario CPS @ Phase" |
| } |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (RegItems / Item type) name: " |
| &vl_currentName); |
| |
| // Item name |
| vl_currentName := "RegulatedItemName." & int2str(i); |
| vl_widgetId := c_EPTF_ExecCtrl_RegulatedItemsTabId & "." & int2str(i) & ".1"; |
| |
| vl_tmpstr := ""; |
| if (ischosen(vl_idName.cps_TC)) { |
| vl_tmpstr := vl_idName.cps_TC.eGrpName |
| &"."&vl_idName.cps_TC.scName |
| &"."&vl_idName.cps_TC.tcName; |
| } |
| if (ischosen(vl_idName.cps_SC)) { |
| vl_tmpstr := vl_idName.cps_SC.eGrpName |
| &"."&vl_idName.cps_SC.scName; |
| } |
| if (ischosen(vl_idName.cps_TCInPhase)) { |
| vl_tmpstr := vl_idName.cps_TCInPhase.eGrpName |
| &"."&vl_idName.cps_TCInPhase.scName |
| &"."&vl_idName.cps_TCInPhase.tcName |
| &"@"&vl_idName.cps_TCInPhase.phase; |
| } |
| if (ischosen(vl_idName.cps_SCInPhase)) { |
| vl_tmpstr := vl_idName.cps_SCInPhase.eGrpName |
| &"."&vl_idName.cps_SCInPhase.scName |
| &"@"&vl_idName.cps_SCInPhase.phase; |
| } |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (RegItems / Item name) name: " |
| &vl_currentName); |
| |
| |
| vl_currentName := f_EPTF_ExecCtrl_getRegulatorNameVarName(vl_idName, i); |
| vl_widgetId := c_EPTF_ExecCtrl_RegulatedItemsTabId & "." & int2str(i) & ".2"; |
| |
| // vl_idx := f_EPTF_Var_getID(f_EPTF_ExecCtrl_Regulator_getRegulatorName(vl_currentName)); |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName &".RegulatedItems", |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (RegItems / Regulator name) name: " |
| &vl_currentName); |
| |
| // Weight |
| vl_currentName := "RegulatedItemWeight." & int2str(i); |
| vl_widgetId := c_EPTF_ExecCtrl_RegulatedItemsTabId & "." & int2str(i) & ".3"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| sampledAtSync,v_ExecCtrl_UIHandler_refreshRate_regulatedItem); |
| |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (RegItems / Item Weight) name: " |
| &vl_currentName); |
| |
| // Enabled |
| vl_currentName := "RegulatedItemEnabled." & int2str(i); |
| vl_widgetId := c_EPTF_ExecCtrl_RegulatedItemsTabId & "." & int2str(i) & ".4"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| sampledAtSync,v_ExecCtrl_UIHandler_refreshRate_regulatedItem); |
| |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (RegItems / Item Enabled) name: " |
| &vl_currentName); |
| |
| } |
| } |
| |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_SubscribeVars2RegulatorsTargetValueTab |
| // |
| // Purpose: |
| // Subscribe regulator related variables to GUI |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_SubscribeVars2RegulatorsTargetValueTab() |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| var charstring vl_currentName, vl_widgetId; |
| var integer vl_idx; |
| var integer vl_size := f_EPTF_ExecCtrl_Regulator_getNofRegulators(); |
| for (var integer i := 0; i < vl_size; i := i + 1) |
| { |
| f_EPTF_ExecCtrl_updateProgressbar(20.0/int2float(vl_size)); |
| f_EPTF_ExecCtrl_UIHandler_createScenarioTab_TableRow(c_EPTF_ExecCtrl_RegulatorsTotalValueTabId); |
| |
| // Regulator Name |
| vl_currentName := c_EPTF_ExecCtrl_RegulatedItemsTabId & "."&"RegulatorName." & int2str(i); |
| vl_widgetId := c_EPTF_ExecCtrl_RegulatorsTotalValueTabId & "." & int2str(i) & ".0"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (Regulators / Reg Name) name: " |
| &vl_currentName); |
| |
| // RegulatedValue |
| vl_currentName := f_EPTF_Var_getName(f_EPTF_ExecCtrl_Regulator_getRegulatorTotalValueIdxByRegulatorId(i)); |
| vl_widgetId := c_EPTF_ExecCtrl_RegulatorsTotalValueTabId & "." & int2str(i) & ".1"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (Regulators / TotalValue) name: " |
| &vl_currentName); |
| |
| // TargetLoad |
| vl_currentName := f_EPTF_Var_getName(f_EPTF_ExecCtrl_Regulator_getRegulatorTargetLoadIdxByRegulatorId(i)); |
| vl_widgetId := c_EPTF_ExecCtrl_RegulatorsTotalValueTabId & "." & int2str(i) & ".2"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| |
| // enabled automatically when regulator connected: |
| //f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (Regulators / TargetLoad) name: " |
| &vl_currentName); |
| |
| // CurrentLoad |
| vl_currentName := f_EPTF_Var_getName(f_EPTF_ExecCtrl_Regulator_getRegulatorCurrentLoadIdxByRegulatorId(i)); |
| vl_widgetId := c_EPTF_ExecCtrl_RegulatorsTotalValueTabId & "." & int2str(i) & ".3"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| f_EPTF_UIHandlerClient_disableGUIElement(vl_widgetId); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (Regulators / CurrentLoad) name: " |
| &vl_currentName); |
| |
| // Status |
| vl_currentName := f_EPTF_Var_getName(f_EPTF_ExecCtrl_Regulator_getRegulatorStatusIdxByRegulatorId(i)); |
| vl_widgetId := c_EPTF_ExecCtrl_RegulatorsTotalValueTabId & "." & int2str(i) & ".4"; |
| |
| f_EPTF_UIHandlerClient_subscribeMe ( |
| vl_currentName, |
| "GUI." & vl_currentName, |
| vl_widgetId, |
| realtime); |
| f_EPTF_UIHandlerClient_disableGUIElement(vl_widgetId); |
| |
| vl_idx := f_EPTF_ExecCtrl_Regulator_getRegulatorStatusIdxByRegulatorId(i); |
| f_EPTF_Var_addPostProcFn( |
| vl_idx, { refers(f_EPTF_ExecCtrl_enableRegulatorTargetLoad), {i}} ); |
| // call the postproc: |
| f_EPTF_ExecCtrl_enableRegulatorTargetLoad(vl_idx,{i}); |
| |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "Last subscribed to GUI variable (Regulators / Status) name: " |
| &vl_currentName); |
| |
| } |
| } |
| |
| private function f_EPTF_ExecCtrl_enableRegulatorTargetLoad( |
| in integer pl_idx, |
| in EPTF_IntegerList pl_argList |
| ) runs on EPTF_ExecCtrl_UIHandler_CT { |
| if (f_EPTF_Base_cleanupIsInProgress()==false) { |
| return; // cleanup is in progress, GUI may not answer disableWidget request after cleanup |
| } |
| var integer vl_regulatorIdx := pl_argList[0]; |
| var charstring vl_widgetId1 := c_EPTF_ExecCtrl_RegulatorsTotalValueTabId & "." & int2str(vl_regulatorIdx) & ".2"; |
| var charstring vl_widgetId2 := c_EPTF_ExecCtrl_RegulatorsTotalValueTabId & "." & int2str(vl_regulatorIdx) & ".1"; |
| var EPTF_StatusLED vl_statusLEDVal := f_EPTF_Var_getStatusLEDValue(pl_idx); |
| if (vl_statusLEDVal == {led_red, "Disconnected"}) { |
| f_EPTF_UIHandlerClient_disableGUIElement(vl_widgetId1); |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId2); |
| } else { |
| f_EPTF_UIHandlerClient_enableGUIElement(vl_widgetId1); |
| f_EPTF_UIHandlerClient_disableGUIElement(vl_widgetId2); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_start |
| // |
| // Purpose: |
| // Test management post proc function to enable/disable start/stop buttons |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_start( |
| in integer pl_idx, |
| in EPTF_IntegerList pl_argList) |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| // Manage buttons'' enabled state |
| f_EPTF_UIHandlerClient_enableGUIElement( |
| c_EPTF_runtimeGuiStopTestButtonWidgetId); |
| f_EPTF_UIHandlerClient_disableGUIElement( |
| c_EPTF_runtimeGuiStartTestButtonWidgetId); |
| |
| } |
| |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_stop |
| // |
| // Purpose: |
| // Test management post proc function to disable/enable start/stop buttons |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_stop( |
| in integer pl_idx, |
| in EPTF_IntegerList pl_argList) |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| // Manage buttons'' enabled state |
| f_EPTF_UIHandlerClient_disableGUIElement( |
| c_EPTF_runtimeGuiStopTestButtonWidgetId); |
| f_EPTF_UIHandlerClient_enableGUIElement( |
| c_EPTF_runtimeGuiStartTestButtonWidgetId); |
| |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_terminate |
| // |
| // Purpose: |
| // Test management post proc function to terminate traffic cases |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_terminate( |
| in integer pl_idx, |
| in EPTF_IntegerList pl_argList) |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| // Manage buttons'' enabled state |
| f_EPTF_UIHandlerClient_disableGUIElement( |
| c_EPTF_runtimeGuiStopTestButtonWidgetId); |
| f_EPTF_UIHandlerClient_enableGUIElement( |
| c_EPTF_runtimeGuiStartTestButtonWidgetId); |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_startScenario |
| // |
| // Purpose: |
| // Test management post proc function to enable/disable buttons at start scenario |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // This is what happens when user presses the start button at widgetId |
| // c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".ControlButtons.Start" |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_startScenario( |
| in integer pl_idx, |
| in EPTF_IntegerList pl_argList) |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| var integer vl_scIdx := pl_argList[0]; |
| var integer vl_eGrpIdx := f_EPTF_ExecCtrl_getScenarioEGroupIdx(vl_scIdx); |
| var charstring vl_eGrpName := f_EPTF_ExecCtrl_eGrp_name(vl_eGrpIdx); |
| var charstring vl_scTypeName := f_EPTF_ExecCtrl_getScenarioName(vl_scIdx); |
| // Manage buttons'' enabled state |
| f_EPTF_UIHandlerClient_enableGUIElement( |
| c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".ControlButtons.Stop"); |
| f_EPTF_UIHandlerClient_disableGUIElement( |
| c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".ControlButtons.Start"); |
| f_EPTF_UIHandlerClient_disableGUIElement( |
| c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".ControlButtons.Reset"); |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_UIHandler_stopScenario |
| // |
| // Purpose: |
| // Test management post proc function stop scenario |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // This is what happens when user presses the stop button at widgetId |
| // c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".ControlButtons.Stop" |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_UIHandler_stopScenario( |
| in integer pl_idx, |
| in EPTF_IntegerList pl_argList) |
| runs on EPTF_ExecCtrl_UIHandler_CT |
| { |
| f_EPTF_ExecCtrl_UIHandler_debug( |
| "### "&%definitionId&"()"); |
| |
| var integer vl_scIdx := pl_argList[0]; |
| var integer vl_eGrpIdx := f_EPTF_ExecCtrl_getScenarioEGroupIdx(vl_scIdx); |
| var charstring vl_eGrpName := f_EPTF_ExecCtrl_eGrp_name(vl_eGrpIdx); |
| var charstring vl_scTypeName := f_EPTF_ExecCtrl_getScenarioName(vl_scIdx); |
| // Manage buttons'' enabled state |
| f_EPTF_UIHandlerClient_disableGUIElement( |
| c_EPTF_ExecCtrl_statisticsRoot&".EG."&vl_eGrpName&".SC."&vl_scTypeName&".ControlButtons.Stop"); |
| f_EPTF_UIHandlerClient_enableGUIElement( |
|