Exemplo n.º 1
0
    def set_up(self):
        """
        Charge the board to match the start capacity.
        """
        # Call the UseCaseBase Setup function
        EmUsecaseBase.set_up(self)

        # check battery state is in expected value
        if self.__expected_batt_state not in [
                "CHARGING", "DISCHARGING", "NOT CHARGING", "FULL"
        ]:
            tmp_txt = "unknown EXPECTED_BATT_STATE value : %s" % \
                str(self.__expected_batt_state)
            self._logger.error(tmp_txt)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     tmp_txt)

        if self.__multimedia_type in ["AUDIO", "VIDEO"]:
            self.__multimedia_type = self.__multimedia_type.capitalize()
            self.__multimedia_api = self._device.get_uecmd(
                self.__multimedia_type)
        elif self.__multimedia_type != "NONE":
            tmp_txt = "unknown multimedia type: %s" % \
                str(self.__multimedia_api)
            self._logger.error(tmp_txt)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     tmp_txt)

        # init capacity
        self.update_battery_info()

        self._em_targets = self._target_file.parse_energy_management_targets(
            "LAB_EM_BATT_MAINTENANCE_CHARGING",
            self._tc_parameters.get_params_as_dict(),
            self._device.get_phone_model())

        # load targets in order to measure iteration
        self._em_meas_verdict.load_target(self._em_targets)

        # update battery temperature expected depending of TCT
        if self.tc_module is not None:
            if self._em_targets[
                    "THERMAL_MSIC_REGISTER_MAINTENANCE.BATTERY.TEMP"] is not None:
                EMUtil.update_conf(
                    self._em_targets[
                        "THERMAL_MSIC_REGISTER_MAINTENANCE.BATTERY.TEMP"],
                    ["lo_lim", "hi_lim"], self._tct, "*")

        # Charge battery
        self.em_core_module.monitor_charging(
            self.em_core_module.batt_max_capacity,
            self.em_core_module.charge_time, self.__em_meas_tab)

        return Global.SUCCESS, "No errors"
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """

        # Call UseCase base Init function
        EmUsecaseBase.__init__(self, tc_name, global_config)

        # Read Band from test case xml file (str)
        self._cell_band = str(self._tc_parameters.get_param_value("CELL_BAND"))

        # Read UL_UARFCN from test case xml file
        self._ul_uarfcn = int(self._tc_parameters.get_param_value("UL_UARFCN"))

        # Read mobile power from test case xml file (int)
        self._mobile_power = int(self._tc_parameters.get_param_value("MOBILE_POWER"))

        # Read CELL_POWER from test case xml file
        self._cell_power = \
            int(self._tc_parameters.get_param_value("CELL_POWER"))

        # Read REBOOT_MODE from test case xml file
        self._reboot_mode = str(self._tc_parameters.get_param_value("REBOOT_MODE"))
        # Init fuel gauging param
        self.em_core_module.init_fg_param()

        # Instantiate ConversionToolBox into conv_toolbox object
        self._conversion_toolbox = get_conversion_toolbox()

        # Read registrationTimeout from Phone_Catalog.xml
        self._registration_timeout = \
            int(self._dut_config.get("registrationTimeout"))

        # Create cellular network simulator and retrieve 3g APIs
        self._ns = self._em.get_cellular_network_simulator("NETWORK_SIMULATOR1")
        self._ns_3g = self._ns.get_cell_3g()

        # Initialize EM  xml object
        # measurement file
        meas_file_name = os.path.join(self._saving_directory,
                                      "EM_meas_report.xml")
        self.__em_meas_tab = EMUtil.XMLMeasurementFile(meas_file_name)
        # result file
        ocv_file_name = os.path.join(self._saving_directory,
                                     "Energy_Management_result_report.xml")
        self._em_meas_result = EMUtil.XMLMeasurementFile(ocv_file_name)
        # enable Global Measurement file
        name = os.path.join(self._campaign_folder,
                            self._em_cst.GLOBAL_MEAS_FILE)
        self.__em_meas_tab.enable_global_meas(name, self._name)
        # init variables
        self._ocv_list = []
        self._network_type = "3G"
Exemplo n.º 3
0
    def __init__(self, tc_name, global_config):
        """
        Get parameter from xml testcase file
        """
        # Call UseCase base Init function
        EmUsecaseBase.__init__(self, tc_name, global_config)
        # init fuel gauging parameters
        self.em_core_module.init_fg_param()
        # Read MAINTENANCE_CHARGING_TIMEOUT from test case xml file
        self.__maintenance_timeout = \
            int(self._tc_parameters.get_param_value("MAINTENANCE_CHARGING_TIMEOUT"))
        # Read EXPECTED_BATTERY_STATE from test case xml file
        self.__expected_batt_state = \
            str(self._tc_parameters.get_param_value(
                "EXPECTED_BATT_STATE")).upper()
        # Read DATA_POLLING from test case xml file
        self.__data_polling = \
            int(self._tc_parameters.get_param_value(
                "DATA_POLLING"))
        # Read CAPABILITY_TAG from test case xml file
        self._capability_tag = \
            str(self._tc_parameters.get_param_value(
                "CAPABILITY_TAG"))
        # Read MULTIMEDIA_TYPE from test case xml file
        self.__multimedia_type = \
            str(self._tc_parameters.get_param_value("MULTIMEDIA_TYPE")).upper()
        # Get Multimedia Parameters
        self.__multimedia_file = self._tc_parameters.get_param_value(
            "MULTIMEDIA_FILE")
        self.__volume = int(self._tc_parameters.get_param_value("VOLUME"))

        # Get path to multimedia files
        self.__multimedia_path = self._device.multimedia_path

        # Initialize EM  xml object
        # measurement file
        name = os.path.join(self._saving_directory, "EM_meas_report.xml")
        self.__em_meas_tab = EMUtil.XMLMeasurementFile(name)
        # enable Global Measurement file
        name = os.path.join(self._campaign_folder,
                            self._em_cst.GLOBAL_MEAS_FILE)
        self.__em_meas_tab.enable_global_meas(name, self._name)
        # hysteresis file
        name = os.path.join(self._saving_directory, "EM_hysteresis_report.xml")
        self.__em_hysteresis_tab = EMUtil.XMLMeasurementFile(name)

        # init variables
        self.__multimedia_api = None
        self._system_api = self._device.get_uecmd("System", True)
Exemplo n.º 4
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """

        # Call UseCase base Init function
        EmUsecaseBase.__init__(self, tc_name, global_config)
        # init fuel gauging parameters
        self.em_core_module.init_fg_param()
        # Read STAND_DURATION from test case xml file
        self._stand_mode = \
            self._tc_parameters.get_param_value(
                "STAND_MODE")
        # Read STANDBY_DURATION from test case xml file
        self._stand_duration = \
            int(self._tc_parameters.get_param_value(
                "STAND_DURATION"))
        # Initialize EM  xml object
        # measurement file
        meas_file_name = os.path.join(self._saving_directory,
                                      "EM_meas_report.xml")
        self.__em_meas_tab = EMUtil.XMLMeasurementFile(meas_file_name)

        self._em_targets = self._target_file.parse_energy_management_targets(
            "LAB_EM_BATT_IBATT_STANDBY_MODE",
            self._tc_parameters.get_params_as_dict(),
            self._device.get_phone_model())

        # load targets in order to measure iteration
        self._em_meas_verdict.load_target(self._em_targets)

        # get network api
        self._network_api = self._device.get_uecmd("Networking")
Exemplo n.º 5
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """
        # Call UseCase base Init function
        EmUsecaseBase.__init__(self, tc_name, global_config)

        # save global config into an attribute in
        # order to retrieve value in set_up method
        self.__global_config = global_config

        # Read OFF_TIMEOUT from test case xml file
        self._sleep_time = \
            int(self._tc_parameters.get_param_value(
                "OFF_TIMEOUT"))

        # Initialize EM  xml object
        # measurement file
        meas_file_name = os.path.join(self._saving_directory,
                                      "EM_meas_report.xml")
        self.__em_meas_tab = EMUtil.XMLMeasurementFile(meas_file_name)

        # Call ConfigsParser to parse Energy_Management
        self._em_targets = self._target_file.parse_energy_management_targets(
            "LAB_EM_BATT_BOOT_COS_MOS",
            self._tc_parameters.get_params_as_dict(),
            self._device.get_phone_model())

        # load targets in order to measure iteration
        self._em_meas_verdict.load_target(self._em_targets)

        # init variables
        self._off_timeout = 300
Exemplo n.º 6
0
    def __init__(self, tc_name, global_config):
        """
        Get parameter from xml testcase file
        """
        # Call UseCase base Init function
        EmUsecaseBase.__init__(self, tc_name, global_config)
        self.em_core_module.init_fg_param()

        # Read MAINTENANCE_CHARGING_TIMEOUT from test case xml file
        self.__maintenance_timeout = int(
            self._tc_parameters.get_param_value(
                "MAINTENANCE_CHARGING_TIMEOUT"))
        # Read EXPECTED_BATTERY_STATE from test case xml file
        self.__expected_batt_state = str(
            self._tc_parameters.get_param_value(
                "EXPECTED_BATT_STATE")).upper()
        # Read DATA_POLLING from test case xml file
        self.__data_polling = int(
            self._tc_parameters.get_param_value("DATA_POLLING"))
        # Read TEMPERATURE from test case xml file
        self.tc_module = None
        self.__chamber_tag = "ROOM"
        self.__temperature = str(
            self._tc_parameters.get_param_value("TEMPERATURE"))
        if self.__temperature != "ROOM":
            # get temperature chamber equipment if not room temperature
            self.__temperature = int(self.__temperature)
            self.tc_module = ThermalChamberModule(self.__temperature)
            # inform module that this is not a default thermal test
            self.tc_module.set_test_type("SPECIFIC")
            self.__chamber_tag = self.tc_module.get_chamber_tag()

        # Read LOAD from test case xml file
        self.__load = \
            str(self._tc_parameters.get_param_value("LOAD")).upper()

        # Initialize EM  xml object
        # measurement file
        name = os.path.join(self._saving_directory, "EM_meas_report.xml")
        self.__em_meas_tab = EMUtil.XMLMeasurementFile(name)
        # enable Global Measurement file
        name = os.path.join(self._campaign_folder,
                            self._em_cst.GLOBAL_MEAS_FILE)
        self.__em_meas_tab.enable_global_meas(name, self._name)
        # hysteresis file
        name = os.path.join(self._saving_directory, "EM_hysteresis_report.xml")
        self.__em_hysteresis_tab = EMUtil.XMLMeasurementFile(name)
Exemplo n.º 7
0
    def set_up(self):
        """
        Initialize the test
        """
        # Call the UseCaseBase Setup function
        EmUsecaseBase.set_up(self)

        # set usb charging on
        self.em_api.set_usb_charging("on")

        # init capacity
        msic = self.update_battery_info()

        # get capability targets
        self._em_targets = self._target_file.parse_energy_management_targets(
            "LAB_EM_BATT_OFF_ON_NO_VC",
            self._tc_parameters.get_params_as_dict(),
            self._device.get_phone_model())

        # load targets in order to measure iteration
        self._em_meas_verdict.load_target(self._em_targets)

        # init verdict value
        if self._em_targets[
                "MSIC_REGISTER_PLUG.BATTERY.CHARGE_NOW"] is not None:
            EMUtil.update_conf(
                self._em_targets["MSIC_REGISTER_PLUG.BATTERY.CHARGE_NOW"],
                "hi_lim", msic["BATTERY"]["CHARGE_FULL_DESIGN"][0], "=")

        if self.tc_module is not None:
            if self._em_targets[
                    "THERMAL_MSIC_REGISTER_PLUG.BATTERY.TEMP"] is not None:
                EMUtil.update_conf(
                    self.
                    _em_targets["THERMAL_MSIC_REGISTER_PLUG.BATTERY.TEMP"],
                    ["lo_lim", "hi_lim"], self._tct, "*")

        # Charge battery
        self.em_core_module.monitor_charging(
            self.em_core_module.batt_max_capacity,
            self.em_core_module.charge_time, self.__em_meas_tab)

        return Global.SUCCESS, "No errors"
    def __init__(self, tc_name, global_config):
        """
        Advanced ON OFF test that also provide action to charge the board
        """

        # Call UseCase base Init function
        EmUsecaseBase.__init__(self, tc_name, global_config)
        # init fuel gauging parameters
        self.em_core_module.init_fg_param()
        # time to wait to boot
        self.__boot_timeout = self._tc_parameters.get_param_value(
            "BOOT_TIMEOUT",
            self._device.get_boot_timeout(),
            default_cast_type=int)
        # time to wait just after the boot action and before wait to successfully boot
        self.__after_perform_boot_time = self._tc_parameters.get_param_value(
            "TIME_TO_WAIT_AFTER_JUST_PERFORM_BOOT", 10, default_cast_type=int)
        # time to wait to shutdown
        self.__shutdown_timeout = self._tc_parameters.get_param_value(
            "SHUTDOWN_TIMEOUT", default_cast_type=int)
        # cable to insert to make board boot
        self.__cable_type = self._tc_parameters.get_param_value("CABLE_TYPE")
        self.__keep_cable_during_shutdown = self._tc_parameters.get_param_value(
            "KEEP_CABLE_DURING_SHUTDOWN", True, default_cast_type=str_to_bool)
        # cable to insert to make board boot
        self.__max_iteration = self._tc_parameters.get_param_value(
            "MAX_ITERATION", default_cast_type=int)
        # time to wait to shutdown
        self.__max_fail = self._tc_parameters.get_param_value(
            "MAX_CONSECUTIVE_FAIL", 0, default_cast_type=int)
        self.__min_capacity_stop = self._tc_parameters.get_param_value(
            "MIN_CAPACITY_TO_STOP_TEST", 0, default_cast_type=int)
        # time to wait to shutdown
        # Initialize EM  xml object
        # measurement file
        meas_file_name = os.path.join(self._saving_directory,
                                      "EM_meas_report.xml")
        self.__em_meas_tab = EMUtil.XMLMeasurementFile(meas_file_name)
        self.__parser_api = self._device.get_uecmd("Aplog", True)
        self.__fail_boot = 0
        self.__pass_boot = 0
Exemplo n.º 9
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """
        # Call Init function
        EmUsecaseBase.__init__(self, tc_name, global_config)

        # Read READ_INFO_TIMEOUT from test case xml file
        self._read_info_timeout = \
            int(self._tc_parameters.get_param_value("READ_INFO_TIMEOUT"))

        # Read CHARGER_TYPE from TC parameters
        self._charger_type = \
            str(self._tc_parameters.get_param_value("CHARGER_TYPE"))

        # Read all temperatures from TC parameters
        temperatures = str(
            self._tc_parameters.get_param_value("TEMPERATURE_CYCLE"))

        self._em_targets = self._target_file.parse_energy_management_targets(
            "LAB_EM_BATT_TEMP_MEAS_CYCLE",
            self._tc_parameters.get_params_as_dict(),
            self._device.get_phone_model())

        # load targets in order to measure iteration
        self._em_meas_verdict.load_target(self._em_targets)

        # get temperature chamber equipment
        self.tc_module = ThermalChamberModule(self._ambient_temperature)
        self.tc_module.set_test_type("SPECIFIC")

        # Initialize EM  xml object
        # measurement file
        name = os.path.join(self._saving_directory, "EM_meas_report.xml")
        self.__em_meas_tab = EMUtil.XMLMeasurementFile(name)

        self._temperature_cycle = []
        for temperature in temperatures.split(","):
            self._temperature_cycle.append(int(temperature))
Exemplo n.º 10
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """

        # Call UseCase base Init function
        EmUsecaseBase.__init__(self, tc_name, global_config)

        # Read REBOOT_MODE from test case xml file
        self._reboot_mode = str(
            self._tc_parameters.get_param_value("REBOOT_MODE"))
        # Init fuel gauging param
        self.em_core_module.init_fg_param()

        # Initialize EM  xml object
        # measurement file
        meas_file_name = os.path.join(self._saving_directory,
                                      "EM_meas_report.xml")
        self.__em_meas_tab = EMUtil.XMLMeasurementFile(meas_file_name)
        # enable Global Measurement file
        name = os.path.join(self._campaign_folder,
                            self._em_cst.GLOBAL_MEAS_FILE)
        self.__em_meas_tab.enable_global_meas(name, self._name)
Exemplo n.º 11
0
    def set_up(self):
        """
        Initialize the test
        """
        # Call the UseCaseBase Setup function
        EmUsecaseBase.set_up(self)

        # set usb charging on
        self.em_api.set_usb_charging("on")

        # Configure CMU
        # Connect to cellular network simulator
        self._ns.init()

        # check that channel is allow for this band
        self._conversion_toolbox.convert_wcdma_channelscript_to_array(
            self._cell_band,
            self._ul_uarfcn)

        # Perform Full Preset
        self._ns.perform_full_preset()

        # Set cell band using CELL_BAND parameter
        self._ns_3g.set_band("BAND" + self._cell_band)

        # Set cell off
        self._ns_3g.set_cell_off()

        # Set Traffic Channel Arfcn using TCH_ARFCN parameter
        self._ns_3g.set_uplink_arfcn(self._ul_uarfcn)

        # Set mobile power using MOBILE_POWER parameter
        self._ns_3g.set_ms_power(self._mobile_power)

        # Set cell power using CELL_POWER parameter
        self._ns_3g.set_cell_power(self._cell_power)

        # init capacity
        msic = self.update_battery_info()

        # get capability targets
        self._em_targets = self._target_file.parse_energy_management_targets(
            "LAB_EM_BATT_OFF_ON_VC_3G", self._tc_parameters.get_params_as_dict(),
            self._device.get_phone_model())

        # load targets in order to measure iteration
        self._em_meas_verdict.load_target(self._em_targets)

        # init verdict value
        if self._em_targets["MSIC_REGISTER_PLUG.BATTERY.CHARGE_NOW"] is not None:
            EMUtil.update_conf(
                self._em_targets["MSIC_REGISTER_PLUG.BATTERY.CHARGE_NOW"],
                "hi_lim", msic["BATTERY"]["CHARGE_FULL_DESIGN"][0], "=")

        # init verdict value
        if self.tc_module is not None:
            if self._em_targets["THERMAL_MSIC_REGISTER_PLUG.BATTERY.TEMP"] is None:
                EMUtil.update_conf(
                    self._em_targets["THERMAL_MSIC_REGISTER_PLUG.BATTERY.TEMP"],
                    ["lo_lim", "hi_lim"], self._tct, "*")

        # Charge battery
        self.em_core_module.monitor_charging(self.em_core_module.batt_max_capacity, self.em_core_module.charge_time,
                              self.__em_meas_tab)

        # set CMU cell phone ON
        self._ns_3g.set_cell_on()

        # register phone
        RegUtil.check_dut_registration_before_timeout(self._ns_3g,
                                                      self.networking_api,
                                                      self._logger,
                                                      None,
                                                      self._registration_timeout)

        # Check registration status on DUT
        self.modem_api.check_cdk_registration_bfor_timeout(
            self._registration_timeout)

        return Global.SUCCESS, "No errors"
    def run_test_body(self):
        EmUsecaseBase.run_test_body(self)

        # configure the board to discharge quicker
        self._logger.info("Start to discharge battery until %s%%" %
                          self.em_core_module.batt_min_capacity)

        # stop charging through usb
        self.em_api.set_usb_charging("off")
        # launch uecmd to help the discharge
        self.phonesystem_api.set_screen_timeout(3600)
        # deactivate set auto brightness
        self.phonesystem_api.set_brightness_mode("manual")
        # set display brightness to max value
        self.phonesystem_api.set_display_brightness(100)
        self.phonesystem_api.set_phone_lock(0)
        # reinitialize consecutive error
        measurement_fail = 0

        self.phone_as_reboot = False
        # discharge loop
        self._logger.info("Start to discharge battery until %s%%" %
                          self.em_core_module.batt_min_capacity)

        while self.batt_capacity > self.em_core_module.batt_min_capacity:

            # update total test value
            self._total_test += 1
            self._logger.info("TEST iteration_%s" % str(self._total_test))

            batt_charge_Low = "FAILED_TO_COMPUTE"
            batt_charge_High = "FAILED_TO_COMPUTE"
            try:
                # get msic registers value after booting
                msic_reg = self.update_battery_info()
                msic_batt = msic_reg["BATTERY"]

                batt_charge_Low = msic_batt["CHARGE_NOW"][0] - \
                    5 * msic_batt["CURRENT_NOW"][0]
                batt_charge_High = msic_batt["CHARGE_NOW"][0] + \
                    5 * msic_batt["CURRENT_NOW"][0]

                if self._em_targets[
                        "MSIC_REGISTER_UNPLUG.BATTERY.CHARGE_NOW"] is not None:
                    EMUtil.update_conf(
                        self.
                        _em_targets["MSIC_REGISTER_UNPLUG.BATTERY.CHARGE_NOW"],
                        ["lo_lim"], batt_charge_Low, "=")
                    EMUtil.update_conf(
                        self.
                        _em_targets["MSIC_REGISTER_UNPLUG.BATTERY.CHARGE_NOW"],
                        ["hi_lim"], batt_charge_High, "=")

                thermal_conf = self.em_api.get_thermal_sensor_info()

                # store result on xml
                self.__em_meas_tab.add_dict_measurement(msic_reg)
                self.__em_meas_tab.add_dict_measurement(thermal_conf)

                # check thermal capabilities only if thermal chamber is used
                if self.tc_module is not None:
                    # Store various information
                    self.__em_meas_tab.add_measurement(
                        [self.tc_module.feed_meas_report()])
                    self._meas_list.add_dict("THERMAL_MSIC_REGISTER_PLUG",
                                             msic_reg)
                    self._meas_list.add_dict("THERMAL_CONF_PLUG", thermal_conf)

                # get the call state
                call_state = "BAND" + self._cell_band
                # Check cs call state
                call_state += "_CS_CALL_" + str(self.voicecall_api.get_state())

                # Store various information
                self.__em_meas_tab.add_measurement([
                    ("REGISTRATION",
                     self.modem_api.get_network_registration_status()),
                    ("VOICE_CALL", call_state)
                ])

            except AcsBaseException as e:
                # try to reconnect to the board if uecmd failed
                self._logger.error(
                    "fail to get measurement for OFF ON cycle SDP PLUG TEST: %s"
                    % str(e))
                measurement_fail += 0.5
            finally:
                # Store various information
                self.__em_meas_tab.add_measurement([
                    self.get_time_tuple(),
                    ("COMMENTS", "OFF ON cycle SDP PLUG TEST")
                ])

                # switch to next meas
                self.__em_meas_tab.switch_to_next_meas()
#------------------------------------------------------------------------------------------

            try:
                # start charging through usb
                self.em_api.set_usb_charging("on")

                # schedule commands
                if self._device.get_state() == "alive":
                    pid = self.em_api.get_msic_registers("scheduled", 15)
                    thermal_pid = self.em_api.get_thermal_sensor_info(
                        "scheduled", 15)

                # Charge board
                self.em_core_module.charge_battery(20)

                # read msic result
                msic_reg = self.em_api.get_msic_registers("read", pid)
                # stop charging through usb
                self.em_api.set_usb_charging("off")

                msic_batt = msic_reg["BATTERY"]
                self.batt_capacity = msic_batt["CAPACITY"][0]
                self.batt_voltage = msic_batt["VOLTAGE"][0]

                # get thermal information
                thermal_conf = self.em_api.get_thermal_sensor_info(
                    "read", thermal_pid)

                # create XML files
                self.__em_meas_tab.add_dict_measurement(msic_reg)
                self.__em_meas_tab.add_dict_measurement(thermal_conf)

                # compute verdict
                self._meas_list.add_dict("MSIC_REGISTER_UNPLUG", msic_reg)

                # get the call state
                call_state = "BAND" + self._cell_band
                # Check cs call state
                call_state += "_CS_CALL_" + str(self.voicecall_api.get_state())

                self.__em_meas_tab.add_measurement([
                    ("REGISTRATION",
                     self.modem_api.get_network_registration_status()),
                    ("VOICE_CALL", call_state)
                ])

                # clean scheduled task
                self.phonesystem_api.clean_daemon_files()
                measurement_fail = 0

            except AcsBaseException as e:
                # try to reconnect to the board if uecmd failed
                self._logger.error(
                    "fail to get measurement for OFF ON cycle SDP UNPLUG TEST:"
                    + str(e))
                measurement_fail += 0.5

                # stop the usecase if measurement fail several times.
                if measurement_fail >= self._consecutive_meas_error:
                    tmp_txt = "Measurement failed after %s times, stop usecase" % \
                        self._consecutive_meas_error
                    self._logger.error(tmp_txt)
                    if self.batt_voltage > self.vbatt_mos_shutdown or self.batt_voltage == -1:
                        raise DeviceException(
                            DeviceException.PROHIBITIVE_MEASURE, tmp_txt)
                    else:
                        self._logger.info(
                            "battery must be empty, stop usecase")
                        break

                # check the board connection
                self.em_core_module.check_board_connection()

            finally:
                self.__em_meas_tab.add_measurement([
                    self.get_time_tuple(),
                    ("COMMENTS", "OFF ON cycle CABLE UNPLUG TEST"),
                    ("REBOOT", self.phone_as_reboot)
                ])

                # generate em verdict
                self._em_meas_verdict.compare_list(self._meas_list,
                                                   self._em_targets)
                self._em_meas_verdict.judge(ignore_blocked_tc=True)
                self._meas_list.clean()

                # switch to next meas
                self.__em_meas_tab.switch_to_next_meas()

            # restart uecmds to help the discharge if phone as reboot
            if self.has_board_reboot():
                self.phonesystem_api.set_phone_lock(0)
                # stop charging through usb
                self.em_api.set_usb_charging("off")

                # establish a call
                self.voicecall_api.dial("OOOO12121121")

                self.phone_as_reboot = False

            self._logger.info("waiting board discharge during  %s seconds" %
                              self.em_core_module.discharge_time)
            time.sleep(self.em_core_module.discharge_time)

        return (self._em_meas_verdict.get_global_result(),
                self._em_meas_verdict.save_data_report_file())
Exemplo n.º 13
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """
        # Call UseCase base Init function
        EmUsecaseBase.__init__(self, tc_name, global_config)

        # save global config into an attribute in
        # order to retrieve value in set_up method
        self.__global_config = global_config

        # Read LOAD from test case xml file
        self._load = \
            str(self._tc_parameters.get_param_value("LOAD"))
        # Read BATT_MIN_CAPACITY from test case xml file
        # Init fuel gauging param
        self.em_core_module.init_fg_param()
        # Read STRESS_PERIOD from test case xml file
        self.hard_stress_time = \
            int(self._tc_parameters.get_param_value(
                "STRESS_PERIOD"))
        # Read NO_STRESS_PERIOD from test case xml file
        self.soft_stress_time = \
            int(self._tc_parameters.get_param_value(
                "NO_STRESS_PERIOD"))

        if self._load in ["HEAVY", "MEDIUM"]:
            # Read Band from test case xml file (str)
            self._cell_band = str(
                self._tc_parameters.get_param_value("CELL_BAND"))
            # Read CELL_SERVICE from test case xml file
            self._cell_service = \
                str(self._tc_parameters.get_param_value("CELL_SERVICE"))
            # Read TCH_ARFCN from test case xml file
            self._tch_arfcn = int(
                self._tc_parameters.get_param_value("TCH_ARFCN"))
            # Read UPLINK_CHANNEL from test case xml file
            self._uplink_channel = int(
                self._tc_parameters.get_param_value("UPLINK_CHANNEL"))
            # Read CELL_POWER from test case xml file
            self._cell_power = \
                int(self._tc_parameters.get_param_value("CELL_POWER"))

            # Read registrationTimeout from Phone_Catalog.xml
            self._registration_timeout = \
                int(self._dut_config.get("registrationTimeout"))

            # Create cellular network simulator and retrieve 2G APIs
            self._ns = self._em.get_cellular_network_simulator(
                "NETWORK_SIMULATOR1")
            self._ns_2g = self._ns.get_cell_2g()
            self._data_2g = self._ns_2g.get_data()
            self._test_mode_2g = self._ns_2g.get_test_mode()

            # Get Multimedia Parameters
            self._audio_file = self._tc_parameters.get_param_value(
                "AUDIO_FILE")
            self._volume = int(self._tc_parameters.get_param_value("VOLUME"))

            # Get path to multimedia files
            self._multimedia_path = self._device.multimedia_path

            # import special api
            self._audio_api = self._device.get_uecmd("Audio")
            self._system_api = self._device.get_uecmd("System")

        if self._load in ["HEAVY"]:

            # Get FTP server parameters
            server = self.__global_config.benchConfig.\
                get_parameters("WIFI_SERVER")
            self._ftp_ip_address = server.get_param_value("IP")
            self._ftp_username = server.get_param_value("username")
            self._ftp_password = server.get_param_value("password")
            if server.has_parameter("ftp_path"):
                self._ftp_path = server.get_param_value("ftp_path")
            else:
                self._ftp_path = ""

            # get file to download info
            self._dlfilename = os.path.join(
                self._ftp_path, self._tc_parameters.get_param_value("DL_FILE"))

            # get wifi parameters
            self._wifi_router_name = None
            self._standard = None
            self._ssid = ""
            self._standard_read = None
            self._security = None
            self._security_read = None
            self._passphrase = None
            self._is_router_name_found = True
            self._is_router_found = False
            supported_wifi_standard = [
                'a', 'b', 'g', 'n', 'an', 'bg', 'gb', 'bgn', 'ngb', 'n2.4G',
                'n5G', 'off'
            ]

            bench_config = self.__global_config.benchConfig
            # Retrieve wifi access point
            self._wifi_router_name = \
                str(self._tc_parameters.get_param_value("WIFI_ACCESS_POINT"))

            # if wifi router name is not specified, exit
            if self._wifi_router_name in [None, "", "NONE"]:
                self._is_router_name_found = False

            elif (bench_config.has_parameter(self._wifi_router_name)
                  and self.__global_config.benchConfig.get_parameters(
                      self._wifi_router_name) != ""):

                self._is_router_found = True
                self._wifirouter = self.__global_config.benchConfig.\
                    get_parameters(self._wifi_router_name)

                ssid_read = self._wifirouter.get_param_value("SSID")
                self._standard_read = self._wifirouter.get_param_value(
                    "standard")
                self._security_read = self._wifirouter.\
                    get_param_value("WIFI_SECURITY").upper()

                if ssid_read != "":
                    self._ssid = ssid_read

                if self._standard_read in supported_wifi_standard:
                    self._standard = self._standard_read

                # retrieve wifi router parameters
                if self._security_read in ("NONE", "OPEN"):

                    self._logger.debug("OPEN"
                                       'Wifi Security type selected,' +
                                       'getting parameters')
                    self._security = self._security_read

                elif self._security_read in ("WEP", "WPA", "WPA2"):

                    self._security = self._security_read
                    self._logger.debug(
                        str(self._security) +
                        " Wifi Security selected, getting parameters")

                    passphrase = self._wifirouter.get_param_value("passphrase")
                    self._passphrase = passphrase

        # Initialize EM xml object
        # measurement file
        meas_file_name = os.path.join(self._saving_directory,
                                      "EM_meas_report.xml")
        self.__em_meas_tab = EMUtil.XMLMeasurementFile(meas_file_name)
        # enable Global Measurement file
        name = os.path.join(self._campaign_folder,
                            self._em_cst.GLOBAL_MEAS_FILE)
        self.__em_meas_tab.enable_global_meas(name, self._name)

        # init variables
        self.__total_test = 0
        self._slots_conf = []
        self._data_call_mode = "TEST_MODE_B"
        self.measurement_fail = 0
        self._em_targets = None
Exemplo n.º 14
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """

        # Call UseCase base Init function
        EmUsecaseBase.__init__(self, tc_name, global_config)

        # Read Band from test case xml file (str)
        self._cell_band = str(self._tc_parameters.get_param_value("CELL_BAND"))
        # Read CELL_SERVICE from test case xml file
        self._cell_service = \
            str(self._tc_parameters.get_param_value("CELL_SERVICE"))
        # Read TCH_ARFCN from test case xml file
        self._tch_arfcn = int(self._tc_parameters.get_param_value("TCH_ARFCN"))
        # Read UPLINK_CHANNEL from test case xml file
        self._uplink_channel = int(
            self._tc_parameters.get_param_value("UPLINK_CHANNEL"))
        # Read CELL_POWER from test case xml file
        self._cell_power = \
            int(self._tc_parameters.get_param_value("CELL_POWER"))

        # Read DATA_CALL from test case xml file
        self._data_call = str_to_bool(
            self._tc_parameters.get_param_value("DATA_CALL"))
        # Read DATA_CALL_MODE from test case xml file
        self._data_call_mode = str(
            self._tc_parameters.get_param_value("DATA_CALL_MODE"))

        # Read REBOOT_MODE from test case xml file
        self._reboot_mode = str(
            self._tc_parameters.get_param_value("REBOOT_MODE"))
        # Init fuel gauging param
        self.em_core_module.init_fg_param()

        # Read registrationTimeout from Device_Catalog.xml
        self._registration_timeout = \
            int(self._dut_config.get("registrationTimeout"))

        # Create cellular network simulator and retrieve 2G APIs
        self._ns = self._em.get_cellular_network_simulator(
            "NETWORK_SIMULATOR1")
        self._ns_2g = self._ns.get_cell_2g()
        self._data_2g = self._ns_2g.get_data()

        # Initialize EM  xml object
        # measurement file
        meas_file_name = os.path.join(self._saving_directory,
                                      "EM_meas_report.xml")
        self.__em_meas_tab = EMUtil.XMLMeasurementFile(meas_file_name)
        # result file
        ocv_file_name = os.path.join(self._saving_directory,
                                     "Energy_Management_result_report.xml")
        self._em_meas_result = EMUtil.XMLMeasurementFile(ocv_file_name)
        # enable Global Measurement file
        name = os.path.join(self._campaign_folder,
                            self._em_cst.GLOBAL_MEAS_FILE)
        self.__em_meas_tab.enable_global_meas(name, self._name)
        # init variables
        self._ocv_list = []
        self._slots_conf = []
Exemplo n.º 15
0
    def set_up(self):
        """
        Initialize the test
        """
        # Call the UseCaseBase Setup function
        EmUsecaseBase.set_up(self)

        # set usb charging on
        self.em_api.set_usb_charging("on")

        # Configure CMU
        # Connect to cellular network simulator
        self._ns.init()
        # Perform Full Preset
        self._ns.perform_full_preset()

        # Set cell band using CELL_BAND parameter
        self._ns_2g.set_band(self._cell_band)

        # Set cell off
        self._ns_2g.set_cell_off()

        # Set cell service using CELL_SERVICE parameter
        self._ns_2g.set_cell_service(self._cell_service)

        # Set Traffic Channel Arfcn using TCH_ARFCN parameter
        self._ns_2g.set_tch_arfcn(self._tch_arfcn)

        # Set cell power using CELL_POWER parameter
        self._ns_2g.set_cell_power(self._cell_power)

        # set data uplink channel
        self._data_2g.set_data_channel(self._uplink_channel)

        # configure cellular network burst slots
        self._slots_conf = self.em_core_module.configure_slot()

        # Set main timeslot to 3 and set slot configs
        self._data_2g.set_custom_multislot_config(3,
                                                  self._slots_conf["DL_STATE"],
                                                  self._slots_conf["DL_VALUE"],
                                                  self._slots_conf["UL_STATE"],
                                                  self._slots_conf["UL_VALUE"])

        # init capacity
        msic = self.update_battery_info()

        # get capability targets
        self._em_targets = self._target_file.parse_energy_management_targets(
            "LAB_EM_BATT_OFF_ON_VC_2G",
            self._tc_parameters.get_params_as_dict(),
            self._device.get_phone_model())

        # load targets in order to measure iteration
        self._em_meas_verdict.load_target(self._em_targets)

        # init verdict value
        if self._em_targets[
                "MSIC_REGISTER_PLUG.BATTERY.CHARGE_NOW"] is not None:
            EMUtil.update_conf(
                self._em_targets["MSIC_REGISTER_PLUG.BATTERY.CHARGE_NOW"],
                "hi_lim", msic["BATTERY"]["CHARGE_FULL_DESIGN"][0], "=")

        # init verdict value
        if self.tc_module is not None:
            if self._em_targets[
                    "THERMAL_MSIC_REGISTER_PLUG.BATTERY.TEMP"] is not None:
                EMUtil.update_conf(
                    self.
                    _em_targets["THERMAL_MSIC_REGISTER_PLUG.BATTERY.TEMP"],
                    ["lo_lim", "hi_lim"], self._tct, "*")

        # Charge battery
        self.em_core_module.monitor_charging(
            self.em_core_module.batt_max_capacity,
            self.em_core_module.charge_time, self.__em_meas_tab)

        # set CMU cell phone ON
        self._data_2g.set_data_cell_on()

        # register phone
        self._data_2g.data_register_dut(None, self._registration_timeout)

        # Check registration status on DUT
        self.modem_api.check_cdk_registration_bfor_timeout(
            self._registration_timeout)

        return Global.SUCCESS, "No errors"
Exemplo n.º 16
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """
        # Call UseCase base Init function
        UseCaseBase.__init__(self, tc_name, global_config)
        self._overmind = None
        # init em stamp
        self.em_stamp = self._name
        self._uc_id_logged = False
        # override IO CARD with a not None type but not implemented type
        if self._io_card is None:
            self._io_card = IIOCard()

        # get em parameter from device catalog here
        self.phone_info = self._device.get_em_parameters()
        # feed the overmind
        self._overmind = OverMind()
        self._overmind.init(device=self._device,
                            tc_parameters=self._tc_parameters,
                            equipment_manager=self._em,
                            bench_config=global_config.benchConfig,
                            dut_config=self._dut_config)

        # Get uecmd api
        self.em_api = self._device.get_uecmd("EnergyManagement")
        self.phonesystem_api = self._device.get_uecmd("PhoneSystem")
        self.modem_api = self._device.get_uecmd("Modem")
        self.voicecall_api = self._device.get_uecmd("VoiceCall")
        self.networking_api = self._device.get_uecmd("Networking")
        self.bt_api = self._device.get_uecmd("LocalConnectivity")

        # init temperature chamber
        self._tct = self._tc_parameters.get_param_value("TCT",
                                                        default_cast_type=int)
        if self._tct is not None:
            self.tc_module = ThermalChamberModule(self._tct)
        else:
            self.tc_module = None

        # Each raw measurement data & xml files are
        # stored in a folder bearing the name
        # of the TC + a time stamp
        directory_name = self._name + "_" + time.strftime("%Y-%m-%d_%Hh%M.%S")
        report_tree = global_config.campaignConfig.get("campaignReportTree")
        self._saving_directory = report_tree.create_subfolder(directory_name)
        campaign_pass_rate = float(
            global_config.campaignConfig.get("targetB2bPassRate"))
        # resume file
        self._campaign_folder = report_tree.get_report_path()
        # verdict file
        self._em_meas_verdict = EMUtil.EMMeasurement(self._saving_directory,
                                                     campaign_pass_rate)

        # Call ConfigsParser to parse Energy_Management
        external_target_path = self._device.get_config("EMExternalTarget")
        if external_target_path is not None and os.path.exists(
                external_target_path):
            # Call ConfigsParser to parse Energy_Management
            self._logger.info("[EM BASE] External EM target file found : %s" %
                              external_target_path)
            self._target_file = ConfigsParser(external_target_path,
                                              config_folder="")
        else:
            # If no external target file , parse default one
            self._logger.info(
                "[EM BASE] No external target file found, use default EM target file"
            )
            self._target_file = ConfigsParser("Energy_Management")

        # Enable ACS secondary reports
        self._secondary_report = SecondaryTestReport(
            self._device.get_report_tree().get_report_path())

        # init variables
        # var for robustness
        self.start_time = time.time()
        self.__phone_date = ""
        self._ambient_temperature = 25
        self.phone_as_reboot = False
        self._consecutive_meas_error = 5
        # pylint: disable=W0212
        # Ignore used of protected member, will be change if a getter is created later
        self.pwr_btn_boot = self._device._prss_pwr_btn_time_switch_on
        self.pwr_btn_off = self._device._prss_pw_btn_time_switch_off

        # INIT PARAMETERS HERE
        # param related to usecase
        self._em_cst = EMUtil.EMConstant
        self._em_targets = None
        # add usb sleep for avoiding to lost connection during usb recognition
        self.usb_sleep = self._device._usb_sleep_duration  # pylint: disable=w0212

        # param related to device
        self.vbatt_mos_shutdown = self.phone_info["BATTERY"][
            "VBATT_MOS_SHUTDOWN"] + 0.1
        self.vbatt_mos_boot = self.phone_info["BATTERY"]["VBATT_MOS_BOOT"] + 0.1

        # param that are designed to be updated
        self.batt_capacity = -1
        self.batt_voltage = -1
        # measurement list where we store measurement inside
        self._meas_list = EMUtil.MeasurementList()

        # init core module at the end
        self.em_core_module = None
        bench_type = self._tc_parameters.get_param_value(
            "BENCH_TYPE", self.DEDICATED_BENCH).upper()
        if bench_type == "POWER_SUPPLY_BENCH":
            self.em_core_module = UcPowerSupplyModule(self)
        elif bench_type == "BATTERY_BENCH":
            self.em_core_module = UcBatteryModule(self)
        self._logger.info("Loaded EM TEST_SCRIPT configuration for %s" %
                          self.DEDICATED_BENCH)
        # get the list of TCD to test, it can have several entries
        # if the parameter is missing or empty ( meaning None) the old verdict system will be used.
        self.tcd_to_test = self._tc_parameters.get_param_value(
            EMConstant.TC_PARAMETER_TO_CHECK, "")
        if type(self.tcd_to_test) is str:
            self.tcd_to_test = filter(None, self.tcd_to_test.split(";"))
            self.tcd_to_test = map(str.strip, self.tcd_to_test)
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """
        # Call UseCase base Init function
        EmUsecaseBase.__init__(self, tc_name, global_config)

        # Read Band from test case xml file (str)
        self._cell_band = str(self._tc_parameters.get_param_value("CELL_BAND"))
        # Read CELL_SERVICE from test case xml file
        self._cell_service = \
            str(self._tc_parameters.get_param_value("CELL_SERVICE"))
        # Read TCH_ARFCN from test case xml file
        self._tch_arfcn = int(self._tc_parameters.get_param_value("TCH_ARFCN"))
        # Read UPLINK_CHANNEL from test case xml file
        self._uplink_channel = int(self._tc_parameters.get_param_value("UPLINK_CHANNEL"))
        # Read CELL_POWER from test case xml file
        self._cell_power = \
            int(self._tc_parameters.get_param_value("CELL_POWER"))

        # Read DATA_CALL from test case xml file
        self._data_call = str_to_bool(self._tc_parameters.get_param_value("DATA_CALL"))
        # Read DATA_CALL_MODE from test case xml file
        self._data_call_mode = str(self._tc_parameters.get_param_value("DATA_CALL_MODE"))

        # Init fuel gauging param
        self.em_core_module.init_fg_param()

        # Read registrationTimeout from Phone_Catalog.xml
        self._registration_timeout = \
            int(self._dut_config.get("registrationTimeout"))

        # Create cellular network simulator and retrieve 2G APIs
        self._ns = self._em.get_cellular_network_simulator("NETWORK_SIMULATOR1")
        self._ns_2g = self._ns.get_cell_2g()
        self._data_2g = self._ns_2g.get_data()
        self._vc_2g = self._ns_2g.get_voice_call()
        self._test_mode_2g = self._ns_2g.get_test_mode()

        # Initialize EM  xml object
        meas_file_name = os.path.join(self._saving_directory,
                                      "EM_meas_report.xml")
        self.__em_meas_tab = EMUtil.XMLMeasurementFile(meas_file_name)
        # enable Global Measurement file
        name = os.path.join(self._campaign_folder,
                            self._em_cst.GLOBAL_MEAS_FILE)
        self.__em_meas_tab.enable_global_meas(name, self._name)
        # Call ConfigsParser to parse Energy_Management
        self._em_targets = self._target_file.parse_energy_management_targets(
            "LAB_EM_BATT_MONITOR_BURST_CTRL", self._tc_parameters.get_params_as_dict(),
            self._device.get_phone_model())

        # load targets in order to measure iteration
        self._em_meas_verdict.load_target(self._em_targets)

        # init variables
        self._total_test = 0
        self._shutdown_timeout = 60
        self._network_type = "2G"
        self._slots_conf = []

        # prepare to launch scheduled test depending of battery capacity
        # enter test like below (battery_min, battery_max, test id): function_to_call
        self.scheduled_test = {
            (65, 81, "1"): self.__ber_test,
            (12, 19, "2"): self.__ber_test,
            (1, 5, "3"): self.__ber_test,
        }
Exemplo n.º 18
0
    def set_up(self):
        """
        Initialize the test
        """
        # Call the UseCaseBase Setup function
        EmUsecaseBase.set_up(self)

        # set usb charging on
        self.em_api.set_usb_charging("on")

        # Check LOAD option
        if self._load not in ["LIGHT", "MEDIUM", "HEAVY"]:
            tmp_txt = "unknown LOAD option value :" + str(self._load)
            self._logger.error(tmp_txt)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     tmp_txt)

        if self._load in ["HEAVY", "MEDIUM"]:
            # Configure CMU
            # Connect to cellular network simulator
            self._ns.init()

            # Perform Full Preset
            self._ns.perform_full_preset()

            # Set cell band using CELL_BAND parameter
            self._ns_2g.set_band(self._cell_band)

            # Set cell off
            self._ns_2g.set_cell_off()

            # Set cell service using CELL_SERVICE parameter
            self._ns_2g.set_cell_service(self._cell_service)

            # Set Traffic Channel Arfcn using TCH_ARFCN parameter
            self._ns_2g.set_tch_arfcn(self._tch_arfcn)

            # Set cell power using CELL_POWER parameter
            self._ns_2g.set_cell_power(self._cell_power)

            # set data uplink channel
            self._data_2g.set_data_channel(self._uplink_channel)

            # configure cellular network burst slots
            self._slots_conf = self.em_core_module.configure_slot()

            # Set main timeslot to 3 and set slot configs
            self._data_2g.set_custom_multislot_config(
                3, self._slots_conf["DL_STATE"], self._slots_conf["DL_VALUE"],
                self._slots_conf["UL_STATE"], self._slots_conf["UL_VALUE"])

        if self._load in ["HEAVY"]:
            # Check initialization and raise exception if something went wrong
            if not self._is_router_name_found:
                msg = "No Wifi router has been specified by the user"
                raise AcsConfigException(
                    AcsConfigException.INVALID_BENCH_CONFIG, msg)

            if not self._is_router_found:
                msg = "router name" + self._wifi_router_name + "is missing"
                raise AcsConfigException(
                    AcsConfigException.INVALID_BENCH_CONFIG, msg)

            if self._ssid == "":
                msg = str(self._ssid) + ": wifi ssid is missing"
                raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                         msg)

            if self._standard is None:
                # unknown wifi security
                if self._standard_read == "":
                    msg = "wifi standard is missing"
                else:
                    msg = self._standard_read \
                        + ":Unknown wifi standard is missing"
                raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                         msg)

            if self._security is None:
                # unknown wifi security
                if self._security_read == "":
                    msg = "missing wifi security"
                else:
                    msg = self._security_read + ": unknown wifi security"
                raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                         msg)

            if (self._security in ("WEP", "WPA", "WPA2")
                    and self._passphrase in ("", None)):
                msg = "Passphrase %s is missing in bench configuration file"
                raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                         msg)

        # check keys on dict to avoid reading empty files
        msic = self.update_battery_info()

        self._em_targets = self._target_file.parse_energy_management_targets(
            "LAB_EM_BATT_VBATT_LOAD", self._tc_parameters.get_params_as_dict(),
            self._device.get_phone_model())

        # load targets in order to measure iteration
        self._em_meas_verdict.load_target(self._em_targets)

        # update charger full design value
        if self._em_targets[
                "MSIC_REGISTER_STRESS.BATTERY.CHARGE_NOW"] is not None:
            EMUtil.update_conf(
                self._em_targets["MSIC_REGISTER_STRESS.BATTERY.CHARGE_NOW"],
                "hi_lim", msic["BATTERY"]["CHARGE_FULL_DESIGN"][0], "=")
        if self.tc_module is not None:
            # update battery temperature expected depending of TCT
            if self._em_targets[
                    "THERMAL_MSIC_REGISTER_STRESS.BATTERY.TEMP"] is not None:
                EMUtil.update_conf(
                    self.
                    _em_targets["THERMAL_MSIC_REGISTER_STRESS.BATTERY.TEMP"],
                    ["lo_lim", "hi_lim"], self._tct, "*")

            if self._em_targets[
                    "THERMAL_MSIC_REGISTER_NO_STRESS.BATTERY.TEMP"] is not None:
                EMUtil.update_conf(
                    self._em_targets[
                        "THERMAL_MSIC_REGISTER_NO_STRESS.BATTERY.TEMP"],
                    ["lo_lim", "hi_lim"], self._tct, "*")

        # Charge battery
        self.em_core_module.monitor_charging(
            self.em_core_module.batt_max_capacity,
            self.em_core_module.charge_time, self.__em_meas_tab)

        if self._load in ["HEAVY", "MEDIUM"]:
            # set CMU cell phone ON
            self._data_2g.set_data_cell_on()

        # launch uecmd to help the discharge
        self.phonesystem_api.set_screen_timeout(3600)
        # deactivate set auto brightness
        self.phonesystem_api.set_brightness_mode("manual")
        # set display brightness to max value
        self.phonesystem_api.set_display_brightness(100)

        if self._load in ["HEAVY"]:
            # setup wifi connection
            self.__setup_wifi()

            # connect wifi
            self.networking_api.\
                wifi_connect(self._ssid)

        if self._load in ["HEAVY", "MEDIUM"]:
            # register phone
            self._data_2g.data_register_dut(None, self._registration_timeout)

        # reset consecutive error
        self.measurement_fail = 0

        return Global.SUCCESS, "No errors"