1'''
2Temperature_RTD - RTD_read_channel_status.py with synchronous mode.
3
4This example demonstrates how to get status in two channels from USBDAQF1RD.
5
6First, it shows how to open thermal port
7Second, get status from channel 0 and channel 1
8Last, close thermal port.
9
10-------------------------------------------------------------------------------------
11Please change correct serial number or IP and port number BEFORE you run example code.
12
13For other examples please check:
14 https://github.com/WPC-Systems-Ltd/WPC_Python_driver_release/tree/main/examples
15See README.md file to get detailed usage of this example.
16
17Copyright (c) 2022-2025 WPC Systems Ltd. All rights reserved.
18'''
19
20## WPC
21from wpcsys import pywpc
22
23
24def main():
25 ## Get Python driver version
26 print(f'{pywpc.PKG_FULL_NAME} - Version {pywpc.__version__}')
27
28 ## Get Python driver version
29 print(f'{pywpc.PKG_FULL_NAME} - Version {pywpc.__version__}')
30
31 ## Create device handle
32 dev = pywpc.USBDAQF1RD()
33
34 ## Connect to device
35 try:
36 dev.connect("default") ## Depend on your device
37 except Exception as err:
38 pywpc.printGenericError(err)
39 ## Release device handle
40 dev.close()
41 return
42
43 try:
44 ## Parameters setting
45 port = 1 ## Depend on your device
46 ch0 = 0
47 ch1 = 1
48 timeout = 3 ## [sec]
49
50 ## Get firmware model & version
51 driver_info = dev.Sys_getDriverInfo(timeout)
52 print(f"Model name: {driver_info[0]}, Firmware version: {driver_info[-1]} ")
53
54 ## Open RTD
55 err = dev.Thermal_open(port, timeout)
56 print(f"Thermal_open in port {port}, status: {err}")
57
58 ## Set RTD port and get status in channel 0
59 status = dev.Thermal_getStatus(port, ch0, timeout)
60 print(f"Thermal_getStatus in channel {ch0} status: {status}")
61
62 ## Set RTD port and get status in channel 1
63 status = dev.Thermal_getStatus(port, ch1, timeout)
64 print(f"Thermal_getStatus in channel {ch1} status: {status}")
65
66 ## Close RTD
67 err = dev.Thermal_close(port, timeout)
68 print(f"Thermal_close in port {port}, status: {err}")
69 except Exception as err:
70 pywpc.printGenericError(err)
71
72 finally:
73 ## Disconnect device
74 dev.disconnect()
75
76 ## Release device handle
77 dev.close()
78
79
80if __name__ == '__main__':
81 main()