keithley-tempcontrol 0.16.14__py3-none-any.whl → 0.17.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- egse/tempcontrol/keithley/daq6510_cs.py +12 -0
- egse/tempcontrol/keithley/daq6510_dev.py +21 -15
- egse/tempcontrol/keithley/daq6510_mon.py +1 -1
- egse/tempcontrol/keithley/daq6510_sim.py +17 -16
- keithley_tempcontrol/cgse_services.py +0 -1
- keithley_tempcontrol/settings.yaml +2 -0
- {keithley_tempcontrol-0.16.14.dist-info → keithley_tempcontrol-0.17.1.dist-info}/METADATA +1 -1
- keithley_tempcontrol-0.17.1.dist-info/RECORD +18 -0
- keithley_tempcontrol-0.16.14.dist-info/RECORD +0 -18
- {keithley_tempcontrol-0.16.14.dist-info → keithley_tempcontrol-0.17.1.dist-info}/WHEEL +0 -0
- {keithley_tempcontrol-0.16.14.dist-info → keithley_tempcontrol-0.17.1.dist-info}/entry_points.txt +0 -0
|
@@ -165,6 +165,10 @@ def start():
|
|
|
165
165
|
multiprocessing.current_process().name = "daq6510_cs (start)"
|
|
166
166
|
|
|
167
167
|
with remote_logging():
|
|
168
|
+
from egse.env import setup_env
|
|
169
|
+
|
|
170
|
+
setup_env()
|
|
171
|
+
|
|
168
172
|
try:
|
|
169
173
|
control_server = DAQ6510ControlServer()
|
|
170
174
|
control_server.serve()
|
|
@@ -194,6 +198,10 @@ def stop():
|
|
|
194
198
|
|
|
195
199
|
multiprocessing.current_process().name = "daq6510_cs (stop)"
|
|
196
200
|
|
|
201
|
+
from egse.env import setup_env
|
|
202
|
+
|
|
203
|
+
setup_env()
|
|
204
|
+
|
|
197
205
|
try:
|
|
198
206
|
with DAQ6510Proxy() as daq:
|
|
199
207
|
sp = daq.get_service_proxy()
|
|
@@ -210,6 +218,10 @@ def status():
|
|
|
210
218
|
|
|
211
219
|
multiprocessing.current_process().name = "daq6510_cs (status)"
|
|
212
220
|
|
|
221
|
+
from egse.env import setup_env
|
|
222
|
+
|
|
223
|
+
setup_env()
|
|
224
|
+
|
|
213
225
|
endpoint = get_endpoint(SERVICE_TYPE, PROTOCOL, HOSTNAME, COMMANDING_PORT)
|
|
214
226
|
|
|
215
227
|
if is_control_server_active(endpoint):
|
|
@@ -23,6 +23,9 @@ DEV_HOST = dev_settings.get("HOSTNAME")
|
|
|
23
23
|
DEV_PORT = dev_settings.get("PORT")
|
|
24
24
|
READ_TIMEOUT = dev_settings.get("TIMEOUT") # [s], can be smaller than timeout (for DAQ6510Proxy) (e.g. 1s)
|
|
25
25
|
|
|
26
|
+
SEPARATOR = b"\n"
|
|
27
|
+
SEPARATOR_STR = SEPARATOR.decode()
|
|
28
|
+
|
|
26
29
|
|
|
27
30
|
class DAQ6510Command(ClientServerCommand):
|
|
28
31
|
def get_cmd_string(self, *args, **kwargs) -> str:
|
|
@@ -36,7 +39,7 @@ class DAQ6510Command(ClientServerCommand):
|
|
|
36
39
|
"""
|
|
37
40
|
|
|
38
41
|
out = super().get_cmd_string(*args, **kwargs)
|
|
39
|
-
return out +
|
|
42
|
+
return out + SEPARATOR_STR
|
|
40
43
|
|
|
41
44
|
|
|
42
45
|
class DAQ6510(DeviceInterface, DeviceTransport):
|
|
@@ -59,7 +62,7 @@ class DAQ6510(DeviceInterface, DeviceTransport):
|
|
|
59
62
|
|
|
60
63
|
self._is_connection_open = False
|
|
61
64
|
|
|
62
|
-
def initialize(self, commands: list[tuple[str, bool]] = None, reset_device: bool = False):
|
|
65
|
+
def initialize(self, commands: list[tuple[str, bool]] = None, reset_device: bool = False) -> list[str | None]:
|
|
63
66
|
"""Initialize the device with optional reset and command sequence.
|
|
64
67
|
|
|
65
68
|
Performs device initialization by optionally resetting the device and then
|
|
@@ -74,21 +77,25 @@ class DAQ6510(DeviceInterface, DeviceTransport):
|
|
|
74
77
|
the command sequence. Defaults to False.
|
|
75
78
|
|
|
76
79
|
Returns:
|
|
77
|
-
None
|
|
80
|
+
Response for each of the commands, or None when no response was expected.
|
|
78
81
|
|
|
79
82
|
Raises:
|
|
80
83
|
Any exceptions raised by the underlying write() or trans() methods,
|
|
81
84
|
typically communication errors or device timeouts.
|
|
82
85
|
|
|
83
86
|
Example:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
responses = device.initialize(
|
|
88
|
+
[
|
|
89
|
+
("*IDN?", True), # Query device ID, expect response
|
|
90
|
+
("SYST:ERR?", True), # Check for errors, expect response
|
|
91
|
+
("OUTP ON", False) # Enable output, no response expected
|
|
92
|
+
],
|
|
93
|
+
reset_device=True
|
|
94
|
+
)
|
|
89
95
|
"""
|
|
90
96
|
|
|
91
97
|
commands = commands or []
|
|
98
|
+
responses = []
|
|
92
99
|
|
|
93
100
|
if reset_device:
|
|
94
101
|
logger.info(f"Resetting the {self.device_name}...")
|
|
@@ -103,6 +110,8 @@ class DAQ6510(DeviceInterface, DeviceTransport):
|
|
|
103
110
|
logger.debug(f"Sending {cmd}...")
|
|
104
111
|
self.write(cmd)
|
|
105
112
|
|
|
113
|
+
return responses
|
|
114
|
+
|
|
106
115
|
def is_simulator(self) -> bool:
|
|
107
116
|
return False
|
|
108
117
|
|
|
@@ -239,7 +248,7 @@ class DAQ6510(DeviceInterface, DeviceTransport):
|
|
|
239
248
|
"""
|
|
240
249
|
|
|
241
250
|
try:
|
|
242
|
-
command +=
|
|
251
|
+
command += SEPARATOR_STR if not command.endswith(SEPARATOR_STR) else ""
|
|
243
252
|
|
|
244
253
|
self._sock.sendall(command.encode())
|
|
245
254
|
|
|
@@ -254,7 +263,7 @@ class DAQ6510(DeviceInterface, DeviceTransport):
|
|
|
254
263
|
raise DeviceConnectionError(DEVICE_NAME, msg)
|
|
255
264
|
raise
|
|
256
265
|
|
|
257
|
-
def trans(self, command: str) ->
|
|
266
|
+
def trans(self, command: str) -> bytes:
|
|
258
267
|
"""Sends a single command to the device controller and block until a response from the controller.
|
|
259
268
|
|
|
260
269
|
This is seen as a transaction.
|
|
@@ -273,7 +282,7 @@ class DAQ6510(DeviceInterface, DeviceTransport):
|
|
|
273
282
|
try:
|
|
274
283
|
# Attempt to send the complete command
|
|
275
284
|
|
|
276
|
-
command +=
|
|
285
|
+
command += SEPARATOR_STR if not command.endswith(SEPARATOR_STR) else ""
|
|
277
286
|
|
|
278
287
|
self._sock.sendall(command.encode())
|
|
279
288
|
|
|
@@ -319,10 +328,7 @@ class DAQ6510(DeviceInterface, DeviceTransport):
|
|
|
319
328
|
break
|
|
320
329
|
except socket.timeout:
|
|
321
330
|
logger.warning(f"Socket timeout error for {self.hostname}:{self.port}")
|
|
322
|
-
return
|
|
323
|
-
except TimeoutError as exc:
|
|
324
|
-
logger.warning(f"Socket timeout error: {exc}")
|
|
325
|
-
return b"\r\n"
|
|
331
|
+
return SEPARATOR
|
|
326
332
|
finally:
|
|
327
333
|
self._sock.settimeout(saved_timeout)
|
|
328
334
|
|
|
@@ -399,7 +399,7 @@ class DAQ6510Monitor:
|
|
|
399
399
|
|
|
400
400
|
|
|
401
401
|
class DAQMonitorClient:
|
|
402
|
-
"""
|
|
402
|
+
"""A simple client for interacting with the DAQ Monitor Service."""
|
|
403
403
|
|
|
404
404
|
def __init__(self, server_address: str = "localhost", port: int = DAQ_MON_CMD_PORT, timeout: float = 5.0):
|
|
405
405
|
"""Initialize the client.
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
1
|
import contextlib
|
|
4
2
|
import datetime
|
|
5
|
-
import logging
|
|
6
3
|
import re
|
|
7
4
|
import socket
|
|
8
5
|
import time
|
|
6
|
+
from typing import Annotated
|
|
9
7
|
|
|
10
8
|
import typer
|
|
9
|
+
|
|
10
|
+
from egse.log import logging
|
|
11
11
|
from egse.settings import Settings
|
|
12
12
|
from egse.system import SignalCatcher
|
|
13
13
|
|
|
14
|
-
logger = logging.getLogger("daq6510-sim")
|
|
14
|
+
logger = logging.getLogger("egse.daq6510-sim")
|
|
15
15
|
|
|
16
16
|
HOST = "localhost"
|
|
17
17
|
DAQ_SETTINGS = Settings.load("Keithley DAQ6510")
|
|
18
18
|
|
|
19
|
+
SEPARATOR = b"\n"
|
|
20
|
+
SEPARATOR_STR = SEPARATOR.decode()
|
|
19
21
|
|
|
20
22
|
device_time = datetime.datetime.now(datetime.timezone.utc)
|
|
21
23
|
reference_time = device_time
|
|
@@ -79,7 +81,7 @@ COMMAND_PATTERNS_ACTIONS_RESPONSES = {
|
|
|
79
81
|
|
|
80
82
|
|
|
81
83
|
def write(conn, response: str):
|
|
82
|
-
response = f"{response}
|
|
84
|
+
response = f"{response}{SEPARATOR_STR}".encode()
|
|
83
85
|
logger.debug(f"write: {response = }")
|
|
84
86
|
conn.sendall(response)
|
|
85
87
|
|
|
@@ -196,7 +198,7 @@ def run_simulator():
|
|
|
196
198
|
logger.info(f"{exc.__class__.__name__} caught: {exc.args}")
|
|
197
199
|
|
|
198
200
|
|
|
199
|
-
def send_request(cmd: str,
|
|
201
|
+
def send_request(cmd: str, cmd_type: str = "query") -> str | None:
|
|
200
202
|
from egse.tempcontrol.keithley.daq6510_dev import DAQ6510
|
|
201
203
|
|
|
202
204
|
response = None
|
|
@@ -204,12 +206,12 @@ def send_request(cmd: str, type_: str = "query"):
|
|
|
204
206
|
daq_dev = DAQ6510(hostname="localhost", port=5025)
|
|
205
207
|
daq_dev.connect()
|
|
206
208
|
|
|
207
|
-
if
|
|
209
|
+
if cmd_type.lower().strip() == "query":
|
|
208
210
|
response = daq_dev.query(cmd)
|
|
209
|
-
elif
|
|
211
|
+
elif cmd_type.lower().strip() == "write":
|
|
210
212
|
daq_dev.write(cmd)
|
|
211
213
|
else:
|
|
212
|
-
logger.info(f"Unknown type {
|
|
214
|
+
logger.info(f"Unknown command type {cmd_type} for send_request.")
|
|
213
215
|
|
|
214
216
|
daq_dev.disconnect()
|
|
215
217
|
|
|
@@ -234,15 +236,14 @@ def stop():
|
|
|
234
236
|
|
|
235
237
|
|
|
236
238
|
@app.command()
|
|
237
|
-
def command(
|
|
238
|
-
|
|
239
|
+
def command(
|
|
240
|
+
cmd: str,
|
|
241
|
+
cmd_type: Annotated[str, typer.Argument(help="either 'write', 'query'")] = "query",
|
|
242
|
+
):
|
|
243
|
+
"""Send an SCPI command directly to the simulator. The response will be in the log info."""
|
|
244
|
+
response = send_request(cmd, cmd_type)
|
|
239
245
|
logger.info(f"{response}")
|
|
240
246
|
|
|
241
247
|
|
|
242
248
|
if __name__ == "__main__":
|
|
243
|
-
logging.basicConfig(
|
|
244
|
-
level=logging.DEBUG,
|
|
245
|
-
format="%(asctime)s %(threadName)-12s %(levelname)-8s %(name)-12s %(module)-20s %(message)s",
|
|
246
|
-
)
|
|
247
|
-
|
|
248
249
|
app()
|
|
@@ -13,6 +13,8 @@ Keithley DAQ6510:
|
|
|
13
13
|
|
|
14
14
|
Keithley Control Server:
|
|
15
15
|
|
|
16
|
+
SERVICE_TYPE: DAQ6510
|
|
17
|
+
PROCESS_NAME: daq6510_cs
|
|
16
18
|
PROTOCOL: tcp
|
|
17
19
|
HOSTNAME: localhost # The hostname that client shall connect to, e.g. pleiad01 @ KU Leuven
|
|
18
20
|
COMMANDING_PORT: 6920 # The port on which the controller listens to commands - REQ-REP
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
egse/tempcontrol/keithley/__init__.py,sha256=QMm0vy6OMqzWmJZ1K6IwKSOpgYeCmUdbcRhv75LH9ZY,130
|
|
2
|
+
egse/tempcontrol/keithley/daq6510.py,sha256=pe12HIC2Yav5ZCGYecoQzhypYcCwecEaJpWZn-OHi8A,24867
|
|
3
|
+
egse/tempcontrol/keithley/daq6510.yaml,sha256=dHHVNyUpOQpdrZpnxPbT6slsl-8Gbnhifj4Q8QOfOYg,4400
|
|
4
|
+
egse/tempcontrol/keithley/daq6510_acs.py,sha256=6sGc2E8gg67ZwkNmHtNSsunC6cN0IYNwtJXC3yMYcpM,64
|
|
5
|
+
egse/tempcontrol/keithley/daq6510_adev.py,sha256=WjBuQvhpeXr2WHVB54mACM5WQwnecSY6I3iG2Cajs5c,2247
|
|
6
|
+
egse/tempcontrol/keithley/daq6510_cs.py,sha256=Ga7z8S6z0oTxL_qQP8FXPaNKlJ6o9RrsPFOXeIJ2TT4,7700
|
|
7
|
+
egse/tempcontrol/keithley/daq6510_dev.py,sha256=EKFFDhP8-FdIPBPosc1DfzE3h4DQmNU1d0Fi7Yhx4I4,12906
|
|
8
|
+
egse/tempcontrol/keithley/daq6510_mon.py,sha256=Xbn2U-l9uxPwNN1-aYW72oJodL2sx13suCiPPbDSti0,20932
|
|
9
|
+
egse/tempcontrol/keithley/daq6510_protocol.py,sha256=v8FUrxEm7bnRzM_iQzW0mMCHTgAMZw4f2Ronl8fdKIE,2676
|
|
10
|
+
egse/tempcontrol/keithley/daq6510_sim.py,sha256=RGjdbNmK2khflc53f4egOJ0dGJBght6TN8kpQDi9hfs,7665
|
|
11
|
+
keithley_tempcontrol/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
keithley_tempcontrol/cgse_explore.py,sha256=y_FkFxJW0vdqGNp9yTU0ELBKxby74-ev3fTuf99Vl1s,400
|
|
13
|
+
keithley_tempcontrol/cgse_services.py,sha256=tndviv2rvygkNSsGy1oA43VfFpyVkdB9If-9sVlLbK4,2466
|
|
14
|
+
keithley_tempcontrol/settings.yaml,sha256=wbrgSZQAdqFl6AxiLJIN36UsdiVHQCzdsgi7Hs7dv7o,1467
|
|
15
|
+
keithley_tempcontrol-0.17.1.dist-info/METADATA,sha256=qVuytSXOrdXx9yy3TuFYkhMifush-gJQxFgKVG7Tbao,962
|
|
16
|
+
keithley_tempcontrol-0.17.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
17
|
+
keithley_tempcontrol-0.17.1.dist-info/entry_points.txt,sha256=_0j2BwcwPi4LlRrhvEWfp9GO9KT8WhCkJe2gFgMzOPs,491
|
|
18
|
+
keithley_tempcontrol-0.17.1.dist-info/RECORD,,
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
egse/tempcontrol/keithley/__init__.py,sha256=QMm0vy6OMqzWmJZ1K6IwKSOpgYeCmUdbcRhv75LH9ZY,130
|
|
2
|
-
egse/tempcontrol/keithley/daq6510.py,sha256=pe12HIC2Yav5ZCGYecoQzhypYcCwecEaJpWZn-OHi8A,24867
|
|
3
|
-
egse/tempcontrol/keithley/daq6510.yaml,sha256=dHHVNyUpOQpdrZpnxPbT6slsl-8Gbnhifj4Q8QOfOYg,4400
|
|
4
|
-
egse/tempcontrol/keithley/daq6510_acs.py,sha256=6sGc2E8gg67ZwkNmHtNSsunC6cN0IYNwtJXC3yMYcpM,64
|
|
5
|
-
egse/tempcontrol/keithley/daq6510_adev.py,sha256=WjBuQvhpeXr2WHVB54mACM5WQwnecSY6I3iG2Cajs5c,2247
|
|
6
|
-
egse/tempcontrol/keithley/daq6510_cs.py,sha256=I6OEOUmb2MG3rc4Ri9SL0MP6a7fQn0POfLUBEsfv-t0,7533
|
|
7
|
-
egse/tempcontrol/keithley/daq6510_dev.py,sha256=a1Z3LtEeKa_z7c3g7l6-C4s9CZ-Z8BineQf-Bl6NZjQ,12728
|
|
8
|
-
egse/tempcontrol/keithley/daq6510_mon.py,sha256=uLTv-fsXhQW7KDzOWUwmDoZ-9_cYjqvgm9A0R0rOvXs,20930
|
|
9
|
-
egse/tempcontrol/keithley/daq6510_protocol.py,sha256=v8FUrxEm7bnRzM_iQzW0mMCHTgAMZw4f2Ronl8fdKIE,2676
|
|
10
|
-
egse/tempcontrol/keithley/daq6510_sim.py,sha256=SojDv2nc2mFHwRC1UG7TOed5cWo9hh44jQDO9kDM9Ic,7534
|
|
11
|
-
keithley_tempcontrol/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
keithley_tempcontrol/cgse_explore.py,sha256=y_FkFxJW0vdqGNp9yTU0ELBKxby74-ev3fTuf99Vl1s,400
|
|
13
|
-
keithley_tempcontrol/cgse_services.py,sha256=n26xIu4o1rH3Duqi8E_ELugXZSobsXkI4foA5eNjhtU,2491
|
|
14
|
-
keithley_tempcontrol/settings.yaml,sha256=3wBkC3BT0RfhIC5_BHcCrBw9l650nUpQgxJsWFmE62g,1391
|
|
15
|
-
keithley_tempcontrol-0.16.14.dist-info/METADATA,sha256=jo9Sl2adEhR4GsJX-j2p91cqW2fJAITLbf9mCQ8S1ew,963
|
|
16
|
-
keithley_tempcontrol-0.16.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
17
|
-
keithley_tempcontrol-0.16.14.dist-info/entry_points.txt,sha256=_0j2BwcwPi4LlRrhvEWfp9GO9KT8WhCkJe2gFgMzOPs,491
|
|
18
|
-
keithley_tempcontrol-0.16.14.dist-info/RECORD,,
|
|
File without changes
|
{keithley_tempcontrol-0.16.14.dist-info → keithley_tempcontrol-0.17.1.dist-info}/entry_points.txt
RENAMED
|
File without changes
|