Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elif self.hazard_rate_type == 2:
self.hazard_rate_model['equation'] = 'lambdab * piQ * piE'
# Base hazard rate.
_stress = (self.operating_voltage + self.acvapplied) / \
self.rated_voltage
try:
self.hazard_rate_model['lambdab'] = \
0.00000192 * ((_stress / 0.33)**3 + 1) * \
exp(10.8 * ((self.temperature_active + 273) /
self.reference_temperature))
except(OverflowError, ZeroDivisionError):
# TODO: Handle overflow error.
return True
return Capacitor.calculate_part(self)
__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 AirTrimmer(Capacitor):
"""
The Variable Air Trimmer capacitor data model contains the attributes and
methods of a variable air trimmer capacitor. The attributes of a variable
air trimmer capacitor are:
:cvar list _lst_piE: list of MIL-HDBK-217FN2 operating environment factor
values.
:cvar list _lst_piQ: list of MIL-HDBK-217FN2 quality factor values.
:cvar list _lst_lambdab_count: list of base hazard rate values for the
MIL-HDBK-217FN2 parts count method.
:cvar int subcategory: the subcategory ID in the RTK common database.
:ivar int specification: default value: 0
:ivar int spec_sheet: default value: 0
Covers specification MIL-C-92.
elif _srcf < 0.6 and _srcf >= 0.4:
self.piSR = 0.13
elif _srcf < 0.4 and _srcf >= 0.2:
self.piSR = 0.20
elif _srcf < 0.2 and _srcf >= 0.1:
self.piSR = 0.27
elif _srcf < 0.1 and _srcf >= 0.0:
self.piSR = 0.33
else:
self.piSR = 0.33
self.hazard_rate_model['piSR'] = self.piSR
return Capacitor.calculate_part(self)
class NonSolid(Capacitor):
"""
Fixed Non-Solid Tantalum Electrolytic Capacitor Component Class.
Covers specifications MIL-C-3965 and MIL-C-39006.
Hazard Rate Models:
# MIL-HDBK-217F, section 10.13
"""
# MIL-HDK-217F hazard rate calculation variables.
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
_piC = [0.3, 1.0, 2.0, 2.5, 3.0]
_piE = [1.0, 2.0, 10.0, 6.0, 16.0, 4.0, 8.0, 14.0, 30.0, 23.0, 0.5, 13.0,
34.0, 610.0]
_piQ = [0.03, 0.1, 0.3, 1.0, 1.5, 3.0, 10.0]
_lambdab_count = [0.0061, 0.013, 0.069, 0.039, 0.11, 0.031, 0.061, 0.13,
def set_attributes(self, values):
"""
Method to set the Non-Solid Tantalum capacitor 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) = Capacitor.set_attributes(self, values[:138])
try:
self.construction = int(values[138])
self.piC = float(values[139])
except IndexError as _err:
_code = Utilities.error_handler(_err.args)
_msg = "ERROR: Insufficient input values."
except TypeError as _err:
_code = Utilities.error_handler(_err.args)
_msg = "ERROR: Converting one or more inputs to correct data type."
return(_code, _msg)
# Base hazard rate.
_stress = (self.operating_voltage + self.acvapplied) / \
self.rated_voltage
try:
self.hazard_rate_model['lambdab'] = \
0.00000192 * ((_stress / 0.33)**3 + 1) * \
exp(10.8 * ((self.temperature_active + 273) /
self.reference_temperature))
except(OverflowError, ZeroDivisionError):
# TODO: Handle overflow error.
return True
return Capacitor.calculate_part(self)
class Ceramic(Capacitor):
"""
The Variable Ceramic capacitor data model contains the attributes and
methods of a variable ceramic capacitor. The attributes of a variable
ceramic capacitor are:
:cvar list _lst_piE: list of MIL-HDBK-217FN2 operating environment factor
values.
:cvar list _lst_piQ: list of MIL-HDBK-217FN2 quality factor values.
:cvar list _lst_lambdab_count: list of base hazard rate values for the
MIL-HDBK-217FN2 parts count method.
:cvar int subcategory: the subcategory ID in the RTK common database.
:ivar int specification: default value: 0
:ivar int spec_sheet: default value: 0
Covers specification MIL-C-81.
_stress = (self.operating_voltage + self.acvapplied) / \
self.rated_voltage
try:
self.hazard_rate_model['lambdab'] = \
0.00069 * ((_stress / 0.4)**5 + 1) * \
exp(2.5 * ((self.temperature_active + 273) /
self.reference_temperature)**18)
except(OverflowError, ZeroDivisionError):
# TODO: Handle overflow error.
return True
# Capacitance correction factor.
self.piCV = 1.2 * (self.capacitance * 1000000.0)**0.092
self.hazard_rate_model['piCV'] = self.piCV
return Capacitor.calculate_part(self)
self.hazard_rate_model['lambdab'] = \
0.00086 * ((_stress / 0.4)**5 + 1) * \
exp(2.5 * ((self.temperature_active + 273) /
self.reference_temperature)**18)
except(OverflowError, ZeroDivisionError):
# TODO: Handle overflow and zero division errors.
return True
# Capacitance correction factor.
self.piCV = 1.2 * (self.capacitance * 1000000.0)**0.095
self.hazard_rate_model['piCV'] = self.piCV
return Capacitor.calculate_part(self)
class Feedthrough(Capacitor):
"""
The Paper, Fixed, Feedthrough capacitor data model contains the attributes
and methods of a fixed paper feedthrough capacitor. The attributes of a
fixed paper feedthrough capacitor are:
:cvar list _lst_piE: list of MIL-HDBK-217FN2 operating environment factor
values.
:cvar list _lst_piQ: list of MIL-HDBK-217FN2 quality factor values.
:cvar list _lst_lambdab_count: list of base hazard rate values for the
MIL-HDBK-217FN2 parts count method.
:cvar int subcategory: default value: 41
:ivar int specification: default value: 0
:ivar int spec_sheet: default value: 0
Covers specification MIL-C-11693.
self.hazard_rate_model['lambdab'] = \
0.0028 * ((_stress / 0.55)**3 + 1) * \
exp(4.09 * ((self.temperature_active + 273) /
self.reference_temperature)**5.9)
except(OverflowError, ZeroDivisionError):
# TODO: Handle overflow and zero division errors.
return True
# Capacitance correction factor.
self.piCV = 0.34 * (self.capacitance * 1000000.0)**0.18
self.hazard_rate_model['piCV'] = self.piCV
return Capacitor.calculate_part(self)
class Wet(Capacitor):
"""
The wet aluminum electrolytic capacitor data model contains the
attributes and methods of a wet aluminum electrolytic capacitor. The
attributes of a wet aluminum electrolytic capacitor are:
Covers specifications MIL-C-3965 and MIL-C-39006.
Hazard Rate Models:
# MIL-HDBK-217F, section 10.13
"""
# MIL-HDK-217F hazard rate calculation variables.
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
_piE = [1.0, 2.0, 12.0, 6.0, 17.0, 10.0, 12.0, 28.0, 35.0, 27.0, 0.5, 14.0,
38.0, 690.0]
_piQ = [0.03, 0.1, 0.3, 1.0, 3.0, 10.0]
self.hazard_rate_model['lambdab'] = \
0.00099 * ((_stress / 0.4)**5 + 1) * \
exp(2.5 * ((self.temperature_active + 273) /
self.reference_temperature)**18)
except(OverflowError, ZeroDivisionError):
# TODO: Handle overflow error.
return True
# Capacitance correction factor.
self.piCV = 1.1 * (self.capacitance * 1000000.0)**0.085
self.hazard_rate_model['piCV'] = self.piCV
return Capacitor.calculate_part(self)
class SuperMetallized(Capacitor):
"""
The Super-Metallized Plastic capacitor data model contains the attributes
and methods of a super-metallized plastic capacitor. The attributes of a
super-metallized plastic capacitor are:
:cvar list _lst_piE: list of MIL-HDBK-217FN2 operating environment factor
values.
:cvar list _lst_piQ: list of MIL-HDBK-217FN2 quality factor values.
:cvar list _lst_lambdab_count: list of base hazard rate values for the
MIL-HDBK-217FN2 parts count method.
:cvar int subcategory: the subcategory ID in the RTK common database.
:ivar int specification: default value: 0
:ivar int spec_sheet: default value: 0
Covers specifications MIL-C-83421.