| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // 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_LoadRegulator_Definitions |
| // |
| // Purpose: |
| // This module contains data type definitions for EPTF LoadRegulator |
| // |
| // Module Parameters: |
| // tsp_EPTF_LoadRegulator_loggingComponentMask - *charstring* - component-type mask for logging, default value: "EPTF_LoadRegulator" |
| // |
| // Module depends on: |
| // <EPTF_CLL_Common_Definitions> |
| // <EPTF_CLL_Logging_Definitions> |
| // <EPTF_CLL_Variable_Definitions> |
| // |
| // Current Owner: |
| // Gabor Tatarka (egbotat) |
| // |
| // Last Review Date: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| /////////////////////////////////////////////////////////// |
| |
| module EPTF_CLL_LoadRegulator_Definitions |
| { |
| import from EPTF_CLL_DataSource_Definitions all; |
| |
| |
| //========================================================================= |
| // Imports |
| //======================================================================= |
| import from EPTF_CLL_Common_Definitions all; |
| import from EPTF_CLL_Variable_Definitions all; |
| import from EPTF_CLL_Logging_Definitions all; |
| |
| modulepar charstring tsp_EPTF_LoadRegulator_loggingComponentMask := "EPTF_LoadRegulator"; |
| //========================================================================= |
| // Data Types |
| //========================================================================= |
| |
| ///////////////////////////////////////////////////////////////////////// |
| // Type: ft_EPTF_LoadRegulator_calculateNextCps |
| // |
| // Purpose: |
| // Function type for calculating next CPS based on the CPU or network load to reach and the old CPS |
| // |
| // Parameters: |
| // loadToReach - *in* *float* - the target load level to reach |
| // oldCps - *in* *float* - previous CPS value |
| // |
| // Return Value: |
| // *float* - new CPS value |
| // |
| // Detailed Comments: |
| // - |
| ///////////////////////////////////////////////////////////////////////// |
| type function ft_EPTF_LoadRegulator_calculateNextCps(in float loadToReach, in float oldCps) |
| runs on self return float; |
| |
| ///////////////////////////////////////////////////////////////////////// |
| // Type: ft_EPTF_LoadRegulator_getSUTLoad |
| // |
| // Purpose: |
| // Function type for getting the SUT load |
| // |
| // Return Value: |
| // *float* - SUT load value |
| // |
| // Detailed Comments: |
| // - |
| ///////////////////////////////////////////////////////////////////////// |
| type function ft_EPTF_LoadRegulator_getSUTLoad() runs on self return float; |
| |
| ///////////////////////////////////////////////////////////////////////// |
| // Type: ft_EPTF_LoadRegulator_postCalculateCPS |
| // |
| // Purpose: |
| // Function type for post-CPS-calculation |
| // |
| // Detailed Comments: |
| // This function should not modify any variables of component EPTF_LoadRegulator_CT |
| ///////////////////////////////////////////////////////////////////////// |
| type function ft_EPTF_LoadRegulator_postCalculateCPS() |
| runs on self; |
| |
| ///////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_LoadRegulator_updateCallback_FT |
| // |
| // Purpose: |
| // Function type to call at variable update |
| // |
| ///////////////////////////////////////////////////////////////////////// |
| type function EPTF_LoadRegulator_updateCallback_FT() runs on self; |
| |
| ///////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_LoadRegulator_context |
| // |
| // Purpose: |
| // Type for storing data used by the behavior altstep activated as default |
| // |
| // Elements: |
| // vl_prevLoad - *float* - previous load |
| // vl_currLoad - *float* - current load (smoothed measured load) |
| // vl_measuredLoad - *float* - measured load |
| // vl_diffLoad - *float* - difference between vl_prevLoad and vl_currLoad |
| // vl_loadToReach - *float* - load to reach |
| // vl_loadToReachDiff - *float* - difference between vl_loadToReach and vl_currLoad |
| // |
| // Detailed Comments: |
| // - |
| ///////////////////////////////////////////////////////////////////////// |
| type record EPTF_LoadRegulator_context { |
| float vl_prevLoad, |
| float vl_currLoad, |
| float vl_measuredLoad, |
| float vl_diffLoad, |
| float vl_loadToReach, |
| float vl_loadToReachDiff |
| } |
| |
| ///////////////////////////////////////////////////////////////////////// |
| // Component: EPTF_LoadRegulator_CT |
| // |
| // Purpose: |
| // Component type for EPTF_LoadRegulator |
| // |
| // Elements: |
| // v_EPTF_LoadRegulator_enabled - *boolean* - Regulator is enabled/disabled |
| // v_EPTF_LoadRegulator_initialized - *boolean* - Regulator is initialized |
| // v_EPTF_LoadRegulator_loadIsStable - *boolean* - is tha load stable |
| // v_EPTF_LoadRegulator_currentLoad - *float* - what is the current load |
| // v_EPTF_LoadRegulator_loadToReach - *float* - load to reach |
| // v_EPTF_LoadRegulator_cpsToReach - *float* - cps to reach |
| // EPTF_FloatList vc_loadRegMeasWindow - <EPTF_FloatList> - measurement list |
| // vc_measWinIdx - *integer* - index in vc_loadRegMeasWindow |
| // vc_loadRegStableWindow - <EPTF_FloatList> - v_EPTF_LoadRegulator_loadIsStable is calculated from here |
| // vc_stableWinIdx - *integer* - index in vc_loadRegStableWindow |
| // v_EPTF_LoadRegulator_altstep - *default* - altstep |
| // v_EPTF_LoadRegulator_ctx - <EPTF_LoadRegulator_context> - context data about the load |
| // vc_EPTF_calculateNextCps - <ft_EPTF_LoadRegulator_calculateNextCps> - calculateNextCps function pointer |
| // vc_EPTF_getSutLoad - <ft_EPTF_LoadRegulator_getSUTLoad> - getSUTLoad function pointer |
| // v_EPTF_postCalcCPS - <ft_EPTF_LoadRegulator_postCalculateCPS> - postCalculateCPS function pointer |
| // |
| // v_EPTF_loadRegulator_measWinSize - *integer* - measure Window size |
| // v_EPTF_loadRegulator_updateTimeout - *float* - length of time between 2 update period |
| // v_EPTF_loadRegulator_LoadVarianceThreshold - *float* - load variance threshold (percentage) |
| // v_EPTF_loadregulator_cpsDelta - *float* - the max value that the CPS value will be changed with |
| // v_EPTF_loadRegulator_errorTolerance - *float* - the precision of the target load (percentage) |
| // v_EPTF_loadRegulator_smoothingFactor - *float* - a smoothing is applied on the |
| // measured load values to avoid spikes (0.0:extreme smoothing and 1,0:no smoothing) |
| // |
| // v_EPTF_loadRegulator_execCtrlVar_totalValueIdx - *integer* - index for ExecCtrl Variable totalValue |
| // v_EPTF_loadRegulator_execCtrlVar_targetLoadIdx - *integer* - index for ExecCtrl Variable targetLoad |
| // v_EPTF_loadRegulator_execCtrlVar_currentLoadIdx - *integer* - index for ExecCtrl Variable currentLoad |
| // v_EPTF_loadRegulator_execCtrlVar_statusIdx - *integer* - index for ExecCtrl Variable status |
| // |
| // T_EPTF_loadReg - *timer* - timeout in v_EPTF_loadRegulator_updateTimeout - at timeout start update data |
| // v_EPTF_loadRegulator_originalCPS - *float* - what was the original CPS before regulating, when disabling, set this value back |
| // |
| // v_LoadRegulator_loggingMaskId - *integer* - logging mask id |
| // |
| // Detailed Comments: |
| // v_EPTF_LoadRegulator_ctx must not be accessed from user defined code. |
| ///////////////////////////////////////////////////////////////////////// |
| type component EPTF_LoadRegulator_CT extends EPTF_Var_CT, EPTF_Logging_CT, EPTF_DataSourceClient_CT |
| { |
| private var boolean v_EPTF_LoadRegulator_initialized := false; |
| /* |
| private var boolean v_EPTF_LoadRegulator_enabled := true; |
| private var boolean v_EPTF_LoadRegulator_loadIsStable := false; |
| private var float v_EPTF_LoadRegulator_currentLoad := 0.0; |
| private var float v_EPTF_LoadRegulator_loadToReach := 0.0; |
| private var float v_EPTF_LoadRegulator_cpsToReach := 0.0; |
| */ |
| private var integer v_LoadRegulator_enabledVarIdx; |
| private var integer v_LoadRegulator_cpsToReachVarIdx; |
| private var integer v_LoadRegulator_loadToReachVarIdx; |
| private var integer v_LoadRegulator_currentLoadVarIdx; |
| private var integer v_LoadRegulator_loadIsStableVarIdx; |
| |
| private var EPTF_FloatList vc_loadRegMeasWindow := {}; |
| private var integer vc_measWinIdx := 0; |
| |
| private var EPTF_FloatList vc_loadRegStableWindow := {}; |
| private var integer vc_stableWinIdx := 0; |
| |
| private var default v_EPTF_LoadRegulator_altstep; |
| private var EPTF_LoadRegulator_context v_EPTF_LoadRegulator_ctx := |
| c_EPTF_LoadRegulator_context_init; |
| |
| private var ft_EPTF_LoadRegulator_calculateNextCps vc_EPTF_calculateNextCps := null; |
| private var ft_EPTF_LoadRegulator_getSUTLoad vc_EPTF_getSutLoad := null; |
| private var ft_EPTF_LoadRegulator_postCalculateCPS v_EPTF_postCalcCPS := null; |
| |
| private var integer v_EPTF_loadRegulator_measWinSize; |
| private var float v_EPTF_loadRegulator_updateTimeout; // 2 secs |
| private var float v_EPTF_loadRegulator_LoadVarianceThreshold; // in % |
| private var float v_EPTF_loadregulator_cpsDelta; |
| private var float v_EPTF_loadRegulator_errorTolerance; // in % |
| private var float v_EPTF_loadRegulator_smoothingFactor; // should be between 0.0:extreme smoothing and 1,0:no smoothing |
| |
| private var integer v_EPTF_loadRegulator_execCtrlVar_totalValueIdx := -1; // index of the totalValue (nextCPS) variable in execCtrl that should be adjusted |
| private var integer v_EPTF_loadRegulator_execCtrlVar_targetLoadIdx := -1 // index of the targetLoad (loadToReach) variable in execCtrl that should be adjusted |
| private var integer v_EPTF_loadRegulator_execCtrlVar_currentLoadIdx := -1 // index of the currentLoad (loadToReach) variable in execCtrl that should be adjusted |
| private var integer v_EPTF_loadRegulator_execCtrlVar_statusIdx := -1; // index of the status variable in execCtrl that should be adjusted when status changes |
| |
| private timer T_EPTF_loadReg; |
| |
| // for f_EPTF_LoadRegulator_calculateNextCps_limitMax: |
| private var float v_EPTF_loadRegulator_originalCPS := -1.0; // the CPS before the regulation started (restored when regulation stops) |
| |
| // logging |
| private var integer v_LoadRegulator_loggingMaskId := c_EPTF_Logging_invalidMaskId; |
| |
| private var EPTF_LoadRegulator_updateCallback_FT v_LoadRegulator_updateCallback := null; |
| } |
| |
| const charstring c_LoadRegulator_sourceId := "LoadRegulator" |
| |
| const charstring c_LoadRegulator_enabledVarName := "EPTF_LoadRegulator.Regulator.enable."; |
| const charstring c_LoadRegulator_totalValueVarName := "EPTF_LoadRegulator.Regulator.totalValue."; |
| const charstring c_LoadRegulator_targetLoadVarName := "EPTF_LoadRegulator.Regulator.targetLoad."; |
| const charstring c_LoadRegulator_currentLoadVarName := "EPTF_LoadRegulator.Regulator.currentLoad."; |
| const charstring c_LoadRegulator_loadIsStableVarName := ".LoadRegulator_loadIsStable"; |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Constant: c_EPTF_LoadRegulator_dataElement_Help |
| // |
| // Purpose: |
| // This data element returns the help information about |
| // all dataElements supported. |
| // ValueType: charstring |
| // |
| // Parameters: |
| // - <c_EPTF_DataSource_paramNameHelpFormat> - the format of the output |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| const charstring c_EPTF_LoadRegulator_dataElement_help := c_EPTF_DataSource_dataElement_Help |
| |
| const EPTF_DataSource_Help_DataElement c_EPTF_LoadRegulator_Help_dataElement_help := c_EPTF_DataSource_Help_dataElement_genericHelp; |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Constant: c_LoadRegulator_dataElement_enabled |
| // |
| // Purpose: |
| // This dataElement returns the variable name where the "enabled" attribute |
| // of the LoadRegulator is stored. |
| // ValueType: boolean |
| // |
| // Parameters: |
| // The element does not have parameters. |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| const charstring c_LoadRegulator_dataElement_enabled := "Enabled"; |
| |
| const EPTF_DataSource_Help_DataElement c_LoadRegulator_Help_dataElement_enabled := { |
| name := c_LoadRegulator_dataElement_enabled, |
| valueType := boolType, |
| description := "This dataElement returns the variable name where the 'enabled' attribute of the LoadRegulator is stored." |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Constant: c_LoadRegulator_dataElement_cpsToReach |
| // |
| // Purpose: |
| // This dataElement returns the variable name where the "cpsToReach" attribute |
| // of the LoadRegulator is stored. |
| // ValueType: float |
| // |
| // Parameters: |
| // The element does not have parameters. |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| const charstring c_LoadRegulator_dataElement_cpsToReach := "CpsToReach"; |
| |
| const EPTF_DataSource_Help_DataElement c_LoadRegulator_Help_dataElement_cpsToReach := { |
| name := c_LoadRegulator_dataElement_cpsToReach, |
| valueType := floatType, |
| description := "This dataElement returns the variable name where the 'cpsToReach' attribute of the LoadRegulator is stored." |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Constant: c_LoadRegulator_dataElement_loadToReach |
| // |
| // Purpose: |
| // This dataElement returns the variable name where the "loadToReach" attribute |
| // of the LoadRegulator is stored. |
| // ValueType: float |
| // |
| // Parameters: |
| // The element does not have parameters. |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| const charstring c_LoadRegulator_dataElement_loadToReach := "LoadToReach"; |
| |
| const EPTF_DataSource_Help_DataElement c_LoadRegulator_Help_dataElement_loadToReach := { |
| name := c_LoadRegulator_dataElement_loadToReach, |
| valueType := floatType, |
| description := "This dataElement returns the variable name where the 'loadToReach' attribute of the LoadRegulator is stored." |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Constant: c_LoadRegulator_dataElement_currentLoad |
| // |
| // Purpose: |
| // This dataElement returns the variable name where the "currentLoad" attribute |
| // of the LoadRegulator is stored. |
| // ValueType: float |
| // |
| // Parameters: |
| // The element does not have parameters. |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| const charstring c_LoadRegulator_dataElement_currentLoad := "CurrentLoad"; |
| |
| const EPTF_DataSource_Help_DataElement c_LoadRegulator_Help_dataElement_currentLoad := { |
| name := c_LoadRegulator_dataElement_currentLoad, |
| valueType := floatType, |
| description := "This dataElement returns the variable name where the 'currentLoad' attribute of the LoadRegulator is stored." |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Constant: c_LoadRegulator_dataElement_loadIsStable |
| // |
| // Purpose: |
| // This dataElement returns the variable name where the "loadIsStable" attribute |
| // of the LoadRegulator is stored. |
| // ValueType: boolean |
| // |
| // Parameters: |
| // The element does not have parameters. |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| const charstring c_LoadRegulator_dataElement_loadIsStable := "LoadIsStable"; |
| |
| const EPTF_DataSource_Help_DataElement c_LoadRegulator_Help_dataElement_loadIsStable := { |
| name := c_LoadRegulator_dataElement_loadIsStable, |
| valueType := boolType, |
| description := "This dataElement returns the variable name where the 'loadIsStable' attribute of the LoadRegulator is stored." |
| } |
| |
| ///////////////////////////////////////////////////////////////////////// |
| // Constant: c_EPTF_LoadRegulator_context_init |
| // |
| // Purpose: |
| // Constant used to initialize variables of type EPTF_LoadRegulator_context. |
| // |
| // Detailed Comments: |
| // - |
| ///////////////////////////////////////////////////////////////////////// |
| const EPTF_LoadRegulator_context c_EPTF_LoadRegulator_context_init := { |
| vl_prevLoad := 0.0, |
| vl_currLoad := 0.0, |
| vl_measuredLoad := 0.0, |
| vl_diffLoad := 0.0, |
| vl_loadToReach := 0.0, |
| vl_loadToReachDiff := 0.0 |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Constant: c_EPTF_LoadRegulator_loggingEventClasses |
| // |
| // Purpose: |
| // list of logging event class names used on the LoadRegulator |
| // |
| // Detailed Comments: |
| // <EPTF_Logging_EventClassPrefixList> { "Warning", "Debug" } |
| /////////////////////////////////////////////////////////// |
| const EPTF_Logging_EventClassPrefixList c_EPTF_LoadRegulator_loggingEventClasses := { "Warning", "Debug" }; |
| |
| /////////////////////////////////////////////////////////// |
| // Constant: c_EPTF_LoadRegulator_loggingClassIdx_Warning |
| // |
| // Purpose: |
| // logging class index for Error |
| // |
| // Detailed Comments: |
| // *0* |
| /////////////////////////////////////////////////////////// |
| const integer c_EPTF_LoadRegulator_loggingClassIdx_Warning := 0; |
| |
| /////////////////////////////////////////////////////////// |
| // Constant: c_EPTF_LoadRegulator_loggingClassIdx_Debug |
| // |
| // Purpose: |
| // logging class index for Error |
| // |
| // Detailed Comments: |
| // *1* |
| /////////////////////////////////////////////////////////// |
| const integer c_EPTF_LoadRegulator_loggingClassIdx_Debug := 1; |
| |
| // the datasource help database for LoadRegulator |
| const EPTF_DataSource_Help_DataElementChildren c_EPTF_LoadRegulator_help := { |
| { |
| dataElement := c_EPTF_LoadRegulator_Help_dataElement_help |
| }, |
| { |
| dataElement := c_LoadRegulator_Help_dataElement_enabled |
| }, |
| { |
| dataElement := c_LoadRegulator_Help_dataElement_cpsToReach |
| }, |
| { |
| dataElement := c_LoadRegulator_Help_dataElement_loadToReach |
| }, |
| { |
| dataElement := c_LoadRegulator_Help_dataElement_currentLoad |
| }, |
| { |
| dataElement := c_LoadRegulator_Help_dataElement_loadIsStable |
| } |
| } |
| |
| } // module |
| |