-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Agent for srs cg635m timing clock. #743
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Michael, I think we should test unplugging and plugging back in the 10 MHz clock input and turning the output off and back on (with the run key) and double check that this agent catches the state changes. That can happen during a compute maintenance window otherwise we need to wait for all telescopes to have a break for data taking. Once tested I'm happy to merge, will give us more peace of mind knowing we have alarms on more failure points of the timing system.
|
||
self.clock = None | ||
|
||
# Registers Temperature and Voltage feeds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied comment not relevant here.
for i, register in enumerate(list(registers)[::-1]): | ||
register_bit = int(lckr / (2**(5 - i))) | ||
registers[register] = int(register_bit) | ||
lckr -= register_bit * (2**(5 - i)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can do this as is but also could maybe do it a bit more compactly: register_list = [bool(msg & 1 << (8-i)) for i in range(1,9)]
I tested this as follows:
In [64]: msg=int('01110000',2);print(msg)
112
In [65]: [bool(msg & 1 << (8-i)) for i in range(1,9)]
Out[65]: [False, True, True, True, False, False, False, False]
In [66]: msg=int('10000000',2);print(msg)
128
In [67]: [bool(msg & 1 << (8-i)) for i in range(1,9)]
Out[67]: [True, False, False, False, False, False, False, False]
In [68]: msg=int('00000001',2);print(msg)
1
In [69]: [bool(msg & 1 << (8-i)) for i in range(1,9)]
Out[69]: [False, False, False, False, False, False, False, True]
Then you can define registers = {rn: rl for r, rl in zip(reg_names, register_list)}
where reg_names
is a list of the register key names that you've defined in the dict in line 106.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I knew there was probably a much cleaner way to do this that one of the friendly daq reviewers would surely suggest to me. :)
I can switch this decoding to this way for clarity sake. Though I'd like to keep them as ints so they're easily displayable on grafana, much like the leak detectors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -43,6 +43,7 @@ | |||
('SmurfFileEmulator', 'smurf_file_emulator/agent.py'), | |||
('SmurfStreamSimulator', 'smurf_stream_simulator/agent.py'), | |||
('SmurfTimingCardAgent', 'smurf_timing_card/agent.py'), | |||
('SRSCG635mAgent', 'srs_cg635m/agent.py'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the 'm' in 'SRSCG635m'? Looking at my photos from the site and the SRS website I don't see it as a part of a listed model number, just sometimes in filenames.
from socs.common.prologix_interface import PrologixInterface | ||
|
||
|
||
class SRS_CG635m_Interface(PrologixInterface): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By convention (and following PEP08) we use CapWords for classnames, so SRSCG635mInterface
.
|
||
class SRS_CG635m_Interface(PrologixInterface): | ||
""" | ||
This device driver is written for the SRS CG635m clock used for the timing system in the SO Office. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd drop the "in the SO office", that's overly specific.
"""acq(wait=1, test_mode=False) | ||
|
||
**Process** - Continuously monitor srs clock lock registers | ||
and send info to aggregator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace "send info to aggregator" with "publish to a feed." The current sentence doesn't really capture that it's also going to other subscribers, like the InfluxDB publisher agent, i.e. to Grafana.
from socs.agents.srs_cg635m.drivers import SRS_CG635m_Interface | ||
|
||
|
||
class SRSCG635mAgent: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a docstring.
Also, more generally, we need a docs page for this agent in socs/docs/agents/
. Plenty of examples there, but also see https://ocs.readthedocs.io/en/main/developer/agent_references/documentation.html.
This is especially important for deciphering those returned integers.
Added an agent for the srs cg635m clock used for timing in the highbay office.
Description
This agent tracks the lock registers of the srs clock so we can monitor if the 10MHZ lock ever died on the srs clock.
The agent also tracks the frequency, CMOS output, and the running state as well.
Motivation and Context
Previously there was no tracking of the 10MHZ lock for the srs clock.
We need to be able to remotely track this lock and srs clock output.
This agent does not add any ability to actually adjust any clock outputs or output states!
Resolves #350.
How Has This Been Tested?
This agent was tested on daq-dev. All queries worked without error.
Grafana showed all lock statuses as well as the frequency, CMOS setting, and running state with no issues.
Types of changes
Checklist: