blob: f60c91dc76cbc1e86fd1c00882204e5e9194f1cb [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// 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_LGenBase_TrafficFunctions
//
// Purpose:
// This module provides functions for traffic management in TitanSim
// load generators
//
// Module Parameters:
// -
//
// Module depends on:
// <EPTF_CLL_Base_Functions>
// <EPTF_CLL_Common_Definitions>
// <EPTF_CLL_LGenBase_Definitions>
// <EPTF_CLL_LGenBase_ConfigDefinitions>
// <EPTF_CLL_LGenBase_ConfigFunctions>
// <EPTF_CLL_LGenBase_PhaseDefinitions>
// <EPTF_CLL_LGenBase_PhaseFunctions>
// <EPTF_CLL_LGenBase_EventHandlingFunctions>
// <EPTF_CLL_Scheduler_Definitions>
// <EPTF_CLL_RBTScheduler_Functions>
// <EPTF_CLL_FBQ_Definitions>
// <EPTF_CLL_FBQ_Functions>
// <EPTF_CLL_RNA_Definitions>
// <EPTF_CLL_RNA_Functions>
// <EPTF_CLL_HashMapStr2Int_Functions>
// <EPTF_CLL_LGenBaseTrafficMixer_Definitions>
// <EPTF_CLL_LGenBaseTrafficMixer_Functions>
// <TCCMaths_Functions>
//
// Current Owner:
// ELSZSKU
//
// Last Review Date:
// 2008-
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////
module EPTF_CLL_LGenBase_TrafficFunctions
{
import from EPTF_CLL_Base_Functions all;
import from EPTF_CLL_Common_Definitions all;
import from EPTF_CLL_LGenBase_Definitions all;
import from EPTF_CLL_LGenBase_ConfigDefinitions all;
import from EPTF_CLL_LGenBase_ConfigFunctions all;
import from EPTF_CLL_LGenBase_EventHandlingFunctions all;
import from EPTF_CLL_Scheduler_Definitions all;
import from EPTF_CLL_RBTScheduler_Functions all;
import from EPTF_CLL_FBQ_Definitions all;
import from EPTF_CLL_FBQ_Functions all;
import from EPTF_CLL_RNA_Definitions all;
import from EPTF_CLL_RNA_Functions all;
import from EPTF_CLL_HashMapStr2Int_Functions all;
import from EPTF_CLL_LGenBaseTrafficMixer_Definitions all;
import from EPTF_CLL_LGenBaseTrafficMixer_Functions all;
import from EPTF_CLL_LGenBaseStats_Definitions all;
import from TCCMaths_Functions all;
import from EPTF_CLL_LGenBase_TemplateFunctions all;
import from EPTF_CLL_LGenBase_LoggingFunctions all;
import from EPTF_CLL_Variable_Functions all;
import from EPTF_CLL_Variable_Definitions all
import from EPTF_CLL_StatMeasure_Functions all
import from EPTF_CLL_LGenBase_ILog_Functions all;
friend module EPTF_CLL_LGenBase_Functions;
friend module EPTF_CLL_LGenBase_StepFunctions;
friend module EPTF_CLL_ExecCtrlClient_Functions;
///////////////////////////////////////////////////////////
// Group: BurstCalculation
//
// Purpose:
// The EPTF_LGenBase functions related to the traffic calculation
///////////////////////////////////////////////////////////
group BurstCalculation{
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_setBurstCalcAlgByIdx
//
// Purpose:
// Assign a burst calculation method to the traffic cases or weighted scenarios
//
// Parameters:
// pl_burstIdx - *in* *integer* - The index of the burst function
// pl_idx - *in* - <EPTF_LGenBase_TcMgmt_AbsIdx> - Union of a traffic case index or a weighted scenario index
//
// Return Value:
// *boolean* - If there is a running traffic case, returns false.
//
// Errors & assertions:
// -
//
// Detailed Comments:
// This function can be used to assign the burst calculation method to a specified traffic case or a weighted scenario.
// The parameter <pl_burstIdx> is the index of the burst calculation algorithm. It can be a predefined algorithm such as orig, imst2, imst2, cs, poisson
// or a user defined one, defined by <f_EPTF_LGenBase_addBurstCalcFunction>.
// The traffic case index or the weighted scenario index should set.
// The normal traffic case can be referred by its traffic case index. The weighted scenario can be referred by its global scenario index.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_setBurstCalcAlgByIdx(
in integer pl_burstIdx,
in EPTF_LGenBase_TcMgmt_AbsIdx pl_idx)
runs on EPTF_LGenBase_Private_CT
return boolean{
var boolean vl_isWeighted := false;
//var boolean vl_returnValue := true;
if(ischosen(pl_idx.tcIdx)) { // normal traffic case
vl_isWeighted := false;
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index.",pl_idx.tcIdx > -1 and pl_idx.tcIdx < sizeof(v_LGenBase_trafficCases));
if(f_EPTF_LGenBase_checkSchedulingTimerIsRunning(pl_idx.tcIdx)){
f_EPTF_LGenBase_loggingError(%definitionId&"Traffic case is running. The burst calculation method can not be set.");
return false;
}
f_EPTF_LGenBase_setBurstCalcAlgInternal(pl_burstIdx, pl_idx.tcIdx, vl_isWeighted);
} else if(ischosen(pl_idx.scIdx)){ // weighted scenario
vl_isWeighted := true;
f_EPTF_LGenBase_setBurstCalcAlgInternal(pl_burstIdx, pl_idx.scIdx, vl_isWeighted);
} else {
// a bit paranoia
return false;
}
return true //vl_returnValue;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_setBurstCalcAlgByName
//
// Purpose:
// Assign a burst calculation method to the traffic cases or weighted scenarios
//
// Parameters:
// pl_funcName - *in* - *charstring* - The name of burst calculation
// pl_eGrpName - *in* - *charstring* - entity group name
// pl_scName - *in* - *charstring* - scenario name
// pl_tcName - *in* - *charstring* - traffic case name(optional)
//
// Return Value:
// *boolean* - If there is a running traffic case, returns false.
//
// Errors & assertions:
// -
//
// Detailed Comments:
// This function can be used to assign the burst calculation method to a specified traffic case or a weighted scenario.
// The parameter <pl_funcName> is the name of the burst calculation algorithm. It can be a predefined algorithm such as orig, imst2, imst2, cs, poisson
// or a user defined one, defined by <f_EPTF_LGenBase_addBurstCalcFunction>.
// The traffic case can be referred by its entity group name, scenario name and traffic case name.
// If traffic case name is not set, then we are assume that the method should be assigned to a weighted scenario.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_setBurstCalcAlgByName(
in charstring pl_funcName,
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName := "")
runs on EPTF_LGenBase_Private_CT
return boolean{
var integer vl_burstIdx := f_EPTF_LGenBase_getBurstCalcFunctionId(pl_funcName);
var boolean vl_isWeighted := false;
var boolean vl_returnValue := true;
if(vl_burstIdx == -1) {
f_EPTF_LGenBase_loggingError(%definitionId&"This burst calculation method "&pl_funcName&" cannot be found. ");
//f_EPTF_Base_assert(%definitionId&"This burst calculation method cannot be found.",false);
return false;
}
var integer vl_idx;
if("" != pl_tcName) { // normal traffic case
vl_idx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName);
vl_isWeighted := false;
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index.",vl_idx > -1 and vl_idx < sizeof(v_LGenBase_trafficCases));
if(f_EPTF_LGenBase_checkSchedulingTimerIsRunning(vl_idx)){
f_EPTF_LGenBase_loggingError(%definitionId&"Traffic case is running. The burst calculation method can not be set.");
return false;
}
} else { // weighted scenario
vl_isWeighted := true;
vl_idx := f_EPTF_LGenBase_scenarioAbsIdxByName(pl_eGrpName, pl_scName);
}
f_EPTF_LGenBase_setBurstCalcAlgInternal(vl_burstIdx,vl_idx,vl_isWeighted);
return vl_returnValue;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getBurstCalcAlgByIdx
//
// Purpose:
// Gets the bust calculation method of a traffic case or a weighted scenario
//
// Parameters:
// pl_idx - *in* - <EPTF_LGenBase_TcMgmt_AbsIdx> - Union of a traffic case index or a weighted scenario index
//
// Return Value:
// *integer* - The index of the used burst function
//
// Detailed Comments:
// This function returns the index of the burst calculation function assigned to a traffic case.
// The normal traffic case can be referred by its traffic case index, the weighted scenario can be referred by its global scenario index.
// If traffic case ID is -1, then it returns the global burst calculation method.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getBurstCalcAlgByIdx (
in EPTF_LGenBase_TcMgmt_AbsIdx pl_idx)
runs on EPTF_LGenBase_Private_CT
return integer
{
if(ischosen(pl_idx.tcIdx)) { // normal traffic case
if(pl_idx.tcIdx == -1) {
return f_EPTF_LGenBase_getBurstCalcFunctionId( v_LGenBase_burstCalcMode );
} else {
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index.",pl_idx.tcIdx > -1 and pl_idx.tcIdx < sizeof(v_LGenBase_trafficCases));
return f_EPTF_LGenBase_getBurstCalcFunctionId( v_LGenBase_trafficCases[pl_idx.tcIdx].schedulerData.burstFuncRef.burstCalcMode );
}
} else if(ischosen(pl_idx.scIdx)){ // weighted scenario
var integer vl_eGrpIdx;
var integer vl_scInGrpIdx;
f_EPTF_LGenBase_scenarioRelIdx(pl_idx.scIdx, vl_eGrpIdx, vl_scInGrpIdx);
return f_EPTF_LGenBase_getBurstCalcFunctionId( v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scInGrpIdx].schedulerData.burstFuncRef.burstCalcMode );
}
// a bit paranoia
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getBurstCalcAlgByName
//
// Purpose:
// Gets the bust calculation method of a traffic case or a weighted scenario
//
// Parameters:
// pl_eGrpName - *in* - *charstring* - entity group name
// pl_scName - *in* - *charstring* - scenario name
// pl_tcName - *in* - *charstring* - traffic case name(optional)
//
// Return Value:
// *integer* - The index of the used burst function
//
// Detailed Comments:
// This function returns the index of the burst calculation function assigned to a traffic case.
// The traffic case can be referred by its entity group name, scenario name and traffic case name.
// If traffic case name is not set, then we are assume that the method should be assigned to a weighted scenario.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getBurstCalcAlgByName (
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName := "")
runs on EPTF_LGenBase_Private_CT
return integer
{
if("" != pl_tcName) { // normal traffic case
var integer vl_idx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName);
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index.",vl_idx > -1 and vl_idx < sizeof(v_LGenBase_trafficCases));
return f_EPTF_LGenBase_getBurstCalcFunctionId( v_LGenBase_trafficCases[vl_idx].schedulerData.burstFuncRef.burstCalcMode );
} else { // weighted scenario
var integer vl_eGrpIdx;
var integer vl_scInGrpIdx;
var integer vl_idx := f_EPTF_LGenBase_scenarioAbsIdxByName(pl_eGrpName, pl_scName);
f_EPTF_LGenBase_scenarioRelIdx(vl_idx, vl_eGrpIdx, vl_scInGrpIdx);
return f_EPTF_LGenBase_getBurstCalcFunctionId( v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scInGrpIdx].schedulerData.burstFuncRef.burstCalcMode );
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_addBurstCalcFunction
//
// Purpose:
// Saves a user defined burst calculation method and its function references to a list.
//
// Parameters:
// pl_funcName - *in* - *charstring* - The name of burst calculation
// pl_preCalcFunc - *in* <EPTF_LGenBase_burstPreCalc_FT> - The burst precalculation function reference
// pl_postCalcFunc - *in* <EPTF_LGenBase_burstPostCalc_FT> - The burst postcalculation function reference
//
// Return Value:
// *integer* - The index of the burst calculation function
//
// Errors & assertions:
// -
//
// Detailed Comments:
// The function saves a user defined burst calculation method and its function references.
// The burst calculation method won't be assigned to any traffic case.
// This saved method can be accessed by its name or ID later, so the name of the method must be unique.
// If there is an error occurred the return value will be -1.
// Note: We assume there will be only a few user defined methods, so defined methods cannot be deleted later.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_addBurstCalcFunction(
in charstring pl_funcName,
in EPTF_LGenBase_burstPreCalc_FT pl_preCalcFunc,
in EPTF_LGenBase_burstPostCalc_FT pl_postCalcFunc)
runs on EPTF_LGenBase_Private_CT
return integer{
var integer vl_listSize := sizeof(v_LGenBase_burstFuncRefList);
for ( var integer vl_i := 0; vl_i < vl_listSize ; vl_i := vl_i+1 )
{
if(v_LGenBase_burstFuncRefList[vl_i].burstCalcMode == pl_funcName){
f_EPTF_LGenBase_loggingError(%definitionId&"This "&pl_funcName&" burst calculation method is already defined: ");
return -1;
}
}
v_LGenBase_burstFuncRefList[vl_listSize].burstCalcMode := pl_funcName;
v_LGenBase_burstFuncRefList[vl_listSize].burstPreCalc := pl_preCalcFunc;
v_LGenBase_burstFuncRefList[vl_listSize].burstPostCalc := pl_postCalcFunc;
return vl_listSize;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getBurstCalcFunctionId
//
// Purpose:
// Gets the index of ther user defined burst calculation method.
//
// Parameters:
// pl_funcName - *in* - *charstring* - The name of burst calculation
//
// Return Value:
// *integer* - The index of the burst calculation function
//
// Errors & assertions:
// -
//
// Detailed Comments:
// The function gets the index of the user defined burst calculation method.
// If the method cannot be found, it returns -1.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getBurstCalcFunctionId(
in charstring pl_funcName)
runs on EPTF_LGenBase_Private_CT
return integer{
for ( var integer vl_i := 0; vl_i < sizeof(v_LGenBase_burstFuncRefList) ; vl_i := vl_i+1 )
{
if(v_LGenBase_burstFuncRefList[vl_i].burstCalcMode == pl_funcName){
return vl_i;
}
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getBurstCalcFunction
//
// Purpose:
// Gets a user defined burst calculation method and its function references from a list.
//
// Parameters:
// pl_funcName - *in* - *charstring* - The name of burst calculation
// pl_preCalcFunc - *out* <EPTF_LGenBase_burstPreCalc_FT> - The burst precalculation function reference
// pl_postCalcFunc - *out* <EPTF_LGenBase_burstPostCalc_FT> - The burst postcalculation function reference
//
// Return Value:
// *integer* - The index of the burst calculation function
//
// Errors & assertions:
// -
//
// Detailed Comments:
// The function gets a user defined burst calculation method and its function references.
// If the method cannot be found, it returns -1.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getBurstCalcFunction(
in charstring pl_funcName,
inout EPTF_LGenBase_burstPreCalc_FT pl_preCalcFunc,
inout EPTF_LGenBase_burstPostCalc_FT pl_postCalcFunc)
runs on EPTF_LGenBase_Private_CT
return integer{
var integer vl_returnValue := -1;
for ( var integer vl_i := 0; vl_i < sizeof(v_LGenBase_burstFuncRefList) ; vl_i := vl_i+1 )
{
if(v_LGenBase_burstFuncRefList[vl_i].burstCalcMode == pl_funcName){
pl_preCalcFunc := v_LGenBase_burstFuncRefList[vl_i].burstPreCalc;
pl_postCalcFunc := v_LGenBase_burstFuncRefList[vl_i].burstPostCalc;
vl_returnValue := vl_i;
}
}
return vl_returnValue;
}
////////////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_adjustSchedulerData4NewCps
//
// Purpose: adjust roundedCpsUpdateInterval, idealBurstSize and moduloOperand for new cps
//
///////////////////////////////////////////////////////////
private function f_EPTF_LGenBase_adjustSchedulerData4NewCps(
inout EPTF_LGenBase_SchedulerData pl_schData
) runs on EPTF_LGenBase_Private_CT {
var float vl_interval;
f_EPTF_Base_assert(
%definitionId&": CPS, or weight must be non-negative",
not ischosen(pl_schData.target.dummy)
and ((ischosen(pl_schData.target.cpsToReach) and pl_schData.target.cpsToReach>=0.0)
or (ischosen(pl_schData.target.trafficWeight) and pl_schData.target.trafficWeight>=0.0))
);
pl_schData.burstCalcNeeded := true;
var float vl_cpsToReach := pl_schData.target.cpsToReach;
if (pl_schData.burstFuncRef.burstCalcMode == c_EPTF_LGenBase_BurstCalc_poisson) {
pl_schData.idealBurstSize := 0.0;
pl_schData.currentBurstSize := 0;
pl_schData.roundedCpsUpdateInterval := 0.0;
} else {
if (vl_cpsToReach<=0.0) {
pl_schData.idealBurstSize := 0.0
vl_interval := 0.0
} else {
if (1.0/vl_cpsToReach<tsp_EPTF_LGenBase_CPS_minUpdateInterval) {
vl_interval:= tsp_EPTF_LGenBase_CPS_minUpdateInterval
} else {
vl_interval := 1.0/vl_cpsToReach
}
//round it down to a multiple of tsp_EPTF_ELEMENTARY_TIMESTEP_PARAM
vl_interval := tsp_EPTF_ELEMENTARY_TIMESTEP_PARAM * int2float(float2int(vl_interval/tsp_EPTF_ELEMENTARY_TIMESTEP_PARAM));
if (vl_interval<tsp_EPTF_ELEMENTARY_TIMESTEP_PARAM) {
vl_interval := tsp_EPTF_ELEMENTARY_TIMESTEP_PARAM
}
pl_schData.idealBurstSize := vl_cpsToReach * vl_interval;
pl_schData.currentBurstSize := float2int(pl_schData.idealBurstSize+0.50000001); // +0.500001 is needed to overcome numerical errors
}
pl_schData.roundedCpsUpdateInterval := vl_interval;
}
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugTraffic)){
f_EPTF_LGenBase_loggingDebugTraffic(%definitionId&": Using scheduler data:"&log2str(pl_schData))
}
}
} //BurstCalculation
///////////////////////////////////////////////////////////
// Group: Conversion
//
// Purpose:
// Conversion functions
//
// Detailed Comments:
// LGenBase stores the state of the entity in integer form. These functions
// convert these value types
///////////////////////////////////////////////////////////
group EntityStateConversion{
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_eState2integer
//
// Purpose:
// Converts an <EPTF_LGenBase_EntityState> value to integer.
//
// Detailed Comments:
// LGenBase stores the state of the entity in integer form.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_eState2integer(in EPTF_LGenBase_EntityState pl_verdict) return integer{
select( pl_verdict )
{
case ( none )
{
return c_EPTF_LGenBase_eStateNone;
}
case ( pass )
{
return c_EPTF_LGenBase_eStatePass;
}
}
return c_EPTF_LGenBase_eStateFail;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_integer2eState
//
// Purpose:
// Converts an integer value to <EPTF_LGenBase_EntityState>.
//
// Detailed Comments:
// LGenBase stores the state of the entity in integer form.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_integer2eState(in integer pl_int) return EPTF_LGenBase_EntityState{
select( pl_int )
{
case ( c_EPTF_LGenBase_eStateNone )
{
return none;
}
case ( c_EPTF_LGenBase_eStatePass )
{
return pass;
}
}
return fail;
}
}//EntityStateConversion
///////////////////////////////////////////////////////////
// Group: GetSet
//
// Purpose:
// Get/Set functions
///////////////////////////////////////////////////////////
group GetSet{
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_setEntityState
//
// Purpose:
// Sets the state of an entity in a traffic case.
//
// Detailed Comments:
// This state has no relation to the enabled/disabled state of the
// entity.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_setEntityState(
in integer pl_entityRelIdx,
in integer pl_tcIdx,
in EPTF_LGenBase_EntityState pl_state)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
f_EPTF_Base_assert(%definitionId&": Invalid entity index.",pl_entityRelIdx > -1 and pl_entityRelIdx < sizeof(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList));
v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList[pl_entityRelIdx].entityState :=
f_EPTF_LGenBase_eState2integer(pl_state);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getEntityState
//
// Purpose:
// Returns the state of an entity in a traffic case.
//
// Detailed Comments:
// This state has no relation to the enabled/disabled state of the
// entity.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getEntityState(
in integer pl_entityRelIdx,
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return EPTF_LGenBase_EntityState{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
f_EPTF_Base_assert(%definitionId&": Invalid entity index.",pl_entityRelIdx > -1 and pl_entityRelIdx < sizeof(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList));
return f_EPTF_LGenBase_integer2eState(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList[pl_entityRelIdx].entityState);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getEntityStarts
//
// Purpose:
// Returns the nr of starts of an entity in a traffic case.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getEntityStarts(
in integer pl_entityRelIdx,
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
f_EPTF_Base_assert(%definitionId&": Invalid entity index.",pl_entityRelIdx > -1 and pl_entityRelIdx < sizeof(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList));
return v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList[pl_entityRelIdx].nrOfStarts;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getEntityFails
//
// Purpose:
// Returns the nr of fails of an entity in a traffic case.
public function f_EPTF_LGenBase_getEntityFails(
in integer pl_entityRelIdx,
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
f_EPTF_Base_assert(%definitionId&": Invalid entity index.",pl_entityRelIdx > -1 and pl_entityRelIdx < sizeof(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList));
return v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList[pl_entityRelIdx].nrOfFails;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getEntityErrors
//
// Purpose:
// Returns the nr of errors of an entity in a traffic case.
public function f_EPTF_LGenBase_getEntityErrors(
in integer pl_entityRelIdx,
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
f_EPTF_Base_assert(%definitionId&": Invalid entity index.",pl_entityRelIdx > -1 and pl_entityRelIdx < sizeof(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList));
return v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList[pl_entityRelIdx].nrOfErrors;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getEntityTimeouts
//
// Purpose:
// Returns the nr of timeouts of an entity in a traffic case.
public function f_EPTF_LGenBase_getEntityTimeouts(
in integer pl_entityRelIdx,
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
f_EPTF_Base_assert(%definitionId&": Invalid entity index.",pl_entityRelIdx > -1 and pl_entityRelIdx < sizeof(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList));
return v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList[pl_entityRelIdx].nrOfTimeouts;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getEntitySuccesses
//
// Purpose:
// Returns the nr of successes of an entity in a traffic case.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getEntitySuccesses(
in integer pl_entityRelIdx,
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
f_EPTF_Base_assert(%definitionId&": Invalid entity index.",pl_entityRelIdx > -1 and pl_entityRelIdx < sizeof(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList));
return v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList[pl_entityRelIdx].nrOfSuccesses;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_resetTrafficStats
//
// Purpose:
// Resets the nrOfSuccesses, nrOfFails, nrOfErrors, nrOfTimeouts values
///////////////////////////////////////////////////////////
private function f_EPTF_LGenBase_resetTrafficStats()
runs on EPTF_LGenBase_Private_CT{
for ( var integer vl_tc := 0; vl_tc < sizeof(v_LGenBase_trafficCases) ; vl_tc := vl_tc+1 ){
var integer vl_eCount := sizeof(v_LGenBase_trafficCases[vl_tc].entityInfo.itemList)
for ( var integer vl_e := 0; vl_e < vl_eCount ; vl_e := vl_e+1 ){
v_LGenBase_trafficCases[vl_tc].entityInfo.itemList[vl_e].nrOfSuccesses := 0
}
v_LGenBase_trafficCases[vl_tc].nrOfStarts := 0
v_LGenBase_trafficCases[vl_tc].nrOfSuccesses := 0
f_EPTF_LGenBaseStats_trafficSucces( vl_tc )
for ( var integer vl_cb := 0; vl_cb < sizeof(v_LGenBase_refreshSuccFnList) ; vl_cb := vl_cb+1 ){
v_LGenBase_refreshSuccFnList[vl_cb].apply( vl_tc )
}
v_LGenBase_trafficCases[vl_tc].nrOfFails := 0
f_EPTF_LGenBaseStats_trafficFail( vl_tc )
for ( var integer vl_cb := 0; vl_cb < sizeof(v_LGenBase_refreshFailFnList) ; vl_cb := vl_cb+1 ){
v_LGenBase_refreshFailFnList[vl_cb].apply( vl_tc )
}
v_LGenBase_trafficCases[vl_tc].nrOfErrors := 0
f_EPTF_LGenBaseStats_trafficError( vl_tc )
for ( var integer vl_cb := 0; vl_cb < sizeof(v_LGenBase_refreshErrorFnList) ; vl_cb := vl_cb+1 ){
v_LGenBase_refreshErrorFnList[vl_cb].apply( vl_tc )
}
v_LGenBase_trafficCases[vl_tc].nrOfTimeouts := 0
f_EPTF_LGenBaseStats_trafficTimeout( vl_tc )
for ( var integer vl_cb := 0; vl_cb < sizeof(v_LGenBase_refreshTimeoutFnList) ; vl_cb := vl_cb+1 ){
v_LGenBase_refreshTimeoutFnList[vl_cb].apply( vl_tc )
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getEntityFSMCtxIdx
//
// Purpose:
// Public function to get the FSM context index of the entity in a traffic case.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getEntityFSMCtxIdx(
in integer pl_entityRelIdx,
in integer pl_tcIdx,
in integer pl_siblingIdx := 0)
runs on EPTF_LGenBase_Private_CT
return integer{
return f_EPTF_LGenBase_fsmCtxIdxOfSiblingInTc(pl_entityRelIdx, pl_tcIdx, pl_siblingIdx)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcStarts
//
// Purpose:
// Returns the nr of starts of an Tc in a traffic case.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getTcStarts(
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
return v_LGenBase_trafficCases[pl_tcIdx].nrOfStarts;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcFails
//
// Purpose:
// Returns the nr of fails of an Tc in a traffic case.
public function f_EPTF_LGenBase_getTcFails(
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
return v_LGenBase_trafficCases[pl_tcIdx].nrOfFails;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcErrors
//
// Purpose:
// Returns the nr of errors of an Tc in a traffic case.
public function f_EPTF_LGenBase_getTcErrors(
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
return v_LGenBase_trafficCases[pl_tcIdx].nrOfErrors;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcTimeouts
//
// Purpose:
// Returns the nr of timeouts of an Tc in a traffic case.
public function f_EPTF_LGenBase_getTcTimeouts(
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
return v_LGenBase_trafficCases[pl_tcIdx].nrOfTimeouts;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcAvailable
//
// Purpose:
// Returns the nr of available entities in a traffic case.
public function f_EPTF_LGenBase_getTcAvailable(
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
return v_LGenBase_trafficCases[pl_tcIdx].nrOfAvailableEntities
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcAllEntities
//
// Purpose:
// Returns the nr of entities in a traffic case.
public function f_EPTF_LGenBase_getTcAllEntities(
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
return v_LGenBase_trafficCases[pl_tcIdx].nrOfAllEntities
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcNotFinishedEntities
//
// Purpose:
// Returns the nr of entities in a traffic case.
public function f_EPTF_LGenBase_getTcNotFinishedEntities(
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
return v_LGenBase_trafficCases[pl_tcIdx].nrOfNotFinishedEntities
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcRunningEntities
//
// Purpose:
// Returns the nr of entities in a traffic case.
public function f_EPTF_LGenBase_getTcRunningEntities(
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
return v_LGenBase_trafficCases[pl_tcIdx].nrOfRunningEntities
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcSuccesses
//
// Purpose:
// Returns the nr of successes of an Tc in a traffic case.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getTcSuccesses(
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
return v_LGenBase_trafficCases[pl_tcIdx].nrOfSuccesses;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_setTCStartDelay
//
// Purpose:
// Sets the start delay of a traffic case.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_setTCStartDelay(
in integer pl_tcIdx,
in float pl_newDelay)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
v_LGenBase_trafficCases[pl_tcIdx].startDelay := pl_newDelay;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_addScenarioCreatedCallBack
//
// Purpose:
// Registers a callback function to call when a scenario is created
//
// Detailed Comments:
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_addScenarioCreatedCallback(in EPTF_LGenBase_scenarioCreated_FT pl_LGenBase_scenarioCreatedCbf)
runs on EPTF_LGenBase_Private_CT return integer
{
var integer i:= sizeof(v_LGenBase_scenarioCreated);
v_LGenBase_scenarioCreated[i] := pl_LGenBase_scenarioCreatedCbf;
return i;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeScenarioCreatedCallBack
//
// Purpose:
// Removes a callback function to call when a scenario is created
//
// Detailed Comments:
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeScenarioCreatedCallback(in integer pl_idx) runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Error: attempting to delete fcb. at invalid idx:" & int2str(pl_idx), pl_idx>-1 and pl_idx<sizeof(v_LGenBase_scenarioCreated));
var EPTF_LGenBase_scenarioCreated_FTList vl_list := v_LGenBase_scenarioCreated;
v_LGenBase_scenarioCreated:= {};
for (var integer i:=0; i<pl_idx; i:= i+1) {
v_LGenBase_scenarioCreated[i] := vl_list[i];
}
for (var integer i:=pl_idx; i<sizeof(vl_list)-1; i:= i+1) {
v_LGenBase_scenarioCreated[i] := vl_list[i+1];
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_addEntityGroupCreatedCallback
//
// Purpose:
// Registers a callback function to call when a entityGroup is created
//
// Detailed Comments:
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_addEntityGroupCreatedCallback(in EPTF_LGenBase_entityGroupCreated_FT pl_LGenBase_entityGroupCreatedCbf)
runs on EPTF_LGenBase_Private_CT return integer
{
var integer i:= sizeof(v_LGenBase_entityGroupCreated);
v_LGenBase_entityGroupCreated[i] := pl_LGenBase_entityGroupCreatedCbf;
return i;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeEntityGroupCreatedCallBack
//
// Purpose:
// Removes a callback function to call when a entityGroup is created
//
// Detailed Comments:
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeEntityGroupCreatedCallback(in integer pl_idx) runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Error: attempting to delete fcb. at invalid idx:" & int2str(pl_idx), pl_idx>-1 and pl_idx<sizeof(v_LGenBase_entityGroupCreated));
var EPTF_LGenBase_entityGroupCreated_FTList vl_list := v_LGenBase_entityGroupCreated;
v_LGenBase_entityGroupCreated:= {};
for (var integer i:=0; i<pl_idx; i:= i+1) {
v_LGenBase_entityGroupCreated[i] := vl_list[i];
}
for (var integer i:=pl_idx; i<sizeof(vl_list)-1; i:= i+1) {
v_LGenBase_entityGroupCreated[i] := vl_list[i+1];
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_addtrafficCaseCreatedCallBack
//
// Purpose:
// Registers a callback function to call when a scenario is created
//
// Detailed Comments:
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_addtrafficCaseCreatedCallback(in EPTF_LGenBase_trafficCaseCreated_FT pl_LGenBase_trafficCaseCreatedCbf)
runs on EPTF_LGenBase_Private_CT return integer
{
var integer i:= sizeof(v_LGenBase_trafficCaseCreated);
v_LGenBase_trafficCaseCreated[i] := pl_LGenBase_trafficCaseCreatedCbf;
return i;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removetrafficCaseCreatedCallBack
//
// Purpose:
// Removes a callback function to call when a scenario is created
//
// Detailed Comments:
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removetrafficCaseCreatedCallback(in integer pl_idx) runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Error: attempting to delete fcb. at invalid idx:" & int2str(pl_idx), pl_idx>-1 and pl_idx<sizeof(v_LGenBase_trafficCaseCreated));
var EPTF_LGenBase_trafficCaseCreated_FTList vl_list := v_LGenBase_trafficCaseCreated;
v_LGenBase_trafficCaseCreated:= {};
for (var integer i:=0; i<pl_idx; i:= i+1) {
v_LGenBase_trafficCaseCreated[i] := vl_list[i];
}
for (var integer i:=pl_idx; i<sizeof(vl_list)-1; i:= i+1) {
v_LGenBase_trafficCaseCreated[i] := vl_list[i+1];
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_addBurstGeneratedCallBack
//
// Purpose:
// Registers a callback function to call after a burst generation occurred (after postproc)
//
// Parameters:
// pl_burstGenerated - *in* - <EPTF_LGenBase_burstPostCalc_FT> - the callback function
//
// Return Value:
// *integer* - Index of the function reference in the list
//
// Detailed Comments:
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_addBurstGeneratedCallBack(in EPTF_LGenBase_burstPostCalc_FT pl_burstGenerated)
runs on EPTF_LGenBase_Private_CT return integer
{
var integer i:= sizeof(v_LGenBase_burstGenerated);
v_LGenBase_burstGenerated[i] := pl_burstGenerated;
return i;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeBurstGeneratedCallBack
//
// Purpose:
// Removes a callback function to call after a burst generation occurred (after postproc)
//
// Parameters:
// pl_idx - *in* - *integer* - Index of the function reference in the list
//
// Detailed Comments:
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeBurstGeneratedCallback(in integer pl_idx) runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Error: attempting to delete fcb. at invalid idx:" & int2str(pl_idx), pl_idx>-1 and pl_idx<sizeof(v_LGenBase_burstGenerated));
var EPTF_LGenBase_burstPostCalc_FTList vl_list := v_LGenBase_burstGenerated;
v_LGenBase_burstGenerated := {};
for (var integer i:=0; i<pl_idx; i:= i+1) {
v_LGenBase_burstGenerated[i] := vl_list[i];
}
for (var integer i:=pl_idx; i<sizeof(vl_list)-1; i:= i+1) {
v_LGenBase_burstGenerated[i] := vl_list[i+1];
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_checkSchedulingTimerIsRunning
//
// Purpose:
// Checks whether the scheduling timer is running in a traffic case
//
// Parameters:
// pl_tcIdx - *in* - *integer* - traffic case index (relative)
//
// Return Value:
// *boolean* - If scheduling timer is running.
//
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_checkSchedulingTimerIsRunning(in integer pl_tcIdx) runs on EPTF_LGenBase_Private_CT
return boolean
{
var boolean vl_returnValue := false;
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index.",pl_tcIdx > -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
if(not f_EPTF_LGenBase_isWeightedScenario(
v_LGenBase_trafficCases[pl_tcIdx].eGroupBackref,
v_LGenBase_trafficCases[pl_tcIdx].eScenarioBackRef)){ //normal scenario
if(-1 != v_LGenBase_trafficCases[pl_tcIdx].schedulingTimer){
vl_returnValue := true;
}
} else { //weighted scenario
if(ispresent(v_LGenBase_entityGroups[v_LGenBase_trafficCases[pl_tcIdx].eGroupBackref].scenarios[v_LGenBase_trafficCases[pl_tcIdx].eScenarioBackRef].schedulerData))
{
if(-1 != v_LGenBase_entityGroups[v_LGenBase_trafficCases[pl_tcIdx].eGroupBackref].scenarios[v_LGenBase_trafficCases[pl_tcIdx].eScenarioBackRef].schedulerData.schedulingTimer){
vl_returnValue := true;
}
}
}
return vl_returnValue;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_checkName
//
// Purpose:
// Checks whether the given name contains the name separator specified in a component variable
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_checkName(in charstring pl_name) return boolean{
template charstring tl_separator := pattern "*{tsp_LGenBase_nameSeparator}*";
return not match(pl_name, tl_separator);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_registerCPSChangedCallback_TC
//
// Purpose:
// Registers a CPS changed callback for the given traffic case instance
//
// Parameters:
// pl_eGrpName - *in charstring* - the entity group name
// pl_scName - *in charstring* - the scenario name
// pl_tcName - *in charstring* - the traffic case name
// pl_cpsChangedCallback - *in* <EPTF_LGenBase_TrafficCaseCPSChangedCallbackFn_FT> - the traffic case CPS changed callback
//
// Return Value:
// -
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_registerCPSChangedCallback_TC(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName,
in EPTF_LGenBase_TrafficCaseCPSChangedCallbackFn_FT pl_cpsChangedCallback
) runs on EPTF_LGenBase_Private_CT {
var integer vl_eGrpIdx := f_EPTF_LGenBase_entityGrpNameIndex(pl_eGrpName);
f_EPTF_Base_assert(%definitionId&": Invalid entity group name: "&pl_eGrpName,-1 < vl_eGrpIdx);
var integer vl_scIdx := f_EPTF_LGenBase_scNameIndexInEG(vl_eGrpIdx, pl_scName);
f_EPTF_Base_assert(%definitionId&": Invalid scenario name: "&pl_scName,-1 < vl_scIdx);
f_EPTF_Base_assert(%definitionId&": CPS change callback cannot be set to weighted scenario: "
&v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdx].uniqueName,
not f_EPTF_LGenBase_isWeightedScenario(vl_eGrpIdx, vl_scIdx));
var integer vl_tcIdx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName);
v_LGenBase_trafficCases[vl_tcIdx].cpsChangedCallbackList[sizeof(v_LGenBase_trafficCases[vl_tcIdx].cpsChangedCallbackList)] := pl_cpsChangedCallback;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_deregisterCPSChangedCallback_TC
//
// Purpose:
// DeRegisters a CPS changed callback for the given traffic case instance
//
// Parameters:
// pl_eGrpName - *in charstring* - the entity group name
// pl_scName - *in charstring* - the scenario name
// pl_tcName - *in charstring* - the traffic case name
// pl_cpsChangedCallback - *in* <EPTF_LGenBase_TrafficCaseCPSChangedCallbackFn_FT> - the traffic case CPS changed callback
//
// Return Value:
// -
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_deregisterCPSChangedCallback_TC(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName,
in EPTF_LGenBase_TrafficCaseCPSChangedCallbackFn_FT pl_cpsChangedCallback
) runs on EPTF_LGenBase_Private_CT {
var integer vl_tcIdx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName);
for(var integer i:=0; i<sizeof(v_LGenBase_trafficCases[vl_tcIdx].cpsChangedCallbackList); i:=i+1) {
if(v_LGenBase_trafficCases[vl_tcIdx].cpsChangedCallbackList[i]==pl_cpsChangedCallback) {
v_LGenBase_trafficCases[vl_tcIdx].cpsChangedCallbackList[i] := null;
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_callCPSChangedCallbacks_TC
//
// Purpose:
// Calls the CPS changed callbacks for the given traffic case instance
//
// Parameters:
// pl_tcIdx - *in integer* - the id of the traffic case in the instance DB
// pl_cps - *in float* - the new CPS value
//
// Return Value:
// -
//
///////////////////////////////////////////////////////////
private function f_EPTF_LGenBase_callCPSChangedCallbacks_TC(in float pl_cps, in integer pl_tcIdx) runs on EPTF_LGenBase_Private_CT {
f_EPTF_Base_assert(%definitionId&": Invalid index "&int2str(pl_tcIdx)&
". Valid index range: (0.."&int2str(sizeof(v_LGenBase_trafficCases))&").",
pl_tcIdx >= 0 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
for (var integer i:=0; i<sizeof(v_LGenBase_trafficCases[pl_tcIdx].cpsChangedCallbackList); i:=i+1) {
if (v_LGenBase_trafficCases[pl_tcIdx].cpsChangedCallbackList[i]!=null) {
v_LGenBase_trafficCases[pl_tcIdx].cpsChangedCallbackList[i].apply(pl_cps,pl_tcIdx);
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_setCPSByNames
//
// Purpose:
// Sets the required CPS of the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_setCPSByNames(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName,
in float pl_newCps
)
runs on EPTF_LGenBase_Private_CT{
//We don't handle the previous value
v_LGenBase_dummyFloat := f_EPTF_LGenBase_setCPS(f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName), pl_newCps);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcCpsToReachByName
//
// Purpose:
// Retrieves the required CPS of the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getTcCpsToReachByName(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName)
runs on EPTF_LGenBase_Private_CT
return float{
var integer vl_tc_idx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName)
f_EPTF_Base_assert(%definitionId&": Invalid traffic case name: "&
pl_eGrpName&tsp_LGenBase_nameSeparator&pl_scName&tsp_LGenBase_nameSeparator&pl_tcName,
-1 < vl_tc_idx)
return f_EPTF_LGenBase_getTcCpsToReachByIdx(vl_tc_idx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcCpsToReachByIdx
//
// Purpose:
// Retrieves the required CPS of the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getTcCpsToReachByIdx(
in integer pl_tcAbsIdx)
runs on EPTF_LGenBase_Private_CT
return float{
f_EPTF_Base_assert(%definitionId&": The traffic case "&v_LGenBase_trafficCases[pl_tcAbsIdx].uniqueName&
" is in a weighted scenario.",ischosen(v_LGenBase_trafficCases[pl_tcAbsIdx].schedulerData.target.cpsToReach));
return v_LGenBase_trafficCases[pl_tcAbsIdx].schedulerData.target.cpsToReach;
//pl_tc.schedulerData.target.cpsToReach
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_setCpsOrWeightOfTcByNames
//
// Purpose:
// Sets the required CPS or Weight of the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_setCpsOrWeightOfTcByNames(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName,
in float pl_newCps
)
runs on EPTF_LGenBase_Private_CT{
var integer vl_tcIdx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName);
if (ischosen(v_LGenBase_trafficCases[vl_tcIdx].schedulerData.target.cpsToReach))
{
v_LGenBase_dummyFloat := f_EPTF_LGenBase_setCPS(vl_tcIdx, pl_newCps);
} else if (ischosen(v_LGenBase_trafficCases[vl_tcIdx].schedulerData.target.trafficWeight))
{
v_LGenBase_dummyFloat := f_EPTF_LGenBase_setTcWeight(vl_tcIdx, pl_newCps);
} else {
//This code shouldn't be reached, because the configuration reader function should prevent
f_EPTF_Base_assert(%definitionId&": There is neither cpsToReach, nor trafficWeight defined for the traffic case.",false)
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getNrOfTCs
//
// Purpose:
// Retrieves the number of the traffic cases
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getNrOfTCs() runs on EPTF_LGenBase_Private_CT return integer{
return sizeof(v_LGenBase_trafficCases);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_setCPS
//
// Purpose:
// Sets the required CPS of the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_setCPS(
in integer pl_tcAbsIdx,
in float pl_newCps
)
runs on EPTF_LGenBase_Private_CT
return float
{
if(not ischosen(v_LGenBase_trafficCases[pl_tcAbsIdx].schedulerData.target.cpsToReach)){
f_EPTF_LGenBase_loggingWarning(%definitionId&": CPS cannot set to weighted TC: "
&v_LGenBase_trafficCases[pl_tcAbsIdx].uniqueName)
return 0.0
}
if(originating == v_LGenBase_trafficCases[pl_tcAbsIdx].trafficType and
-1 < v_LGenBase_trafficCases[pl_tcAbsIdx].schedulingTimer){
f_EPTF_SchedulerComp_CancelEvent(v_LGenBase_trafficCases[pl_tcAbsIdx].schedulingTimer)
v_LGenBase_trafficCases[pl_tcAbsIdx].schedulingTimer := -1
}
var float vl_ret := v_LGenBase_trafficCases[pl_tcAbsIdx].schedulerData.target.cpsToReach ;
v_LGenBase_trafficCases[pl_tcAbsIdx].schedulerData.target.cpsToReach := pl_newCps
f_EPTF_LGenBase_callCPSChangedCallbacks_TC(pl_newCps,pl_tcAbsIdx);
if(originating == v_LGenBase_trafficCases[pl_tcAbsIdx].trafficType){
//set modulo,roundedUpdateInterval, idealBurstSize
f_EPTF_LGenBase_adjustSchedulerData4NewCps(v_LGenBase_trafficCases[pl_tcAbsIdx].schedulerData);
var EPTF_LGenBase_tcState vl_statePrev := v_LGenBase_trafficCases[pl_tcAbsIdx].state;
if(c_EPTF_LGenBase_tcStateRunning != vl_statePrev){
return vl_ret; // do not schedule event if TC is not running
}
// distribute the bursterror differently according to the traffic corrigation => smooth out cumulative bursts
var integer vl_eGrpIdx := v_LGenBase_trafficCases[pl_tcAbsIdx].eGroupBackref
v_LGenBase_trafficCases[pl_tcAbsIdx].schedulerData.burstSizeCumulativeError := v_LGenBase_entityGroups[vl_eGrpIdx].trafficCorrigation;
if(0.0 < pl_newCps){
// calculate the remaining time from start_delay
var float vl_execTime := f_EPTF_Base_getRelTimeInSecs() - v_LGenBase_trafficCases[pl_tcAbsIdx].startTime
var float vl_remainingTime := v_LGenBase_trafficCases[pl_tcAbsIdx].startDelay - vl_execTime;
//HL48155 In any case the timer must be rescheduled, even if there is a running scheduled timer action.
//Otherwise the CPS change won't take action untill the scheduled action timed out.
//if( -1 == v_LGenBase_trafficCases[pl_tcAbsIdx].schedulingTimer ) // if an event exists already we don't need to reschedule
{
if ( tsp_EPTF_ELEMENTARY_TIMESTEP_PARAM > vl_remainingTime) {
vl_remainingTime := tsp_EPTF_ELEMENTARY_TIMESTEP_PARAM
}
// set different start time for different LGens => smooth out synchronous call generation (far small CPS):
var float vl_stTrafficCorrigation := v_LGenBase_entityGroups[vl_eGrpIdx].trafficCorrigation/v_LGenBase_trafficCases[pl_tcAbsIdx].schedulerData.target.cpsToReach;
vl_remainingTime := vl_remainingTime + vl_stTrafficCorrigation;
f_EPTF_LGenBase_restartActionTimer(v_LGenBase_trafficCases[pl_tcAbsIdx].schedulingTimer,
refers(f_EPTF_LGenBase_doTrafficCaseTimerAction),
{pl_tcAbsIdx},
vl_remainingTime);
}
/*}else{
if(-1 < v_LGenBase_trafficCases[pl_tcAbsIdx].schedulingTimer){
f_EPTF_SchedulerComp_CancelEvent(v_LGenBase_trafficCases[pl_tcAbsIdx].schedulingTimer)
v_LGenBase_trafficCases[pl_tcAbsIdx].schedulingTimer := -1
}*/
}
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_setScenarioCPS
//
// Purpose:
// Sets the required CPS of the scenario
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_setScenarioCPS(
in charstring pl_eGrpName,
in charstring pl_scName,
in float pl_newCps
)
runs on EPTF_LGenBase_Private_CT
return float{
var integer vl_eGrpIdx := f_EPTF_LGenBase_entityGrpNameIndex(pl_eGrpName);
f_EPTF_Base_assert(%definitionId&": Invalid entity group name: "&pl_eGrpName,-1 < vl_eGrpIdx);
var integer vl_scIdx := f_EPTF_LGenBase_scNameIndexInEG(vl_eGrpIdx, pl_scName);
f_EPTF_Base_assert(%definitionId&": Invalid scenario name: "&pl_scName,-1 < vl_scIdx);
var float vl_ret := f_EPTF_LGenBase_setScenarioCPSByIdx(vl_eGrpIdx, vl_scIdx, pl_newCps);
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getEGrpName
//
// Purpose:
// Public function to get the size of the entity group based on the index of the entity group
//
// Detailed Comments:
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getEGrpName(
in integer pl_eGrpIdx)
runs on EPTF_LGenBase_Private_CT
return charstring{
f_EPTF_Base_assert(%definitionId&": Invalid entity group index.",pl_eGrpIdx > -1 and pl_eGrpIdx < sizeof(v_LGenBase_entityGroups));
return v_LGenBase_entityGroups[pl_eGrpIdx].name;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_registerCPSChangedCallback_SC
//
// Purpose:
// Registers a CPS changed callback for the given scenario instance
//
// Parameters:
// pl_eGrpName - *in charstring* - the entity group name
// pl_scName - *in charstring* - the scenario name
// pl_cpsChangedCallback - *in* <EPTF_LGenBase_TrafficCaseCPSChangedCallbackFn_FT> - the scenario CPS changed callback
//
// Return Value:
// -
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_registerCPSChangedCallback_SC(
in charstring pl_eGrpName,
in charstring pl_scName,
in EPTF_LGenBase_ScenarioCPSChangedCallbackFn_FT pl_cpsChangedCallback
) runs on EPTF_LGenBase_Private_CT {
var integer vl_eGrpIdx := f_EPTF_LGenBase_entityGrpNameIndex(pl_eGrpName);
f_EPTF_Base_assert(%definitionId&": Invalid entity group name: "&pl_eGrpName,-1 < vl_eGrpIdx);
var integer vl_scIdx := f_EPTF_LGenBase_scNameIndexInEG(vl_eGrpIdx, pl_scName);
f_EPTF_Base_assert(%definitionId&": Invalid scenario name: "&pl_scName,-1 < vl_scIdx);
f_EPTF_Base_assert(%definitionId&": CPS change callback cannot be set to non-weighted scenario: "
&v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdx].uniqueName,
f_EPTF_LGenBase_isWeightedScenario(vl_eGrpIdx, vl_scIdx));
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdx].cpsChangedCallbackList[sizeof(v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdx].cpsChangedCallbackList)] := pl_cpsChangedCallback;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_deregisterCPSChangedCallback_SC
//
// Purpose:
// DeRegisters a CPS changed callback for the given scenario instance
//
// Parameters:
// pl_eGrpName - *in charstring* - the entity group name
// pl_scName - *in charstring* - the scenario name
// pl_cpsChangedCallback - *in* <EPTF_LGenBase_TrafficCaseCPSChangedCallbackFn_FT> - the scenario CPS changed callback
//
// Return Value:
// -
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_deregisterCPSChangedCallback_SC(
in charstring pl_eGrpName,
in charstring pl_scName,
in EPTF_LGenBase_ScenarioCPSChangedCallbackFn_FT pl_cpsChangedCallback
) runs on EPTF_LGenBase_Private_CT {
var integer vl_eGrpIdx := f_EPTF_LGenBase_entityGrpNameIndex(pl_eGrpName);
f_EPTF_Base_assert(%definitionId&": Invalid entity group name: "&pl_eGrpName,-1 < vl_eGrpIdx);
var integer vl_scIdx := f_EPTF_LGenBase_scNameIndexInEG(vl_eGrpIdx, pl_scName);
f_EPTF_Base_assert(%definitionId&": Invalid scenario name: "&pl_scName,-1 < vl_scIdx);
for(var integer i:=0; i<sizeof(v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdx].cpsChangedCallbackList); i:=i+1) {
if(v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdx].cpsChangedCallbackList[i]==pl_cpsChangedCallback) {
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdx].cpsChangedCallbackList[i] := null;
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_callCPSChangedCallbacks_SC
//
// Purpose:
// Calls the CPS changed callbacks for the given scenario instance
//
// Parameters:
// pl_cps - *in float* - the new CPS value
// pl_eGrpIdx - *in integer* - the entity group instance idx
// pl_scIdx - *in integer* - the scenario instance idx in entity group
//
// Return Value:
// -
//
///////////////////////////////////////////////////////////
private function f_EPTF_LGenBase_callCPSChangedCallbacks_SC(in float pl_cps, in integer pl_eGrpIdx, in integer pl_scIdx) runs on EPTF_LGenBase_Private_CT {
f_EPTF_Base_assert(%definitionId&": Invalid entity group index: "&int2str(pl_eGrpIdx),-1 < pl_eGrpIdx and pl_eGrpIdx < sizeof(v_LGenBase_entityGroups));
f_EPTF_Base_assert(%definitionId&": Invalid scenario index: "&int2str(pl_scIdx),-1 < pl_scIdx and pl_scIdx < sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios));
f_EPTF_Base_assert(%definitionId&": CPS cannot set to non-weighted scenario: "
&v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].uniqueName,
f_EPTF_LGenBase_isWeightedScenario(pl_eGrpIdx, pl_scIdx));
for (var integer i:=0; i<sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].cpsChangedCallbackList); i:=i+1) {
if (v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].cpsChangedCallbackList[i]!=null) {
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].cpsChangedCallbackList[i].apply(pl_cps,pl_eGrpIdx,pl_scIdx);
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_setScenarioCPSByIdx
//
// Purpose:
// Sets the required CPS of the scenario
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_setScenarioCPSByIdx(
in integer pl_eGrpIdx,
in integer pl_scIdx,
in float pl_newCps,
in boolean pl_forceAdjust := false
)
runs on EPTF_LGenBase_Private_CT
return float{
f_EPTF_Base_assert(%definitionId&": Invalid entity group index: "&int2str(pl_eGrpIdx),-1 < pl_eGrpIdx and pl_eGrpIdx < sizeof(v_LGenBase_entityGroups));
f_EPTF_Base_assert(%definitionId&": Invalid scenario index: "&int2str(pl_scIdx),-1 < pl_scIdx and pl_scIdx < sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios));
f_EPTF_Base_assert(%definitionId&": CPS cannot set to non-weighted scenario: "
&v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].uniqueName,
f_EPTF_LGenBase_isWeightedScenario(pl_eGrpIdx, pl_scIdx));
var float vl_ret := v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].schedulerData.target.cpsToReach;
if(pl_forceAdjust or v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].schedulerData.target.cpsToReach == pl_newCps) {
f_EPTF_LGenBase_loggingDebugTraffic(%definitionId&": setting the same CPS value ignored.");
return vl_ret;
}
if(originating == v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].trafficType and
-1 < v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].schedulerData.schedulingTimer){
f_EPTF_SchedulerComp_CancelEvent(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].schedulerData.schedulingTimer)
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].schedulerData.schedulingTimer := -1
}
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].schedulerData.target.cpsToReach := pl_newCps;
f_EPTF_LGenBase_callCPSChangedCallbacks_SC(pl_newCps,pl_eGrpIdx,pl_scIdx);
if(originating == v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].trafficType){
f_EPTF_LGenBase_adjustSchedulerData4NewCps(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].schedulerData);
// distribute the bursterror differently according to the traffic corrigation => smooth out cumulative bursts
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].schedulerData.burstSizeCumulativeError := v_LGenBase_entityGroups[pl_eGrpIdx].trafficCorrigation;
var EPTF_LGenBase_tcState vl_statePrev := v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].state;
if(c_EPTF_LGenBase_tcStateRunning != vl_statePrev){
return vl_ret; // do not schedule event if SC is not running
}
if(0.0 < pl_newCps){
// set different start time for different LGens => smooth out synchronous call generation (far small CPS):
var float vl_stTrafficCorrigation := v_LGenBase_entityGroups[pl_eGrpIdx].trafficCorrigation/v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].schedulerData.target.cpsToReach;
f_EPTF_LGenBase_restartActionTimer(
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].schedulerData.schedulingTimer,
refers(f_EPTF_LGenBase_doWeightedScenarioTimerAction),
{pl_eGrpIdx, pl_scIdx},
vl_stTrafficCorrigation
);
/*}else{
if(-1 < v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].schedulerData.schedulingTimer){
f_EPTF_SchedulerComp_CancelEvent(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].schedulerData.schedulingTimer)
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].schedulerData.schedulingTimer := -1
}*/
}
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcCpsToReachByName
//
// Purpose:
// Retrieves the required CPS of the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getScCpsToReachByName(
in charstring pl_eGrpName,
in charstring pl_scName)
runs on EPTF_LGenBase_Private_CT
return float{
var integer vl_eGrpIdx := f_EPTF_LGenBase_entityGrpNameIndex(pl_eGrpName);
var integer vl_scRelIdx := f_EPTF_LGenBase_scNameIndexInEG(vl_eGrpIdx, pl_scName);
return f_EPTF_LGenBase_getScCpsToReachByIdx(vl_eGrpIdx, vl_scRelIdx);
}
///////////////////////////////////////////////////////////
// Wrapper function for backward compatibility
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getScCpsSoReachByName(
in charstring pl_eGrpName,
in charstring pl_scName)
runs on EPTF_LGenBase_Private_CT
return float{
return f_EPTF_LGenBase_getScCpsToReachByName(pl_eGrpName, pl_scName)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getScCpsToReachByIdx
//
// Purpose:
// Retrieves the required CPS of the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getScCpsToReachByIdx(
in integer pl_eGrpIdx,
in integer pl_scRelIdx)
runs on EPTF_LGenBase_Private_CT
return float{
f_EPTF_Base_assert(%definitionId&": The "&v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scRelIdx].uniqueName&
" scenario is not a weighted scenario.",
f_EPTF_LGenBase_isWeightedScenario(pl_eGrpIdx, pl_scRelIdx));
return v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scRelIdx].schedulerData.target.cpsToReach;
//pl_tc.schedulerData.target.cpsToReach
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_setTcWeight
//
// Purpose:
// Sets the required CPS of the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_setTcWeight(
in integer pl_tcAbsIdx,
in float pl_newWeight)
runs on EPTF_LGenBase_Private_CT
return float{
f_EPTF_Base_assert(%definitionId&": Weight cannot set to normal TC: "
&v_LGenBase_trafficCases[pl_tcAbsIdx].uniqueName,
ischosen(v_LGenBase_trafficCases[pl_tcAbsIdx].schedulerData.target.trafficWeight));
var float vl_ret := v_LGenBase_trafficCases[pl_tcAbsIdx].schedulerData.target.trafficWeight ;
var integer vl_eGrpIdx := v_LGenBase_trafficCases[pl_tcAbsIdx].eGroupBackref;
var integer vl_scInGrpIdx := v_LGenBase_trafficCases[pl_tcAbsIdx].eScenarioBackRef;
v_LGenBase_trafficCases[pl_tcAbsIdx].schedulerData.target.trafficWeight := pl_newWeight
var boolean vl_mixerAcceptsMix := f_EPTF_TrafficMixer_acceptNewTrafficMix(
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scInGrpIdx].trafficMixData,
f_EPTF_LGenBase_getEnabledWeightListFromScenario(vl_eGrpIdx,vl_scInGrpIdx),
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scInGrpIdx].weightedScData.deterministicMix
)
f_EPTF_Base_assert(%definitionId&": initializing traffic mix for TC in weighted SC "&v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scInGrpIdx].name& ": mixer has not accepted traffic mix",
vl_mixerAcceptsMix);
//set modulo,roundedUpdateInterval, idealBurstSize
//f_EPTF_LGenBase_adjustSchedulerData4NewCps(v_LGenBase_trafficCases[pl_tcAbsIdx].schedulerData);
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getCPSByNames
//
// Purpose:
// Retrieves the last reached CPS of the traffic case
//
// Detailed Comments:
// This function retrives the content of the lastCPS field
// of the traffic case descriptor. To retrieve the measured
// last CPS use the <f_EPTF_LGenBase_getMeasuredCPSByNames>
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getCPSByNames(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName
)
runs on EPTF_LGenBase_Private_CT
return float{
var integer vl_tcAbsIdx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName);
return f_EPTF_LGenBase_getCPS(vl_tcAbsIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getCPS
//
// Purpose:
// Retrieves the last reached CPS of the traffic case
//
// Detailed Comments:
// This function retrives the content of the lastCPS field
// of the traffic case descriptor. To retrieve the measured
// last CPS use the <f_EPTF_LGenBase_getMeasuredCPSByIdx>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getCPS(
in integer pl_tcAbsIdx
)
runs on EPTF_LGenBase_Private_CT
return float{
return v_LGenBase_trafficCases[pl_tcAbsIdx].lastCPS;
}
//TODO comment
public function f_EPTF_LGenBase_getMeasuredCPSByNames(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName
)
runs on EPTF_LGenBase_Private_CT
return float{
var charstring vl_varName :=
f_EPTF_LGenBase_getNamePrefix(pl_eGrpName, pl_scName, pl_tcName) & c_EPTF_LGenBaseStats_nameOfTcLastCps
var integer vl_varIdx := f_EPTF_Var_getId(vl_varName)
if(0 > vl_varIdx){
f_EPTF_LGenBase_loggingWarning(%definitionId&": Invalid traffic case names: "&pl_eGrpName&","&pl_scName&","&pl_tcName)
return 0.0
}
var EPTF_Var_DirectContent vl_content
f_EPTF_Var_getContent(vl_varIdx, vl_content)
return vl_content.floatVal
}
//TODO comment
public function f_EPTF_LGenBase_getMeasuredCPSByIdx(
in integer pl_tcAbsIdx
)
runs on EPTF_LGenBase_Private_CT
return float{
var charstring vl_eGrpName, vl_scName, vl_tcName
f_EPTF_LGenBase_trafficCaseIdNames(pl_tcAbsIdx, vl_eGrpName, vl_scName, vl_tcName)
return f_EPTF_LGenBase_getMeasuredCPSByNames(vl_eGrpName, vl_scName, vl_tcName)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_tcTimerIsRunning
//
// Purpose:
// Retrieves whether a named timer is running
// in the FSM of the traffic case.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_tcTimerIsRunning(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName,
in charstring pl_timerName,
in integer pl_eRelIdx,
in integer pl_siblingIdx := 0
)
runs on EPTF_LGenBase_Private_CT
return boolean{
var integer vl_tcAbsIdx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName);
var integer vl_grpIdx := v_LGenBase_trafficCases[vl_tcAbsIdx].eGroupBackref;
f_EPTF_Base_assert(%definitionId& "Invalid entity index.",pl_eRelIdx<v_LGenBase_entityGroups[vl_grpIdx].eCount and pl_eRelIdx > -1);
var integer vl_eAbsIdx := v_LGenBase_entityGroups[vl_grpIdx].eOffset+pl_eRelIdx;
var integer vl_fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSiblingInTc(pl_eRelIdx, vl_tcAbsIdx, pl_siblingIdx);
if(0 > vl_fsmCtxIdx){
return false;
}
var integer vl_timerIdx := -1;
var integer vl_i := 0;
var integer vl_fsmIdx := v_LGenBase_trafficCases[vl_tcAbsIdx].fsmIdx;
while ( vl_timerIdx < 0 and vl_i < sizeof(v_LGenBase_fsmTables[vl_fsmIdx].timerList) )
{
if(pl_timerName == v_LGenBase_fsmTables[vl_fsmIdx].timerList[vl_i].name){
vl_timerIdx := vl_i;
}
vl_i := vl_i + 1;
}
f_EPTF_Base_assert(%definitionId& "Invalid timer name: "&pl_timerName,-1 < vl_timerIdx);
return f_EPTF_LGenBase_fsmTimerIsRunning(vl_eAbsIdx,vl_fsmCtxIdx,vl_timerIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_nrOfBusyEntities
//
// Purpose:
// Returns the count of busy entities in a traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_nrOfBusyEntities(
in integer pl_tcIdx
)
runs on EPTF_LGenBase_Private_CT
return integer
{
if(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.entitySelection == round_robin) {
return f_EPTF_FBQ_getLengthOfBusyChain(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.fbq);
} else {
return f_EPTF_RNA_getLengthOfBusyList(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.rna);
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcState
//
// Purpose:
// Returns the state of a traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getTcState(
in integer pl_tcIdx
)
runs on EPTF_LGenBase_Private_CT
return EPTF_LGenBase_tcState
{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
return v_LGenBase_trafficCases[pl_tcIdx].state
}
//TODO comment
public function f_EPTF_LGenBase_getScStateByNames(
in charstring pl_eGrpName,
in charstring pl_scName
)
runs on EPTF_LGenBase_Private_CT
return EPTF_LGenBase_tcState
{
var integer vl_eGrpIdx := f_EPTF_LGenBase_entityGrpNameIndex(pl_eGrpName);
f_EPTF_Base_assert(%definitionId&": Invalid entity group name: "&pl_eGrpName,-1 != vl_eGrpIdx);
var integer vl_scIdx := f_EPTF_LGenBase_scNameIndexInEG(vl_eGrpIdx, pl_scName);
f_EPTF_Base_assert(%definitionId&": Invalid scenario name: "&pl_scName,-1 != vl_scIdx);
return f_EPTF_LGenBase_getScState(vl_eGrpIdx, vl_scIdx)
}
//TODO comment
public function f_EPTF_LGenBase_getScState(
in integer pl_eGrpIdx,
in integer pl_scIdxInGrp
)
runs on EPTF_LGenBase_Private_CT
return EPTF_LGenBase_tcState
{
return v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdxInGrp].state
}
}//GetSet
///////////////////////////////////////////////////////////
// Group: StartStop
//
// Purpose:
// Functions to start, stop, pause, etc. the traffic cases and scenarios
///////////////////////////////////////////////////////////
group StartStop{
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_stopTrafficCase
//
// Purpose:
// Calls f_EPTF_LGenBase_stopTrafficCaseByIdx and stops the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_stopTrafficCase(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName
)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_LGenBase_stopTrafficCaseByIdx(f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName));
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_startTrafficCase
//
// Purpose:
// Calls f_EPTF_LGenBase_enableTrafficCaseInternal and starts the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_startTrafficCase(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName
)
runs on EPTF_LGenBase_Private_CT{
var integer vl_tcAbsIdx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName);
f_EPTF_LGenBase_startTrafficCaseByIdx(vl_tcAbsIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_startTrafficCaseByIdx
//
// Purpose:
// Calls f_EPTF_LGenBase_enableTrafficCaseInternal and starts the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_startTrafficCaseByIdx(
in integer pl_tcAbsIdx
)
runs on EPTF_LGenBase_Private_CT{
var integer vl_eGrpIdx := v_LGenBase_trafficCases[pl_tcAbsIdx].eGroupBackref
var integer vl_scInGrpIdx := v_LGenBase_trafficCases[pl_tcAbsIdx].eScenarioBackRef
if(f_EPTF_LGenBase_isWeightedScenario(vl_eGrpIdx, vl_scInGrpIdx)){
// if scenario is weighted and it is not running, start it:
if (v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scInGrpIdx].state != c_EPTF_LGenBase_tcStateRunning) {
f_EPTF_LGenBase_enableScenarioOnEntityGroup(vl_eGrpIdx, vl_scInGrpIdx, true);
if (v_LGenBase_trafficCases[pl_tcAbsIdx].state == c_EPTF_LGenBase_tcStateRunning) {
return; // traffic case is already running, do not need to start it
}
}
}
f_EPTF_LGenBase_enableTrafficCaseInternal(pl_tcAbsIdx, true);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_startWeightedScenario
//
// Purpose:
// Sends <c_EPTF_LGenBase_inputIdx_testMgmt_stopTC> to the
// entities in the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_startWeightedScenario(
in charstring pl_eGrpName,
in charstring pl_scName)
runs on EPTF_LGenBase_Private_CT{
var integer vl_eGrpIdx := f_EPTF_LGenBase_entityGrpNameIndex(pl_eGrpName);
var integer vl_scInGrpIdx := f_EPTF_LGenBase_scNameIndexInEG(vl_eGrpIdx, pl_scName)
if (f_EPTF_LGenBase_isWeightedScenario(vl_eGrpIdx,vl_scInGrpIdx)) {
f_EPTF_LGenBase_enableScenarioOnEntityGroup(vl_eGrpIdx, vl_scInGrpIdx, true)
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_finishLaunchTC
//
// Purpose:
// Calls the <f_EPTF_LGenBase_disableTrafficCaseInternal>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_finishLaunchTC(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName
)
runs on EPTF_LGenBase_Private_CT{
var integer vl_tcAbsIdx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName);
f_EPTF_LGenBase_finishLaunchTCByIdx(vl_tcAbsIdx)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_finishLaunchTCByIdx
//
// Purpose:
// Calls the <f_EPTF_LGenBase_disableTrafficCaseInternal>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_finishLaunchTCByIdx(
in integer pl_tcAbsIdx
)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index: "&int2str(pl_tcAbsIdx),-1 < pl_tcAbsIdx and pl_tcAbsIdx < sizeof(v_LGenBase_trafficCases));
f_EPTF_LGenBase_disableTrafficCaseInternal(pl_tcAbsIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_finishTCByName
//
// Purpose:
// Stops the traffic case like the custom finish condition
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_finishTCByName(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName
)
runs on EPTF_LGenBase_Private_CT{
var integer vl_tcAbsIdx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName);
f_EPTF_LGenBase_finishTCByIdx(vl_tcAbsIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_finishTCByIdx
//
// Purpose:
// Stops the traffic case like the custom finish condition
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_finishTCByIdx(
in integer pl_tcAbsIdx
)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index: "&int2str(pl_tcAbsIdx),-1 < pl_tcAbsIdx and pl_tcAbsIdx < sizeof(v_LGenBase_trafficCases));
f_EPTF_LGenBase_groupFinishedDetected(pl_tcAbsIdx, c_EPTF_LGenBase_customConditionTrue)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_stopTrafficCaseByIdx
//
// Purpose:
// Sends <c_EPTF_LGenBase_inputIdx_testMgmt_stopTC> to the
// entities in the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_stopTrafficCaseByIdx(
in integer pl_tcIdx
)
runs on EPTF_LGenBase_Private_CT{
if(terminating == v_LGenBase_trafficCases[pl_tcIdx].trafficType){
f_EPTF_LGenBase_loggingDebugTraffic(%definitionId&": Stop called for terminating tc "&v_LGenBase_trafficCases[pl_tcIdx].uniqueName&
". The feature is not implemented yet.");
return;
}
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index: "&int2str(pl_tcIdx),-1 < pl_tcIdx and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
f_EPTF_LGenBase_loggingDebugTraffic(%definitionId&": StopTrafficCaseByIdx called for tc "&v_LGenBase_trafficCases[pl_tcIdx].uniqueName);
v_LGenBase_trafficCases[pl_tcIdx].stopped := true
f_EPTF_LGenBase_disableTrafficCaseInternal(pl_tcIdx);
v_LGenBase_trafficCases[pl_tcIdx].state := c_EPTF_LGenBase_tcStateStopping;
f_EPTF_LGenBase_tcStateChanged(pl_tcIdx);
var integer vl_maxEntity := v_LGenBase_entityGroups[v_LGenBase_trafficCases[pl_tcIdx].eGroupBackref].eCount;
f_EPTF_FBQ_initFreeBusyQueue(v_LGenBase_trafficCases[pl_tcIdx].stoppingEntityInfo);
//var integer vl_maxEntities := sizeof(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList);
//f_EPTF_FBQ_createFreeSlots(vl_maxEntities, v_LGenBase_trafficCases[pl_tcIdx].stoppingEntityInfo);
f_EPTF_FBQ_createFreeSlots(vl_maxEntity, v_LGenBase_trafficCases[pl_tcIdx].stoppingEntityInfo);
//cancel timer first:
if(-1 < v_LGenBase_trafficCases[pl_tcIdx].stopTimeoutTimer){
if(not f_EPTF_SchedulerComp_CancelEvent(v_LGenBase_trafficCases[pl_tcIdx].stopTimeoutTimer)) {
f_EPTF_LGenBase_loggingWarning(%definitionId&": Cancelling stop timeout timer failed.");
}
v_LGenBase_trafficCases[pl_tcIdx].stopTimeoutTimer := -1;
}
if(not f_EPTF_SchedulerComp_scheduleAction(
T_EPTF_componentClock.read + tsp_EPTF_LGenBase_abortStopProcess,
refers(f_EPTF_LGenBase_stopProcessTimedOut),
{pl_tcIdx,0},
v_LGenBase_trafficCases[pl_tcIdx].stopTimeoutTimer)) {
f_EPTF_LGenBase_loggingError(%definitionId&" can not schedule the timer event to abort the stop process.");
f_EPTF_Base_stop();
}
for ( var integer vl_i := 0; vl_i < vl_maxEntity ; vl_i := vl_i+1 )
{
if(not f_EPTF_FBQ_itemIsBusy(f_EPTF_LGenBase_fsmCtxIdxOfSiblingInTc(vl_i,pl_tcIdx,0), v_LGenBase_entities[v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList[vl_i].entityIdx].fsmCtxQueue)
or v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList[vl_i].disabled){
continue; // fsm is inactive or entity is disabled ****
}
var EPTF_LGenBase_ReportedEventDescriptor vl_stopTcOfFsmEvent := c_EPTF_LGenBase_emptyReportedEventDescriptor;
vl_stopTcOfFsmEvent.event.bIdx := c_EPTF_LGenBase_bIdx;
vl_stopTcOfFsmEvent.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_stopTC;
vl_stopTcOfFsmEvent.event.target := {
eIdx := v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList[vl_i].entityIdx,
fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSiblingInTc(vl_i,pl_tcIdx,0)
};
vl_stopTcOfFsmEvent.reportedArgs := {pl_tcIdx};
f_EPTF_LGenBase_dispatchEvent(vl_stopTcOfFsmEvent);
}
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugTraffic)){
f_EPTF_LGenBase_loggingDebugTraffic(%definitionId&
": Timer: "&log2str(v_LGenBase_trafficCases[pl_tcIdx].stopTimeoutTimer))
}
v_LGenBase_trafficCases[pl_tcIdx].lastCPS := 0.0;
// if in weighted scenario: recalculate the traffic mix:
var integer vl_eGrpIdx := v_LGenBase_trafficCases[pl_tcIdx].eGroupBackref
var integer vl_scInGrpIdx := v_LGenBase_trafficCases[pl_tcIdx].eScenarioBackRef
if(f_EPTF_LGenBase_isWeightedScenario(vl_eGrpIdx, vl_scInGrpIdx))
{
var boolean vl_mixerAcceptsMix := f_EPTF_TrafficMixer_acceptNewTrafficMix(
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scInGrpIdx].trafficMixData,
f_EPTF_LGenBase_getEnabledWeightListFromScenario(vl_eGrpIdx,vl_scInGrpIdx),
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scInGrpIdx].weightedScData.deterministicMix
)
f_EPTF_Base_assert(%definitionId&": initializing traffic mix for TC in weighted SC "&v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scInGrpIdx].name& ": mixer has not accepted traffic mix",
vl_mixerAcceptsMix);
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_stopProcessTimedOut
//
// Purpose:
// This function is called when the traffic case had been stopped, but
// not all the entities handled the stop event in a predefined interval.
///////////////////////////////////////////////////////////
private function f_EPTF_LGenBase_stopProcessTimedOut(
in EPTF_ScheduledAction pl_action,
in integer pl_eventIndex)
runs on EPTF_LGenBase_Private_CT
return boolean{
var integer vl_tcIdx := pl_action.actionId[0];
var charstring vl_msg := "";
v_LGenBase_trafficCases[vl_tcIdx].stopTimeoutTimer := -1;
f_EPTF_LGenBase_loggingDebugTraffic(%definitionId&": StopProcessTimedOut called for tc "&v_LGenBase_trafficCases[vl_tcIdx].uniqueName);
f_EPTF_LGenBase_loggingDebugTraffic(%definitionId&": State of tc: "&c_EPTF_LGenBase_stateNames[v_LGenBase_trafficCases[vl_tcIdx].state]);
select( v_LGenBase_trafficCases[vl_tcIdx].state )
{
case ( c_EPTF_LGenBase_tcStateAborting )
{
v_LGenBase_trafficCases[vl_tcIdx].state := c_EPTF_LGenBase_tcStateAborted;
vl_msg :=%definitionId&": WARNING: "&"Abort the entities of the traffic case "&v_LGenBase_trafficCases[vl_tcIdx].uniqueName&" has been timed out.";
f_EPTF_LGenBase_logNotRespondedEntities(vl_tcIdx, "abort")
}
case ( c_EPTF_LGenBase_tcStateStopping )
{
v_LGenBase_trafficCases[vl_tcIdx].state := c_EPTF_LGenBase_tcStateStopped;
if(null != v_LGenBase_detectPhaseFinishFn){v_LGenBase_detectPhaseFinishFn.apply( vl_tcIdx )}
//f_EPTF_LGenBase_callPhaseFinishConditions(vl_tcIdx);
vl_msg :=%definitionId&": WARNING: "&"Stop the entities of the traffic case "&v_LGenBase_trafficCases[vl_tcIdx].uniqueName&" has been timed out.";
f_EPTF_LGenBase_logNotRespondedEntities(vl_tcIdx, "stop")
}
case ( c_EPTF_LGenBase_tcStateFinished, c_EPTF_LGenBase_tcStateTerminated )
{
vl_msg := %definitionId&": Stop the entities of the traffic case "&v_LGenBase_trafficCases[vl_tcIdx].uniqueName&" has been timed out.";
f_EPTF_LGenBase_logNotRespondedEntities(vl_tcIdx, "stop or abort")
}
case else
{
if(2 > sizeof(pl_action.actionId) or 1 != pl_action.actionId[1]){
vl_msg :=%definitionId&": WARNING: "&": The traffic case is in invalid "&c_EPTF_LGenBase_stateNames[v_LGenBase_trafficCases[vl_tcIdx].state]&" state!";
}else{
vl_msg :=%definitionId&": WARNING: "&": Not all the entities answered to the stop or abort event. State: "&c_EPTF_LGenBase_stateNames[v_LGenBase_trafficCases[vl_tcIdx].state];
}
f_EPTF_LGenBase_logNotRespondedEntities(vl_tcIdx, "stop or abort")
}
}
f_EPTF_FBQ_initFreeBusyQueue(v_LGenBase_trafficCases[vl_tcIdx].stoppingEntityInfo);
f_EPTF_LGenBase_tcStateChanged(vl_tcIdx);
f_EPTF_LGenBase_loggingWarning(vl_msg);
return true;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_singleShotTc
//
// Purpose:
// Starts a traffic on the first available entity in the traffic case.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_singleShotTc(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName,
in integer pl_eIdx := -1
)
runs on EPTF_LGenBase_Private_CT{
var integer vl_tcIdx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName)
f_EPTF_LGenBase_singleShotTcByIdx(vl_tcIdx,pl_eIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_singleShotTcByIdx
//
// Purpose:
// Starts a traffic on the first available or the selected entity in the traffic case.
//
// Detailed Comment:
// The index of the entity is realtive index in the entity group
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_singleShotTcByIdx(
in integer pl_tcIdx,
in integer pl_eIdx := -1,
in boolean pl_singleShotDebug := false
)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
f_EPTF_Base_assert(%definitionId&": Invalid entity index: "&int2str(pl_eIdx),pl_eIdx < v_LGenBase_entityGroups[v_LGenBase_trafficCases[pl_tcIdx].eGroupBackref].eCount)
var integer vl_eIdxInTC := pl_eIdx
if(0 > vl_eIdxInTC){
vl_eIdxInTC := f_EPTF_LGenBase_getNextFreeEntity(pl_tcIdx)
}else{
}
if (vl_eIdxInTC >=0) {
var integer vl_logBufferVar := -1
var integer vl_eAbsIdx := vl_eIdxInTC+v_LGenBase_entityGroups[v_LGenBase_trafficCases[pl_tcIdx].eGroupBackref].eOffset
if(pl_singleShotDebug){
f_EPTF_Var_newCharstring(c_EPTF_LGenBase_fsmSingleShotVarPrefix&f_EPTF_LGenBase_getEntityName(vl_eAbsIdx), "", vl_logBufferVar)
for ( var integer vl_postproc := 0; vl_postproc < sizeof(v_LGenBase_singleShotDebugPostprocList) ; vl_postproc := vl_postproc+1 ){
f_EPTF_Var_addPostProcFn(vl_logBufferVar, v_LGenBase_singleShotDebugPostprocList[vl_postproc])
}
}
v_LGenBase_dummyBool := f_EPTF_LGenBase_doStartStep(vl_eIdxInTC, pl_tcIdx, true, pl_singleShotDebug, vl_logBufferVar);
}else{
f_EPTF_LGenBase_loggingWarning(%definitionId&": There is no free entity in traffic case "&v_LGenBase_trafficCases[pl_tcIdx].uniqueName)
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_singleShotSc
//
// Purpose:
// Starts a traffic on the first available entity in the
// enabled traffic cases of the scenario.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_singleShotSc(
in charstring pl_eGrpName,
in charstring pl_scName,
in integer pl_eIdx := -1
)
runs on EPTF_LGenBase_Private_CT{
var integer vl_eGrpIdx := f_EPTF_LGenBase_entityGrpNameIndex(pl_eGrpName);
f_EPTF_Base_assert(%definitionId&": Invalid entity group name: "&pl_eGrpName,-1 != vl_eGrpIdx);
var integer vl_scIdx := f_EPTF_LGenBase_scNameIndexInEG(vl_eGrpIdx, pl_scName);
f_EPTF_Base_assert(%definitionId&": Invalid scenario name: "&pl_scName,-1 != vl_scIdx);
f_EPTF_LGenBase_singleShotScByIdx(vl_eGrpIdx, vl_scIdx, pl_eIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_singleShotScByIdx
//
// Purpose:
// Starts a traffic on the first available entity in the
// enabled traffic cases of the scenario.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_singleShotScByIdx(
in integer pl_eGrpIdx,
in integer pl_scIdx,
in integer pl_eIdx := -1
)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Invalid entity group index: "&int2str(pl_eGrpIdx),-1 < pl_eGrpIdx and pl_eGrpIdx < sizeof(v_LGenBase_entityGroups));
f_EPTF_Base_assert(%definitionId&": Invalid scenario index: "&int2str(pl_scIdx),-1 < pl_scIdx and pl_scIdx < sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios));
f_EPTF_Base_assert(%definitionId&": Invalid entity index: "&int2str(pl_eIdx),pl_eIdx < v_LGenBase_entityGroups[pl_eGrpIdx].eCount)
var integer vl_tcCount := sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].tcIdxList)
for ( var integer vl_i := 0; vl_i < vl_tcCount ; vl_i := vl_i+1 )
{
if(v_LGenBase_trafficCases[v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].tcIdxList[vl_i]].enabled){
f_EPTF_LGenBase_singleShotTcByIdx(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].tcIdxList[vl_i], pl_eIdx);
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_createScenarios2EntityGroup
//
// Purpose:
// Adds a traffic case list to the entity group
//
// Detailed Comments:
// This function creates the
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_TcMgmt_createScenarios2EntityGroup(
in EPTF_LGenBase_TcMgmt_Scenarios2GrpList pl_list)
runs on EPTF_LGenBase_Private_CT{
for ( var integer vl_i := 0; vl_i < sizeof(pl_list) ; vl_i := vl_i+1 )
{
for ( var integer vl_sc := 0; vl_sc < sizeof(pl_list[vl_i].scenarioNames) ; vl_sc := vl_sc+1 )
{
f_EPTF_LGenBase_createScenario2EntityGroup({pl_list[vl_i].eGrpName, pl_list[vl_i].scenarioNames[vl_sc]},false);
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_createScenario2EntityGroup
//
// Purpose:
// Adds a traffic case list to the entity group
//
// Detailed Comments:
// This function creates the scenario to an entity group
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_createScenario2EntityGroup(
in EPTF_LGenBase_Scenario2Grp pl_scenarioDesc,
in boolean pl_autoStart := true)
runs on EPTF_LGenBase_Private_CT{
var integer vl_eGrpIdx := f_EPTF_LGenBase_entityGrpNameIndex(pl_scenarioDesc.eGrpName);
if(vl_eGrpIdx == -1){
f_EPTF_LGenBase_loggingError(%definitionId&": Invalid entity group: "&pl_scenarioDesc.eGrpName);
}
var integer vl_scIdx := f_EPTF_LGenBase_scenarioNameIndex(pl_scenarioDesc.scenarioName);
if(vl_scIdx == -1){
f_EPTF_LGenBase_loggingError(%definitionId&": Invalid scenario name: "&pl_scenarioDesc.scenarioName);
}
if(-1 != f_EPTF_LGenBase_scNameIndexInEG(vl_eGrpIdx, pl_scenarioDesc.scenarioName)){
f_EPTF_LGenBase_loggingError(%definitionId&": Scenario "&pl_scenarioDesc.scenarioName&" already exists in group "&pl_scenarioDesc.eGrpName);
}
var EPTF_LGenBase_ScenarioOfGrp vl_sc := c_EPTF_LGenBase_emptyScenarioOfGrp;
vl_sc.name := pl_scenarioDesc.scenarioName;
vl_sc.uniqueName := pl_scenarioDesc.eGrpName&tsp_LGenBase_nameSeparator&pl_scenarioDesc.scenarioName;
vl_sc.weightedScData := v_LGenBase_scenarioTypes[vl_scIdx].weightedScData;//EGBOZIE: new, is omit for weighted scenario
vl_sc.phaseData := v_LGenBase_scenarioTypes[vl_scIdx].phaseData;// phase data
var integer vl_scIdxInGrp := sizeof(v_LGenBase_entityGroups[vl_eGrpIdx].scenarios);
var integer vl_tcCount := sizeof(v_LGenBase_scenarioTypes[vl_scIdx].tcList);
var boolean vl_isWeightedSc := ispresent(vl_sc.weightedScData);//EGBOZIE
var EPTF_ProbabilityList vl_new_wList := {};//EGBOZIE used only for weighted SC
var integer vl_tcAbsIdx := -1;
vl_sc.absIdx := f_EPTF_FBQ_getOrCreateFreeSlot(v_LGenBase_scenarios);
vl_sc.trafficType := v_LGenBase_scenarioTypes[vl_scIdx].trafficType
f_EPTF_FBQ_setQueueDidx(vl_sc.absIdx, {vl_eGrpIdx,vl_scIdxInGrp}, v_LGenBase_scenarios);
f_EPTF_FBQ_moveFromFreeToBusyTail(vl_sc.absIdx, v_LGenBase_scenarios);
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp] := vl_sc;
//Create and initialize all the traffic case specimen
for(var integer vl_i := 0; vl_i < vl_tcCount; vl_i := vl_i + 1){
vl_tcAbsIdx := f_EPTF_LGenBase_createTc2EntityGroup(
v_LGenBase_scenarioTypes[vl_scIdx].tcList[vl_i],
vl_eGrpIdx,
vl_scIdxInGrp,
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp]);
f_EPTF_Base_assert(%definitionId&": Error assigning the traffic case "&
v_LGenBase_scenarioTypes[vl_scIdx].tcList[vl_i].tcPrivateName&" to group "&
pl_scenarioDesc.eGrpName, -1 != v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].tcIdxList[vl_i]);
//vl_tcAbsIdx := vl_sc.tcIdxList[vl_i];
}
for(var integer vl_i := 0; vl_i < vl_tcCount; vl_i := vl_i + 1){
vl_tcAbsIdx := v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].tcIdxList[vl_i];
v_LGenBase_trafficCases[vl_tcAbsIdx].trafficStartFinishConditionsAndActions := c_EPTF_LGenBase_emptyTrafficStartFinishConditionsAndActionsDesc;
if(v_LGenBase_scenarioTypes[vl_scIdx].conditionsFromTc){
//Use conditions and actions declared in the tc type declaration
f_EPTF_LGenBase_convertTrafficStartFinishConditionsInternalDeclarator2Desc(
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp],
v_LGenBase_trafficCaseTypes[v_LGenBase_trafficCases[vl_tcAbsIdx].tcTypeIdx].trafficStartFinishConditions,
v_LGenBase_trafficCases[vl_tcAbsIdx].trafficStartFinishConditionsAndActions)
f_EPTF_LGenBase_convertEntityFinishConditionsInternalDeclarator2Desc(
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp],
v_LGenBase_trafficCaseTypes[v_LGenBase_trafficCases[vl_tcAbsIdx].tcTypeIdx].entityFinishConditions,
v_LGenBase_trafficCases[vl_tcAbsIdx].entityFinishConditions)
f_EPTF_Base_assert(%definitionId&": There is range loop condition without range",
(not ispresent(v_LGenBase_trafficCases[vl_tcAbsIdx].trafficStartFinishConditionsAndActions.nrOfRangeLoop))or
v_LGenBase_trafficCases[vl_tcAbsIdx].v_sizeofRanges > 0);
f_EPTF_LGenBase_convertTcEntityFinishActions2Desc(
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp],
v_LGenBase_trafficCaseTypes[v_LGenBase_trafficCases[vl_tcAbsIdx].tcTypeIdx].entityFinishActions,
v_LGenBase_trafficCases[vl_tcAbsIdx].entityFinishActions);
f_EPTF_LGenBase_convertGroupActionsList2GroupActionsDescList(
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp],
v_LGenBase_trafficCaseTypes[v_LGenBase_trafficCases[vl_tcAbsIdx].tcTypeIdx].trafficFinishedActions,
v_LGenBase_trafficCases[vl_tcAbsIdx].trafficFinishedActions);
}else{
//Use conditions and actions declared in the tcOfScenario
f_EPTF_LGenBase_convertEntityFinishConditionsInternalDeclarator2Desc(
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp],
v_LGenBase_scenarioTypes[vl_scIdx].tcList[vl_i].entityFinishConditions,
v_LGenBase_trafficCases[vl_tcAbsIdx].entityFinishConditions);
f_EPTF_LGenBase_convertTrafficStartFinishConditionsInternalDeclarator2Desc(
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp],
v_LGenBase_scenarioTypes[vl_scIdx].tcList[vl_i].trafficStartFinishConditionsAndActions,
v_LGenBase_trafficCases[vl_tcAbsIdx].trafficStartFinishConditionsAndActions);
f_EPTF_LGenBase_convertTcEntityFinishActions2Desc(
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp],
v_LGenBase_scenarioTypes[vl_scIdx].tcList[vl_i].entityFinishActions,
v_LGenBase_trafficCases[vl_tcAbsIdx].entityFinishActions);
f_EPTF_LGenBase_convertGroupActionsList2GroupActionsDescList(
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp],
v_LGenBase_scenarioTypes[vl_scIdx].tcList[vl_i].trafficFinishedActions,
v_LGenBase_trafficCases[vl_tcAbsIdx].trafficFinishedActions);
}
v_LGenBase_trafficCases[vl_tcAbsIdx].paramRanges := v_LGenBase_scenarioTypes[vl_scIdx].tcList[vl_i].ranges;
v_LGenBase_trafficCases[vl_tcAbsIdx].v_sizeofRanges := sizeof(v_LGenBase_trafficCases[vl_tcAbsIdx].paramRanges);
v_LGenBase_trafficCases[vl_tcAbsIdx].customParams := v_LGenBase_scenarioTypes[vl_scIdx].tcList[vl_i].params;
v_LGenBase_trafficCases[vl_tcAbsIdx].restoreTCAtStartTC := v_LGenBase_scenarioTypes[vl_scIdx].tcList[vl_i].restoreTCAtStartTC;
var integer vl_paramCount := sizeof(v_LGenBase_trafficCases[vl_tcAbsIdx].customParams);
for ( var integer vl_par := 0; vl_par < vl_paramCount ; vl_par := vl_par+1 )
{
f_EPTF_str2int_HashMap_Insert(v_LGenBase_trafficCases[vl_tcAbsIdx].paramHashMap,
v_LGenBase_trafficCases[vl_tcAbsIdx].customParams[vl_par].aName&
tsp_LGenBase_nameSeparator&
v_LGenBase_trafficCases[vl_tcAbsIdx].customParams[vl_par].pName,
vl_par);
}
if (vl_isWeightedSc){
var integer vl_tcIdx := v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].tcIdxList[vl_i];
f_EPTF_Base_assert(%definitionId&": collecting traffic weights: TC["&int2str(vl_i)&"] in weighted SC shall have a weight instead of cpsToReach!",
ischosen(v_LGenBase_trafficCases[vl_tcIdx].schedulerData.target.trafficWeight));
if (v_LGenBase_trafficCases[v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].tcIdxList[vl_i]].enabled) {
vl_new_wList[vl_i] := v_LGenBase_trafficCases[vl_tcIdx].schedulerData.target.trafficWeight;
} else {
vl_new_wList[vl_i] := 0.0;
}
}
}
//now take care for extra data in case of weighted scenario
if (vl_isWeightedSc) {
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].schedulerData := c_EPTF_LGenBase_emptySchedulerData4TcWeight
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].schedulerData.target.cpsToReach := v_LGenBase_scenarioTypes[vl_scIdx].weightedScData.cpsToReach
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].schedulerData.roundedCpsUpdateInterval := tsp_EPTF_cpsUpdateInterval
//{{"cs", null, null}, false, {cpsToReach:= v_LGenBase_scenarioTypes[vl_scIdx].weightedScData.cpsToReach},0,0,0.0,tsp_EPTF_cpsUpdateInterval,0.0,-1,0,{false,0.0,{}}}
// setting burst calc for weighted
var charstring vl_burstName;
if(ispresent(v_LGenBase_scenarioTypes[vl_scIdx].weightedScData.scheduler)) {
if(ischosen(v_LGenBase_scenarioTypes[vl_scIdx].weightedScData.scheduler.preDefinedName)){
vl_burstName := f_EPTF_LGenBase_BurstFuncName2Char(v_LGenBase_scenarioTypes[vl_scIdx].weightedScData.scheduler.preDefinedName);
} else {
vl_burstName := v_LGenBase_scenarioTypes[vl_scIdx].weightedScData.scheduler.userDefinedName;
}
} else {
if("" != v_LGenBase_burstCalcMode) {
vl_burstName := v_LGenBase_burstCalcMode;
} else {
f_EPTF_Base_assert(%definitionId&"No Global or Local burst calculation method is set.",false);
}
}
var integer vl_burstId := f_EPTF_LGenBase_getBurstCalcFunctionId(vl_burstName);
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].schedulerData.burstFuncRef.burstCalcMode := v_LGenBase_burstFuncRefList[vl_burstId].burstCalcMode;
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].schedulerData.burstFuncRef.burstPreCalc := v_LGenBase_burstFuncRefList[vl_burstId].burstPreCalc;
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].schedulerData.burstFuncRef.burstPostCalc := v_LGenBase_burstFuncRefList[vl_burstId].burstPostCalc;
f_EPTF_LGenBase_adjustSchedulerData4NewCps(v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].schedulerData);
// distribute the bursterror differently according to the traffic corrigation => smooth out cumulative bursts
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].schedulerData.burstSizeCumulativeError := v_LGenBase_entityGroups[vl_eGrpIdx].trafficCorrigation;
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].trafficMixData := {
wList := vl_new_wList, // initial weight of each traffic
pList := {}, // probability of each traffic ( == eloszlas-Fv), will be inited later
currentBurst := {},
burstList := {},
burstListIdx := 0
}
var boolean vl_mixerAcceptsMix := f_EPTF_TrafficMixer_acceptNewTrafficMix(
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].trafficMixData,
vl_new_wList,
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].weightedScData.deterministicMix
);
f_EPTF_Base_assert(%definitionId&": initializing traffic mix for TC in weighted SC "&pl_scenarioDesc.scenarioName& ": mixer has not accepted traffic mix",
vl_mixerAcceptsMix);
}
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugConfig)){
f_EPTF_LGenBase_loggingDebugConfig(%definitionId&": constructed scenario:"&log2str(v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp]))
}
f_EPTF_LGenBaseStats_createScenarioVars(vl_eGrpIdx, vl_scIdxInGrp);
for (var integer x:= 0; x<sizeof(v_LGenBase_scenarioCreated); x:= x+1)
{
v_LGenBase_scenarioCreated[x].apply( vl_eGrpIdx, vl_scIdxInGrp );
}
for ( var integer vl_i := 0; vl_i < sizeof(v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].tcIdxList) ; vl_i := vl_i+1 )
{
f_EPTF_LGenBase_tcStateChanged(v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].tcIdxList[vl_i]);
}
for ( var integer vl_tc := 0; vl_tc < sizeof(v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].tcIdxList) ; vl_tc := vl_tc+1 )
{
vl_tcAbsIdx := v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].tcIdxList[vl_tc]
for (var integer x:= 0; x<sizeof(v_LGenBase_trafficCaseCreated); x:= x+1)
{
v_LGenBase_trafficCaseCreated[x].apply( vl_tcAbsIdx );
}
}
var boolean vl_autoStart := pl_autoStart;
if(ispresent(v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].phaseData)){
vl_autoStart := false; // if phase information exists disabling automatic scenario generation
}
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugConfig)){
f_EPTF_LGenBase_loggingDebugConfig(%definitionId&": The created scenario: "&log2str( v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp] ))
f_EPTF_LGenBase_loggingDebugConfig(%definitionId&": The traffic cases: ")
for ( var integer vl_t := 0; vl_t < sizeof(v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].tcIdxList) ; vl_t := vl_t+1 )
{
f_EPTF_LGenBase_loggingDebugConfig(%definitionId&": "&log2str(v_LGenBase_trafficCases[v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdxInGrp].tcIdxList[vl_t]]))
}
}
//EGBOZIE: code refactored into a standalone function
f_EPTF_LGenBase_enableScenarioOnEntityGroup(
vl_eGrpIdx, //entity group
vl_scIdxInGrp, //scenario index in group
vl_autoStart or terminating == vl_sc.trafficType)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_restoreScenario
//
// Purpose:
// Initializes the entities and the statistics of a traffic cases of the scenario.
//
// Detailed Comments:
// This function is used to reset the entities and the statistics
// of the traffic casees of a scenario before restart. If pl_autoStart
// and the enabled field of the declarator of the traffic case is true, starts the affected traffic cases
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_restoreScenario(
in charstring pl_eGrpName,
in charstring pl_scName,
in boolean pl_autoStart := true
)
runs on EPTF_LGenBase_Private_CT
return boolean
{
var integer vl_eGrpIdx := f_EPTF_LGenBase_entityGrpNameIndex(pl_eGrpName);
f_EPTF_Base_assert(%definitionId&": Invalid entity group name: "&pl_eGrpName,-1 != vl_eGrpIdx);
var integer vl_scIdx := f_EPTF_LGenBase_scNameIndexInEG(vl_eGrpIdx, pl_scName);
f_EPTF_Base_assert(%definitionId&": Invalid scenario name: "&pl_scName,-1 != vl_scIdx);
return f_EPTF_LGenBase_restoreScenarioByIdx(vl_eGrpIdx, vl_scIdx, pl_autoStart);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_resetStats
//
// Purpose:
// Initializes the statistics of all traffic cases.
//
// Detailed Comments:
// This function is used to reset the the statistics
// of all traffic cases.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_resetStats()
runs on EPTF_LGenBase_Private_CT
{
var integer vl_nOfTcs := sizeof(v_LGenBase_trafficCases);
for(var integer vl_tcIdx:=0; vl_tcIdx<vl_nOfTcs; vl_tcIdx:=vl_tcIdx+1) {
f_EPTF_LGenBase_resetTcStatsData(vl_tcIdx, v_LGenBase_trafficCases[vl_tcIdx]);
}
return;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_restoreScenarioByIdx
//
// Purpose:
// Initializes the entities and the statistics of a traffic cases of the scenario.
//
// Detailed Comments:
// This function is used to reset the entities and the statistics
// of the traffic casees of a scenario before restart. If pl_autoStart
// and the enabled field of the declarator of the traffic case is true, starts the affected traffic cases
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_restoreScenarioByIdx(
in integer pl_eGrpIdx,
in integer pl_scIdx,
in boolean pl_autoStart := true
)
runs on EPTF_LGenBase_Private_CT
return boolean
{
var integer vl_max := sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].tcIdxList);
for ( var integer vl_i := 0; vl_i < vl_max ; vl_i := vl_i+1 )
{
var integer vl_tcIdx := v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].tcIdxList[vl_i];
if(c_EPTF_LGenBase_tcStateRunning == v_LGenBase_trafficCases[vl_tcIdx].state){
f_EPTF_LGenBase_loggingWarning(%definitionId&": The running traffic case "&v_LGenBase_trafficCases[vl_tcIdx].uniqueName&" can not be restored!");
return false;
}
}
var boolean vl_ret := true;
for ( var integer vl_i := 0; vl_i < vl_max ; vl_i := vl_i+1 )
{
var integer vl_tcIdx := v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].tcIdxList[vl_i];
if(not f_EPTF_LGenBase_restoreTCbyIdx(vl_tcIdx)) { vl_ret := false; }
if(v_LGenBase_trafficCases[vl_tcIdx].enabledAtStartup){
f_EPTF_LGenBase_enableTrafficCaseInternal(
vl_tcIdx,
pl_autoStart);
}else{
v_LGenBase_trafficCases[vl_tcIdx].enabled := false;
}
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_get_restoreTCAtStartTC
//
// Purpose:
// Returns the restoreTCAtStartTC flag
//
// Detailed Comments:
// This function is used to get the restoreTCAtStartTC flag.
// If this flag is true, ExecCtrl will restore the TC before
// the TC is started. Otherwise restoreTC is not called.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_get_restoreTCAtStartTC(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName
)
runs on EPTF_LGenBase_Private_CT
return boolean
{
var integer vl_tcIdx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName);
return v_LGenBase_trafficCases[vl_tcIdx].restoreTCAtStartTC;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_restoreTC
//
// Purpose:
// Initializes the entities and the statistics of a traffic case
//
// Detailed Comments:
// This function is used to reset the entities and the statistics
// of a traffic case before restart.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_restoreTC(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName
)
runs on EPTF_LGenBase_Private_CT
return boolean
{
var integer vl_tcIdx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName);
return f_EPTF_LGenBase_restoreTCbyIdx(vl_tcIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_restoreTCbyIdx
//
// Purpose:
// Initializes the entities and the statistics of a traffic case
//
// Detailed Comments:
// This function is used to reset the entities and the statistics
// of a traffic case before restart.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_restoreTCbyIdx(
in integer pl_tcIdx
)
runs on EPTF_LGenBase_Private_CT
return boolean
{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index",pl_tcIdx> -1 and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
if(c_EPTF_LGenBase_tcStateRunning == v_LGenBase_trafficCases[pl_tcIdx].state){
f_EPTF_LGenBase_loggingWarning(%definitionId&": The running traffic case "&v_LGenBase_trafficCases[pl_tcIdx].uniqueName&" can not be restored!");
return false;
}
if(-1 != v_LGenBase_trafficCases[pl_tcIdx].stopTimeoutTimer){
if(not f_EPTF_SchedulerComp_CancelEvent(v_LGenBase_trafficCases[pl_tcIdx].stopTimeoutTimer)) {
f_EPTF_LGenBase_loggingWarning(%definitionId&": Cancelling stop timeout timer failed.");
}
v_LGenBase_trafficCases[pl_tcIdx].stopTimeoutTimer := -1;
v_LGenBase_trafficCases[pl_tcIdx].stoppingEntityInfo := c_EPTF_emptyFreeBusyQueue;
}
f_EPTF_LGenBase_initTCInternal(
v_LGenBase_trafficCases[pl_tcIdx],
pl_tcIdx,
v_LGenBase_trafficCases[pl_tcIdx].enableEntitiesAtStartup,
false
)
v_LGenBase_trafficCases[pl_tcIdx].state := c_EPTF_LGenBase_tcStateIdle;
f_EPTF_LGenBase_tcStateChanged(pl_tcIdx);
return true;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_abortTrafficCase
//
// Purpose:
// Sends <c_EPTF_LGenBase_inputIdx_testMgmt_abortTC> to the
// entities in the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_abortTrafficCase(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName
)
runs on EPTF_LGenBase_Private_CT{
var integer vl_eGrpIdx := f_EPTF_LGenBase_entityGrpNameIndex(pl_eGrpName);
f_EPTF_Base_assert(%definitionId&": Invalid entity group name: "&pl_eGrpName,-1 != vl_eGrpIdx);
var integer vl_scIdx := f_EPTF_LGenBase_scNameIndexInEG(vl_eGrpIdx, pl_scName);
f_EPTF_Base_assert(%definitionId&": Invalid scenario name: "&pl_scName,-1 != vl_scIdx);
var integer vl_tcIdx := f_EPTF_LGenBase_tcOfScenario(v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdx], pl_tcName);
f_EPTF_Base_assert(%definitionId&": Invalid traffic case name: "&pl_scName,-1 != vl_tcIdx);
f_EPTF_LGenBase_abortTrafficCaseByIdx(f_EPTF_LGenBase_trafficCaseAbsIdx(vl_eGrpIdx, vl_scIdx, vl_tcIdx));
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_stopWeightedScenarioByIdx
//
// Purpose:
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_stopWeightedScenarioByIdx(
in integer pl_eGrpIdx,
in integer pl_scInGrpIdx)
runs on EPTF_LGenBase_Private_CT{
if (v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].schedulerData.schedulingTimer>-1) {
f_EPTF_LGenBase_stopScTimerInternal(pl_eGrpIdx,pl_scInGrpIdx);
}
f_EPTF_LGenBase_stopScenarioByIdx(pl_eGrpIdx,pl_scInGrpIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_stopScenarioByIdx
//
// Purpose:
// Sends <c_EPTF_LGenBase_inputIdx_testMgmt_abortTC> to the
// entities in the traffic cases of the scenario
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_stopScenarioByIdx(
in integer pl_eGrpIdx,
in integer pl_scInGrpIdx)
runs on EPTF_LGenBase_Private_CT{
if(terminating == v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].trafficType){
f_EPTF_LGenBase_loggingDebugTraffic(%definitionId&": Stop called for terminating scenario "&
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].uniqueName&
". The feature is not implemented yet.");
return;
}
for ( var integer vl_tc := 0; vl_tc < sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].tcIdxList) ; vl_tc := vl_tc+1 )
{
var integer vl_tcIdx := v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].tcIdxList[vl_tc];
f_EPTF_LGenBase_stopTrafficCaseByIdx(vl_tcIdx);
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_abortWeightedScenarioByIdx
//
// Purpose:
// Sends <c_EPTF_LGenBase_inputIdx_testMgmt_abortTC> to the
// entities in the traffic cases of the scenario
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_abortWeightedScenarioByIdx(
in integer pl_eGrpIdx,
in integer pl_scInGrpIdx)
runs on EPTF_LGenBase_Private_CT{
if (v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].schedulerData.schedulingTimer>-1) {
f_EPTF_LGenBase_stopScTimerInternal(pl_eGrpIdx,pl_scInGrpIdx);
}
f_EPTF_LGenBase_abortScenarioByIdx(pl_eGrpIdx,pl_scInGrpIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_abortScenarioByIdx
//
// Purpose:
// Sends <c_EPTF_LGenBase_inputIdx_testMgmt_abortTC> to the
// entities in the traffic cases of the scenario
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_abortScenarioByIdx(
in integer pl_eGrpIdx,
in integer pl_scInGrpIdx)
runs on EPTF_LGenBase_Private_CT{
if(terminating == v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].trafficType){
f_EPTF_LGenBase_loggingWarning(%definitionId&": Abort called for terminating scenario "&
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].uniqueName&
". The feature is not implemented yet.");
return;
}
for ( var integer vl_tc := 0; vl_tc < sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].tcIdxList) ; vl_tc := vl_tc+1 )
{
var integer vl_tcIdx := v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].tcIdxList[vl_tc];
f_EPTF_LGenBase_abortTrafficCaseByIdx(vl_tcIdx);
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_abortTrafficCaseByIdx
//
// Purpose:
// Sends <c_EPTF_LGenBase_inputIdx_testMgmt_abortTC> to the
// entities in the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_abortTrafficCaseByIdx(
in integer pl_tcIdx
)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index: "&int2str(pl_tcIdx),-1 < pl_tcIdx and pl_tcIdx < sizeof(v_LGenBase_trafficCases));
f_EPTF_LGenBase_loggingDebugTraffic(%definitionId&": "&v_LGenBase_trafficCases[pl_tcIdx].uniqueName);
v_LGenBase_trafficCases[pl_tcIdx].stopped := true
f_EPTF_LGenBase_disableTrafficCaseInternal(pl_tcIdx);
v_LGenBase_trafficCases[pl_tcIdx].state := c_EPTF_LGenBase_tcStateAborting;
f_EPTF_LGenBase_tcStateChanged(pl_tcIdx);
f_EPTF_FBQ_initFreeBusyQueue(v_LGenBase_trafficCases[pl_tcIdx].stoppingEntityInfo);
//var integer vl_maxEntities := sizeof(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList);
//f_EPTF_FBQ_createFreeSlots(vl_maxEntities, v_LGenBase_trafficCases[pl_tcIdx].stoppingEntityInfo);
var integer vl_maxEntity := v_LGenBase_entityGroups[v_LGenBase_trafficCases[pl_tcIdx].eGroupBackref].eCount;
f_EPTF_FBQ_createFreeSlots(vl_maxEntity, v_LGenBase_trafficCases[pl_tcIdx].stoppingEntityInfo);
if(not f_EPTF_SchedulerComp_scheduleAction(
T_EPTF_componentClock.read + tsp_EPTF_LGenBase_abortStopProcess,
refers(f_EPTF_LGenBase_stopProcessTimedOut),
{pl_tcIdx,0},
v_LGenBase_trafficCases[pl_tcIdx].stopTimeoutTimer)) {
f_EPTF_LGenBase_loggingError(%definitionId&" Can not schedule the timer event to abort the stop process.");
f_EPTF_Base_stop();
}
v_LGenBase_trafficCases[pl_tcIdx].lastCPS := 0.0;
for ( var integer vl_i := 0; vl_i < vl_maxEntity ; vl_i := vl_i+1 )
{
var EPTF_LGenBase_ReportedEventDescriptor vl_abortTcOfFsmEvent := c_EPTF_LGenBase_emptyReportedEventDescriptor;
vl_abortTcOfFsmEvent.event.bIdx := c_EPTF_LGenBase_bIdx;
vl_abortTcOfFsmEvent.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_abortTC;
vl_abortTcOfFsmEvent.event.target := {
eIdx := v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList[vl_i].entityIdx,
fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSiblingInTc(vl_i, pl_tcIdx, 0)
};
vl_abortTcOfFsmEvent.reportedArgs := {pl_tcIdx};
f_EPTF_LGenBase_dispatchEvent(vl_abortTcOfFsmEvent);
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_startLaunchTC
//
// Purpose:
// Initializes and starts a traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_startLaunchTC(
in integer pl_tcIdx,
in boolean pl_silentIfRunning := false)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_LGenBase_loggingDebugTraffic(%definitionId&": Start traffic case "&v_LGenBase_trafficCases[pl_tcIdx].uniqueName);
var EPTF_LGenBase_tcState vl_statePrev := v_LGenBase_trafficCases[pl_tcIdx].state;
if(c_EPTF_LGenBase_tcStatePaused != vl_statePrev and
c_EPTF_LGenBase_tcStateStopped != vl_statePrev and
c_EPTF_LGenBase_tcStateAborted != vl_statePrev and
c_EPTF_LGenBase_tcStateIdle != vl_statePrev and
c_EPTF_LGenBase_tcStateTerminated != vl_statePrev){
if(c_EPTF_LGenBase_tcStateRunning != vl_statePrev or not pl_silentIfRunning){
f_EPTF_LGenBase_loggingWarning(%definitionId&": Start launch called for tc "&
v_LGenBase_trafficCases[pl_tcIdx].uniqueName&" in state "&c_EPTF_LGenBase_stateNames[vl_statePrev]);
}
return;
}
if(not v_LGenBase_trafficCases[pl_tcIdx].enabled){
f_EPTF_LGenBase_loggingWarning(%definitionId&": Start launch called for the disabled tc "&v_LGenBase_trafficCases[pl_tcIdx].uniqueName);
return;
}
v_LGenBase_trafficCases[pl_tcIdx].state := c_EPTF_LGenBase_tcStateRunning;
// check if conditions are fulfilled at start:
var EPTF_IntegerList vl_counters := {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
vl_counters[f_EPTF_LGenBase_TrafficStartFinishConditions_2int(nrOfExecStart)] := f_EPTF_LGenBase_getTrafficStartFinishConditionCounter(pl_tcIdx,nrOfExecStart);
vl_counters[f_EPTF_LGenBase_TrafficStartFinishConditions_2int(nrOfSuccesses)] := f_EPTF_LGenBase_getTrafficStartFinishConditionCounter(pl_tcIdx,nrOfSuccesses);
vl_counters[f_EPTF_LGenBase_TrafficStartFinishConditions_2int(nrOfFails)] := f_EPTF_LGenBase_getTrafficStartFinishConditionCounter(pl_tcIdx,nrOfFails);
vl_counters[f_EPTF_LGenBase_TrafficStartFinishConditions_2int(nrOfTimeouts)] := f_EPTF_LGenBase_getTrafficStartFinishConditionCounter(pl_tcIdx,nrOfTimeouts);
vl_counters[f_EPTF_LGenBase_TrafficStartFinishConditions_2int(nrOfErrors)] := f_EPTF_LGenBase_getTrafficStartFinishConditionCounter(pl_tcIdx,nrOfErrors);
vl_counters[f_EPTF_LGenBase_TrafficStartFinishConditions_2int(nrOfRangeLoop)] := f_EPTF_LGenBase_getTrafficStartFinishConditionCounter(pl_tcIdx,nrOfRangeLoop);
var EPTF_LGenBase_ConditionTrue vl_condition := c_EPTF_LGenBase_emptyConditionTrue;
if (vl_counters[f_EPTF_LGenBase_TrafficStartFinishConditions_2int(nrOfExecStart)]==0) {
vl_condition.nrOfExecStart := true;
vl_condition.anythingFinished := true;
}
if (vl_counters[f_EPTF_LGenBase_TrafficStartFinishConditions_2int(nrOfSuccesses)]==0) {
vl_condition.nrOfSuccesses := true;
vl_condition.anythingFinished := true;
}
if (vl_counters[f_EPTF_LGenBase_TrafficStartFinishConditions_2int(nrOfFails)]==0) {
vl_condition.nrOfFails := true;
vl_condition.anythingFinished := true;
}
if (vl_counters[f_EPTF_LGenBase_TrafficStartFinishConditions_2int(nrOfTimeouts)]==0) {
vl_condition.nrOfTimeouts := true;
vl_condition.anythingFinished := true;
}
if (vl_counters[f_EPTF_LGenBase_TrafficStartFinishConditions_2int(nrOfErrors)]==0) {
vl_condition.nrOfErrors := true;
vl_condition.anythingFinished := true;
}
if (vl_counters[f_EPTF_LGenBase_TrafficStartFinishConditions_2int(nrOfRangeLoop)]==0) {
vl_condition.nrOfRangeLoop := true;
vl_condition.anythingFinished := true;
}
if(f_EPTF_LGenBase_checkGroupFinishConditionFiredAny(vl_condition)) {
f_EPTF_LGenBase_tcStateChanged(pl_tcIdx);
f_EPTF_LGenBase_groupFinishedDetected(pl_tcIdx, vl_condition);
return;
}
//~TR
var integer vl_eGrpIdx := v_LGenBase_trafficCases[pl_tcIdx].eGroupBackref
var integer vl_scInGrpIdx := v_LGenBase_trafficCases[pl_tcIdx].eScenarioBackRef
var float vl_stTimeDelay := v_LGenBase_trafficCases[pl_tcIdx].startDelay;
// distribute the bursterror differently according to the traffic corrigation => smooth out cumulative bursts
v_LGenBase_trafficCases[pl_tcIdx].schedulerData.burstSizeCumulativeError := v_LGenBase_entityGroups[vl_eGrpIdx].trafficCorrigation;
if( 0.0 == vl_stTimeDelay ){ vl_stTimeDelay := 0.01;} // FIXME: magic number again
if(f_EPTF_LGenBase_isWeightedScenario(vl_eGrpIdx, vl_scInGrpIdx)){
var boolean vl_mixerAcceptsMix := f_EPTF_TrafficMixer_acceptNewTrafficMix(
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scInGrpIdx].trafficMixData,
f_EPTF_LGenBase_getEnabledWeightListFromScenario(vl_eGrpIdx,vl_scInGrpIdx),
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scInGrpIdx].weightedScData.deterministicMix
)
f_EPTF_Base_assert(%definitionId&": initializing traffic mix for TC in weighted SC "&v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scInGrpIdx].name& ": mixer has not accepted traffic mix",
vl_mixerAcceptsMix);
//TR: MTTSM00016010
f_EPTF_SchedulerComp_refreshSnapshotTime();
v_LGenBase_trafficCases[pl_tcIdx].startTime := f_EPTF_SchedulerComp_snapshotTime();
f_EPTF_LGenBase_startExecTimeTimer(pl_tcIdx); // starts execTime timer if needed, not part of the TR correction
f_EPTF_LGenBase_tcStateChanged(pl_tcIdx);
return;
}
if(c_EPTF_LGenBase_tcStatePaused != vl_statePrev){
f_EPTF_LGenBase_resetTcStats(pl_tcIdx, v_LGenBase_trafficCases[pl_tcIdx]);
Inc(v_LGenBase_entityGroups[v_LGenBase_trafficCases[pl_tcIdx].eGroupBackref].scenarios[v_LGenBase_trafficCases[pl_tcIdx].eScenarioBackRef].startedTcs);
for ( var integer vl_i := 0; vl_i < sizeof(v_LGenBase_tcStartedOrStoppedCallbacks) ; vl_i := vl_i+1 )
{
v_LGenBase_tcStartedOrStoppedCallbacks[vl_i].apply( pl_tcIdx, true );
}
// the function f_EPTF_LGenBase_resetTcStats becomes slow for huge number of entities => the event should be scheduled after it has been called,
// also the time of start should be calculated after that
//TR: MTTSM00016010
f_EPTF_SchedulerComp_refreshSnapshotTime();
v_LGenBase_trafficCases[pl_tcIdx].startTime := f_EPTF_SchedulerComp_snapshotTime();
f_EPTF_LGenBase_startExecTimeTimer(pl_tcIdx); // starts execTime timer if needed, not part of the TR correction
f_EPTF_LGenBase_dispatchEvent({
event := {
bIdx := c_EPTF_LGenBase_bIdx,
iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_trafficCaseStarted,
target := omit,
source := omit
},
reportedArgs := {pl_tcIdx}
});
}
f_EPTF_LGenBase_tcStateChanged(pl_tcIdx);
// scheduling the event here to avoid overload after start in case of huge entity number (initializing takes a lof of time)
if(not f_EPTF_LGenBase_isWeightedScenario(vl_eGrpIdx, vl_scInGrpIdx)){
if(originating == v_LGenBase_trafficCases[pl_tcIdx].trafficType and
ischosen(v_LGenBase_trafficCases[pl_tcIdx].schedulerData.target.cpsToReach) and
0.0 < v_LGenBase_trafficCases[pl_tcIdx].schedulerData.target.cpsToReach){
// set different start time for different LGens => smooth out synchronous call generation (far small CPS):
var float vl_stTrafficCorrigation := v_LGenBase_entityGroups[vl_eGrpIdx].trafficCorrigation/v_LGenBase_trafficCases[pl_tcIdx].schedulerData.target.cpsToReach;
if(not f_EPTF_SchedulerComp_scheduleAction(
v_LGenBase_trafficCases[pl_tcIdx].startTime+vl_stTimeDelay+vl_stTrafficCorrigation,
refers(f_EPTF_LGenBase_doTrafficCaseTimerAction),
{pl_tcIdx},
v_LGenBase_trafficCases[pl_tcIdx].schedulingTimer)) {
f_EPTF_LGenBase_loggingError(%definitionId&" Can not schedule timer event to delay the start of the traffic case .");
f_EPTF_Base_stop();
}
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_startLaunchWeightedScenario
//
// Purpose:
// Initializes and starts a traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_startLaunchWeightedScenario(
in integer pl_eGrpIdx,
in integer pl_scInGrpIdx,
in boolean pl_checkRunningState := true)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_LGenBase_loggingDebugTraffic(%definitionId&": Start weighted scenario "&v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].name
& " of group " & v_LGenBase_entityGroups[pl_eGrpIdx].name);
f_EPTF_Base_assert(%definitionId&": The scenario "&
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].uniqueName&" is not weighted.",
f_EPTF_LGenBase_isWeightedScenario(pl_eGrpIdx, pl_scInGrpIdx))
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].schedulerData.lastBurstSize := 0;
f_EPTF_LGenBase_adjustSchedulerData4NewCps(
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].schedulerData)
// distribute the bursterror differently according to the traffic corrigation => smooth out cumulative bursts
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].schedulerData.burstSizeCumulativeError := v_LGenBase_entityGroups[pl_eGrpIdx].trafficCorrigation;
var EPTF_LGenBase_tcState vl_scStatePrev := v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].state;
if(pl_checkRunningState and
c_EPTF_LGenBase_tcStatePaused != vl_scStatePrev and
c_EPTF_LGenBase_tcStateStopped != vl_scStatePrev and
c_EPTF_LGenBase_tcStateAborted != vl_scStatePrev and
c_EPTF_LGenBase_tcStateIdle != vl_scStatePrev and
c_EPTF_LGenBase_tcStateTerminated != vl_scStatePrev){
f_EPTF_LGenBase_loggingWarning(%definitionId&": Start launch called for weighted scenario "&
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].uniqueName&
" in state "&c_EPTF_LGenBase_stateNames[vl_scStatePrev]&
"\nThe command can not be executed.");
if(c_EPTF_LGenBase_tcStateRunning != vl_scStatePrev or
-1 != v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].schedulerData.schedulingTimer){
return
}
}
if(not v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].enabled){
f_EPTF_LGenBase_loggingWarning(%definitionId&": Start launch called for the disabled scenario "&v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].uniqueName);
return;
}
if(c_EPTF_LGenBase_tcStateStopped == vl_scStatePrev or
c_EPTF_LGenBase_tcStateAborted == vl_scStatePrev or
c_EPTF_LGenBase_tcStateTerminated == vl_scStatePrev) {
var boolean vl_ret := f_EPTF_LGenBase_restoreScenarioByIdx(pl_eGrpIdx, pl_scInGrpIdx, false);
// f_EPTF_LGenBase_restoreScenarioByIdx should fail only if the scenario is running.
f_EPTF_Base_assert(%definitionId&": restore scenario failed. eGrpIdx: " & int2str(pl_eGrpIdx) &
", scInGrpIdx: " & int2str(pl_scInGrpIdx) & ", scState: " &int2str(vl_scStatePrev), vl_ret);
f_EPTF_LGenBase_loggingDebugTraffic(%definitionId&": generating new traffic mix.");
if(f_EPTF_LGenBase_isWeightedScenario(pl_eGrpIdx, pl_scInGrpIdx))
{
var boolean vl_mixerAcceptsMix := f_EPTF_TrafficMixer_acceptNewTrafficMix(
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].trafficMixData,
f_EPTF_LGenBase_getEnabledWeightListFromScenario(pl_eGrpIdx,pl_scInGrpIdx),
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].weightedScData.deterministicMix
)
f_EPTF_Base_assert(%definitionId&": initializing traffic mix for TC in weighted SC "&v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].name& ": mixer has not accepted traffic mix",
vl_mixerAcceptsMix);
}
}
var float vl_now := T_EPTF_componentClock.read;
var boolean vl_paused := c_EPTF_LGenBase_tcStatePaused == v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].state;
for ( var integer vl_tc := 0; vl_tc < sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].tcIdxList) ; vl_tc := vl_tc+1 )
{
var integer vl_tcIdx := v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scInGrpIdx].tcIdxList[vl_tc];
if(v_LGenBase_trafficCases[vl_tcIdx].enabled){
v_LGenBase_trafficCases[vl_tcIdx].state := c_EPTF_LGenBase_tcStateRunning;
//TR: MTTSM00016010
if(c_EPTF_LGenBase_tcStatePaused != vl_scStatePrev) {
v_LGenBase_trafficCases[vl_tcIdx].startTime := vl_now;
f_EPTF_LGenBase_startExecTimeTimer(vl_tcIdx); // starts execTime timer if needed, not part of the TR correction
}
//~TR
// distribute the bursterror differently according to the traffic corrigation => smooth out cumulative bursts
v_LGenBase_trafficCases[vl_tcIdx].schedulerData.burstSizeCumulativeError := v_LGenBase_entityGroups[pl_eGrpIdx].trafficCorrigation;
if(not vl_paused){
Inc(v_LGenBase_entityGroups[v_LGenBase_trafficCases[vl_tcIdx].eGroupBackref].scenarios[v_LGenBase_trafficCases[vl_tcIdx].eScenarioBackRef].startedTcs);
f_EPTF_LGenBase_resetTcStats(vl_tcIdx, v_LGenBase_trafficCases[vl_tcIdx]);
f_EPTF_LGenBase_dispatchEvent({
event := {
bIdx := c_EPTF_LGenBase_bIdx,
iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_trafficCaseStarted,
target := omit,
source := omit
},
reportedArgs := {vl_tcIdx}