How to use the hardware.component.Component.Model function in hardware

To help you get started, we’ve selected a few hardware examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ReliaQualAssociates / ramstk / tests / unit / TestHardwareComponent.py View on Github external
def setUp(self):
        """
        Setup the test fixture for the Component class.
        """

        _database = '/home/andrew/projects/RTKTestDB.rtk'
        self._dao = _dao(_database)

        self.DUT = Model()

        self._base_values = (0, 32, 'Alt Part #', 'Attachments', 'CAGE Code',
                             'Comp Ref Des', 0.0, 0.0, 0.0, 'Description',
                             100.0, 0, 0, 'Figure #', 50.0, 'LCN', 1, 0, 10.0,
                             'Name', 'NSN', 0, 'Page #', 0, 0, 'Part #', 1,
                             'Ref Des', 1.0, 0, 'Remarks', 0.0, 'Spec #', 0,
                             30.0, 30.0, 0.0, 2014)
        self._stress_values = (1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0,
                               1.0, 0.0, 1.0)
        self._rel_values = (0.0, 1.0, 1.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0,
                            0.0, 0.0, 1, 0.0, '', 0.0, 0.0, 0.0, 1, 0.0, 0.0,
                            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0,
                            1.0, 1.0, 0.0, 0.0, 0)
        self._user_values = (0.0, 1.0, 2.0, 30.0, 440.0, 5, 6, 7.0, 8.0, 99.0,
                             10.0, 11, 12, 13.0, 14, 15.0, 16.0, 17.0, 18,
                             19.0, 0.0, 1.0, 2, 3, 440.0, 50, 60, 7.0, 80.0,
github ReliaQualAssociates / ramstk / tests / unit / TestHardwareComponent.py View on Github external
def test_create(self):
        """
        (TestComponent) __init__ should return an Component model
        """

        self.assertTrue(isinstance(self.DUT, Model))

        # Properly sources the Hardware class.
        self.assertEqual(self.DUT.revision_id, None)

        # Scalar values are correct.
        self.assertEqual(self.DUT.category_id, 0)
        self.assertEqual(self.DUT.subcategory_id, 0)
        self.assertEqual(self.DUT.junction_temperature, 0.0)
        self.assertEqual(self.DUT.knee_temperature, 30.0)
        self.assertEqual(self.DUT.thermal_resistance, 0.0)
        self.assertEqual(self.DUT.reference_temperature, 30.0)
github ReliaQualAssociates / ramstk / rtk / hardware / BoM.py View on Github external
def load_component(self, attributes):
        """
        Method to load the correct Component based on the category and
        subcategory ID's.

        :param tuple attributes: the attributes of the component to load.
        :return: an instance of the appropriate Component class.
        :rtype: object
        """
        # TODO: Consider refactoring load_component; current McCabe Complexity metric = 12.
        # Select the correct component type and create an instance of it's
        # data model.
        if attributes[90] < 1 or attributes[91] < 1:
            _component = Component()
        elif attributes[90] == 1:
            _component = load_capacitor(attributes[91])
        elif attributes[90] == 2:
            _component = load_connection(attributes[91])
        elif attributes[90] == 3:
            _component = load_inductor(attributes[91])
        elif attributes[90] == 4:
            _component = load_integrated_circuit(attributes[91])
        elif attributes[90] == 5:
            _component = load_meter(attributes[91])
        elif attributes[90] == 6:
            _component = load_miscellaneous(attributes[91])
        elif attributes[90] == 7:
            _component = load_relay(attributes[91])
        elif attributes[90] == 8:
            _component = load_resistor(attributes[91])
github ReliaQualAssociates / ramstk / rtk / hardware / component / miscellaneous / Filter.py View on Github external
__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 Filter(Component):
    """
    The Filter data model contains the attributes and methods of a Filter
    component.  The attributes of an Filter are:

    :cvar int category: the Component category.
    :cvar int subcategory: the Component subcategory.

    :ivar int quality: the MIL-HDBK-217FN2 quality list index.
    :ivar int specification: the specification list index.
    :ivar int style: the style list index.
    :ivar float q_override: the user-defined quality factor.
    :ivar float base_hr: the MIL-HDBK-217FN2 base/generic hazard rate.
    :ivar float piQ: the MIL-HDBK-217FN2 quality factor.
    :ivar float piE: the MIL-HDBK-217FN2 operating environment factor.
    :ivar str reason: the reason(s) the Filter is overstressed.
github ReliaQualAssociates / ramstk / rtk / hardware / component / resistor / Resistor.py View on Github external
__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 Model(Component):
    """
    The Resistor data model contains the attributes and methods of a Resistor
    component.  The attributes of a Resistor are:

    :cvar int category: default value: 3

    :ivar int quality: the MIL-HDBK-217FN2 quality level.
    :ivar float q_override: the user-supplied quality factor.
    :ivar float resistance: the resistance (in ohms) of the resistor.
    :ivar float base_hr: the MIL-HDBK-217FN2 base hazard rate.
    :ivar float piQ: the MIL-HDBK-217FN2 quality factor.
    :ivar float piE: the MIL-HDBK-217FN2 operating environment factor.
    :ivar float piR: the MIL-HDBK-217FN2 resistance factor.
    :ivar str reason: default value: ""

    Hazard Rate Models:
github ReliaQualAssociates / ramstk / rtk / hardware / component / relay / Relay.py View on Github external
__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 Model(Component):
    """
    The Relay data model contains the attributes and methods of a Relay
    component.  The attributes of a Relay are:

    :cvar int category: default value: 6

    :ivar int quality: the index for the MIL-HDBK-217FN2 quality level.
    :ivar int construction: the index for the MIL-HDBK-217FN2 construction.
    :ivar float q_override: the user-defined quality factor.
    :ivar float base_hr: the MIL-HDBK-217FN2 base/generic hazard rate.
    :ivar float piQ: the MIL-HDBK-217FN2 quality factor.
    :ivar float piE: the MIL-HDBK-217FN2 operating environment factor.
    :ivar str reason: the reason(s) the Relay is over-stressed.

    Hazard Rate Models:
        # MIL-HDBK-217FN2, section 13.
github ReliaQualAssociates / ramstk / rtk / hardware / component / connection / Connection.py View on Github external
__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 Model(Component):
    """
    The Connection data model contains the attributes and methods of a
    connection component.  The attributes of a Connection are:

    :cvar int category: the Component category of a Connection.

    :ivar float base_hr: the MIL-HDBK-217FN2 base/generic hazard rate.
    :ivar str reason: the reason(s) the connection is overstressed.
    :ivar float piE: the MIL-HDBK-217FN2 operating environment factor.

    Hazard Rate Models:
        # MIL-HDBK-217FN2, sections 15, 16, and 17.
    """

    category = 8
github ReliaQualAssociates / ramstk / rtk / hardware / component / miscellaneous / Lamp.py View on Github external
__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 Lamp(Component):
    """
    The Lamp data model contains the attributes and methods of a Lamp
    component.  The attributes of an Lamp are:

    :cvar int category: the Component category.
    :cvar int subcategory: the Component subcategory.

    :ivar int application: the MIL-HDBK-217FN2 application list index.
    :ivar float illuminate_hours: the MIL-HDBK-217FN2 mission illumination
                                  hours.
    :ivar float operate_hours: the MIL-HDBK-217FN2 mission hours.
    :ivar float base_hr: the MIL-HDBK-217FN2 base/generic hazard rate.
    :ivar float piU: the MIL-HDBK-217FN2 utilization factor.
    :ivar float piA: the MIL-HDBK-217FN2 application factor.
    :ivar float piE: the MIL-HDBK-217FN2 operating environment factor.
    :ivar str reason: the reason(s) the lamp is overstressed.