vstadnytskyi / icarus-nmr

Other
1 stars 4 forks source link

Event controller cannot find a device controller PV #29

Open vstadnytskyi opened 2 years ago

vstadnytskyi commented 2 years ago

While following instruction on the I have started device, dio(digital) and event controller in this order in three different terminals. First, device controller device Next DIO digital controller

digital

and last "event controller" event_controller

I am using OS: MacOS XXXXX Python Version: XXXXX wxpython version: XXXXX

vstadnytskyi commented 2 years ago

The event controller cannot find Process Variable(PV) that device controller is hosting.

image

Though you can see from your device controller screenshot that the request PV exists

image

The two names have to be exact and they are. That is a good sign. It is still not clear why event controller client could not find device controller PV value.

vstadnytskyi commented 2 years ago

One can check if PV is available. For example, the scripts folder contains a script that provides terminal like access to PVs

MacBook-Pro:scripts user-13$ ipython3
runPython 3.7.4 (v3.7.4:e09359112e, Jul  8 2019, 14:54:52) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.8.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: run device_controller_terminal_client.py                                                                                                                                                     

In [2]: pvs.keys()                                                                                                                                                                                   
Out[2]: dict_keys(['dio', 'freq', 'queue_length', 'data', 'peek_data', 'packet_shape', 'LIST'])

In [3]: pvs['packet_shape'].read()                                                                                                                                                                   
Out[3]: ReadNotifyResponse(data=array([64, 10], dtype=int32), data_type=<ChannelType.LONG: 5>, data_count=2, status=CAStatusCode(name='ECA_NORMAL', code=0, code_with_severity=1, severity=<CASeverity.SUCCESS: 1>, success=1, defunct=False, description='Normal successful completion'), ioid=0, metadata=None)

In [4]: pvs['packet_shape'].read().data                                                                                                                                                              
Out[4]: array([64, 10], dtype=int32)

when a new client connects to a server there should be a line in the corresponding terminal. For example, in this example we have connected to device controller.

[I 16:59:32.741       common: 1080] Connected to new client at 192.168.1.3:49421 (total: 3).
INFO:caproto.ctx:Connected to new client at 192.168.1.3:49421 (total: 3).

and when you disconnect by closing a GUI or exiting python shell.

[I 17:05:48.274       common: 1095] Disconnected from client at 192.168.1.3:49421 (total: 2).
INFO:caproto.ctx:Disconnected from client at 192.168.1.3:49421 (total: 2).

The remaining two clients are: dio (digital) controller and event controller.

dustybaber commented 2 years ago

After launching device_controller and dio_controller, I get the following from the PV check you suggested (looks to be the same as your results):

Python 3.7.11 (default, Jul 27 2021, 07:03:16) Type 'copyright', 'credits' or 'license' for more information IPython 7.29.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: run device_controller_terminal_client.py

In [2]: pvs.keys() Out[2]: dict_keys(['dio', 'freq', 'queue_length', 'data', 'peek_data', 'packet_shape', 'LIST'])

In [3]: pvs['packet_shape'].read() Out[3]: ReadNotifyResponse(data=array([64, 10], dtype=int32), data_type=<ChannelType.LONG: 5>, data_count=2, status=CAStatusCode(name='ECA_NORMAL', code=0, code_with_severity=1, severity=<CASeverity.SUCCESS: 1>, success=1, defunct=False, description='Normal successful completion'), ioid=0, metadata=None)

In [4]: pvs['packet_shape'].read().data Out[4]: array([64, 10], dtype=int32)

vstadnytskyi commented 2 years ago

@dustybaber, I have created a new script that would allow us to quickly compare library versions and test basic connectivity with device and digital controller.

location of the new script "icarus_nmr/scripts/software_manual_test.py"

you should see something like this

$ python3 software_manual_test.py 
---------
numpy version
1.17.4
---------
serial version
3.4
---------
usb version
1.0.2
---------
matplotlib version
3.4.3
---------
circular_buffer_numpy version
0.2.0
---------
ubcs_auxiliary version
0.post32+g8b6a5a6
---------
epics version
3.4.0rc3+181.g418858d
---------
scipy version
1.3.1
---------
psutil version
5.6.3
---------
caproto version
0.7.1
--------- --------- --------- ---------
testing access to Device Controller
--------- --------- --------- ---------
PVs read dict_keys(['freq', 'dio', 'queue_length', 'data', 'peek_data', 'packet_shape', 'LIST'])
--------- --------- --------- ---------
testing access to Digital Controller
--------- --------- --------- ---------
PVs read dict_keys(['dio', 'bit0_indicator', 'bit0', 'bit0_enable', 'bit1_indicator', 'bit1', 'bit1_enable', 'bit2_indicator', 'bit2', 'bit2_enable', 'bit3_indicator', 'bit3', 'bit3_enable', 'shutdown_state', 'operating_mode', 'pulse_generator_depre_width', 'pulse_generator_pre_width', 'pulse_generator_delay', 'pulse_generator_period'])
vstadnytskyi commented 2 years ago

I would also recommend to force reinstallation of the icarus_nmr software.

  1. change directory to the location of the library
  2. install local copy of software forcing reinstallation of all other libraries. $ pip3 install --force-reinstall --no-cache-dir -e .
dustybaber commented 2 years ago

I git cloned the most recent icarus version, ran 'pip3 --force-reinstall --no-cache-dir -e .' from icarus-nmr dir, and now see the following when I launch event_controller.py before it times out: (* added for masking)

~/opt/anaconda3/envs/py37/lib/python3.7/site-packages/ubcs_auxiliary/threading.py:6: DeprecationWarning: The 'ubcs_auxiliary.threading' class was renamed to 'ubcs_auxiliary.multithreading' to make room for 'multithreading' and 'multiprocessing' warnings.warn("The 'ubcs_auxiliary.threading' class was renamed to 'ubcs_auxiliary.multithreading' to make room for 'multithreading' and 'multiprocessing'", DeprecationWarning ) SERVER_NAME = DK05: INFO:caproto.bcast:Watching Beacons from .116:5064 INFO:caproto.bcast:Watching Beacons from .142:65399 Traceback (most recent call last): File "event_controller.py", line 45, in daq.init() File "/Users/bbbb/opt/icarus-nmr/icarus_nmr/event_daq.py", line 32, in init self.packet_shape = client.packet_shape.read().data File "/Users/bbbb/opt/anaconda3/envs/py37/lib/python3.7/site-packages/caproto/threading/client.py", line 97, in inner f"{pv} could not connect within " caproto._utils.CaprotoTimeoutError: <PV name='DK05_device_controller:packet_shape' priority=0 (searching....)> could not connect within 2.0-second timeout.

dustybaber commented 2 years ago

I ran software_manual_test after re-installing icarus-nmr via 'git clone' and 'pip3 --force-reinstall --no-cache-dir -e .' It's a bit different than yours above. (* used for masking).

py3 software_manual_test.py

numpy version 1.21.5

serial version 3.5

usb version 1.2.1

matplotlib version 3.5.1

circular_buffer_numpy version 0.2.0

ubcs_auxiliary version 0.2.3

epics version 3.5.1

scipy version 1.7.3

psutil version 5.9.0

caproto version 0.8.1


testing access to Device Controller


Traceback (most recent call last): File "software_manual_test.py", line 32, in dev_result = dev_client.get_all() File "/Users/bbbb/opt/icarus-nmr/icarus_nmr/device_client.py", line 31, in get_all dict[key] = self.pvs[key].read().data File "/Users/bbbb/opt/anaconda3/envs/py37/lib/python3.7/site-packages/caproto/threading/client.py", line 97, in inner f"{pv} could not connect within " caproto._utils.CaprotoTimeoutError: <PV name='DK05*_device_controller:freq' priority=0 (searching....)> could not connect within 2.0-second timeout

dustybaber commented 2 years ago

I'm concerned that the Mac Firewall might be blocking necessary communications. A window pops up asking me to "accept incoming network connections" when I launch device and dio. I select "Allow", but our IT has recently started blocking our ability to view and make changes to Firewall settings, even as an administrator.

vstadnytskyi commented 2 years ago

I'm concerned that the Mac Firewall might be blocking necessary communications. A window pops up asking me to "accept incoming network connections" when I launch device and dio. I select "Allow", but our IT has recently started blocking our ability to view and make changes to Firewall settings, even as an administrator.

That could be the case. The ports caproto uses for communication might be not permitted. I need to think about how to test it.