Overview

In this chapter an overview of the FGF component is provided.

Architecture

The anatomy of an FGF Application is depicted below.

../_images/fgf_application_arch.png

The scenario schown in the figure, depicts the usage with a real camera. For the FGF Simulator, the FGF Communication Adapter is used internally to simulate the image aquisition, by playing back frames contained in a FITS image cube.

The internal elements of an FGF Application are:

Acquisition Thread: The Acquisition Thread, as indicated by the name, is responsible for acquiring the image frames from the associated camera. Once a frame has been received, the image data (pixels) and metadata information is stored in the Input Queue and the Publisher Thread informed about the availability of a new data frame. Note, it is only possible to receive complete frames and not to handle sub-frames.

RTMS Packaging Threads: In order to reduce the internal latency in an FGF application, the packaging of the RTMS packets, is handled by multiple threads. This yields a small improvement, although the major part of the latency is caused by the RTMS publishing of the RTMS packets.

RTMS Publisher Thread: The thread publishes the RTMS packets produced by the RTMS Packaging Threads. This is done in sequence, by only one thread, to ensure the proper ordering of the RTMS packets.

FGF Communication Adapter: The Communication Adapter used for communicating with the associated camera. As this adapter is provided by the user, it could be used for other purposes, or to collect data from other sources than cameras.

Camera SDK: Many cameras are delivered with a proprietary SDK, facilitating the implementation of the communication. Such SDKs shall be used internally in the FGF Communication Adapter to implement the proper communication for the given camera solution.

Specific HW: Specific HW may include PCI Express cards for Camera Link-based cameras or various fiber-based physical transportation media.

OPC UA Server (Thread): The OPC UA Server Thread is handling the OPC UA communication with client applications. It is based on the open62541 SDK. Examples of clients are CCF with the ENVision Communication Adapter and the engineering interface, UA Expert, which might be used for development, test and troubleshooting.

State Machine

An FGF application is based on the following state machine:

../_images/fgf_sm.png

An FGF instance is seen as an embedded application. Therefore, after starting up the process, the process enter directly “Operational/Initalising”. After having executed the initilisation procedure it transitions to “Operational/Idle”.

To initiate the image acquisition the OPC UA method “Start” is invoked and the frame grabber transitions to “Operational/Acquisition”. The “Stop” method will stop the image acquisition and brings it back to “Operational/Idle”.

If for some reason an error occurrs while in “Operational/Initialising|Idle|Acqusition”, the state transitions to “Operational/Error”. It can be attempted to recover from the error state, by submitting the OPC UA method “Reset”.

The handlig of the run-time set up of an FGF Application, is handled as follows:

The OPC UA nodes prefixed with “ctrl” basically constitute the configuration and setup of the FGF instance. When altering the parameters, these are updated in the FGF instance OPC UA namespace, but not automatically applied. The parameters current adjusted in the “ctrl” category are applied, when the “Start” OPC UA method is invoked. If parameters are changed when the FGF instance is in “Acquiring” substate, it is necessary to invoke the “Stop” method, followed by the “Start” method, to have the new parameters take effect.

FGF Simulator

The FGF package provides an FGF Application which emulates a normal camera frame grabber by playing back a series of FITS images from a FITS cube (FGF Simulator).

This can be used for executing the instrument software in a test environment (automatic integration tests), and for troubleshooting.

Options:
-h [ --help ]                     Print help messages
--list-loggers                    List defined loggers and exit
-a [ --address ] arg (=127.0.0.1) RTMS source IP address
-p [ --port ] arg (=59000)        Network port
-n [ --netif ] arg                Network interface to be used
-s [ --fits-file ] arg            FITS filename to be used for the simulation
-f [ --log-prop-file ] arg        Log property filename
-u [ --uaport ] arg (=4840)       OPCUA server port
-l [ --log-level ] arg (=ERROR)   Log level: ERROR, INFO, DEBUG, TRACE

Some additional information to the options is added in the following:

FGF Application Options

Option

Description

-h/–help

Print help messages

–list-loggers

The option triggers the application to print out the loggers defined during start-up. Note other loggers will be in used once the application is running.

-a/–address arg (=127.0.0.1)

This option specifies the RTMS source IP address, which corresponds to the destination IP address to which the MUDPI packets will be sent. In the context of multicast communication, this would be the multicast group address.

-p/–port arg (=59000)

Network port for the UDP socket.

-n/–netif arg

This option specifies the local network interface on the host where the FGF Application is running, to be used, which corresponds to the network interface through which the MUDPI packets will be sent.

-s/–fits-file arg

FITS data cube to be used to generate the stream of images. The simulators plays back the planes in the cube repeatedly.

-f/–log-prop-file arg

Makes it possible to specify a log properties file to be used. If not specified a default configuration of the “log4cplus” SDK i used (“log4cplus::BasicConfigurator”).

-u/–uaport arg (=4840)

Can be used to specify an alternative OPC UA server port than the default one (4840).

-l/–log-level arg (=ERROR)

Log level: ERROR, INFO, DEBUG, TRACE.

An example of execution of the tool, is shown here:

$ fgfSim -a 127.0.0.1 -p 59000 -n 127.0.0.1 -s /elt/ifw/resource/image/ifw/ccf/control/test_naxis3_1_512_int16.fits -l INFO
INFO - Starting application...
INFO - Cube number of planes: 10
INFO - Image BPP: 2
INFO - Image width: 512
INFO - Image height: 512
[2025-02-13 15:23:43.445 (UTC+0000)] info/eventloop     Starting the EventLoop
INFO - Acquisition Thread started
INFO - Acquisition waiting...
[2025-02-13 15:23:43.445 (UTC+0000)] warn/server        AccessControl: Unconfigured AccessControl. Users have all permissions.
[2025-02-13 15:23:43.445 (UTC+0000)] info/server        AccessControl: Anonymous login is enabled
[2025-02-13 15:23:43.445 (UTC+0000)] warn/server        x509 Certificate Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2025-02-13 15:23:43.446 (UTC+0000)] info/session       TCP 0   | SC 0  | Session "Administrator"       | AddNode (i=15303): No TypeDefinition. Use the default TypeDefinition for the Variable/Object
[2025-02-13 15:23:43.448 (UTC+0000)] info/session       TCP 0   | SC 0  | Session "Administrator"       | AddNode (i=25451): No TypeDefinition. Use the default TypeDefinition for the Variable/Object
[2025-02-13 15:23:43.457 (UTC+0000)] warn/userland      ServerUrls already set. Overriding.
[2025-02-13 15:23:43.457 (UTC+0000)] warn/server        AccessControl: Unconfigured AccessControl. Users have all permissions.
[2025-02-13 15:23:43.457 (UTC+0000)] info/server        AccessControl: Anonymous login is enabled
[2025-02-13 15:23:43.457 (UTC+0000)] warn/server        x509 Certificate Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2025-02-13 15:23:43.457 (UTC+0000)] warn/server        x509 Certificate Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2025-02-13 15:23:43.458 (UTC+0000)] info/network       TCP     | Listening on all interfaces
[2025-02-13 15:23:43.459 (UTC+0000)] info/network       TCP 4   | Creating listen socket for "0.0.0.0" (with local hostname "eltdev95.hq.eso.org") on port 4840
[2025-02-13 15:23:43.459 (UTC+0000)] info/server        New DiscoveryUrl added: opc.tcp://eltdev95.hq.eso.org:4840
[2025-02-13 15:23:43.459 (UTC+0000)] info/network       TCP 5   | Creating listen socket for "::" (with local hostname "eltdev95.hq.eso.org") on port 4840

Note, the FITS cube used in the example below is a file which is normally available on a host, where the ELT DevEnv is installed. The user, however, can use specific FITS cubes, which e.g. emulates sequences of observations, used to develop and test various functions of the software, involving e.g. image processing.

OPC UA Namespace Generator

The OPC UA Namespace Generator is used to generate the C code, which creates the OPC UA namespace programmatically, when starting up an FGF application:

> fgfGenerator -h
usage: fgfGenerator [-h] [-i INPUT] [-t TEMP] [-c COMM] [-s HEADER] [-o OPCUA]

FGF OPCUA Source Generator

options:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        input namespace (e.g: ~/fgNodeSet.yaml)
  -t TEMP, --temp TEMP  directory to generate temporary files (default: /tmp, e.g: ~/myfolder)
  -c COMM, --comm COMM  communication adapter class name (e.g: ifw::fgf::sim::CommAdapter)
  -s HEADER, --header HEADER
                        communication adapter include filename (e.g.: ifw/fgf/sim/commAdapter.hpp)
  -o OPCUA, --opcua OPCUA
                        OPCUA include files subfolder (e.g: ifw/fgf/sim)

The OPC UA Generator uses a YAML format defined in the context of the FGF project.

Here’s an example of this format (from the ENVision format definition):

Cameras:
    Sim:
        stat:
            lrExpoTime:
               type: Double
               val: 0.
               perm: Read
               var_comm_adapter_label: ifw::fgf::common::STAT_EXPO_TIME_STR
            lrFrameRate:
               type: Double
               val: 0.
               perm: Read
               var_comm_adapter_label: ifw::fgf::common::STAT_FRAME_RATE_STR
            nFrameCounter:
               type: UInt32
               val: 0
              perm: Read
               var_comm_adapter_label: ifw::fgf::common::STAT_FRAME_COUNTER_STR
            nTotalFrameCounter:
               type: UInt32
               val: 0
               perm: Read
               var_comm_adapter_label: ifw::fgf::common::STAT_TOTAL_FRAME_COUNTER_STR
            nWidth:
               type: UInt32
               val: 0
               perm: Read
               var_comm_adapter_label: ifw::fgf::common::STAT_WIDTH_STR
            nHeight:
               type: UInt32
               val: 0
               perm: Read
               var_comm_adapter_label: ifw::fgf::common::STAT_HEIGHT_STR
            sCameraInterface:
               type: String
               val: None
               perm: Read
               var_comm_adapter_label: ifw::fgf::common::STAT_CAMERA_INTERFACE_STR
            . . .

As can be seen, the format is hierachical. The branch

Cameras:
    Sim:
        stat:
            lrExpoTime:

translates into an OPC UA node with the name “Cameras.Sim.stat.lrExpoTime”.

The properties are as follows:

  • type: Datatype of the node (Double, Int8, …).

  • val: Default value.

  • perm: Read/write permissions.

  • var_comm_adapter_label: Used to map the value in the OPC UA namespace to/from the variable used in the FGF Adapter.