| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // 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_ExecCtrl_PhaseFunctions |
| // |
| // Purpose: |
| // This module contains functions for EPTF_CLL_ExecCtrl phase |
| // handling implementation. |
| // |
| // Module depends on: |
| // <EPTF_CLL_Common_Definitions> |
| // <EPTF_CLL_ExecCtrl_Definitions> |
| // <EPTF_CLL_ExecCtrl_PhaseDefinitions> |
| // <EPTF_CLL_HashMapStr2Int_Functions> |
| // <EPTF_CLL_FBQ_Functions> |
| // <EPTF_CLL_ExecCtrl_LoggingFunctions> |
| // <EPTF_CLL_ExecCtrl_ScenarioFunctions> |
| // <EPTF_CLL_Base_Functions> |
| // <EPTF_CLL_Variable_Functions> |
| // <EPTF_CLL_LGenBase_PhaseDefinitions> |
| // <EPTF_CLL_LGenBase_PhaseFunctions> |
| // |
| // Module Parameters: |
| // - |
| // |
| // Current Owner: |
| // Antal Wu-Hen-Chang (EANTWUH) |
| // |
| // Last Review Date: |
| // 2008-11-24 |
| // |
| // Detailed Comments: |
| // This module contains functions for EPTF_CLL_ExecCtrl phase |
| // handling implementation. |
| // |
| // Public functions: |
| // <f_EPTF_ExecCtrl_ScenarioGroup_get_byScIndex> |
| // <f_EPTF_ExecCtrl_ScenarioGroup_getIdx> |
| // <f_EPTF_ExecCtrl_registerScenarioGroupPhaseChangedCallback> |
| // <f_EPTF_ExecCtrl_ScenarioGroup_start> |
| // <f_EPTF_ExecCtrl_ScenarioGroup_stop> |
| // <f_EPTF_ExecCtrl_getScenarioGroupInstanceName> |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| module EPTF_CLL_ExecCtrl_PhaseFunctions |
| { |
| import from EPTF_CLL_Common_Definitions all; |
| import from EPTF_CLL_ExecCtrl_Definitions all; |
| import from EPTF_CLL_ExecCtrl_PhaseDefinitions all; |
| import from EPTF_CLL_HashMapStr2Int_Functions all; |
| import from EPTF_CLL_FBQ_Functions all; |
| import from EPTF_CLL_ExecCtrl_LoggingFunctions all; |
| import from EPTF_CLL_ExecCtrl_ScenarioFunctions all; |
| import from EPTF_CLL_Base_Functions all; |
| import from EPTF_CLL_Variable_Functions all; |
| import from EPTF_CLL_LGenBase_PhaseDefinitions all; |
| import from EPTF_CLL_LGenBase_PhaseFunctions all; |
| |
| |
| friend module EPTF_CLL_ExecCtrlClient_Functions, EPTF_CLL_ExecCtrl_Functions; |
| friend module EPTF_CLL_ExecCtrlUIHandler_Functions, EPTF_CLL_ExecCtrl_DSFunctions; |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_Phase_init |
| // |
| // Purpose: |
| // Initilaizes the phase aspect of the EPTF_CLL_ExecCtrl feature |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // Inits the databases and reads in the phase list declarators |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| friend function f_EPTF_ExecCtrl_Phase_init() runs on EPTF_ExecCtrl_CT |
| { |
| f_EPTF_FBQ_initFreeBusyQueue(v_ExecCtrl_PhaseListDeclaratorDB.queue); |
| v_ExecCtrl_PhaseListDeclaratorDB.data :={} |
| v_ExecCtrl_PhaseListDeclaratorDB.hashRef := f_EPTF_str2int_HashMap_New(c_EPTF_ExecCtrl_PhaseListDeclaratorDB_HashName); |
| |
| f_EPTF_FBQ_initFreeBusyQueue(v_ExecCtrl_ScenarioGroupInstanceDB.queue); |
| v_ExecCtrl_ScenarioGroupInstanceDB.data :={} |
| v_ExecCtrl_ScenarioGroupInstanceDB.hashRef := f_EPTF_str2int_HashMap_New(c_EPTF_ExecCtrl_ScenarioGroupInstanceDB_HashName); |
| |
| // Storing phase lists |
| for (var integer i:=0; i<sizeof(v_EPTF_ExecCtrl_PhaseList_Declarators); i:=i+1) |
| { |
| if(f_EPTF_ExecCtrl_PhaseList_store(v_EPTF_ExecCtrl_PhaseList_Declarators[i]) == -1) |
| { |
| f_EPTF_ExecCtrl_warning |
| (log2str("ExecCtrl_Phase: Couldn't store phase list: ", v_EPTF_ExecCtrl_PhaseList_Declarators[i], " at declarator index: ", i)); |
| f_EPTF_ExecCtrl_warning |
| (log2str(("ExecCtrl_Phase: Possible name collision in v_EPTF_ExecCtrl_PhaseList_Declarators"))); |
| } |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_Phase_createScenarioGroups |
| // |
| // Purpose: |
| // Processes the scenario group declarators |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // Reads in the scenario group declaratores and produces the scenario group |
| // instances that will be stored in the v_ExecCtrl_ScenarioGroups component |
| // variable. |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| friend function f_EPTF_ExecCtrl_Phase_createScenarioGroups() |
| runs on EPTF_ExecCtrl_CT |
| { |
| for (var integer i:=0; i<sizeof(v_EPTF_ExecCtrl_ScenarioGroup_Declarators); i:=i+1) |
| { |
| var EPTF_ExecCtrl_ScenarioGroup_Instance vl_sgInstance; |
| if (f_EPTF_ExecCtrl_ScenarioGroup_createInstance(v_EPTF_ExecCtrl_ScenarioGroup_Declarators[i], vl_sgInstance)) |
| { |
| if (f_EPTF_ExecCtrl_ScenarioGroup_storeInstance(vl_sgInstance) == -1) |
| { |
| f_EPTF_ExecCtrl_warning |
| (log2str("ExecCtrl_Phase: Couldn't store scenario instance: ", vl_sgInstance, " at declarator index: ", i, ". A scenario with that name already exist.")); |
| } |
| } |
| else |
| { |
| f_EPTF_ExecCtrl_error |
| (log2str(%definitionId&": Couldn't create scenario group instance: ", v_EPTF_ExecCtrl_ScenarioGroup_Declarators[i], " at declarator index: ", i, |
| " : One or more scenarios in the scenarioNames does not exist.")); |
| } |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_Phase_cleanUp |
| // |
| // Purpose: |
| // Clean up function for the ExecCtrl phase aspect. |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| friend function f_EPTF_ExecCtrl_Phase_cleanUp() |
| runs on EPTF_ExecCtrl_CT |
| { |
| f_EPTF_FBQ_initFreeBusyQueue(v_ExecCtrl_PhaseListDeclaratorDB.queue); |
| //v_ExecCtrl_PhaseListDeclaratorDB.data :={} |
| //v_ExecCtrl_PhaseListDeclaratorDB.hashRef := -1; |
| if (v_ExecCtrl_PhaseListDeclaratorDB.hashRef != -1) { |
| f_EPTF_str2int_HashMap_Delete(c_EPTF_ExecCtrl_PhaseListDeclaratorDB_HashName); |
| v_ExecCtrl_PhaseListDeclaratorDB.hashRef := -1; |
| } |
| v_ExecCtrl_PhaseListDeclaratorDB := c_ExecCtrl_PhaseListDeclaratorDB_initValue; |
| |
| f_EPTF_FBQ_initFreeBusyQueue(v_ExecCtrl_ScenarioGroupInstanceDB.queue); |
| //v_ExecCtrl_ScenarioGroupInstanceDB.data :={} |
| //v_ExecCtrl_ScenarioGroupInstanceDB.hashRef := -1; |
| if (v_ExecCtrl_ScenarioGroupInstanceDB.hashRef != -1) { |
| f_EPTF_str2int_HashMap_Delete(c_EPTF_ExecCtrl_ScenarioGroupInstanceDB_HashName); |
| v_ExecCtrl_ScenarioGroupInstanceDB.hashRef := -1; |
| } |
| v_ExecCtrl_ScenarioGroupInstanceDB := c_ExecCtrl_ScenarioGroupInstanceDB_initValue; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_PhaseList_store |
| // |
| // Purpose: |
| // Stores a phase list declarator in the internal database |
| // (v_ExecCtrl_PhaseListDeclaratorDB) |
| // |
| // Parameters: |
| // - p_declarator - in <EPTF_LGenBase_PhaseList_Declarator> - phase list |
| // declarator to be stored |
| // |
| // Return Value: |
| // - integer index of the stored declarator in the database, or -1 in case of |
| // error |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_PhaseList_store |
| ( |
| in EPTF_LGenBase_PhaseList_Declarator p_declarator |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return integer |
| { |
| var integer vl_plIdx := -1; |
| var integer vl_key := -1; |
| |
| if (not f_EPTF_str2int_HashMap_Find(v_ExecCtrl_PhaseListDeclaratorDB.hashRef, p_declarator.name, vl_key)) |
| { |
| vl_plIdx := f_EPTF_FBQ_getOrCreateFreeSlot(v_ExecCtrl_PhaseListDeclaratorDB.queue); |
| v_ExecCtrl_PhaseListDeclaratorDB.data[vl_plIdx] := p_declarator; |
| f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_ExecCtrl_PhaseListDeclaratorDB.queue); |
| |
| f_EPTF_str2int_HashMap_Insert(v_ExecCtrl_PhaseListDeclaratorDB.hashRef, p_declarator.name, vl_plIdx); |
| } |
| |
| return vl_plIdx; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_PhaseList_get_byIndex |
| // |
| // Purpose: |
| // Returns a phase list declarator from the internal database by using its index |
| // |
| // Parameters: |
| // - p_idx - in *integer* - index of the phase list in the DB |
| // - p_declarator - inout <EPTF_LGenBase_PhaseList_Declarator> - the returned |
| // declarator |
| // |
| // Return Value: |
| // - *boolean*: false in case of error, otherwise true |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_PhaseList_get_byIndex |
| ( |
| in integer p_idx, |
| inout EPTF_LGenBase_PhaseList_Declarator p_declarator |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return boolean |
| { |
| if (p_idx > -1 and p_idx < sizeof(v_ExecCtrl_PhaseListDeclaratorDB.data)) |
| { |
| p_declarator := v_ExecCtrl_PhaseListDeclaratorDB.data[p_idx]; |
| return true; |
| } |
| return false; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_PhaseList_get_byName |
| // |
| // Purpose: |
| // Returns a phase list declarator from the internal database by using its name |
| // |
| // Parameters: |
| // - p_name - in *charstring* - name of the phase list in the DB |
| // - p_declarator - inout <EPTF_LGenBase_PhaseList_Declarator> - the returned declarator |
| // |
| // Return Value: |
| // - *boolean*: false in case of error, otherwise true |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_PhaseList_get_byName |
| ( |
| in charstring p_name, |
| inout EPTF_LGenBase_PhaseList_Declarator p_declarator |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return boolean |
| { |
| var integer vl_key := -1; |
| |
| if (f_EPTF_str2int_HashMap_Find(v_ExecCtrl_PhaseListDeclaratorDB.hashRef, p_name, vl_key)) |
| { |
| if (f_EPTF_ExecCtrl_PhaseList_get_byIndex(vl_key, p_declarator)) |
| { |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_PhaseList_createInstance_byDeclarator |
| // |
| // Purpose: |
| // Returns a phase list instance based on the declarator passed as parameter |
| // |
| // Parameters: |
| // - p_declarator - in <EPTF_LGenBase_PhaseList_Declarator> - name of the phase list in the DB |
| // - p_instance - inout <EPTF_ExecCtrl_PhaseList_Instance> - the returned instance |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_PhaseList_createInstance_byDeclarator |
| ( |
| in EPTF_LGenBase_PhaseList_Declarator p_declarator, |
| inout EPTF_ExecCtrl_PhaseList_Instance p_instance |
| ) |
| runs on EPTF_ExecCtrl_CT |
| { |
| p_instance := c_EPTF_ExecCtrl_PhaseList_Instance_empty; |
| |
| p_instance.name := p_declarator.name; |
| |
| for (var integer i:=0; i<sizeof(p_declarator.phases); i:=i+1) |
| { |
| p_instance.phases[i] := |
| { |
| name := p_declarator.phases[i].name, |
| enabled := p_declarator.phases[i].enabled, |
| state := IDLE |
| } |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_PhaseList_createInstance_byName |
| // |
| // Purpose: |
| // Returns a phase list instance by using the name of the declarator |
| // |
| // Parameters: |
| // - p_declarator - in *charstring* - name of the declared phase list |
| // - p_instance - inout <EPTF_ExecCtrl_PhaseList_Instance> - the returned instance |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_PhaseList_createInstance_byName |
| ( |
| in charstring p_name, |
| inout EPTF_ExecCtrl_PhaseList_Instance p_instance |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return boolean |
| { |
| var integer vl_key := -1; |
| |
| if (f_EPTF_str2int_HashMap_Find(v_ExecCtrl_PhaseListDeclaratorDB.hashRef, p_name, vl_key)) |
| { |
| f_EPTF_ExecCtrl_PhaseList_createInstance_byDeclarator(v_ExecCtrl_PhaseListDeclaratorDB.data[vl_key], p_instance); |
| return true; |
| } |
| |
| return false; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_PhaseList_resetPhaseStates |
| // |
| // Purpose: |
| // Resets the phase states of a phase list instance. |
| // |
| // Parameters: |
| // - p_pl - inout <EPTF_ExecCtrl_PhaseList_Instance> - the modified instance |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_PhaseList_resetPhaseStates |
| ( |
| inout EPTF_ExecCtrl_PhaseList_Instance p_pl |
| ) |
| { |
| p_pl.actualPhaseIndex := 0; |
| for (var integer i:=0; i<sizeof(p_pl.phases); i:=i+1) |
| { |
| p_pl.phases[i].state := IDLE; |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_PhaseList_setNextState |
| // |
| // Purpose: |
| // Sets the next state of aphase list instance if possible |
| // |
| // Parameters: |
| // - p_pl - inout <EPTF_ExecCtrl_PhaseList_Instance> - the modified instance |
| // |
| // Return Value: |
| // - boolean: false in case of error (e.g. phase list is neither IDLE nor FINISHED) |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_PhaseList_setNextState |
| ( |
| inout EPTF_ExecCtrl_PhaseList_Instance p_pl |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return boolean |
| { |
| if (p_pl.phases[p_pl.actualPhaseIndex].state == FINISHED or |
| p_pl.phases[p_pl.actualPhaseIndex].state == IDLE) |
| { |
| if (p_pl.actualPhaseIndex < sizeof(p_pl.phases)-1) |
| { |
| p_pl.actualPhaseIndex := p_pl.actualPhaseIndex + 1; |
| } |
| else |
| { |
| p_pl.actualPhaseIndex := 0; |
| } |
| p_pl.phases[p_pl.actualPhaseIndex].state := IDLE; |
| |
| return true; |
| } |
| else |
| { |
| f_EPTF_ExecCtrl_warning |
| (log2str("Cannot set next state, current state is still running!")); |
| return false; |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_PhaseList_isValidPhase |
| // |
| // Purpose: |
| // Returns the index of the given phase name in the phase list |
| // |
| // Parameters: |
| // - p_pl - inout <EPTF_ExecCtrl_PhaseList_Instance> - phase list instance |
| // - pl_phaseName - in *charstring* - name of the phase |
| // |
| // Return Value: |
| // - integer: -1 in case of error (e.g. phase doesn't exist in the list) |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| friend function f_EPTF_ExecCtrl_PhaseList_isValidPhase |
| ( |
| inout EPTF_ExecCtrl_PhaseList_Instance p_pl, |
| in charstring pl_phaseName |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return integer |
| { |
| for (var integer i:=0; i<sizeof(p_pl.phases); i:=i+1) |
| { |
| if (p_pl.phases[i].name == pl_phaseName) |
| { |
| return i; |
| } |
| } |
| return -1; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_PhaseList_setPhase |
| // |
| // Purpose: |
| // Sets the phase in a phase list instance if possible |
| // |
| // Parameters: |
| // - p_pl - inout <EPTF_ExecCtrl_PhaseList_Instance> - phase list instance |
| // - pl_phaseName - in *charstring* - name of the phase |
| // |
| // Return Value: |
| // - boolean: false in case of error (e.g. phase list is not IDLE) |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_PhaseList_setPhase |
| ( |
| inout EPTF_ExecCtrl_PhaseList_Instance p_pl, |
| in charstring p_phaseName |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return boolean |
| { |
| if (p_pl.phases[p_pl.actualPhaseIndex].state == FINISHED or |
| p_pl.phases[p_pl.actualPhaseIndex].state == IDLE) |
| { |
| var integer vl_phaseIdx := f_EPTF_ExecCtrl_PhaseList_isValidPhase(p_pl, p_phaseName); |
| |
| if (vl_phaseIdx > -1) |
| { |
| p_pl.actualPhaseIndex := vl_phaseIdx; |
| p_pl.phases[p_pl.actualPhaseIndex].state := IDLE; |
| |
| return true; |
| } |
| } |
| |
| f_EPTF_ExecCtrl_warning |
| (log2str("Couldn't set state: ",p_phaseName," for ",p_pl)); |
| return false; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_PhaseList_reset |
| // |
| // Purpose: |
| // Resets the phase phase list and moves it to its first phase |
| // |
| // Parameters: |
| // - p_pl - inout <EPTF_ExecCtrl_PhaseList_Instance> - phase list instance |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_PhaseList_reset |
| ( |
| inout EPTF_ExecCtrl_PhaseList_Instance p_pl |
| ) |
| { |
| f_EPTF_ExecCtrl_PhaseList_resetPhaseStates(p_pl); |
| |
| if (sizeof(p_pl.phases)>0) |
| { |
| p_pl.actualPhaseIndex := 0; |
| } |
| else |
| { |
| p_pl.actualPhaseIndex := -1; |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_PhaseList_setStateFromSubPhaseLists |
| // |
| // Purpose: |
| // Sets the phase in a phase list instance if possible |
| // |
| // Parameters: |
| // - p_main - inout <EPTF_ExecCtrl_PhaseList_Instance> - main phase list instance |
| // - p_subs - inout <EPTF_ExecCtrl_PhaseList_Instance_List> - phase lists which the main phase list is depending on |
| // |
| // Return Value: |
| // - boolean: false in case of error (e.g. the sub phase lists' states are contradictory) |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_PhaseList_setStateFromSubPhaseLists |
| ( |
| inout EPTF_ExecCtrl_PhaseList_Instance p_main, |
| inout EPTF_ExecCtrl_PhaseList_Instance_List p_subs |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return boolean |
| { |
| var integer vl_idle := 0; |
| var integer vl_running := 0; |
| var integer vl_skipping := 0; |
| var integer vl_stopping := 0; |
| var integer vl_finished := 0; |
| var integer vl_total := sizeof(p_subs); |
| |
| var integer vl_actPhase := p_main.actualPhaseIndex; |
| |
| for (var integer i:=0; i<vl_total; i:=i+1) |
| { |
| if (p_subs[i].actualPhaseIndex == vl_actPhase) |
| { |
| if (p_subs[i].phases[vl_actPhase].state == IDLE) |
| { |
| vl_idle := vl_idle + 1; |
| } |
| else if (p_subs[i].phases[vl_actPhase].state == RUNNING) |
| { |
| vl_running := vl_running + 1; |
| } |
| else if (p_subs[i].phases[vl_actPhase].state == SKIPPING) |
| { |
| vl_skipping := vl_skipping + 1; |
| } |
| else if (p_subs[i].phases[vl_actPhase].state == STOPPING) |
| { |
| vl_stopping := vl_stopping + 1; |
| } |
| else if (p_subs[i].phases[vl_actPhase].state == FINISHED) |
| { |
| vl_finished := vl_finished + 1; |
| } |
| } |
| else |
| { |
| f_EPTF_ExecCtrl_warning |
| (log2str("Phase mismatch in ",p_main," at the ",i," element of ", p_subs)); |
| return false |
| } |
| } |
| |
| if (vl_idle == vl_total) |
| { |
| p_main.phases[vl_actPhase].state := IDLE; |
| } |
| else if (vl_finished == vl_total) |
| { |
| p_main.phases[vl_actPhase].state := FINISHED; |
| } |
| else if (vl_stopping > 0) |
| { |
| p_main.phases[vl_actPhase].state := STOPPING; |
| } |
| else if (vl_running > 0) |
| { |
| p_main.phases[vl_actPhase].state := RUNNING; |
| } |
| else if (vl_skipping > 0) |
| { |
| p_main.phases[vl_actPhase].state := SKIPPING; |
| } |
| else |
| { |
| f_EPTF_ExecCtrl_warning(log2str("Can't determine phase in ",p_main," from ", p_subs)); |
| f_EPTF_ExecCtrl_debug(log2str("Statistics: ")); |
| f_EPTF_ExecCtrl_debug(log2str("idle: ", vl_idle)); |
| f_EPTF_ExecCtrl_debug(log2str("running: ", vl_running)); |
| f_EPTF_ExecCtrl_debug(log2str("skipping: ", vl_skipping)); |
| f_EPTF_ExecCtrl_debug(log2str("finished: ", vl_finished)); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_isValidExecMode |
| // |
| // Purpose: |
| // Checks whether an execution mode name is valid or not and returns the |
| // corresponding enumerated value. |
| // |
| // Parameters: |
| // - p_str - in *charstring* - main phase list instance |
| // - p_exec - out <EPTF_ExecCtrl_ScenarioGroup_ExecMode> - returned enum value |
| // |
| // Return Value: |
| // - boolean: false in case of error (e.g. exec mode name doesn't exist) |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| friend function f_EPTF_ExecCtrl_ScenarioGroup_isValidExecMode |
| ( |
| in charstring p_str, |
| out EPTF_ExecCtrl_ScenarioGroup_ExecMode p_exec |
| ) |
| return boolean |
| { |
| if (p_str == "AUTOMATIC" or p_str == "automatic") |
| { |
| p_exec := AUTOMATIC; |
| return true; |
| } |
| else if (p_str == "MANUAL" or p_str == "manual") |
| { |
| p_exec := MANUAL; |
| return true; |
| } |
| |
| return false; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_createInstance |
| // |
| // Purpose: |
| // Creates a scenario group instance based on the given declarator. |
| // |
| // Parameters: |
| // - p_declarator - in <EPTF_ExecCtrl_ScenarioGroup_Declarator> - declarator |
| // - p_instance - inout <EPTF_ExecCtrl_ScenarioGroup_Instance> - returned instance |
| // |
| // Return Value: |
| // - boolean: false in case of error (e.g. declarator refers to not existing scenarios or entity groups) |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_ScenarioGroup_createInstance |
| ( |
| in EPTF_ExecCtrl_ScenarioGroup_Declarator p_declarator, |
| inout EPTF_ExecCtrl_ScenarioGroup_Instance p_instance |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return boolean |
| { |
| var EPTF_ExecCtrl_PhaseList_Instance p_pl := c_EPTF_ExecCtrl_PhaseList_Instance_empty; |
| if (f_EPTF_ExecCtrl_PhaseList_createInstance_byName(p_declarator.phaseListName, p_pl)) |
| { |
| p_instance := c_EPTF_ExecCtrl_ScenarioGroup_Instance_empty; |
| p_instance.name := p_declarator.name; |
| p_instance.execMode := p_declarator.execMode; |
| p_instance.groupPhaseList := p_pl; |
| |
| for (var integer i:=0; i<sizeof(p_declarator.scenarioNames); i:=i+1) |
| { |
| var integer vl_scIdx := f_EPTF_ExecCtrl_getScenarioIdxByInstanceName(p_declarator.scenarioNames[i]); |
| if (vl_scIdx==-1) { |
| f_EPTF_ExecCtrl_warning(%definitionId&": Scenario "&p_declarator.scenarioNames[i]&" not found in scenario group "&p_declarator.name); |
| return false; // createInstance not successful |
| } |
| var integer vl_eGroupIdx := -1; |
| var EPTF_IntegerList vl_lgens := {}; |
| var EPTF_ExecCtrl_PhaseList_Instance_List vl_lgenPhaseList := {}; |
| |
| // this is done in f_EPTF_ExecCtrl_ScenarioGroup_deployInstance |
| // // TODO: FIXME inside this if :-) |
| // if (vl_scIdx != -1) |
| // { |
| // vl_eGroupIdx := v_ExecCtrl_scenarios[vl_scIdx].eGroupIdx; |
| // if (vl_eGroupIdx != -1) |
| // { |
| // for (var integer j:=0; j<sizeof(v_ExecCtrl_entityGroups[vl_eGroupIdx].lgenList); j:=j+1) |
| // { |
| // vl_lgens[sizeof(vl_lgens)] := v_ExecCtrl_entityGroups[vl_eGroupIdx].lgenList[j].lgenIdx; |
| // vl_lgenPhaseList[sizeof(vl_lgenPhaseList)] := p_pl; |
| // } |
| // if (sizeof(v_ExecCtrl_entityGroups[vl_eGroupIdx].lgenList)==0) |
| // { |
| // action("There are no LGens for ", p_declarator.scenarioNames[i]); |
| // action(v_ExecCtrl_entityGroups[vl_eGroupIdx]); |
| // } |
| // } |
| // else |
| // { |
| // action("Entity Group not found for ", p_declarator.scenarioNames[i]); |
| // } |
| // } |
| // else |
| // { |
| // action("Scenario instance not found for ", p_declarator.scenarioNames[i]); |
| // } |
| |
| p_instance.scenarios[i] := |
| { |
| name := p_declarator.scenarioNames[i], |
| idx := vl_scIdx, |
| lgenIndexes := vl_lgens, |
| lgenPhaseLists := vl_lgenPhaseList |
| }; |
| |
| p_instance.scenarioPhaseLists[i] := p_pl; |
| } |
| |
| return true |
| } |
| |
| return false; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_Phase_deployScenarioGroups |
| // |
| // Purpose: |
| // Deploys scenario groups to LGens |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // Reads in the scenario group instances and deploys them on LGens. |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| friend function f_EPTF_ExecCtrl_Phase_deployScenarioGroups() |
| runs on EPTF_ExecCtrl_CT |
| { |
| for (var integer i:=0; i<sizeof(v_ExecCtrl_ScenarioGroupInstanceDB.data); i:=i+1) |
| { |
| var EPTF_ExecCtrl_ScenarioGroup_Instance vl_sgInstance; |
| if (not f_EPTF_ExecCtrl_ScenarioGroup_deployInstance(v_ExecCtrl_ScenarioGroupInstanceDB.data[i])) |
| { |
| f_EPTF_ExecCtrl_warning |
| (log2str("ExecCtrl_Phase: Couldn't deploy scenario instance to LGens: ", v_ExecCtrl_ScenarioGroupInstanceDB.data[i], " with instance index: ", i)); |
| } |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_deployInstance |
| // |
| // Purpose: |
| // Deploys a scenario group instance to LGens. |
| // |
| // Parameters: |
| // - p_instance - inout <EPTF_ExecCtrl_ScenarioGroup_Instance> - returned instance |
| // |
| // Return Value: |
| // - boolean: false in case of error (e.g. declarator refers to not existing scenarios or entity groups) |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_ScenarioGroup_deployInstance |
| ( |
| inout EPTF_ExecCtrl_ScenarioGroup_Instance p_instance |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return boolean |
| { |
| for (var integer i:=0; i<sizeof(p_instance.scenarios); i:=i+1) |
| { |
| var integer vl_scIdx := p_instance.scenarios[i].idx; |
| var integer vl_eGroupIdx := -1; |
| var EPTF_IntegerList vl_lgens := {}; |
| var EPTF_ExecCtrl_PhaseList_Instance_List vl_lgenPhaseList := {}; |
| |
| // TODO: FIXME inside this if :-) |
| if (vl_scIdx != -1) |
| { |
| vl_eGroupIdx := v_ExecCtrl_scenarios[vl_scIdx].eGroupIdx; |
| if (vl_eGroupIdx != -1) |
| { |
| for (var integer j:=0; j<sizeof(v_ExecCtrl_entityGroups[vl_eGroupIdx].lgenList); j:=j+1) |
| { |
| vl_lgens[sizeof(vl_lgens)] := v_ExecCtrl_entityGroups[vl_eGroupIdx].lgenList[j].lgenIdx; |
| vl_lgenPhaseList[sizeof(vl_lgenPhaseList)] := p_instance.groupPhaseList; |
| } |
| if (sizeof(v_ExecCtrl_entityGroups[vl_eGroupIdx].lgenList)==0) |
| { |
| f_EPTF_ExecCtrl_debug(log2str("There are no LGens for ", p_instance.scenarios[i].name)); |
| f_EPTF_ExecCtrl_debug(log2str(v_ExecCtrl_entityGroups[vl_eGroupIdx])); |
| } |
| } |
| else |
| { |
| f_EPTF_ExecCtrl_debug(log2str("Entity Group not found for ", p_instance.scenarios[i].name)); |
| } |
| } |
| else |
| { |
| f_EPTF_ExecCtrl_debug(log2str("Scenario instance not found for ", p_instance.scenarios[i].name)); |
| } |
| |
| p_instance.scenarios[i] := |
| { |
| name := p_instance.scenarios[i].name, |
| idx := vl_scIdx, |
| lgenIndexes := vl_lgens, |
| lgenPhaseLists := vl_lgenPhaseList |
| }; |
| } |
| return true |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_storeInstance |
| // |
| // Purpose: |
| // Stores the given scenario group instance in the component variable database. |
| // |
| // Parameters: |
| // - p_sg_inst - in <EPTF_ExecCtrl_ScenarioGroup_Instance> - scenario group instance |
| // |
| // Return Value: |
| // - integer: index of the stored instance in the database, -1 in case of an |
| // error (e.g. an instance with this scenario group name is already stored) |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_ScenarioGroup_storeInstance |
| ( |
| in EPTF_ExecCtrl_ScenarioGroup_Instance p_sg_inst |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return integer |
| { |
| var integer vl_key := -1; |
| var integer vl_sgIdx := -1; |
| |
| if (not f_EPTF_str2int_HashMap_Find(v_ExecCtrl_ScenarioGroupInstanceDB.hashRef, p_sg_inst.name, vl_key)) |
| { |
| vl_sgIdx := f_EPTF_FBQ_getOrCreateFreeSlot(v_ExecCtrl_ScenarioGroupInstanceDB.queue); |
| |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx] := p_sg_inst; |
| f_EPTF_ExecCtrl_ScenarioGroup_registerInstanceId2ScenariosDB(vl_sgIdx); |
| f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_ExecCtrl_ScenarioGroupInstanceDB.queue); |
| |
| f_EPTF_str2int_HashMap_Insert(v_ExecCtrl_ScenarioGroupInstanceDB.hashRef, p_sg_inst.name, vl_sgIdx); |
| } |
| |
| return vl_sgIdx; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_registerInstanceId2ScenariosDB |
| // |
| // Purpose: |
| // Updates the scenario instance DB with the scenario group index to which |
| // the scenario is added. |
| // |
| // Parameters: |
| // - pl_sgIdx - in integer - scenario group instance idx |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_ScenarioGroup_registerInstanceId2ScenariosDB(in integer pl_sgIdx) runs on EPTF_ExecCtrl_CT { |
| for(var integer sc:=0; sc<sizeof(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_sgIdx].scenarios); sc:=sc+1) { |
| var integer vl_scIdx := v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_sgIdx].scenarios[sc].idx; |
| v_ExecCtrl_scenarios[vl_scIdx].scGrpIdx := pl_sgIdx; |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_get_byScIndex |
| // |
| // Purpose: |
| // Returns a scenario group instance idx from the database |
| // to which the scenario with instance idx is added |
| // |
| // Parameters: |
| // - p_scIdx - in *integer* - scenario instance index |
| // |
| // Return Value: |
| // - integer: the scenario group instance index (-1 if not found) |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| public function f_EPTF_ExecCtrl_ScenarioGroup_get_byScIndex |
| ( |
| in integer p_scIdx |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return integer |
| { |
| if (p_scIdx < 0 or p_scIdx >= sizeof(v_ExecCtrl_scenarios)) |
| { |
| return -1; |
| } |
| return v_ExecCtrl_scenarios[p_scIdx].scGrpIdx; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_get_byIndex |
| // |
| // Purpose: |
| // Returns a scenario group instance from the database using its index |
| // |
| // Parameters: |
| // - p_idx - in *integer* - scenario group instance index in the database |
| // - p_instance - inout <EPTF_ExecCtrl_ScenarioGroup_Instance> - the |
| // returned instance |
| // |
| // Return Value: |
| // - boolean: false in case of an error (e.g. index is not valid) |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_ScenarioGroup_get_byIndex |
| ( |
| in integer p_idx, |
| inout EPTF_ExecCtrl_ScenarioGroup_Instance p_instance |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return boolean |
| { |
| if (p_idx > -1 and p_idx < sizeof(v_ExecCtrl_ScenarioGroupInstanceDB.data)) |
| { |
| p_instance := v_ExecCtrl_ScenarioGroupInstanceDB.data[p_idx]; |
| return true; |
| } |
| return false; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_get_byName |
| // |
| // Purpose: |
| // Returns a scenario group instance from the database using its name |
| // |
| // Parameters: |
| // - p_name - in *charstring* - scenario group instance name in the database |
| // - p_instance - inout <EPTF_ExecCtrl_ScenarioGroup_Instance> - the |
| // returned instance |
| // |
| // Return Value: |
| // - boolean: false in case of an error (e.g. name is not valid) |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_ScenarioGroup_get_byName |
| ( |
| in charstring p_name, |
| inout EPTF_ExecCtrl_ScenarioGroup_Instance p_instance |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return boolean |
| { |
| var integer vl_key := -1; |
| |
| if (f_EPTF_str2int_HashMap_Find(v_ExecCtrl_ScenarioGroupInstanceDB.hashRef, p_name, vl_key)) |
| { |
| if (f_EPTF_ExecCtrl_ScenarioGroup_get_byIndex(vl_key, p_instance)) |
| { |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_getIdx |
| // |
| // Purpose: |
| // Returns the index of a scenario group instance in the database using its name |
| // |
| // Parameters: |
| // - p_name - in *charstring* - scenario group instance name in the database |
| // |
| // Return Value: |
| // - integer: -1 in case of an error (e.g. name is not valid) |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| public function f_EPTF_ExecCtrl_ScenarioGroup_getIdx |
| ( |
| in charstring p_name |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return integer |
| { |
| var integer vl_key := -1; |
| |
| if (not f_EPTF_str2int_HashMap_Find(v_ExecCtrl_ScenarioGroupInstanceDB.hashRef, p_name, vl_key)) { |
| return -1; |
| }; |
| return vl_key; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_resetScenarios |
| // |
| // Purpose: |
| // Resets the scenarios of the scenario group |
| // |
| // Parameters: |
| // - p_instance - in <EPTF_ExecCtrl_ScenarioGroup_Instance> - the modified scenario group instance |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_ScenarioGroup_resetScenarios |
| ( |
| in EPTF_ExecCtrl_ScenarioGroup_Instance p_instance |
| ) runs on EPTF_ExecCtrl_CT |
| { |
| for(var integer i:=0; i<sizeof(p_instance.scenarios); i:=i+1) { |
| f_EPTF_ExecCtrl_resetScenarioOnLGens_private(p_instance.scenarios[i].idx); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_resetPhaseStates |
| // |
| // Purpose: |
| // Resets the phase states of the phase list instance of the scenario group |
| // |
| // Parameters: |
| // - p_instance - inout <EPTF_ExecCtrl_ScenarioGroup_Instance> - the modified scenario group instance |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_ScenarioGroup_resetPhaseStates |
| ( |
| inout EPTF_ExecCtrl_ScenarioGroup_Instance p_instance |
| ) runs on EPTF_ExecCtrl_CT |
| { |
| f_EPTF_ExecCtrl_PhaseList_resetPhaseStates(p_instance.groupPhaseList); |
| |
| for (var integer i:=0; i<sizeof(p_instance.scenarioPhaseLists); i:=i+1) |
| { |
| f_EPTF_ExecCtrl_PhaseList_resetPhaseStates(p_instance.scenarioPhaseLists[i]); |
| for (var integer j:=0; j<sizeof(p_instance.scenarios[i].lgenPhaseLists); j:=j+1) |
| { |
| f_EPTF_ExecCtrl_PhaseList_resetPhaseStates(p_instance.scenarios[i].lgenPhaseLists[j]); |
| } |
| } |
| // call phaseChangedCallBacks: |
| f_EPTF_ExecCtrl_callScenarioGroupPhaseChangedCallbacks(p_instance.name,p_instance.groupPhaseList.actualPhaseIndex); |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_setPhase |
| // |
| // Purpose: |
| // Sets the actual phase for a scenario group instance (affects the phase list instances |
| // of the scenario group instance) |
| // |
| // Parameters: |
| // - p_instance - inout <EPTF_ExecCtrl_ScenarioGroup_Instance> - the modified scenario group instance |
| // - p_phaseName - in *charstring* - the name of the phase to be set |
| // |
| // Return Value: |
| // - boolean: false in case of error |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| friend function f_EPTF_ExecCtrl_ScenarioGroup_setPhase |
| ( |
| inout EPTF_ExecCtrl_ScenarioGroup_Instance p_instance, |
| in charstring p_phaseName |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return boolean |
| { |
| if (f_EPTF_ExecCtrl_PhaseList_setPhase(p_instance.groupPhaseList, p_phaseName)) |
| { |
| for (var integer i:=0; i<sizeof(p_instance.scenarioPhaseLists); i:=i+1) |
| { |
| if(not f_EPTF_ExecCtrl_PhaseList_setPhase(p_instance.scenarioPhaseLists[i], p_phaseName)) {/*cannot happen*/}; |
| for (var integer j:=0; j<sizeof(p_instance.scenarios[i].lgenPhaseLists); j:=j+1) |
| { |
| if(not f_EPTF_ExecCtrl_PhaseList_setPhase(p_instance.scenarios[i].lgenPhaseLists[j], p_phaseName)) {/*cannot happen*/}; |
| } |
| } |
| // call phaseChangedCallBacks: |
| f_EPTF_ExecCtrl_callScenarioGroupPhaseChangedCallbacks(p_instance.name,p_instance.groupPhaseList.actualPhaseIndex); |
| return true; |
| } |
| return false; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_resetPhaseLists |
| // |
| // Purpose: |
| // Resets the phase states of the phase list instance of the scenario group |
| // |
| // Parameters: |
| // - p_instance - inout <EPTF_ExecCtrl_ScenarioGroup_Instance> - the modified scenario group instance |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_ScenarioGroup_resetPhaseLists |
| ( |
| inout EPTF_ExecCtrl_ScenarioGroup_Instance p_instance |
| ) |
| { |
| f_EPTF_ExecCtrl_PhaseList_reset(p_instance.groupPhaseList); |
| |
| for (var integer i:=0; i<sizeof(p_instance.scenarioPhaseLists); i:=i+1) |
| { |
| f_EPTF_ExecCtrl_PhaseList_reset(p_instance.scenarioPhaseLists[i]); |
| for (var integer j:=0; j<sizeof(p_instance.scenarios[i].lgenPhaseLists); j:=j+1) |
| { |
| f_EPTF_ExecCtrl_PhaseList_reset(p_instance.scenarios[i].lgenPhaseLists[j]); |
| } |
| } |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_registerScenarioGroupPhaseChangedCallback |
| // |
| // Purpose: |
| // Register a scenarioGroup phaseChange callback function, that is called when the phase of the scenarioGroup changes |
| // |
| // Parameters: |
| // - pl_scenarioStateChangedCallback - *in* <EPTF_ExecCtrl_ScenarioStateChangedCallbackFn> - reference to the callback function |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // |
| // |
| /////////////////////////////////////////////////////////// |
| public function f_EPTF_ExecCtrl_registerScenarioGroupPhaseChangedCallback(in EPTF_ExecCtrl_ScenarioGroupPhaseChangedCallbackFn pl_scenarioGroupPhaseChangedCallback) runs on EPTF_ExecCtrl_CT { |
| v_EPTF_ExecCtrl_ScenarioGroupPhaseChangedCallbackFns[sizeof(v_EPTF_ExecCtrl_ScenarioGroupPhaseChangedCallbackFns)] := pl_scenarioGroupPhaseChangedCallback; |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_callScenarioGroupPhaseChangedCallbacks |
| // |
| // Purpose: |
| // Calls all scenarioGroupPhaseChange callback functions |
| // |
| // Parameters: |
| // - pl_sgName - *in charstring* - name of the scenario group |
| // - pl_actualPhaseIdx - *in integer* - index of the actual phase of the scenarioGroup |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // |
| // |
| /////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_callScenarioGroupPhaseChangedCallbacks(in charstring pl_sgName, in integer pl_actualPhaseIdx) runs on EPTF_ExecCtrl_CT { |
| //var integer vl_sgIdx := f_EPTF_ExecCtrl_ScenarioGroup_getIdx(pl_sgName); |
| for(var integer i:=0; i<sizeof(v_EPTF_ExecCtrl_ScenarioGroupPhaseChangedCallbackFns);i:=i+1) { |
| if(c_EPTF_Common_debugSwitch) { |
| f_EPTF_ExecCtrl_debug(log2str("ExecCtrl: scenarioGroupPhaseChangedCallback: ", v_EPTF_ExecCtrl_ScenarioGroupPhaseChangedCallbackFns[i], " called")); |
| f_EPTF_ExecCtrl_debug(log2str("Args: pl_sgName: ", pl_sgName, " pl_actualPhaseIdx: ",pl_actualPhaseIdx)) |
| } |
| v_EPTF_ExecCtrl_ScenarioGroupPhaseChangedCallbackFns[i].apply(pl_sgName,pl_actualPhaseIdx); |
| if(c_EPTF_Common_debugSwitch) { |
| f_EPTF_ExecCtrl_debug(log2str("ExecCtrl: scenarioGroupPhaseChangedCallback: ", v_EPTF_ExecCtrl_ScenarioGroupPhaseChangedCallbackFns[i], " done")); |
| } |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_startActualPhase |
| // |
| // Purpose: |
| // Starts the actual phase of the given scenario group |
| // |
| // Parameters: |
| // - p_instance - inout <EPTF_ExecCtrl_ScenarioGroup_Instance> - the scenario group instance to be started |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_ScenarioGroup_startActualPhase |
| ( |
| inout EPTF_ExecCtrl_ScenarioGroup_Instance p_instance |
| ) |
| runs on EPTF_ExecCtrl_CT |
| { |
| var integer vl_sgIdx := f_EPTF_ExecCtrl_ScenarioGroup_getIdx(p_instance.name); |
| var integer vl_phaseIdx := p_instance.groupPhaseList.actualPhaseIndex; |
| |
| if (p_instance.groupPhaseList.phases[vl_phaseIdx].state == IDLE) |
| { |
| var EPTF_ExecCtrl_Phase_States vl_groupState := RUNNING; |
| |
| if (not p_instance.groupPhaseList.phases[vl_phaseIdx].enabled) { vl_groupState := SKIPPING } |
| p_instance.groupPhaseList.phases[vl_phaseIdx].state := vl_groupState; |
| |
| f_EPTF_ExecCtrl_debug |
| (log2str("ScenarioGroup: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].name& |
| " phase: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList.phases[vl_phaseIdx].name&" starting.")); |
| |
| f_EPTF_ExecCtrl_debug(log2str("ScenarioGroup: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].name& |
| " phase: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList.phases[vl_phaseIdx].name&" starting.")); |
| |
| // for each scenario |
| for (var integer i:=0; i<sizeof(p_instance.scenarioPhaseLists); i:=i+1) |
| { |
| var EPTF_ExecCtrl_Phase_States vl_scenState := vl_groupState; |
| |
| if (not p_instance.scenarioPhaseLists[i].phases[vl_phaseIdx].enabled) { vl_scenState := SKIPPING } |
| p_instance.scenarioPhaseLists[i].phases[vl_phaseIdx].state := vl_scenState; |
| |
| for (var integer j:=0; j<sizeof(p_instance.scenarios[i].lgenPhaseLists); j:=j+1) |
| { |
| p_instance.scenarios[i].lgenPhaseLists[j].phases[vl_phaseIdx].state := vl_scenState; |
| |
| var integer vl_eGrpIdx := v_ExecCtrl_scenarios[p_instance.scenarios[i].idx].eGroupIdx; |
| |
| var integer vl_lgenIdx := p_instance.scenarios[i].lgenIndexes[j]; |
| var integer vl_lgenIdxInEGrp := f_EPTF_ExecCtrl_getLGenIdxInEGrpForLGenAndEgrp(vl_lgenIdx,vl_eGrpIdx); |
| if (v_ExecCtrl_entityGroups[vl_eGrpIdx].lgenList[vl_lgenIdxInEGrp].eCount == 0) { |
| continue; // do not send packet to LGen if there is no entity on the LGen |
| } |
| |
| f_EPTF_ExecCtrl_sendPhaseStartReq |
| (EPTF_ExecCtrl_PhaseStartReq: |
| { |
| phaseName := p_instance.groupPhaseList.phases[vl_phaseIdx].name, |
| entityGroupName := v_ExecCtrl_entityGroups[vl_eGrpIdx].name, |
| scenarioInstanceName := f_EPTF_ExecCtrl_getScenarioName(p_instance.scenarios[i].idx), |
| state := vl_scenState, |
| msgID := |
| { |
| vl_sgIdx, |
| i, |
| j, |
| vl_phaseIdx |
| } |
| }, |
| p_instance.scenarios[i].lgenIndexes[j] |
| ); |
| } |
| } |
| } |
| else |
| { |
| f_EPTF_ExecCtrl_warning |
| (log2str("Actual phase is not idle, cannot start: ", p_instance.groupPhaseList)); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_stopActualPhase |
| // |
| // Purpose: |
| // Stops the actual phase of the given scenario group |
| // |
| // Parameters: |
| // - p_instance - inout <EPTF_ExecCtrl_ScenarioGroup_Instance> - the scenario group instance to be stopped |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_ScenarioGroup_stopActualPhase |
| ( |
| inout EPTF_ExecCtrl_ScenarioGroup_Instance p_instance |
| ) |
| runs on EPTF_ExecCtrl_CT |
| { |
| var integer vl_sgIdx := f_EPTF_ExecCtrl_ScenarioGroup_getIdx(p_instance.name); |
| var integer vl_phaseIdx := p_instance.groupPhaseList.actualPhaseIndex; |
| |
| if (p_instance.groupPhaseList.phases[vl_phaseIdx].state == RUNNING or |
| p_instance.groupPhaseList.phases[vl_phaseIdx].state == SKIPPING |
| ) |
| { |
| f_EPTF_ExecCtrl_debug(log2str("ScenarioGroup: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].name& |
| " phase: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList.phases[vl_phaseIdx].name&" stopping.")); |
| |
| p_instance.groupPhaseList.phases[vl_phaseIdx].state := STOPPING; |
| |
| // for each scenario |
| for (var integer i:=0; i<sizeof(p_instance.scenarioPhaseLists); i:=i+1) |
| { |
| p_instance.scenarioPhaseLists[i].phases[vl_phaseIdx].state := STOPPING; |
| |
| var integer vl_eGrpIdx := v_ExecCtrl_scenarios[p_instance.scenarios[i].idx].eGroupIdx; |
| |
| for (var integer j:=0; j<sizeof(p_instance.scenarios[i].lgenPhaseLists); j:=j+1) |
| { |
| var integer vl_lgenIdx := p_instance.scenarios[i].lgenIndexes[j]; |
| var integer vl_lgenIdxInEGrp := f_EPTF_ExecCtrl_getLGenIdxInEGrpForLGenAndEgrp(vl_lgenIdx,vl_eGrpIdx); |
| if (v_ExecCtrl_entityGroups[vl_eGrpIdx].lgenList[vl_lgenIdxInEGrp].eCount == 0) { |
| continue; // do not send packet to LGen if there is no entity on the LGen |
| } |
| p_instance.scenarios[i].lgenPhaseLists[j].phases[vl_phaseIdx].state := STOPPING; |
| f_EPTF_ExecCtrl_sendPhaseStopReq |
| (EPTF_ExecCtrl_PhaseStopReq: |
| { |
| phaseName := p_instance.groupPhaseList.phases[vl_phaseIdx].name, |
| entityGroupName := v_ExecCtrl_entityGroups[vl_eGrpIdx].name, |
| scenarioInstanceName := f_EPTF_ExecCtrl_getScenarioName(p_instance.scenarios[i].idx), |
| state := STOPPING, |
| msgID := |
| { |
| vl_sgIdx, |
| i, |
| j, |
| vl_phaseIdx |
| } |
| }, |
| p_instance.scenarios[i].lgenIndexes[j] |
| ); |
| } |
| } |
| } |
| else |
| { |
| action |
| (log2str("Actual phase is not running/skipping, cannot stop: ", p_instance.groupPhaseList)); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_stopExecutionForSCGrp |
| // |
| // Purpose: |
| // Stops the actual phase and the test for the given scenario group |
| // |
| // Parameters: |
| // - p_instance - inout <EPTF_ExecCtrl_ScenarioGroup_Instance> - the scenario group instance to be stopped |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // The current phase is stopped (state is set to IDLE) |
| // and the next phase will not be started. |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_ScenarioGroup_stopExecutionForSCGrp |
| ( |
| inout EPTF_ExecCtrl_ScenarioGroup_Instance p_instance |
| ) |
| runs on EPTF_ExecCtrl_CT |
| { |
| var integer vl_sgIdx := f_EPTF_ExecCtrl_ScenarioGroup_getIdx(p_instance.name); |
| var integer vl_phaseIdx := p_instance.groupPhaseList.actualPhaseIndex; |
| |
| if (p_instance.groupPhaseList.phases[vl_phaseIdx].state != IDLE) |
| { |
| f_EPTF_ExecCtrl_debug |
| (log2str("ScenarioGroup: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].name& |
| " phase: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList.phases[vl_phaseIdx].name&" stopping test.")); |
| |
| p_instance.groupPhaseList.phases[vl_phaseIdx].state := IDLE; |
| |
| // for each scenario |
| for (var integer i:=0; i<sizeof(p_instance.scenarioPhaseLists); i:=i+1) |
| { |
| p_instance.scenarioPhaseLists[i].phases[vl_phaseIdx].state := IDLE; |
| |
| var integer vl_eGrpIdx := v_ExecCtrl_scenarios[p_instance.scenarios[i].idx].eGroupIdx; |
| |
| for (var integer j:=0; j<sizeof(p_instance.scenarios[i].lgenPhaseLists); j:=j+1) |
| { |
| var integer vl_lgenIdx := p_instance.scenarios[i].lgenIndexes[j]; |
| var integer vl_lgenIdxInEGrp := f_EPTF_ExecCtrl_getLGenIdxInEGrpForLGenAndEgrp(vl_lgenIdx,vl_eGrpIdx); |
| if (v_ExecCtrl_entityGroups[vl_eGrpIdx].lgenList[vl_lgenIdxInEGrp].eCount == 0) { |
| continue; // do not send packet to LGen if there is no entity on the LGen |
| } |
| p_instance.scenarios[i].lgenPhaseLists[j].phases[vl_phaseIdx].state := IDLE; |
| f_EPTF_ExecCtrl_sendPhaseStopTestReq |
| (EPTF_ExecCtrl_PhaseStopTestReq: |
| { |
| phaseName := p_instance.groupPhaseList.phases[vl_phaseIdx].name, |
| entityGroupName := v_ExecCtrl_entityGroups[vl_eGrpIdx].name, |
| scenarioInstanceName := f_EPTF_ExecCtrl_getScenarioName(p_instance.scenarios[i].idx), |
| state := IDLE, |
| msgID := |
| { |
| vl_sgIdx, |
| i, |
| j, |
| vl_phaseIdx |
| } |
| }, |
| p_instance.scenarios[i].lgenIndexes[j] |
| ); |
| } |
| } |
| } |
| else |
| { |
| action |
| (log2str("Actual phase is not running/skipping, cannot stop: ", p_instance.groupPhaseList)); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_setNextPhase |
| // |
| // Purpose: |
| // Sets the next phase of the given scenario group |
| // |
| // Parameters: |
| // - p_instance - inout <EPTF_ExecCtrl_ScenarioGroup_Instance> - the scenario group instance to be modified |
| // |
| // Return Value: |
| // - boolean: false in case of error |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_ScenarioGroup_setNextPhase |
| ( |
| inout EPTF_ExecCtrl_ScenarioGroup_Instance p_instance |
| ) |
| runs on EPTF_ExecCtrl_CT |
| return boolean |
| { |
| var boolean l_ret := true; |
| if (f_EPTF_ExecCtrl_PhaseList_setNextState(p_instance.groupPhaseList)) |
| { |
| for (var integer i:=0; i<sizeof(p_instance.scenarioPhaseLists); i:=i+1) |
| { |
| if (not f_EPTF_ExecCtrl_PhaseList_setNextState(p_instance.scenarioPhaseLists[i])) |
| { |
| f_EPTF_ExecCtrl_warning(log2str("Couldn't set next state for scenario", p_instance.scenarioPhaseLists[i], " at ",i)); |
| l_ret := false; |
| } |
| |
| for (var integer j:=0; j<sizeof(p_instance.scenarios[i].lgenPhaseLists); j:=j+1) |
| { |
| if (not f_EPTF_ExecCtrl_PhaseList_setNextState(p_instance.scenarios[i].lgenPhaseLists[j])) |
| { |
| f_EPTF_ExecCtrl_warning |
| (log2str("Couldn't set next state for lgen", p_instance.scenarios[i].lgenPhaseLists[j], " at ",i,",",j)); |
| l_ret := false; |
| } |
| } |
| } |
| } |
| |
| // call phaseChangedCallBacks: |
| f_EPTF_ExecCtrl_callScenarioGroupPhaseChangedCallbacks(p_instance.name,p_instance.groupPhaseList.actualPhaseIndex); |
| |
| return l_ret; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_start |
| // |
| // Purpose: |
| // Starts the scenario group |
| // |
| // Parameters: |
| // - pl_scenarioGroupIdx - in integer - the scenario group instance index to be started |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| public function f_EPTF_ExecCtrl_ScenarioGroup_start |
| ( |
| in integer pl_scenarioGroupIdx |
| ) |
| runs on EPTF_ExecCtrl_CT |
| { |
| f_EPTF_ExecCtrl_ScenarioGroup_resetScenarios(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx]); |
| if (v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].groupPhaseList.phases[v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].groupPhaseList.actualPhaseIndex].state == IDLE) |
| { |
| f_EPTF_ExecCtrl_ScenarioGroup_startActualPhase(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx]); |
| } |
| else |
| { |
| f_EPTF_ExecCtrl_warning |
| (log2str("Cannot start scenario group, because it is already running:", v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx])); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_stop |
| // |
| // Purpose: |
| // Stops the actual phase in the scenario group |
| // |
| // Parameters: |
| // - pl_scenarioGroupIdx - in integer - the scenario group instance index to be stopped |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| public function f_EPTF_ExecCtrl_ScenarioGroup_stop |
| ( |
| in integer pl_scenarioGroupIdx |
| ) |
| runs on EPTF_ExecCtrl_CT |
| { |
| if (v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].groupPhaseList.phases[v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].groupPhaseList.actualPhaseIndex].state == RUNNING) |
| { |
| f_EPTF_ExecCtrl_ScenarioGroup_stopActualPhase(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx]); |
| } |
| else |
| { |
| action |
| (log2str("Cannot stop scenario group, because it is not running:", v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx])); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_stopExecution |
| // |
| // Purpose: |
| // Stops the scenario group execution |
| // |
| // Parameters: |
| // - pl_scenarioGroupIdx - in integer - the scenario group instance index to be stopped |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| friend function f_EPTF_ExecCtrl_ScenarioGroup_stopExecution |
| ( |
| in integer pl_scenarioGroupIdx |
| ) |
| runs on EPTF_ExecCtrl_CT |
| { |
| if (v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].groupPhaseList.phases[v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].groupPhaseList.actualPhaseIndex].state != IDLE) |
| { |
| f_EPTF_ExecCtrl_ScenarioGroup_stopExecutionForSCGrp(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx]); |
| } |
| else |
| { |
| action |
| (log2str("Cannot stop scenario group, because it is already IDLE:", v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx])); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_ScenarioGroup_reset |
| // |
| // Purpose: |
| // Stops the scenario group |
| // |
| // Parameters: |
| // - pl_scenarioGroupIdx - in integer - the scenario group instance index to be reset |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| friend function f_EPTF_ExecCtrl_ScenarioGroup_reset |
| ( |
| in integer pl_scenarioGroupIdx |
| ) |
| runs on EPTF_ExecCtrl_CT |
| { |
| var integer vl_sgIdx := f_EPTF_ExecCtrl_ScenarioGroup_getIdx(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].name); |
| var integer vl_phaseIdx := v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].groupPhaseList.actualPhaseIndex; |
| |
| // No check, reset immediately |
| |
| f_EPTF_ExecCtrl_debug |
| (log2str("ScenarioGroup: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].name& |
| " phase: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList.phases[vl_phaseIdx].name&" reset.")); |
| |
| f_EPTF_ExecCtrl_debug(log2str("ScenarioGroup: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].name& |
| " phase: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList.phases[vl_phaseIdx].name&" reset.")); |
| |
| f_EPTF_ExecCtrl_ScenarioGroup_resetPhaseLists(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx]); |
| |
| // call phaseChangedCallBacks: |
| f_EPTF_ExecCtrl_callScenarioGroupPhaseChangedCallbacks(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].name,v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].groupPhaseList.actualPhaseIndex); |
| |
| // for each scenario |
| for (var integer i:=0; i<sizeof(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].scenarioPhaseLists); i:=i+1) |
| { |
| var integer vl_eGrpIdx := v_ExecCtrl_scenarios[v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].scenarios[i].idx].eGroupIdx; |
| |
| //f_EPTF_ExecCtrl_resetScenarioOnLGens(p_instance.scenarios[i].idx); <- would be circular import, |
| // => only groupFinish data is reset. Hope that EPTF_ExecCtrl_PhaseResetReq resets scenarios on the LGen |
| f_EPTF_ExecCtrl_resetGroupFinishDataForSc(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].scenarios[i].idx); |
| |
| for (var integer j:=0; j<sizeof(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].scenarios[i].lgenPhaseLists); j:=j+1) |
| { |
| var integer vl_lgenIdx := v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].scenarios[i].lgenIndexes[j]; |
| var integer vl_lgenIdxInEGrp := f_EPTF_ExecCtrl_getLGenIdxInEGrpForLGenAndEgrp(vl_lgenIdx,vl_eGrpIdx); |
| if (v_ExecCtrl_entityGroups[vl_eGrpIdx].lgenList[vl_lgenIdxInEGrp].eCount == 0) { |
| continue; // do not send packet to LGen if there is no entity on the LGen |
| } |
| f_EPTF_ExecCtrl_sendPhaseResetReq |
| (EPTF_ExecCtrl_PhaseResetReq: |
| { |
| phaseName := v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].groupPhaseList.phases[vl_phaseIdx].name, |
| entityGroupName := v_ExecCtrl_entityGroups[vl_eGrpIdx].name, |
| scenarioInstanceName := f_EPTF_ExecCtrl_getScenarioName(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].scenarios[i].idx), |
| state := IDLE, |
| msgID := |
| { |
| vl_sgIdx, |
| i, |
| j, |
| vl_phaseIdx |
| } |
| }, |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scenarioGroupIdx].scenarios[i].lgenIndexes[j] |
| ); |
| } |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_sendPhaseStartReq |
| // |
| // Purpose: |
| // Sends a start phase request PDU to the LGen appointed by index (which points |
| // into the v_ExecCtrl_lgens database. |
| // |
| // Parameters: |
| // - p_req - in <EPTF_ExecCtrl_PhaseStartReq> - the request to be sent |
| // - p_toLgenIdx - in *integer* - the database index of the LGen. |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_sendPhaseStartReq |
| ( |
| in EPTF_ExecCtrl_PhaseStartReq p_req, |
| in integer p_toLgenIdx |
| ) |
| runs on EPTF_ExecCtrl_CT |
| { |
| var integer vl_to := -1; |
| |
| if (p_toLgenIdx < sizeof(v_ExecCtrl_lgens)) |
| { |
| vl_to := v_ExecCtrl_lgens[p_toLgenIdx].lgenCompRef; |
| } |
| else { return } |
| |
| if (vl_to!=-1) { |
| ExecCtrl_MgmtIf_CP.send(p_req) to f_EPTF_Base_downcast(vl_to); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_sendPhaseStopReq |
| // |
| // Purpose: |
| // Sends a stop phase request PDU to the LGen appointed by index (which points |
| // into the v_ExecCtrl_lgens database. |
| // |
| // Parameters: |
| // - p_req - in <EPTF_ExecCtrl_PhaseStopReq> - the request to be sent |
| // - p_toLgenIdx - in *integer* - the database index of the LGen. |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_sendPhaseStopReq |
| ( |
| in EPTF_ExecCtrl_PhaseStopReq p_req, |
| in integer p_toLgenIdx |
| ) |
| runs on EPTF_ExecCtrl_CT |
| { |
| var integer vl_to := -1; |
| |
| if (p_toLgenIdx < sizeof(v_ExecCtrl_lgens)) |
| { |
| vl_to := v_ExecCtrl_lgens[p_toLgenIdx].lgenCompRef; |
| } |
| else { return } |
| |
| if (vl_to!=-1) { |
| ExecCtrl_MgmtIf_CP.send(p_req) to f_EPTF_Base_downcast(vl_to); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_sendPhaseStopTestReq |
| // |
| // Purpose: |
| // Sends a stop phase request PDU to the LGen appointed by index (which points |
| // into the v_ExecCtrl_lgens database. |
| // |
| // Parameters: |
| // - p_req - in <EPTF_ExecCtrl_PhaseStopReq> - the request to be sent |
| // - p_toLgenIdx - in *integer* - the database index of the LGen. |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_sendPhaseStopTestReq |
| ( |
| in EPTF_ExecCtrl_PhaseStopTestReq p_req, |
| in integer p_toLgenIdx |
| ) |
| runs on EPTF_ExecCtrl_CT |
| { |
| var integer vl_to := -1; |
| |
| if (p_toLgenIdx < sizeof(v_ExecCtrl_lgens)) |
| { |
| vl_to := v_ExecCtrl_lgens[p_toLgenIdx].lgenCompRef; |
| } |
| else { return } |
| |
| if (vl_to!=-1) { |
| ExecCtrl_MgmtIf_CP.send(p_req) to f_EPTF_Base_downcast(vl_to); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_sendPhaseResetReq |
| // |
| // Purpose: |
| // Sends a reset phase request PDU to the LGen appointed by index (which points |
| // into the v_ExecCtrl_lgens database. |
| // |
| // Parameters: |
| // - p_req - in <EPTF_ExecCtrl_PhaseStopReq> - the request to be sent |
| // - p_toLgenIdx - in *integer* - the database index of the LGen. |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_sendPhaseResetReq |
| ( |
| in EPTF_ExecCtrl_PhaseResetReq p_req, |
| in integer p_toLgenIdx |
| ) |
| runs on EPTF_ExecCtrl_CT |
| { |
| var integer vl_to := -1; |
| |
| if (p_toLgenIdx < sizeof(v_ExecCtrl_lgens)) |
| { |
| vl_to := v_ExecCtrl_lgens[p_toLgenIdx].lgenCompRef; |
| } |
| else { return } |
| if (vl_to!=-1) { |
| ExecCtrl_MgmtIf_CP.send(p_req) to f_EPTF_Base_downcast(vl_to); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_handlePhaseStatusRsp |
| // |
| // Purpose: |
| // Phase Status Response PDU handler. Sets the appropriate phase list states |
| // of the scenario groups. |
| // |
| // Parameters: |
| // - p_rsp - in <EPTF_ExecCtrl_PhaseStatusRsp> - the response to be processed |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - the msgID field of the incoming response must contain the following |
| // indices respectively: scenario group index, scenario index, LGen index, phase index |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| private function f_EPTF_ExecCtrl_handlePhaseStatusRsp |
| ( |
| in EPTF_ExecCtrl_PhaseStatusRsp p_rsp |
| ) |
| runs on EPTF_ExecCtrl_CT |
| { |
| if (p_rsp.state == FINISHED) |
| { |
| var integer vl_sgIdx := p_rsp.msgID[0]; |
| var integer vl_scIdx := p_rsp.msgID[1]; |
| var integer vl_lgIdx := p_rsp.msgID[2]; |
| var integer vl_phIdx := p_rsp.msgID[3]; |
| |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].scenarios[vl_scIdx].lgenPhaseLists[vl_lgIdx].phases[vl_phIdx].state := FINISHED; |
| |
| if(not f_EPTF_ExecCtrl_PhaseList_setStateFromSubPhaseLists |
| ( |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].scenarioPhaseLists[vl_scIdx], |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].scenarios[vl_scIdx].lgenPhaseLists |
| )) {/*cannot happen*/}; |
| |
| if(not f_EPTF_ExecCtrl_PhaseList_setStateFromSubPhaseLists |
| ( |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList, |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].scenarioPhaseLists |
| )) {/*cannot happen*/}; |
| |
| if (v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList.phases[vl_phIdx].state == FINISHED) |
| { |
| if (v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].phaseFinishAction != null) |
| { |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].phaseFinishAction.apply |
| ( |
| vl_sgIdx, |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList.phases[vl_phIdx].name |
| ); |
| } |
| f_EPTF_ExecCtrl_debug |
| (log2str("ScenarioGroup: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].name& |
| " phase: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList.phases[vl_phIdx].name&" finished.")); |
| f_EPTF_ExecCtrl_debug(log2str("ScenarioGroup: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].name& |
| " phase: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList.phases[vl_phIdx].name&" finished.")) |
| |
| if (v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList.actualPhaseIndex == |
| sizeof(v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList.phases)-1) |
| { |
| f_EPTF_ExecCtrl_debug |
| (log2str("SceanrioGroup "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].name&" finished")); |
| f_EPTF_ExecCtrl_debug(log2str("ScenarioGroup: "&v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].name&" finished")); |
| |
| if (v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].isRunningVarIdx != -1) |
| { |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].internalAdjust := true; |
| f_EPTF_Var_adjustContent(v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].isRunningVarIdx, {boolVal := false}); |
| } |
| |
| if (v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupFinishAction != null) |
| { |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupFinishAction.apply(vl_sgIdx, ""); |
| } |
| f_EPTF_ExecCtrl_ScenarioGroup_resetPhaseStates(v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx]); |
| } |
| else |
| { |
| f_EPTF_ExecCtrl_debug |
| (log2str("Setting next phase")); |
| if (f_EPTF_ExecCtrl_ScenarioGroup_setNextPhase(v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx])) |
| { |
| if (v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].execMode == AUTOMATIC) |
| { |
| f_EPTF_ExecCtrl_debug |
| (log2str("Starting next phase")); |
| if (v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].isRunningVarIdx != -1) |
| { |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].internalAdjust := true; |
| f_EPTF_Var_adjustContent(v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].isRunningVarIdx, {boolVal := true}); |
| } |
| if (v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].groupPhaseList.actualPhaseIndex != 0) |
| { |
| f_EPTF_ExecCtrl_ScenarioGroup_startActualPhase(v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx]); |
| } |
| } |
| else if (v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].isRunningVarIdx != -1) |
| { |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].internalAdjust := true; |
| f_EPTF_Var_adjustContent(v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx].isRunningVarIdx, {boolVal := false}); |
| } |
| } |
| } |
| } |
| f_EPTF_ExecCtrl_debug |
| (log2str("# DEBUG:", v_ExecCtrl_ScenarioGroupInstanceDB.data[vl_sgIdx])); |
| } |
| else |
| { |
| f_EPTF_ExecCtrl_warning(log2str("PhaseStatusRsp not handled: dropping ", p_rsp)); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Altstep: as_EPTF_ExecCtrl_MgmtIf_handlePhaseMsgs |
| // |
| // Purpose: |
| // Altstep for handling the incoming phase PDUs at the ExecCtrl component |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| friend altstep as_EPTF_ExecCtrl_MgmtIf_handlePhaseMsgs() |
| runs on EPTF_ExecCtrl_CT |
| { |
| [] ExecCtrl_MgmtIf_CP.receive(EPTF_ExecCtrl_PhaseStatusRsp:?) -> value v_ExecCtrl_PhasePDU.phaseStatusRsp |
| { |
| f_EPTF_ExecCtrl_handlePhaseStatusRsp(v_ExecCtrl_PhasePDU.phaseStatusRsp); |
| repeat; |
| } |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Altstep: as_EPTF_ExecCtrlClient_MgmtIf_handlePhaseMsgs |
| // |
| // Purpose: |
| // Altstep for handling the incoming phase PDUs at the ExecCtrlClient component |
| // |
| // Parameters: |
| // - |
| // |
| // Return Value: |
| // - |
| // |
| // Errors & assertions: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| friend altstep as_EPTF_ExecCtrlClient_MgmtIf_handlePhaseMsgs() |
| runs on EPTF_ExecCtrlClient_CT |
| { |
| [] ExecCtrlClient_MgmtIf_CP.receive(EPTF_ExecCtrl_PhaseStatusRsp:?) -> value v_ExecCtrlClient_PhasePDU.phaseStatusRsp |
| { |
| f_EPTF_ExecCtrlClient_warning(log2str("Unexpected phase status response message was recevied: dropping: ", v_ExecCtrlClient_PhasePDU.phaseStatusRsp)) |
| repeat; |
| } |
| [] ExecCtrlClient_MgmtIf_CP.receive(EPTF_ExecCtrl_PhaseStartReq:?) -> value v_ExecCtrlClient_PhasePDU.phaseStartReq |
| { |
| var boolean vl_couldStart := false; |
| |
| if (v_ExecCtrlClient_PhasePDU.phaseStartReq.state == RUNNING) |
| { |
| vl_couldStart := f_EPTF_LGenBase_startPhase |
| ( |
| v_ExecCtrlClient_PhasePDU.phaseStartReq.entityGroupName, |
| v_ExecCtrlClient_PhasePDU.phaseStartReq.scenarioInstanceName, |
| v_ExecCtrlClient_PhasePDU.phaseStartReq.phaseName, |
| refers(f_EPTF_ExecCtrlClient_handlePhaseFinished), |
| v_ExecCtrlClient_PhasePDU.phaseStartReq.msgID |
| ); |
| } |
| else if (v_ExecCtrlClient_PhasePDU.phaseStartReq.state == SKIPPING) |
| { |
| vl_couldStart := f_EPTF_LGenBase_skipPhase |
| ( |
| v_ExecCtrlClient_PhasePDU.phaseStartReq.entityGroupName, |
| v_ExecCtrlClient_PhasePDU.phaseStartReq.scenarioInstanceName, |
| v_ExecCtrlClient_PhasePDU.phaseStartReq.phaseName, |
| refers(f_EPTF_ExecCtrlClient_handlePhaseFinished), |
| v_ExecCtrlClient_PhasePDU.phaseStartReq.msgID |
| ); |
| } |
| |
| if (not vl_couldStart) |
| { |
| f_EPTF_ExecCtrlClient_warning(log2str("Couldn't execute phase start request message: ", v_ExecCtrlClient_PhasePDU.phaseStartReq)); |
| var EPTF_ExecCtrl_PhaseStatusRsp vl_resp := |
| { |
| phaseName := v_ExecCtrlClient_PhasePDU.phaseStartReq.entityGroupName, |
| entityGroupName := v_ExecCtrlClient_PhasePDU.phaseStartReq.scenarioInstanceName, |
| scenarioInstanceName := v_ExecCtrlClient_PhasePDU.phaseStartReq.scenarioInstanceName, |
| state := FINISHED, |
| msgID := v_ExecCtrlClient_PhasePDU.phaseStartReq.msgID |
| } |
| ExecCtrlClient_MgmtIf_CP.send(vl_resp); |
| } |
| repeat; |
| } |
| [] ExecCtrlClient_MgmtIf_CP.receive(EPTF_ExecCtrl_PhaseStopReq:?) -> value v_ExecCtrlClient_PhasePDU.phaseStopReq |
| { |
| var boolean vl_couldStop := false; |
| |
| if (v_ExecCtrlClient_PhasePDU.phaseStopReq.state == STOPPING) |
| { |
| vl_couldStop := f_EPTF_LGenBase_stopPhase |
| ( |
| v_ExecCtrlClient_PhasePDU.phaseStopReq.entityGroupName, |
| v_ExecCtrlClient_PhasePDU.phaseStopReq.scenarioInstanceName, |
| v_ExecCtrlClient_PhasePDU.phaseStopReq.phaseName |
| ); |
| } |
| |
| if (not vl_couldStop) |
| { |
| f_EPTF_ExecCtrlClient_warning(log2str("Couldn't execute phase stop request message: ", v_ExecCtrlClient_PhasePDU.phaseStopReq)); |
| var EPTF_ExecCtrl_PhaseStatusRsp vl_resp := |
| { |
| phaseName := v_ExecCtrlClient_PhasePDU.phaseStopReq.entityGroupName, |
| entityGroupName := v_ExecCtrlClient_PhasePDU.phaseStopReq.scenarioInstanceName, |
| scenarioInstanceName := v_ExecCtrlClient_PhasePDU.phaseStopReq.scenarioInstanceName, |
| state := FINISHED, |
| msgID := v_ExecCtrlClient_PhasePDU.phaseStopReq.msgID |
| } |
| ExecCtrlClient_MgmtIf_CP.send(vl_resp); |
| } |
| repeat; |
| } |
| [] ExecCtrlClient_MgmtIf_CP.receive(EPTF_ExecCtrl_PhaseStopTestReq:?) -> value v_ExecCtrlClient_PhasePDU.phaseStopTestReq |
| { |
| f_EPTF_LGenBase_stopPhaseTest |
| ( |
| v_ExecCtrlClient_PhasePDU.phaseStopTestReq.entityGroupName, |
| v_ExecCtrlClient_PhasePDU.phaseStopTestReq.scenarioInstanceName, |
| v_ExecCtrlClient_PhasePDU.phaseStopTestReq.phaseName |
| ); |
| |
| repeat; |
| } |
| [] ExecCtrlClient_MgmtIf_CP.receive(EPTF_ExecCtrl_PhaseResetReq:?) -> value v_ExecCtrlClient_PhasePDU.phaseResetReq |
| { |
| if(not f_EPTF_LGenBase_resetPhase |
| ( |
| v_ExecCtrlClient_PhasePDU.phaseResetReq.entityGroupName, |
| v_ExecCtrlClient_PhasePDU.phaseResetReq.scenarioInstanceName, |
| v_ExecCtrlClient_PhasePDU.phaseResetReq.phaseName |
| )) {/*should not happen*/}; |
| repeat; |
| } |
| } |
| |
| private function f_EPTF_ExecCtrlClient_handlePhaseFinished( |
| in charstring pl_eGrpName, |
| in charstring pl_scName, |
| in charstring pl_phase, |
| in EPTF_IntegerList pl_args) |
| runs on EPTF_ExecCtrlClient_CT |
| { |
| var EPTF_ExecCtrl_PhaseStatusRsp vl_resp := |
| { |
| phaseName := pl_phase, |
| entityGroupName := pl_eGrpName, |
| scenarioInstanceName := pl_scName, |
| state := FINISHED, |
| msgID := pl_args |
| } |
| ExecCtrlClient_MgmtIf_CP.send(vl_resp); |
| } |
| |
| //get/set functions for v_ExecCtrl_ScenarioGroupInstanceDB |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstance(in integer pl_scGrpIdx) |
| runs on EPTF_ExecCtrl_CT return EPTF_ExecCtrl_ScenarioGroup_Instance { |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx]; |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ExecCtrl_getScenarioGroupInstanceName |
| // |
| // Purpose: |
| // Returns the scenario group instance name |
| // |
| // Parameters: |
| // pl_scGrpIdx - *in integer* - the idx of the scenario group instance |
| // |
| // Return Value: |
| // charstring - the instance name of the scenario group |
| // |
| /////////////////////////////////////////////////////////// |
| public function f_EPTF_ExecCtrl_getScenarioGroupInstanceName(in integer pl_scGrpIdx) |
| runs on EPTF_ExecCtrl_CT return charstring { |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].name; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceInternalAdjust(in integer pl_scGrpIdx) |
| runs on EPTF_ExecCtrl_CT return boolean { |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].internalAdjust; |
| } |
| |
| friend function f_EPTF_ExecCtrl_setScenarioGroupInstanceInternalAdjust(in integer pl_scGrpIdx, in boolean pl_internalAdjust) |
| runs on EPTF_ExecCtrl_CT { |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].internalAdjust := pl_internalAdjust; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceIsRunningVarIdx(in integer pl_scGrpIdx) |
| runs on EPTF_ExecCtrl_CT return integer { |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].isRunningVarIdx; |
| } |
| |
| friend function f_EPTF_ExecCtrl_setScenarioGroupInstanceIsRunningVarIdx(in integer pl_scGrpIdx, in integer pl_isRunningVarIdx) |
| runs on EPTF_ExecCtrl_CT { |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].isRunningVarIdx := pl_isRunningVarIdx; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstancePhaseNum(in integer pl_scGrpIdx) |
| runs on EPTF_ExecCtrl_CT return integer { |
| return sizeof(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].groupPhaseList.phases); |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceGroupPhaseList(in integer pl_scGrpIdx) |
| runs on EPTF_ExecCtrl_CT return EPTF_ExecCtrl_PhaseList_Instance { |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].groupPhaseList; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceGroupPhaseListName(in integer pl_scGrpIdx) |
| runs on EPTF_ExecCtrl_CT return charstring { |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].groupPhaseList.name; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceGroupPhaseListPhasesNum(in integer pl_scGrpIdx) |
| runs on EPTF_ExecCtrl_CT return integer { |
| return sizeof(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].groupPhaseList.phases); |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceGroupPhaseListPhaseName(in integer pl_scGrpIdx, in integer pl_phIdx) |
| runs on EPTF_ExecCtrl_CT return charstring { |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].groupPhaseList.phases[pl_phIdx].name; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceActualPhaseName(in integer pl_scGrpIdx) |
| runs on EPTF_ExecCtrl_CT return charstring { |
| var integer vl_currentPhaseIdx := v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].groupPhaseList.actualPhaseIndex; |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].groupPhaseList.phases[vl_currentPhaseIdx].name; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceActualPhaseIndex(in integer pl_scGrpIdx) |
| runs on EPTF_ExecCtrl_CT return integer { |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].groupPhaseList.actualPhaseIndex; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceDataNum() |
| runs on EPTF_ExecCtrl_CT return integer { |
| return sizeof(v_ExecCtrl_ScenarioGroupInstanceDB.data); |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceExecMode(in integer pl_scGrpIdx) |
| runs on EPTF_ExecCtrl_CT return EPTF_ExecCtrl_ScenarioGroup_ExecMode { |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].execMode; |
| } |
| |
| friend function f_EPTF_ExecCtrl_setScenarioGroupInstanceExecMode(in integer pl_scGrpIdx, in EPTF_ExecCtrl_ScenarioGroup_ExecMode pl_execMode) |
| runs on EPTF_ExecCtrl_CT { |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].execMode := pl_execMode; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceScenarioNum(in integer pl_scGrpIdx) |
| runs on EPTF_ExecCtrl_CT return integer { |
| return sizeof(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].scenarios); |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceScenarioName(in integer pl_scGrpIdx, in integer pl_scOfSCGrpIdx) |
| runs on EPTF_ExecCtrl_CT return charstring { |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].scenarios[pl_scOfSCGrpIdx].name; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceScenarioLGenIndexNum(in integer pl_scGrpIdx, in integer pl_scOfSCGrpIdx) |
| runs on EPTF_ExecCtrl_CT return integer { |
| return sizeof(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].scenarios[pl_scOfSCGrpIdx].lgenIndexes); |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceScenarioPhaseList(in integer pl_scGrpIdx, in integer pl_scOfSCGrpIdx) |
| runs on EPTF_ExecCtrl_CT return EPTF_ExecCtrl_PhaseList_Instance { |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].scenarioPhaseLists[pl_scOfSCGrpIdx]; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceScenarioPhaseListPhaseName(in integer pl_scGrpIdx, in integer pl_scOfSCGrpIdx, in integer pl_phIdx) |
| runs on EPTF_ExecCtrl_CT return charstring { |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].scenarioPhaseLists[pl_scOfSCGrpIdx].phases[pl_phIdx].name; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceScenarioPhaseListPhaseEnabled(in integer pl_scGrpIdx, in integer pl_scOfSCGrpIdx, in integer pl_phIdx) |
| runs on EPTF_ExecCtrl_CT return boolean { |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].scenarioPhaseLists[pl_scOfSCGrpIdx].phases[pl_phIdx].enabled; |
| } |
| |
| friend function f_EPTF_ExecCtrl_setScenarioGroupInstanceScenarioPhaseListPhaseEnabled(in integer pl_scGrpIdx, in integer pl_scOfSCGrpIdx, in integer pl_phIdx, in boolean pl_enabled) |
| runs on EPTF_ExecCtrl_CT { |
| v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].scenarioPhaseLists[pl_scOfSCGrpIdx].phases[pl_phIdx].enabled := pl_enabled; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceIsValidPhase(in integer pl_scGrpIdx, in charstring pl_phaseName) |
| runs on EPTF_ExecCtrl_CT return integer { |
| return f_EPTF_ExecCtrl_PhaseList_isValidPhase(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].groupPhaseList, pl_phaseName); |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceGroupPhaseListActualPhaseState(in integer pl_scGrpIdx) |
| runs on EPTF_ExecCtrl_CT return EPTF_ExecCtrl_Phase_States { |
| var integer vl_currentPhaseIdx := v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].groupPhaseList.actualPhaseIndex; |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].groupPhaseList.phases[vl_currentPhaseIdx].state; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceGroupPhaseListPhaseState(in integer pl_scGrpIdx, in integer pl_phIdx) |
| runs on EPTF_ExecCtrl_CT return EPTF_ExecCtrl_Phase_States { |
| return v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx].groupPhaseList.phases[pl_phIdx].state; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getScenarioGroupInstanceSetPhase(in integer pl_scGrpIdx, in charstring pl_phaseName) |
| runs on EPTF_ExecCtrl_CT return boolean { |
| return f_EPTF_ExecCtrl_ScenarioGroup_setPhase(v_ExecCtrl_ScenarioGroupInstanceDB.data[pl_scGrpIdx], pl_phaseName); |
| } |
| |
| //get/set functions for v_ExecCtrl_PhaseListDeclaratorDB |
| |
| friend function f_EPTF_ExecCtrl_getPhaseListDeclaratorDataNum() |
| runs on EPTF_ExecCtrl_CT return integer { |
| return sizeof(v_ExecCtrl_PhaseListDeclaratorDB.data); |
| } |
| |
| friend function f_EPTF_ExecCtrl_getPhaseListDeclaratorName(in integer pl_declaratorIdx) |
| runs on EPTF_ExecCtrl_CT return charstring { |
| return v_ExecCtrl_PhaseListDeclaratorDB.data[pl_declaratorIdx].name; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getPhaseListDeclaratorPhasesNum(in integer pl_declaratorIdx) |
| runs on EPTF_ExecCtrl_CT return integer { |
| return sizeof(v_ExecCtrl_PhaseListDeclaratorDB.data[pl_declaratorIdx].phases); |
| } |
| |
| friend function f_EPTF_ExecCtrl_getPhaseListDeclaratorPhaseName(in integer pl_declaratorIdx, in integer pl_phaseIdx) |
| runs on EPTF_ExecCtrl_CT return charstring { |
| return v_ExecCtrl_PhaseListDeclaratorDB.data[pl_declaratorIdx].phases[pl_phaseIdx].name; |
| } |
| |
| friend function f_EPTF_ExecCtrl_getPhaseListDeclaratorPhaseEnabled(in integer pl_declaratorIdx, in integer pl_phaseIdx) |
| runs on EPTF_ExecCtrl_CT return boolean { |
| return v_ExecCtrl_PhaseListDeclaratorDB.data[pl_declaratorIdx].phases[pl_phaseIdx].enabled; |
| } |
| |
| friend function f_EPTF_ExecCtrl_setPhaseListDeclaratorPhaseEnabled(in integer pl_declaratorIdx, in integer pl_phaseIdx, in boolean pl_enabled) |
| runs on EPTF_ExecCtrl_CT { |
| v_ExecCtrl_PhaseListDeclaratorDB.data[pl_declaratorIdx].phases[pl_phaseIdx].enabled := pl_enabled; |
| } |
| |
| } // module |