+1 vote
572 views
in Test Automation by Wojciech Prochwicz (13 points)
Hi all,

I am going to use the start_capture() and stop_capture() functions from the Typhoon HIL API 1.30.0 and Typhoon Control Center 2023.3. Based on the code examples from documentation I prepared a small test to verify if it works as expected and got the following error:

    def recv_time_data(socket, flags=0, copy=False, track=True):

        """recv a numpy array or a dict with a numpy array and scalars"""

        # first receive a metadata as json

        md = socket.recv_json(flags=flags)

        print(md)

        # time data are sent as dictionary

>       if md["time_data_type"] == "dict":

           ^^^^^^^^^^^^^^^^^^^^

E       KeyError: 'time_data_type'

.venv\Lib\site-packages\typhoon\api\hil\stub.py:56: KeyError

I printed the md structure and it shows the following data:

[WARNING] [CAPTURE MESSAGE] stop_capture() will be ignored since desired number of samples are already captured!

{'dtype': 'float64', 'shape': [100000]}

so it is right that the key  "time_data_type" does not exist.

Is this a bug in the HiL API or incompability issue?

After replacing the key: 'time_data_type' with 'dtype' it works as expected.

The code snipped I used for testing:

def test_typhoon_recorder():

    import typhoon.api.hil as typhoon_hil

    import time

    trigger_settings = ["Forced"]

    timeout = 2

    capture_settings = [10, 2, 1e5]

    channel_settings = [["TestOC.IaOCTest",

                        "TestOC.IcOCTest"], []]

    buffer = []

    typhoon_hil.set_text_mode(typhoon_hil.RM_SYSTEM)

    typhoon_hil.load_model(MODEL_NAME)

    typhoon_hil.load_settings_file(RUNX_SETTINGS)

    typhoon_hil.start_simulation()

    time.sleep(2)

    typhoon_hil.start_capture(

        capture_settings,

        trigger_settings,

        channel_settings,

        dataBuffer=buffer,

        timeout=timeout,

    )

    time.sleep(2)

    typhoon_hil.stop_capture()

    print(buffer)

    typhoon_hil.stop_simulation()

1 Answer

+2 votes
by Aleksandar Lakic (62 points)

Hi Wojciech,

can you reproduce the same issue when latest SW  version is used
(THCC 2025.2) ?

Welcome to the Typhoon HIL user forum. Please check self-service support resources before posting a question.

HIL Specialist 2.0 courses
Documentation
Knowledgebase (Legacy)
Video support on demand
Youtube tutorials

For subscription-based support visit Typhoon HIL Support Center
...