Silecs Basics

Create a new silecs-design

  • First create a new FESA class .. check here for details on that
  • Create the .silecsdesign xml file:
    silecs -c ~/path/to/workspace/MyClass/src/MyClass.design
  • You can now modify the .silecsdesign file with any xml editor. (In eclipse best pick open-with --> other --> internal editors --> XML Editor and check the checkbox "Use it for all '*.silecsdesign' files")
  • Add some Blocks / Registers to the file, according to your required PLC-configuration
    • For each Block you can choose to generate a property in FESA ( @generateFesaProperty )
    • For each Register a device-specific field will be generated in FESA, using the matching FESA-datatype
    • For each Register you can choose to generate a value-item in FESA ( @generateFesaValueItem )
    • Keep in mind that you can use the Block/Register model defined here per "silecs-device"
  • Check if the xml-document is valid:
    silecs -v ~/path/to/workspace/MyClass/src/MyClass.silecsdesign
    • If it is not valid, first fix remaining problems.
  • Safe the document when it is valid.

Create a new silecs-deploy

  • First create a new FESA deploy unit .. check here for details on that
  • Create the .silecsdeploy xml file:
    silecs -c ~/path/to/workspace/MyDU/src/MyDU.deploy
  • You can now modify the .silecsdesign file with any xml editor. (In eclipse best pick open-with --> other --> internal editors --> XML Editor and check the checkbox "Use it for all '*.silecsdeploy' files")
  • Add a new Controller
    • The "host-name" of the controller should be the network-name of your plc
    • Select the "SilecsDesign" name / version which you want to run on the controller
    • Add a "Device" to your "SilecsDesign" for each design-instance(silecs-device) which you want to run on this controller
    • Select your PLC-model (You can replace "Siemens-PLC by" by right-click --> replace-with --> ... )
  • Check if the xml-document is valid:
    silecs -v ~/path/to/workspace/MyDU/src/MyDU.deploy
    • If it is not valid, first fix remaining problems.
  • Generate code:
    silecs -g ~/path/to/workspace/MyDU/src/MyDU.deploy
    • in generated/controller the files which have to be loaded into the PLC(s) can be found

Test your setup

  • upload the controller-code to the PLC
  • Run all PLC's on which you want to use the new configuration
  • Connect to the PLC by using the SILECS Diagnostic Tool
    • silecs -d ~/path/to/workspace/MyClass/src/MyClass.silecsdeploy
    • Pick the class you want to test
    • Pick the controller which you want to test and press ConnectPLC
    • Press sent / receive on the different Data-Fields to check if the connection is working
  • Optional: You can script access to the PLC by using the silecs-cli-client

Make use of the FESA-Part

Generate code for the FESA Class

  • Open your silecs design document (.silecsdesign)
  • Generate code to update the fesa .design file and generate C++ code:
    silecs -g ~/path/to/workspace/MyClass/src/MyClass.silecsdesign
  • The related SILECS C++ code will be generated into the "common" folder of the FESA-class
  • Make use of it in the actions of your FESA-class, according to your needs
  • Check the Silecs Code Snippets in order to see how to access plc blocks/registers
  • Dont forget to call the method ::setup in the specificInit method of your FESA-class, like described in the Silecs Code Snippets
  • Make sure to update the Makefile.specific to build against the silecs library
  • Modify the generated FESA-class, according to your needs ( Check the FESA Wiki for help on that ! )
  • Later on you add additional SILECS Blocks/Registers in the .silecsdesign and generate according FESA properties/fields
    • Please note that old silecs-properties/fields in FESA are not removed automatically (e.g. if a Property is renamed )

Modify the generated FESA Deploy-Unit

  • Check the FESA deploy-unit document
  • Probably you need to define scheduler, so that the generated SILECS RT-Actions get Scheduled
  • Make sure to update the Makefile.specific to build against the silecs library
  • Modify the generated FESA-Deployment-Unit, according to your needs ( Check the FESA Wiki for help on that ! )
  • Compile and link the deployment-unit ( Press on the target "make all" in the eclipse make-target view )

Modify the FESA instantiation-File

  • Create a instance-file fo the FEC on which the FESA-binary should run
  • Usually it makes sense to create a FESA-device for each SILECS-device you defined

Deliver & Run the FESA binary

  • Please refer to the FESA Wiki for help on that !
  • For Siemens-PLC's: The dynamic snap7 library, which is needed in order to communicate with a plc is not available per default on a FEC.
    • You will notice that when attempting to start the FESA-binary via the start-script
    • You will need to copy the .silecsparam to the FEC
    • When using the daemon, the .silecsparam file will not be available by default, to fix that, go to e.g. asl733:/common/export/nfsinit/myFECName
    • ln -s ../global/silecs_siemens 45_silec_siemens
      • make sure that the number is lower than the one for the fesa script, otherwise you will need to wait 5min until your binary is started by the daemon (failover)
    • reboot the FEC

On any problems, please dont hesitate to contact the silecs-support: silecs-support(AT)gsi.de
Topic revision: r2 - 17 May 2022, AlexanderSchwinn
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback