Skip to content
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

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open

TernaryArrayIOC #812

wants to merge 29 commits into from

Conversation

gwbischof
Copy link
Contributor

@gwbischof gwbischof commented Apr 27, 2023

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.


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)
Copy link
Contributor Author

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):
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants