How to use the fmpy.ssp.ssd.read_ssd function in FMPy

To help you get started, we’ve selected a few FMPy 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 CATIA-Systems / FMPy / tests / test_ssp.py View on Github external
def test_SampleSystemSubSystemDictionary(self):
        filename = self.ssp_example_path('SampleSystemSubSystemDictionary.ssp')
        ssd = read_ssd(filename)
        self.assertEqual(ssd.name, 'Simple System with SubSystem and Dictionary')

        # parameter bindings from .ssv file
        parameter_binding = ssd.system.parameterBindings[0]
        self.assertEqual('SubSystem.', parameter_binding.prefix)
        self.assertEqual('application/x-ssp-parameter-set', parameter_binding.type)

        p1, p2, p3 = parameter_binding.parameterValues[0].parameters
        self.assertEqual(('FirstFMUInstance1.Gain_Gain', 'Real', '8.0'), (p1.name, p1.type, p1.value))
        self.assertEqual(('FirstFMUInstance2.Gain_Gain', 'Real', '3.0'), (p2.name, p2.type, p2.value))
        self.assertEqual(('FirstFMUInstance2.Gain1_Gain', 'Real', '18.0'), (p3.name, p3.type, p3.value))

        # signal dictionary from .sss file
        signal_dictionary = ssd.system.signalDictionaries[0]
        self.assertEqual('MyDictionary', signal_dictionary.name)
        self.assertEqual('resources/SampleSignalDictionary.sss', signal_dictionary.source)
github CATIA-Systems / FMPy / tests / test_ssp.py View on Github external
def test_SampleSystemSubSystemDictionaryInline(self):
        filename = self.ssp_example_path('SampleSystemSubSystemDictionaryInline.ssp')
        ssd = read_ssd(filename)
        self.assertEqual(ssd.name, 'Simple System with SubSystem and Dictionary all inline')

        # inline parameter bindings
        parameter_binding = ssd.system.parameterBindings[0]
        self.assertEqual('SubSystem.', parameter_binding.prefix)
        self.assertEqual('application/x-ssp-parameter-set', parameter_binding.type)

        p1, p2, p3 = parameter_binding.parameterValues[0].parameters
        self.assertEqual(('FirstFMUInstance1.Gain_Gain', 'Real', '8.0'), (p1.name, p1.type, p1.value))
        self.assertEqual(('FirstFMUInstance2.Gain_Gain', 'Real', '3.0'), (p2.name, p2.type, p2.value))
        self.assertEqual(('FirstFMUInstance2.Gain1_Gain', 'Real', '18.0'), (p3.name, p3.type, p3.value))

        # inline signal dictionary
        signal_dictionary = ssd.system.signalDictionaries[0]
        self.assertEqual('MyDictionary', signal_dictionary.name)
        self.assertEqual('application/x-ssp-signal-dictionary', signal_dictionary.type)
github CATIA-Systems / FMPy / tests / test_ssp.py View on Github external
def test_SampleSystemSubSystemParamConnectors(self):
        filename = self.ssp_example_path('SampleSystemSubSystemParamConnectors.ssp')
        ssd = read_ssd(filename)
        self.assertEqual(ssd.name, 'Simple System with SubSystem and Dictionary all inline, and parameter connectors')
github CATIA-Systems / FMPy / tests / test_ssp.py View on Github external
def test_read_ssd_with_referenced_signal_dictionary(self):
        filename = self.ssp_example_path('SampleSystemSubSystemDictionary.ssp')
        ssd = read_ssd(filename)
        self.assertEqual(ssd.name, 'Simple System with SubSystem and Dictionary')
        self.assertEqual(1, len(ssd.system.elements[2].elements[0].parameterBindings))
github CATIA-Systems / FMPy / tests / test_ssp.py View on Github external
def test_read_ssd_with_inlined_signal_dictionary(self):
        filename = self.ssp_example_path('SampleSystemSubSystemDictionaryInline.ssp')
        ssd = read_ssd(filename)
        self.assertEqual(ssd.name, 'Simple System with SubSystem and Dictionary all inline')
github CATIA-Systems / FMPy / tests / test_ssp.py View on Github external
def test_SampleSystemSubSystemReuseNested(self):
        filename = self.ssp_example_path('SampleSystemSubSystemReuseNested.ssp')
        ssd = read_ssd(filename)
        self.assertEqual(ssd.name, 'Simple System with SubSystem and External Reuse')
github CATIA-Systems / FMPy / tests / test_ssp.py View on Github external
def test_SampleSystemSubSystemReuse(self):
        filename = self.ssp_example_path('SampleSystemSubSystemReuse.ssp')
        ssd = read_ssd(filename)
        self.assertEqual(ssd.name, 'Simple System with SubSystem and Reuse')
github CATIA-Systems / FMPy / tests / test_ssp.py View on Github external
def test_SampleSystemVariants(self):
        filename = self.ssp_example_path('SampleSystemVariants.ssp')
        ssd = read_ssd(filename)
        self.assertEqual(ssd.name, 'Simple Sample System')
github CATIA-Systems / FMPy / tests / test_ssp.py View on Github external
def test_SubSystem(self):
        filename = self.ssp_example_path('SubSystem.ssp')
        ssd = read_ssd(filename)
        self.assertEqual(ssd.name, 'Subsystem for External Reuse')
github CATIA-Systems / FMPy / fmpy / ssp / simulation.py View on Github external
def simulate_ssp(ssp_filename, start_time=0.0, stop_time=None, step_size=None, parameter_set=None, input={}):
    """ Simulate a system of FMUs """

    if stop_time is None:
        stop_time = 1.0

    if step_size is None:
        step_size = stop_time * 1e-2

    ssd = read_ssd(ssp_filename)

    add_path(ssd.system)

    components = find_components(ssd.system)
    connectors = find_connectors(ssd.system)
    connections = get_connections(ssd.system)

    # resolve connections
    connections_reversed = {}

    for a, b in connections:
        connections_reversed[b] = a

    new_connections = []

    # trace connections back to the actual start connector