""""""
import functools
import nirfmxlte.attributes as attributes
import nirfmxlte.enums as enums
import nirfmxlte.errors as errors
import nirfmxlte.internal._helper as _helper
def _raise_if_disposed(f):
"""From https://stackoverflow.com/questions/5929107/decorators-with-parameters."""
@functools.wraps(f)
def aux(*xs, **kws):
meas_obj = xs[0] # parameter 0 is 'self' which is the measurement object
if meas_obj._signal_obj.is_disposed:
raise Exception("Cannot access a disposed Lte signal configuration")
return f(*xs, **kws)
return aux
[docs]
class SemComponentCarrierConfiguration(object):
""""""
def __init__(self, signal_obj):
""""""
self._signal_obj = signal_obj
self._session_function_lock = signal_obj._session_function_lock
self._interpreter = signal_obj._interpreter
[docs]
@_raise_if_disposed
def get_integration_bandwidth(self, selector_string):
r"""Gets the integration bandwidth of a component carrier. This value is expressed in Hz.
Use "carrier<*k*>" or "subblock<*n*>/carrier<*k*>" as the selector string to read this result.
The default value is 9 MHz.
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (float):
Returns the integration bandwidth of a component carrier. This value is expressed in Hz.
error_code (int):
Returns the status code of this method. The status code either indicates success or describes a warning condition.
"""
try:
self._session_function_lock.enter_read_lock()
updated_selector_string = _helper.validate_and_update_selector_string(
selector_string, self._signal_obj
)
attr_val, error_code = self._interpreter.get_attribute_f64(
updated_selector_string,
attributes.AttributeID.SEM_COMPONENT_CARRIER_INTEGRATION_BANDWIDTH.value,
)
finally:
self._session_function_lock.exit_read_lock()
return attr_val, error_code
[docs]
@_raise_if_disposed
def get_output_power_type(self, selector_string):
r"""Gets the method of calculating the mask limits as specified in the section 6.6.3 of *3GPP 36.141* specification.
Use "carrier<*k*>" or "subblock<*n*>/carrier<*k*>" as the selector string to configure or read this attribute.
The default value is **Maximum Output Power**.
.. note::
This attribute is ignored when you set Bandwidth to **200k**.
+--------------------------+--------------------------------------------------------------------------------------------------------------------------+
| Name (Value) | Description |
+==========================+==========================================================================================================================+
| Maximum Output Power (0) | The configured value in the SEM CC Max Output Power (dBm) attribute is considered to be P\ :sub:`max,c`\, per carrier |
| | specified in the section 6.6.3 of *3GPP 36.141* specification and is used only to choose the applicable SEM mask limit |
| | table. |
+--------------------------+--------------------------------------------------------------------------------------------------------------------------+
| Rated Output Power (1) | The configured value in the SEM CC Max Output Power (dBm) attribute is considered to be P\ :sub:`rated,c`\, per carrier |
| | specified in the section 6.6.3 of *3GPP 36.141* specification. This P\ :sub:`rated,c`\ value is used to choose the |
| | applicable SEM mask limit table and to calculate the mask limits. This is the recommended setting for *3GPP Release 15* |
| | and above. |
+--------------------------+--------------------------------------------------------------------------------------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (enums.SemComponentCarrierOutputPowerType):
Specifies the method of calculating the mask limits as specified in the section 6.6.3 of *3GPP 36.141* specification.
error_code (int):
Returns the status code of this method. The status code either indicates success or describes a warning condition.
"""
try:
self._session_function_lock.enter_read_lock()
updated_selector_string = _helper.validate_and_update_selector_string(
selector_string, self._signal_obj
)
attr_val, error_code = self._interpreter.get_attribute_i32(
updated_selector_string,
attributes.AttributeID.SEM_COMPONENT_CARRIER_OUTPUT_POWER_TYPE.value,
)
attr_val = enums.SemComponentCarrierOutputPowerType(attr_val)
except (KeyError, ValueError):
raise errors.DriverTooNewError() # type: ignore
finally:
self._session_function_lock.exit_read_lock()
return attr_val, error_code
[docs]
@_raise_if_disposed
def set_output_power_type(self, selector_string, value):
r"""Sets the method of calculating the mask limits as specified in the section 6.6.3 of *3GPP 36.141* specification.
Use "carrier<*k*>" or "subblock<*n*>/carrier<*k*>" as the selector string to configure or read this attribute.
The default value is **Maximum Output Power**.
.. note::
This attribute is ignored when you set Bandwidth to **200k**.
+--------------------------+--------------------------------------------------------------------------------------------------------------------------+
| Name (Value) | Description |
+==========================+==========================================================================================================================+
| Maximum Output Power (0) | The configured value in the SEM CC Max Output Power (dBm) attribute is considered to be P\ :sub:`max,c`\, per carrier |
| | specified in the section 6.6.3 of *3GPP 36.141* specification and is used only to choose the applicable SEM mask limit |
| | table. |
+--------------------------+--------------------------------------------------------------------------------------------------------------------------+
| Rated Output Power (1) | The configured value in the SEM CC Max Output Power (dBm) attribute is considered to be P\ :sub:`rated,c`\, per carrier |
| | specified in the section 6.6.3 of *3GPP 36.141* specification. This P\ :sub:`rated,c`\ value is used to choose the |
| | applicable SEM mask limit table and to calculate the mask limits. This is the recommended setting for *3GPP Release 15* |
| | and above. |
+--------------------------+--------------------------------------------------------------------------------------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
value (enums.SemComponentCarrierOutputPowerType, int):
Specifies the method of calculating the mask limits as specified in the section 6.6.3 of *3GPP 36.141* specification.
Returns:
int:
Returns the status code of this method. The status code either indicates success or describes a warning condition.
"""
try:
self._session_function_lock.enter_read_lock()
updated_selector_string = _helper.validate_and_update_selector_string(
selector_string, self._signal_obj
)
value = (
value.value if type(value) is enums.SemComponentCarrierOutputPowerType else value
)
error_code = self._interpreter.set_attribute_i32(
updated_selector_string,
attributes.AttributeID.SEM_COMPONENT_CARRIER_OUTPUT_POWER_TYPE.value,
value,
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_maximum_output_power(self, selector_string):
r"""Gets the maximum output power, P\ :sub:`max,c`\, per carrier when you set the
:py:attr:`~nirfmxlte.attributes.AttributeID.SEM_COMPONENT_CARRIER_OUTPUT_POWER_TYPE` attribute to **Maximum Output
Power**. For more details, please refer to the section 6.6.3 of *3GPP 36.141 Release 14* and lower specifications.
Specifies the rated output power, P\ :sub:`rated,c`\, per carrier when you set the
:py:attr:`~nirfmxlte.attributes.AttributeID.SEM_COMPONENT_CARRIER_OUTPUT_POWER_TYPE` attribute to **Rated Output
Power**. For more details, please refer to the section 6.6.3 of *3GPP 36.141 Release 15* and Higher specifications.
Use "carrier<*k*>" or "subblock<*n*>/carrier<*k*>" as the selector string to configure or read this attribute.
The default value is 0. Valid values are within 38, inclusive.
.. note::
P\ :sub:`max,c`\ is considered only when you set the :py:attr:`~nirfmxlte.attributes.AttributeID.LINK_DIRECTION`
attribute to **Downlink**, :py:attr:`~nirfmxlte.attributes.AttributeID.ENODEB_CATEGORY` attribute to **Medium Range
Base Station**, and :py:attr:`~nirfmxlte.attributes.AttributeID.SEM_DOWNLINK_MASK_TYPE` attribute to **eNodeB Category
Based**.
P\ :sub:`rated,c`\ is considered only when you set the
:py:attr:`~nirfmxlte.attributes.AttributeID.LINK_DIRECTION` attribute to **Downlink**,
:py:attr:`~nirfmxlte.attributes.AttributeID.ENODEB_CATEGORY` attribute to **Medium Range Base Station**, and
:py:attr:`~nirfmxlte.attributes.AttributeID.SEM_DOWNLINK_MASK_TYPE` attribute to **eNodeB Category Based** or
:py:attr:`~nirfmxlte.attributes.AttributeID.SEM_DOWNLINK_MASK_TYPE` attribute to **Band 46** and
:py:attr:`~nirfmxlte.attributes.AttributeID.ENODEB_CATEGORY` attribute to **Medium Range Base Station** or **Local Area
Base Station**.
When you set Bandwidth to **200k** the maximum output power used to choose limit table and to calculate the
mask.
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (float):
Specifies the maximum output power, P\ :sub:`max,c`\, per carrier when you set the
:py:attr:`~nirfmxlte.attributes.AttributeID.SEM_COMPONENT_CARRIER_OUTPUT_POWER_TYPE` attribute to **Maximum Output
Power**. For more details, please refer to the section 6.6.3 of *3GPP 36.141 Release 14* and lower specifications.
error_code (int):
Returns the status code of this method. The status code either indicates success or describes a warning condition.
"""
try:
self._session_function_lock.enter_read_lock()
updated_selector_string = _helper.validate_and_update_selector_string(
selector_string, self._signal_obj
)
attr_val, error_code = self._interpreter.get_attribute_f64(
updated_selector_string,
attributes.AttributeID.SEM_COMPONENT_CARRIER_MAXIMUM_OUTPUT_POWER.value,
)
finally:
self._session_function_lock.exit_read_lock()
return attr_val, error_code
[docs]
@_raise_if_disposed
def set_maximum_output_power(self, selector_string, value):
r"""Sets the maximum output power, P\ :sub:`max,c`\, per carrier when you set the
:py:attr:`~nirfmxlte.attributes.AttributeID.SEM_COMPONENT_CARRIER_OUTPUT_POWER_TYPE` attribute to **Maximum Output
Power**. For more details, please refer to the section 6.6.3 of *3GPP 36.141 Release 14* and lower specifications.
Specifies the rated output power, P\ :sub:`rated,c`\, per carrier when you set the
:py:attr:`~nirfmxlte.attributes.AttributeID.SEM_COMPONENT_CARRIER_OUTPUT_POWER_TYPE` attribute to **Rated Output
Power**. For more details, please refer to the section 6.6.3 of *3GPP 36.141 Release 15* and Higher specifications.
Use "carrier<*k*>" or "subblock<*n*>/carrier<*k*>" as the selector string to configure or read this attribute.
The default value is 0. Valid values are within 38, inclusive.
.. note::
P\ :sub:`max,c`\ is considered only when you set the :py:attr:`~nirfmxlte.attributes.AttributeID.LINK_DIRECTION`
attribute to **Downlink**, :py:attr:`~nirfmxlte.attributes.AttributeID.ENODEB_CATEGORY` attribute to **Medium Range
Base Station**, and :py:attr:`~nirfmxlte.attributes.AttributeID.SEM_DOWNLINK_MASK_TYPE` attribute to **eNodeB Category
Based**.
P\ :sub:`rated,c`\ is considered only when you set the
:py:attr:`~nirfmxlte.attributes.AttributeID.LINK_DIRECTION` attribute to **Downlink**,
:py:attr:`~nirfmxlte.attributes.AttributeID.ENODEB_CATEGORY` attribute to **Medium Range Base Station**, and
:py:attr:`~nirfmxlte.attributes.AttributeID.SEM_DOWNLINK_MASK_TYPE` attribute to **eNodeB Category Based** or
:py:attr:`~nirfmxlte.attributes.AttributeID.SEM_DOWNLINK_MASK_TYPE` attribute to **Band 46** and
:py:attr:`~nirfmxlte.attributes.AttributeID.ENODEB_CATEGORY` attribute to **Medium Range Base Station** or **Local Area
Base Station**.
When you set Bandwidth to **200k** the maximum output power used to choose limit table and to calculate the
mask.
Args:
selector_string (string):
Pass an empty string.
value (float):
Specifies the maximum output power, P\ :sub:`max,c`\, per carrier when you set the
:py:attr:`~nirfmxlte.attributes.AttributeID.SEM_COMPONENT_CARRIER_OUTPUT_POWER_TYPE` attribute to **Maximum Output
Power**. For more details, please refer to the section 6.6.3 of *3GPP 36.141 Release 14* and lower specifications.
Returns:
int:
Returns the status code of this method. The status code either indicates success or describes a warning condition.
"""
try:
self._session_function_lock.enter_read_lock()
updated_selector_string = _helper.validate_and_update_selector_string(
selector_string, self._signal_obj
)
error_code = self._interpreter.set_attribute_f64(
updated_selector_string,
attributes.AttributeID.SEM_COMPONENT_CARRIER_MAXIMUM_OUTPUT_POWER.value,
value,
)
finally:
self._session_function_lock.exit_read_lock()
return error_code