TcMatrix

Description

A TwinCAT 3 library for manipulating 2D data sets of LREAL.

Features include:

  • Element-wise setting, getting, summing, scaling, and power functions
  • Initialization as copies, zeros, trapezoidal, and other pre-defined matrix types
  • Matrix operations like multiplication, transposition, and inversion
  • Vector operations for 1D matricies like dot/cross product and normalization
  • Complex access operations similar to 'slicing'
  • Options to use static or dynamically allocated memory
  • Reading/Writing with CSV files, output to the ADS message logger

Compare to:

  • CODESYS Matrix Library (docs)
  • Siemens Library of General Functions (docs)

Contents

  • Installation
  • Full API reference
  • Examples
    • Projects

TwinCAT 3 Installation

From Binary

  1. Go to the releases page and download the *.library file from the latest release, saving it to a temporary directory somewhere on the computer running TwinCAT.
  2. Follow the library installation instructions from Beckhoff, using the 'Install' option and browsing for the local copy you had just downloaded.
  3. After installtion, you may delete the local copy of the library that you had downloaded. Beckhoff has likely copied it to a version-specific folder in C:\TwinCAT\3.1\Components\Plc\Managed Libraries\Burks Engineering\TcMatrix\

From Source

Preconditions:

  • TwinCAT 3.1.4024 XAE
  • TwinCAT 3.1.4024 XAR, ideally configured with an isolated core
  • Visual Studio Community or Shell, 2019 or higher
  • TcUnit v1.2 or higher

Compilation:

  1. Clone the repository to a computer running TwinCAT 3
  2. Open the main solution file in Visual Studio
  3. Within the Visual Studio TcMatrix project, right click on the TcMatrix/TcMatrix Project item and select Rebuild
    1. There should be no compile errors, although there may be warnings
  4. Right click on the TcMatrix/TcMatrix Project item again and select Save as library and install
    1. The file can be saved anywhere, but a local Builds folder is always a good choice

Test:

  1. Within the Visual Studio TcMatrixTest project, right click on the PLC/TcMatrixTest/TcMatrixTest Project item and select Rebuild
    1. There should be no compile errors, although there may be warnings
  2. Open the SYSTEM/Real-Time item and click Read From Target, then assign all tasks to an isolated core from your system
  3. In the Visual Studio toolbar (or TwinCAT file menu) click Activate Configuration
  4. When prompted, agree to start the project in run mode and auto-start the boot project
  5. After a few seconds the TcUnit results should be visible in the Error List window. Verify that all tests have passed.

Examples

Projects With Implementations

  • TcTransform: Static memory 3x1, 3x3, and 4x4 matricies for common 3D coordinate system transformations
  • The unit tests within this project provide a large number of simple examples and usages
  • The ExternalStaticMatrix is one example of how to implement the StaticMatrix base class
  • Improve this Doc
In This Article
Back to top Generated by DocFX