Contents

Factory Control Application

This module controls the Alarm Light and Reset button. The output of Edge Video Analytics Microservice (EVAM) i.e., the classified result data (MetaData, Frame) is published on a topic which is mentioned in the docker compose.yml file in the EVAM section. The factory control app subscribes to this topic that is the sub topic mentioned in compose file of factory control app section. This metadata is parsed by the FCA & is used to determine- if the frame is defective or not and indicate by glowing the red or green light in the IO module (Adam controller) respectively.

FactoryControlApp uses a message bus library to subscribe to the output of EVAM on the topic, where the EVAM publishes the classified data on the same topic. The config about Adamcontroller (IO module) like port, IP address, and register bits are stored in ETCD (A distributed key-value store).

Prerequisites

  1. Configure io_module using a tool AdamApax.Net Utility V2.05.11 B19.msi. This is downloaded from (https://support.advantech.com/support/DownloadSRDetail_New.aspx?SR_ID=1-2AKUDB&Doc_Source=Download) by selecting Primary Download Site with the AdamApax.Net Utility V2.05.11 B19.msi.

    Note: The system from which io_module is configured and IO module both should be in the same subnet. In the next step, if the password prompted then the password is “00000000”.

  2. Install, open the downloaded app and follow the instructions:
    1. On the left-hand side pannel, right click on Ethernet and select Search Device

    2. io_module will be detected (ADAM-6050) under Ethernet, click on it and go to Network tab and set the <ip_address> to the io_module.

Service Bring Up

Steps to Independently Build and Deploy the FactoryControlApp Service

Note

For running two or more microservices, it is recommended that the user tries the use case-driven approach for building and deploying as mentioned at Generate Consolidated Files for a Subset of Edge Insights for Industrial Services

Steps to Independently Build the FactoryControlApp Service

Note

When switching between independent deployment of the service with and without config manager agent service dependency, one would run into issues with docker-compose build w.r.t Certificates folder existence. As a workaround, run the command sudo rm -rf Certificates to proceed with docker-compose build.

To independently build FactoryControlApp service, complete the following steps:

  1. The downloaded source code should have a directory named FactoryControlApp:

    cd IEdgeInsights/FactoryControlApp
    
  2. Copy the IEdgeInsights/build/.env file using the following command in the current folder

    cp ../build/.env .
    

    NOTE: Update the HOST_IP and ETCD_HOST variables in the .env file with your system IP.

    # Source the .env using the following command:
    set -a && source .env && set +a
    
  3. Independently build

    docker-compose build
    

Steps to Independently Deploy the FactoryControlApp Service

User can deploy the FactoryControlApp service in any of the following two ways:

Deploy the FactoryControlApp Service without the Config Manager Agent Dependency

Run the following commands to deploy the FactoryControlApp service without the Config Manager Agent dependency:

# Enter the FactoryControlApp directory
cd IEdgeInsights/FactoryControlApp

Copy the IEdgeInsights/build/.env file using the following command in the current folder, if not already present.

cp ../build/.env .

Note: Ensure that docker ps is clean and docker network ls must not have EII bridge network.

Update .env file for the following:
1. HOST_IP and ETCD_HOST variables with your system IP.
2. `READ_CONFIG_FROM_FILE_ENV` value to `true` and `DEV_MODE` value to `true`.

Source the .env using the following command:
set -a && source .env && set +a
# Run the service
docker-compose -f docker-compose.yml -f docker-compose-dev.override.yml up -d

Note

FactoryControlApp container restarts automatically when its config is modified in config.json file. If user is updating the config.json file using vi or vim editor, it is required to append the set backupcopy=yes in ~/.vimrc so that the changes done on the host machine config.json gets reflected inside the container mount point.

Deploy the FactoryControlApp Service with the Config Manager Agent Dependency

Run the following commands to deploy the FactoryControlApp service with the Config Manager Agent dependency:

Note

Ensure that the Config Manager Agent image present in the system. If not, build the Config Manager Agent locally when independently deploying the service with Config Manager Agent dependency.

# Enter the FactoryControlApp directory
cd IEdgeInsights/FactoryControlApp

Copy the IEdgeInsights/build/.env file using the following command in the current folder, if not already present.

cp ../build/.env .

Note: Ensure that docker ps is clean and docker network ls doesn’t have EII bridge networks.

Update .env file for following:
1. HOST_IP and ETCD_HOST variables with your system IP.
2. `READ_CONFIG_FROM_FILE_ENV` value is set to `false`.

Copy the docker-compose.yml from IEdgeInsights/ConfigMgrAgent as docker-compose.override.yml in IEdgeInsights/FactoryControlApp.

cp ../ConfigMgrAgent/docker-compose.yml docker-compose.override.yml

Copy the builder.py with standalone mode changes from IEdgeInsights/build directory

cp ../build/builder.py .

Run the builder.py in standalone mode, this will generate eii_config.json and update docker-compose.override.yml

python3 builder.py -s true

Building the service (This step is optional for building the service if not already done in the Independently buildable step above)

docker-compose build

For running the service in PROD mode, run the following command:

NOTE: Make sure to update DEV_MODE to false in .env while running in PROD mode and source the .env using the command set -a && source .env && set +a.

docker-compose up -d

For running the service in DEV mode, run the following command:

NOTE: Make sure to update DEV_MODE to true in .env while running in DEV mode and source the .env using the command set -a && source .env && set +a.

docker-compose -f docker-compose.yml -f docker-compose-dev.override.yml -f docker-compose.override.yml up -d