Makers Blog

Dynamic Axiobus Configuration Totally IEC 61131

griboldi@phoenixcontact.com 30 March 2020 min. read
246 views 1 comments

This demo projects would like to be an easy way to implement an automatic startup of the Axioline configuration on the local bus of the PLC Next.

The project has been developed entirely in IEC 61131 to help developer who are not used to C++ or other HighLevel languages.

To do so I used the procedure for the bus startup found in Bus Conductor (https://github.com/PLCnext/BusConductor) and I trasposed it in IEC 61131.

Prerequisites

Libraries:

  • PLCnext Controller
    You should already find it in the default path for PLCNext Eng library (C:\Program Files\PHOENIX CONTACT\PLCnext Engineer 2020.0\Libraries) as it comes with the software installation.

The projects has been tested with:

  • PLCNext Engineer 2020.0.1
  • AXC F 2152 FW 2020

It is a normal PLCNext project, so you just need to know how to download a project with PLCNext Engineer 😉

Functionalites Description

In the project you will find 2 function blocks:

  • InitAxio
    It will simply startup the connected bus accepting the whole physical configuration.
  • InitAxio_AutoConfig
    It starts the configuration as the other block but it will give also the list of connected modules.

To get informations from the modules, I used PDI objects, please refer to the Axioline manual to get more informations about them.

The information given by InitAxio_AutoConfig are:

  • DeviceFamily  [STRING58] -> The module type (analog/digital, input/output, others)
  • OrderNumber  [STRING32] -> The order number of the module
  • ProductName [STRING32] -> The product name of the module
  • PD_Length  [UINT] -> The number of words of Input process data of the module (Please consider that axioline modules have the same dimension for PDIN and PDOUT)

This properties has been choosen because I thought they could be the minimum information you may need for an easy use of the bus, however it is possible to add (or remove) properties reading the desired PDI object.

Example

Project Description

The project’s structure is quite simple

Project Structure

Software side, the project contains a single Cylic task (100ms) with the 2 available function blocks.
Please notice that both the blocks need to be used in a Cyclic Task.

Hardware side, you can see the dummy module AXL F physcial; this module is needed for the dynamic bus configuration.
It provides 2 arrays that contains all the process data produced and consumed by the modules.

Main Program

The Main program contains the two available function blocks

Main Program

As you can see, there is no need of particular configuration to use these FBs.

Please noticed that you can use just one of them at one time.

InitAxio

The function block follow different phases

InitAxioPhases :

  1. Init
  2. ResetDriver
  3. CreateConfiguration
  4. ReadLocal_IO
  5. GetNumberOf_IO
  6. ReadUserConfiguration
  7. Load_PD_Mapping
  8. StartDataTransfer
  9. End

As already mentioned I copied these steps from C++ Bus Conductor library, they are the necessary steps for the Axiobus startup.

InitAxio_AutoConfig

This function block is quite the same of the previous one but it introduces a step before the End step:

InitAxioPhases :

  1. Init
  2. ResetDriver
  3. CreateConfiguration
  4. ReadLocal_IO
  5. GetNumberOf_IO
  6. ReadUserConfiguration
  7. Load_PD_Mapping
  8. StartDataTransfer
  9. ReadPhysicalConfiguration
  10. End

During the Step 9 the function block reads the properties of every module found in the configuration using PDI read commands.
Also the Step 9 is developed in phases to make it easier to modify.

Possibilities

The demo project provides just few tools that might help you to develope more articulated dynamic configurations.

You can for example compare the list of modules read with a desired configuration (for example simply looking at the product numbers) and then choose to prevent the use of all process datas or use just a part of them.

You can implement routines for dynamic configuration of connected modules (specially for analog modules).

Or you can use the process data length to dynamically change the dimension of a module (e.g. if you replace a 16DI with a 32DI module).

Or it can just help you to implement a dynamic bus configuration in your IEC 61131 project.

Repository

https://github.com/griboldi/Dynamic-Axiobus-Configuration

Note:

The Makers Blog shows applications and user stories of community members that are not tested or reviewed by Phoenix Contact. Use them at your own risk.

Discussion

Please login/register to comment
Login/Register

Leave a Reply

kmanieri 22.11.2021

Is it possible to update this library to include smart element IO?

Login / Register to reply
kmanieri 22.11.2021

Nevermind - it already does work with the Smart Elements! It was the RS485 Card that it did not like.

griboldi 23.11.2021

Hi, the library is not bind to a particular list of AXIO modules. It reads the bus and make it runs indipendently from the configuration. For this reason it should be compatible with all standard Axioline Modules. It will have problems with modules like AXC F IL ADAPT - 1020304 that has a particular behaviour.

Newsletter
Never miss a new article
Sign up for the newsletter
Never miss news about PLCnext Technology
Get interesting content via newsletter four times a year
Receive exclusive information before all other users