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

Best way to create a "simulation-mode" #6

Closed
gfabbris opened this issue Jul 21, 2020 · 13 comments
Closed

Best way to create a "simulation-mode" #6

gfabbris opened this issue Jul 21, 2020 · 13 comments
Assignees
Labels
enhancement New feature or request

Comments

@gfabbris
Copy link
Contributor

I started playing with this by creating "sim_framework" and "sim_devices". Right now I just commented out the import calls in the collection.py, but we can create some conditions (like not being able to read from epics). With this, I could get it to run in my Mac.

@prjemian: Is this the best way to approach it? Creating simulated motors seem trivial based on a quick look at the bluesky tutorial, but it's not obvious to me how to create a simulated scaler.

@gfabbris gfabbris added the enhancement New feature or request label Jul 21, 2020
@gfabbris gfabbris self-assigned this Jul 21, 2020
@gfabbris
Copy link
Contributor Author

by the way, this is done in my forked copy.

@prjemian
Copy link
Contributor

prjemian commented Jul 21, 2020 via email

@gfabbris
Copy link
Contributor Author

gfabbris commented Aug 5, 2020

@prjemian: I tried the docker. The start_iocxxx.sh seems to run fine, I can access the container and see the ioc there. For instance "caget xxx:datetime" works fine if I run it within the container. But my the ioc is not visible to my computer, if I run "caget xxx:datetime", it says "Channel connect timed out: 'xxx:datetime' not found.". Any ideas?

@prjemian
Copy link
Contributor

prjemian commented Aug 6, 2020

Are you starting the docker container with the --net=host option?

@prjemian
Copy link
Contributor

prjemian commented Aug 6, 2020

@gfabbris
Copy link
Contributor Author

gfabbris commented Aug 6, 2020

It turns out docker in Mac does not support --net=host option (but it doesn't return any error if you try to use it). The only way to network with the container is through a port. I've tried using -p 8000:8000 when starting the container and caget 127.0.0.1:8000:xxx:datetime but it doesn't work. Do you know if/how caget would work through a port?

@gfabbris
Copy link
Contributor Author

gfabbris commented Aug 6, 2020

@prjemian
Copy link
Contributor

prjemian commented Aug 6, 2020

EPICS ChannelAccess (CA) uses ports 5064 and 6065: -p 5064:5064 -p 5065:5065

@gfabbris
Copy link
Contributor Author

gfabbris commented Aug 6, 2020

What PV would pyepics see? The ones below didn't work...
Screen Shot 2020-08-06 at 11 19 43 AM

@prjemian
Copy link
Contributor

prjemian commented Aug 6, 2020

Any of the PVs from the IOC, such as: xxx:datetime, xxx:UPTIME, and xxx:m1. These are all easy to type. Maybe we need to tell the Mac that both tcp and UDP are permitted on those ports:

-p 5064:5064/tcp -p 5065:5065/tcp -p 5064:5064/udp -p 5065:5065/udp

or maybe use docker's bridged network instead: --net=bridge (but that seems to be the default)

The first of these references is the most useful (but not sure any of them help):

@gfabbris
Copy link
Contributor Author

gfabbris commented Aug 6, 2020

It works! It needs (both): -p 5064:5064/tcp -p 5064:5064/udp

I don't know why, but using 5065 doesn't work (but it also doesn't hurt).

@prjemian
Copy link
Contributor

prjemian commented Aug 6, 2020

One of them (5064) is the EPICS_CA_SERVER_PORT (see https://epics.anl.gov/base/R3-14/12-docs/CAref.html) that ChannelAccess listens for PV requests (does anyone have this PV name of "ssfhdsjdf"?) Once an IOC is identified (you hope it is only one IOC), the server will create a separate channel (on a different port) to connect with that PV. The other (5065, EPICS_CA_REPEATER_PORT) receives CA information from various IOCs and routes it to the correct CA client on the workstation. That's why 5065 seems to provide no particular value in this case.

@gfabbris
Copy link
Contributor Author

This is working as discussed here. Closing this issue.

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

No branches or pull requests

2 participants