+3 votes
544 views
in Test Automation by Christian Engst (18 points)

Hi!

Been pondering on this issue for some time now with our automated software team.
Our setup has both HIL600 and HIL606 connected.
Most of the automated tests are using models dedicated to HIL606, but some are developed for HIL600. Both v2020.3 (supporting HIL600) and v2024.1 (supporting HIL606) Typhoon HIL Control Center pieces of software work as intended and detect respective HILs in Device manager.
We haven't been able to utilize API for HIL600. The problem with

detect_hw_settings()

method is that it always returns

  Hardware settings: ['HIL606', 3, 1]

and so the automated script only connects to the HIL606.
Do you have any other approach in connecting to HIL device defined within v2020.3's integrated API version?

Thanks!

1 Answer

+3 votes
by Ivan Morar (63 points)
selected by Christian Engst
 
Best answer
Hello Christian,

Do you have both HIL devices connected to the same PC?
by Christian Engst (18 points)
+2
Yes, I have a screenshot of Device Manager from Typhoon HIL Control Center 2020.3 and Typhoon HIL Control Center 2024.1 where, respectively, HIL600 and HIL606 are connected.
by Ivan Morar (63 points)
+2
If they are both connected with a USB, than there is no option for selection which device you would like to use.
detect_hw_settings() will just return one of these two devices and its random which one will be returned.
The best way would be to have both HIL devices connected with ethernet and than use device manager API, but I think 2020.3 is not supporting it.
by Christian Engst (18 points)
+1
Hi Ivan,

Would it be possible to have HIL600 connected via USB and HIL606 connected via Ethernet and be sure that detect_hw_settings() will detect HIL600?

Also, what changes in terms of usage via TyphoonHILControlCenter or API for HIL606 when using Ethernet compared what we have now?

Thanks!
by Ivan Morar (63 points)
+1
When USB is used, than HIL devices on the network will not be visible on that PC. So in this case only HIL600 would be visible.
If you had some new-er device instead of HIL600, than you could have both of them on the Ethernet and select through API which you want to use in the tests.

So solution would be ether to use two PC which are executing tests (one on each device), or to have smart power switch which you could use to turn on/off (select) HIL device which you want to use.

To me, the first option would be better choice.
by Christian Engst (18 points)
Hi Ivan,


Apologies for the delay.

We have set up the power switch for when we are intending to test on HIL600, which will turn off the HIL606 device.
However, method:
detect_hw_settings()
in this case, returns:
Autodetection failed. Hardware unit malfunctioned or its not connected to computer.

It was my understanding that, since both devices are connected via USB, now, the HIL600 would be available.

Please let me know if our assumption was incorrect or what is the alternative solution.


Thank you!
by Christian Engst (18 points)
+1
Morning Ivan,

I am posting additional information from the debugging process:


>>> model.set_model_property_value("hil_device", 'HIL606')
>>> model.set_model_property_value("hil_device", 'HIL604')
>>> model.set_model_property_value("hil_device", 'HIL600')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\cobsys0004\AppData\Roaming\typhoon\2020.3\python_portables\python3_portable\lib\site-packages\typhoon\api\schematic_editor\__init__.py", line 560, in set_model_property_value
    return clstub().set_model_property_value(prop_code_name=prop_code_name,
  File "C:\Users\cobsys0004\AppData\Roaming\typhoon\2020.3\python_portables\python3_portable\lib\site-packages\typhoon\api\common\__init__.py", line 140, in func_wrapper
    return func(*args, **kwargs)
  File "C:\Users\cobsys0004\AppData\Roaming\typhoon\2020.3\python_portables\python3_portable\lib\site-packages\typhoon\api\schematic_editor\stub.py", line 120, in wrapper
    raise SchApiException(err_msg,
typhoon.api.schematic_editor.exception.SchApiException: Change of model configuration failed due to ''HIL600''.
by Ivan Morar (63 points)
+1
Hi Christian,

I see from the log that you are targeting the correct Python which is great.

However set model property still fails, which could mean that active THCC is the newer one v2024.1.
Maybe you still have some process active in the windows device manager.

Could you try to close all typhoon_hil.exe processes, start THCC 2020.3 and try to call set_model_property_value() again?

This is the same issue as you said in previous post for detect_hw_settings().
by Christian Engst (18 points)
Hi Ivan!


You are correct, starting the THCC 2020.3 before starting the script did help and now it correctly detects:
>>>['HIL600',2,3]

However, without this step, the script is using the 2024.1 installation even though the correct Python version is used, as you pointed.
I suspect this is due to PATH variable settings where they are ordered as first 2024.1 and then 2020.3.

How can we automatize the process of selecting the HIL600 device?


Best regards!
by Christian Engst (18 points)
reshown by Christian Engst
+1
I feel like I have to explain the solution we have implemented.

Just like guys pointed in the other answer, there was a need to control the power of devices in order to achieve compatibility of automation with two generation of devices connected to PC.

Alongside this, there was a need to also force usage of desired API / Python installation / THCC installation because by default automated testing framework always selects the first location in the PATH.
To prevent this, explicit command to add THCC 2020.3 location of python_portable of site-packages was used, which you can adjust to your environment:

TYMPHON_HIL_2020_3 = "C:\\Users\\cobsys0004\\AppData\\Roaming\\typhoon\\2020.3\\python_portables\\python3_portable\\Lib\\site-packages"
env.PATH = "${TYMPHON_HIL_2020_3};${env.PATH}"
                        

After this setup, the desired version of API is correctly selected.
by Ivan Morar (63 points)
Similar to this, to start proper version of thcc you would need to ether modify path variable to have desired thcc first in the list. For example having this path specified first:
C:\Program Files\Typhoon HIL Control Center 2024.4\bin\
would start THCC version 2024.4.

In this bin folder you can also find typhoon-python.cmd, which would execute proper python for this installation.

To me the best solution would be to have some cmd script which would change the path and execute tests.

Other solution would be to, again through some cmd script, to execute first proper version of THCC, which will assure that proper version is selected, and than run the Python like you are already doing right now.
...