diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index da5807142..3671653c1 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -47,6 +47,7 @@ set(SPHINX_SOURCE_FILES src/pygettingstarted.rst src/firmware.rst src/serverupgrade.rst + src/virtualserver.rst ) diff --git a/docs/src/consuming.rst b/docs/src/consuming.rst index cd0bae70b..ab91670c6 100644 --- a/docs/src/consuming.rst +++ b/docs/src/consuming.rst @@ -6,7 +6,7 @@ slsDetectorPackage there are a few different ways to consume our package. The recommended way is to use one of the CMake approaches. - +One can test with :ref:`detector simulators` before testing the API with a real detector or when a real detector is not at hand. CMake: slsDetectorPackage as submodule in your project --------------------------------------- diff --git a/docs/src/index.rst b/docs/src/index.rst index cc4d0ee7b..9df1cc852 100644 --- a/docs/src/index.rst +++ b/docs/src/index.rst @@ -60,6 +60,7 @@ Welcome to slsDetectorPackage's documentation! servers serverupgrade + virtualserver diff --git a/docs/src/installation.rst b/docs/src/installation.rst index 8ded5f979..26819b283 100644 --- a/docs/src/installation.rst +++ b/docs/src/installation.rst @@ -48,6 +48,8 @@ Build using cmk.sh script ------------------------- .. code-block:: bash + The binaries are generated in slsDetectorPackage/build/bin directory. + # new build and make with 9 parallel threads ./cmk.sh -cbj9 diff --git a/docs/src/virtualserver.rst b/docs/src/virtualserver.rst new file mode 100644 index 000000000..d56bbe6c1 --- /dev/null +++ b/docs/src/virtualserver.rst @@ -0,0 +1,152 @@ +.. _Virtual Detector Servers: +Detector Simulators +=================== + +Compilation +----------- + +* Using CMake, turn on the option + .. code-block:: bash + + SLS_USE_SIMULATOR=ON + +* Using cmk.sh script, + .. code-block:: bash + + ./cmk.sh -b**s**j9 #option s is for simulator + + +Binaries +^^^^^^^^ + .. code-block:: bash + + eigerDetectorServerMaster_virtual + eigerDetectorServerSlaveTop_virtual + eigerDetectorServerSlaveBottom_virtual + jungfrauDetectorServer_virtual + gotthardDetectorServer_virtual + gotthard2DetectorServer_virtual + mythen3DetectorServer_virtual + moenchDetectorServer_virtual + ctbDetectorServer_virtual + + +Arguments +--------- + +The arguments are the same as the normal server. + .. code-block:: bash + + Possible arguments are: + -v, --version : Software version + -p, --port : TCP communication port with client. + -g, --nomodule : [Mythen3][Gotthard2] Generic or No Module mode. Skips detector type checks. + -f, --phaseshift : [Gotthard] only. Sets phase shift. + -d, --devel : Developer mode. Skips firmware checks. + -u, --update : Update mode. Skips firmware checks and initial detector setup. + -s, --stopserver : Stop server. Do not use as it is created by control server + +When using multiple modules, the most important one for the virtual server is to have different ports for each virtual server. + .. code-block:: bash + + # will start control server at port 1912 and stop server at port 1913 + mythen3DetectorServer --port 1912 & + + # will start second control server at port 1914 and stop server at port 1915 + mythen3DetectorServer --port 1914 & + + +Client +------ + +.. code-block:: bash + + # hostname should include the port (if not default) + sls_detector_put hostname localhost:1912+localhost:1914+ + + # or use virtual command, instead of hostname + # connects to 2 servers at localhost + # (control servers: 1912, 1914; stop servers: 1913, 1915) + sls_detector_put virtual 2 1912 + +Use the same in the config file. + + +Sample Config file +^^^^^^^^^^^^^^^^^^ + +For a Single Module + .. code-block:: bash + + # connects to control port 1912 + hostname localhost:1912+ + + # connects to receiver at ports 2012 + rx_hostname mpc1922:2012+ + + # sets destination udp ports (not needed, default is 50001) + udp_dstport 50012 + + # source udp ips must be same subnet at destintaion udp ips + udp_srcip 192.168.1.112 + + # destination udp ip picked up from rx_hostname (if auto) + udp_dstip auto + +For Multiple Modules + .. code-block:: bash + + # connects to control ports 1912, 1914 and stop ports 1913, 1915 + virtual 2 1912 + # or hostname localhost:1912+localhost:1914+ + + # connects to receivers at ports 2012 and 2014 + rx_hostname mpc1922:2012+mpc1922:2014+ + + # sets differernt destination udp ports + 0:udp_dstport 50012 + 1:udp_dstport 50014 + + # source udp ips must be same subnet at destintaion udp ips + 0:udp_srcip 192.168.1.112 + 1:udp_srcip 192.168.1.114 + + # destination udp ip picked up from rx_hostname (if auto) + udp_dstip auto + + +Receivers +---------- +Same as if you would use an actual detector + +For a Single Module + .. code-block:: bash + + slsReceiver -t2012 + + +For Multiple Modules + .. code-block:: bash + + # slsMultiReceiver [starting port] [number of receivers] [print each frame header for debugging] + slsMultiReceiver 2012 2 0 + +Gui +---- +| Same as if you would use an actual detector. +| Compile with SLS_USE_GUI=ON in cmake or -g option in cmk.sh script. + +.. code-block:: bash + + slsDetectorGui + +Limitations +----------- + +#. Data coming out of virtual server is fake. Value at each pixel/ channel is incremented by 1. + +#. A stop will stop the virtual acquisition only at the start of every new frame. + +#. Triggers are counted as number of virtual frames. trigger command to send a software trigger (Mythen3 & Eiger) is not implemented in virtual server. + +#. firmware version and serial number will give 0. diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c index bfe2286bf..f4c9e78a4 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c @@ -61,7 +61,8 @@ int main(int argc, char *argv[]) { "\t-d, --devel : Developer mode. Skips firmware checks. \n" "\t-u, --update : Update mode. Skips firmware checks and " "initial detector setup. \n" - "\t-s, --stopserver : Stop server. Do not use as created by " + "\t-s, --stopserver : Stop server. Do not use as it is created " + "by " "control server \n\n", argv[0]);