-
Notifications
You must be signed in to change notification settings - Fork 38
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
TernaryArrayIOC #812
base: master
Are you sure you want to change the base?
TernaryArrayIOC #812
Conversation
caproto/ioc_examples/ternaryarray.py
Outdated
|
||
async def general_scan(self, index, group, instance, async_lib): | ||
# A hacky way to write to the pv. | ||
await self.pvdb[f'{self.prefix}device{index}_rbv'].write(self._devices[index].state) |
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 that there might be a way to get rid of this hack. Any ideas?
self._devices = [TernaryDeviceSim() for i in range(count)] | ||
|
||
# Dynamically setup the pvs. | ||
for i in range(count): |
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.
Do this as a helper function that uses type
to define a new class. Going up (down?) an abstraction layer will simplify this a a bunch.
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.
Sounds good, ill try that.
A TernaryDevice is a device with 3 states. Many components at a beamline have this behavior. For example, a valve, has an open and close command, a closed state, an open state, and an in-between state.
The TernaryArrayIOC is an IOC that has an array of TernaryDevices.
An example of a device that has an array of ternary devices is an Attenuator, which is an array of filters.
I think an interesting thing about this example is the dynamic pv creation.
Also, I think this is useful to test Ophyd devices like the Attenuator at CMS.
I plan to add an ophyd device here also.