Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
"""
Setup the test fixture for the Semiconductor class.
"""
_database = '/home/andrew/projects/RTKTestDB.rtk'
self._dao = _dao(_database)
self.DUT = Model()
def set_attributes(self, values):
"""
Sets the Low Frequency Silicon FET data model attributes.
:param tuple values: tuple of values to assign to the instance
attributes.
:return: (_code, _msg); the error code and error message.
:rtype: tuple
"""
_code = 0
_msg = ''
(_code, _msg) = Semiconductor.set_attributes(self, values)
try:
self.application = int(values[117])
self.type = int(values[118])
self.piA = float(values[101])
except IndexError as _err:
_code = Utilities.error_handler(_err.args)
_msg = "ERROR: Insufficient input values."
except(TypeError, ValueError) as _err:
_code = Utilities.error_handler(_err.args)
_msg = "ERROR: Converting one or more inputs to correct data type."
return(_code, _msg)
". Operating power > 70% rated power.\n"
_reason_num += 1
if self.junction_temperature > 125.0:
self.overstress = True
self.reason = self.reason + str(_reason_num) + \
". Junction temperature > 125.0C.\n"
else:
if self.operating_power > 0.9 * self.rated_power:
self.overstress = True
self.reason = self.reason + str(_reason_num) + \
". Operating power > 90% rated power.\n"
return False
class HighFrequency(Semiconductor):
"""
The High Frequency Diode data model contains the attributes and methods of
a High Frequency Diode component. The attributes of a High Frequency Diode
are:
:cvar int subcategory: default value: 13
:ivar int application: default value: 0
:ivar int type: default value: 0
:ivar float piA: default value: 0.0
:ivar float piR: default value: 0.0
Hazard Rate Models:
# MIL-HDBK-217F, section 6.2.
"""
(self.junction_temperature +
273.0)) - (1.0 / 373.0)))
self.hazard_rate_model['piT'] = self.piT
# Set the power rating factor for the model.
if self.application == 1:
self.piA = 7.6
else:
self.piA = 0.06 * self.duty_cycle + 0.4
self.hazard_rate_model['piA'] = self.piA
# Set the voltage stress factor for the model.
self.piM = self._lst_piM[self.matching - 1]
self.hazard_rate_model['piM'] = self.piM
return Semiconductor.calculate_part(self)
def set_attributes(self, values):
"""
Sets the High Frequency Field Effect Transistor data model attributes.
:param tuple values: tuple of values to assign to the instance
attributes.
:return: (_code, _msg); the error code and error message.
:rtype: tuple
"""
_code = 0
_msg = ''
(_code, _msg) = Semiconductor.set_attributes(self, values)
try:
self.type = int(values[117])
except IndexError as _err:
_code = Utilities.error_handler(_err.args)
_msg = "ERROR: Insufficient input values."
except(TypeError, ValueError) as _err:
_code = Utilities.error_handler(_err.args)
_msg = "ERROR: Converting one or more inputs to correct data type."
return(_code, _msg)
__author__ = 'Andrew Rowland'
__email__ = 'andrew.rowland@reliaqual.com'
__organization__ = 'ReliaQual Associates, LLC'
__copyright__ = 'Copyright 2007 - 2015 Andrew "weibullguy" Rowland'
# Add localization support.
try:
locale.setlocale(locale.LC_ALL, Configuration.LOCALE)
except locale.Error: # pragma: no cover
locale.setlocale(locale.LC_ALL, '')
_ = gettext.gettext
class Thyristor(Semiconductor):
"""
The Thyristor data model contains the attributes and methods of a
Thyristor component. The attributes of a Thyristor
are:
:cvar subcategory: default value: 21
:ivar piR: default value: 0.0
:ivar piS: default value: 0.0
Covers specification MIL-S-19500.
Hazard Rate Models:
# MIL-HDBK-217F, section 6.10.
"""
__author__ = 'Andrew Rowland'
__email__ = 'andrew.rowland@reliaqual.com'
__organization__ = 'ReliaQual Associates, LLC'
__copyright__ = 'Copyright 2007 - 2015 Andrew "weibullguy" Rowland'
# Add localization support.
try:
locale.setlocale(locale.LC_ALL, Configuration.LOCALE)
except locale.Error: # pragma: no cover
locale.setlocale(locale.LC_ALL, '')
_ = gettext.gettext
class HFSiFET(Semiconductor):
"""
The High Frequency Silicon Field Effect Transistor data model contains the
attributes and methods of a High Frequency Field Effect Transistor
component. The attributes of a High Frequency Field Effect Transistor are:
:cvar subcategory: default value: 20
:ivar type: default value: 0
Covers specification MIL-S-19500.
Hazard Rate Models:
# MIL-HDBK-217F, section 6.9.
"""
# MIL-HDK-217F hazard rate calculation variables.
__author__ = 'Andrew Rowland'
__email__ = 'andrew.rowland@reliaqual.com'
__organization__ = 'ReliaQual Associates, LLC'
__copyright__ = 'Copyright 2007 - 2015 Andrew "weibullguy" Rowland'
# Add localization support.
try:
locale.setlocale(locale.LC_ALL, Configuration.LOCALE)
except locale.Error: # pragma: no cover
locale.setlocale(locale.LC_ALL, '')
_ = gettext.gettext
class Unijunction(Semiconductor):
"""
The Unijunction Transistor data model contains the attributes and methods
of a Unijunction Transistor component. The attributes of a Unijunction
Transistor are:
:cvar subcategory: default value: 16
Covers specification MIL-S-19500.
Hazard Rate Models:
# MIL-HDBK-217F, section 6.5.
"""
# MIL-HDK-217F hazard rate calculation variables.
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
_lst_piE = [1.0, 6.0, 9.0, 9.0, 19.0, 13.0, 29.0, 20.0, 43.0, 24.0, 0.5,
__author__ = 'Andrew Rowland'
__email__ = 'andrew.rowland@reliaqual.com'
__organization__ = 'ReliaQual Associates, LLC'
__copyright__ = 'Copyright 2007 - 2015 Andrew "weibullguy" Rowland'
# Add localization support.
try:
locale.setlocale(locale.LC_ALL, Configuration.LOCALE)
except locale.Error: # pragma: no cover
locale.setlocale(locale.LC_ALL, '')
_ = gettext.gettext
class Detector(Semiconductor):
"""
The Optoelectronic Detector data model contains the attributes and methods
of an Optoelectronic Detector component. The attributes of an
Optoelectronic Detector are:
:cvar list _lst_lambdab: list of base hazard rates
:cvar list _lst_piE: list of operating environment pi factors
:cvar int subcategory: default value: 22
:ivar int type: default value: 0
Covers specification MIL-S-19500.
Hazard Rate Models:
# MIL-HDBK-217F, section 6.11.
"""
def set_attributes(self, values):
"""
Method to set the Thyristor data model attributes.
:param tuple values: tuple of values to assign to the instance
attributes.
:return: (_code, _msg); the error code and error message.
:rtype: tuple
"""
_code = 0
_msg = ''
(_code, _msg) = Semiconductor.set_attributes(self, values)
try:
self.piR = float(values[101])
self.piS = float(values[102])
except IndexError as _err:
_code = Utilities.error_handler(_err.args)
_msg = "ERROR: Insufficient input values."
except(TypeError, ValueError) as _err:
_code = Utilities.error_handler(_err.args)
_msg = "ERROR: Converting one or more inputs to correct data type."
return(_code, _msg)