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:
Contents
TwinCAT 3 Installation
From Binary
- 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.
- Follow the library installation instructions from Beckhoff, using the 'Install' option and browsing for the local copy you had just downloaded.
- 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:
- Clone the repository to a computer running TwinCAT 3
- Open the main solution file in Visual Studio
- Within the Visual Studio TcMatrix project, right click on the TcMatrix/TcMatrix Project item and select Rebuild
- There should be no compile errors, although there may be warnings
- Right click on the TcMatrix/TcMatrix Project item again and select Save as library and install
- The file can be saved anywhere, but a local Builds folder is always a good choice
Test:
- Within the Visual Studio TcMatrixTest project, right click on the PLC/TcMatrixTest/TcMatrixTest Project item and select Rebuild
- There should be no compile errors, although there may be warnings
- Open the SYSTEM/Real-Time item and click Read From Target, then assign all tasks to an isolated core from your system
- In the Visual Studio toolbar (or TwinCAT file menu) click Activate Configuration
- When prompted, agree to start the project in run mode and auto-start the boot project
- 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