Manual. TC3 Power Monitoring. TwinCAT 3. Version: Date: Order No.: TF3650

Similar documents
TC3 Interface for Matlab /Simulink

Manual. TC3 Virtual Serial COM. TwinCAT 3. Version: Date: Order No.: TF 6360

Manual. Software Protection. TwinCAT 3. Version: Date:

Manual. PLC Lib: Tc2_DMX. TwinCAT 3. Version: Date:

Manual. PLC Lib: Tc2_DataExchange. TwinCAT 3. Version: Date:

Manual. PLC Lib: Tc2_DataExchange. TwinCAT 3. Version: Date:

Manual. PLC Lib: Tc2_SMI. TwinCAT 3. Version: Date:

Manual. TC3 EtherCAT Simulation. TwinCAT 3. Version: Date: Order No.: TE1111

Manual. TwinCAT MC Flying Saw. TwinCAT 3. Version: Date: Order No.: TF5055

Manual. MATLAB /Simulink. TwinCAT 3. Version: Date:

Manual. PLC Lib: Tc2_Coupler. TwinCAT 3. Version: Date:

Documentation for. TwinSAFE User. Tool to modify the User Administration of a TwinSAFE Logic. Version: Date:

Manual. TC3 Filter. TwinCAT 3. Version: Date: Order No.: TF3680

PLC Lib: Tc3_MC2_AdvancedHoming

Manual. PLC Lib: Tc2_Drive. TwinCAT 3. Version: Date:

Manual. PLC Lib: Tc2_EtherCAT. TwinCAT 3. Version: Date:

Documentation KM2042. Sixteen channel digital output module with D-Sub Connector. Version: Date:

Documentation ZB8610. Fan cartridge for EtherCAT and Bus Terminals. Version: Date:

Manual TC3 UML. TwinCAT 3. Version: Date: Order No.: TF1910

Manual. PLC Lib: Tc2_Standard. TwinCAT 3. Version: Date:

Documentation EM2042. Sixteen Channel Digital Output Module with D-Sub Connector. Version: Date:

Documentation. Mains filter AX2090-NF50. Version: Date:

Manual. PLC Lib: Tc2_NcDrive. TwinCAT. Version: Date:

Documentation. KM2604 and KM2614. Four channel relay module. Version: Date:

Documentation. CU20xx, CU22xx. Ethernet Switch. Version: Date:

Manual. TC3 Database Server. TwinCAT 3. Version: Date: Order No.: TF6420

Manual. PLC Lib: Tc2_DALI. TwinCAT 3. Version: Date:

TwinCAT KinematicTransformation

Manual. TwinCAT MC Camming. TwinCAT. Version: Date: Order No.: TS5050

Installation- and Operating instructions for CU Ethernet Controller with USB Input. Version: 1.4 Date:

Documentation. KM10xx. Terminal Modules with Digital Inputs. Version: Date:

Description AX5805. List of permissible motors. Version: Date:

Description AX5805. Default values for the permissible motors. Version: Date:

Documentation. FC2001 and FC2002. Lightbus PCI Interface Cards. Version: Date:

Documentation. AL225x Connector-Box. Accessory for servo drives of the series AX5000 and AX2000. Version: Date:

Manual. TC3 ADS-over-MQTT. TwinCAT. Version: Date:

Manual TC3 TCP/IP. TwinCAT 3. Version: Date: Order No.: TF6310

Documentation KM2002, KM2004, KM2008. Terminal modules with digital outputs, 24 V, 0.5 A. Version: Date:

Operating instructions for AX5801. TwinSAFE drive option card for the AX5000 servo drive. Version: Date:

Documentation. FC7501 and FC7502. SERCOS interface PCI Cards. Version: Date:

Manual. TC3 Robotics unival PLC. TwinCAT 3. Version: Date: Order No.: TF5130

C9900-P223 and C9900-P224

Manual. TC3 Scope View. TwinCAT 3. Version: Date: Order No.: TE13xx

Manual. PLC Lib: Tc3 BA Common. TwinCAT. Version: Date:

Installation- and Operating instructions for CU Port USB 2.0 Hub. Version: 1.3 Date:

Manual. NC PTP: Quick Starting Guide. TwinCAT 3. Version: Date: Order No.: TF5000

Documentation KL channel Digital Output Terminal, 24 V DC, 2 x 4 A/1 x 8 A. Version: Date:

Manual. TC3 EthernetIP Scanner. TwinCAT 3. Version: Date: Order No.: TF6281

Application Note FC1100/FC1121 (EtherCAT Slave Card)

Application Note FC1100/FC1121 (EtherCAT Slave Card)

Installation- and Operating instructions for CU Port USB 3.0 Hub. Version: 1.1 Date:

C9900-P208 and C9900-P209

EL9820/EL9821 Evaluation Kit. Version: 1.3 Date:

Micro800 Programmable Controllers: Getting Started with CIP Client Messaging

User Manual Connection to BRC-Symbolic

Manual. PLC Lib: Tc3_JsonXml. TwinCAT 3. Version: Date:

CU port USB 2.0 hub. Version: 1.1 Date:

Manual. PLC Lib: Tc2_EnOcean. TwinCAT 3. Version: Date:

Anybus CompactCom 40 Diagnostic Events for EtherCAT SCM ENGLISH

Manual. TC3 IoT Data Agent. TwinCAT 3. Version: Date: Order No.: TF6720

Safety module SY6 Manual

Machine Automation Controller NJ-series. EtherNet/IP TM. Connection Guide. OMRON Corporation. CJ2-series Controller P568-E1-01

Wonderware Operations Integration Supervisory Beckhoff TWINCAT Server (G-1.2 Series)

Aotewell SIMATIC S7-PDIAG for S7-300 and S Configuring Process Diagnostic Getting St

CU USB-Extender-Rx (USB and DVI Extender) Version: 0.3 Date:

SIMOTION. Motion Control Task Trace. Preface 1. Overview 2. Configuring 3. Working with the SIMOTION Task Profiler 4.

Operation Manual BK5000. Bus Coupler for CAN-CAL Version: 1.12

Schneider Electric Floating License Manager

Installation- and Operating instructions for CU CP-Link 4 transmitter box The Two Cable Display Link. Version: 1.

DeviceNet ILxxxx-B520. IO Data Mapping DeviceNet Objects Indicators and Switches

Installation- and Operating instructions for CU CFast card adapter with USB connector. Version: 1.1 Date:

OMRON Corporation. IO-Link Connection Guide (EtherCAT(R) Host Communications) Machine Automation Controller NJ-series

Schneider Electric License Manager

Manual. PLC Lib: Tc2_MPBus. TwinCAT 3. Version: Date:

OMRON Corporation. IO-Link Connection Guide (EtherCAT(R) Host Communications) Machine Automation Controller NJ-series

Documentation. KL85xx und KL9309. Manual operating modules with K-Bus interface. Version: Date:

Machine Automation Controller NJ-series. EtherCAT. Connection Guide. OMRON Corporation. E3X-ECT Sensor Communication Unit (EtherCAT Slave) P529-E1-01

SIMATIC HMI. Software RemoteOperate V2. Preface. Overview 1. Range of functions of the RemoteOperate software. Hardware and software requirements

Machine Automation Controller NJ-series. EtherCAT. Connection Guide. OMRON Corporation. Digital Sensor Communication Unit (E3NW-ECT) P563-E1-01

SIMATIC PC. Panel PC Industrial Lite Without Operating System. Preface, Table of Contents

SIMOTION. SIMOTION SCOUT Task Trace. Preface 1. Overview 2. Configuring 3. Working with the SIMOTION Task Profiler. Function Manual 05/2009

Operating Instructions

ADN. System Installer. Instruction manual

CU Compact-Flash card adapter for USB. Version: 1.0 Date:

Video Management System SeMSy III Setup Server

Using PROFIsafe modules in combination with PROFIBUS-DP and PROFINET Application note

Documentation. KL2784 und KL2794. Four channel digital output terminals with MOSFET transistors. Version: Date:

SIMATIC. Communications processor CP 340 first commissioning steps. Getting Started 04/2005 A5E

SPECIFICATIONS SUBJECT TO CHANGE WITHOUT NOTICE

SIMATIC Automation License Manager Manual 02/2008 A5E

Manual EAP. TwinCAT 3. Version: Date:

Addendum to the Manual

Library for Building Automation. Module Descriptions for KNX IP Master

Using WAGO Series 750 DeviceNet IO with an A-B SLC SDN Scanner Application note

PHOENIX CONTACT GmbH & Co. KG

Machine Automation Controller NJ-series. EtherCAT(R) Connection Guide. Balluff GmbH. Network Interface (BNI ECT-508) P673-E1-01

One Identity Manager Administration Guide for Connecting Oracle E-Business Suite

efesotomasyon.com - Lenze Manual Global Drive PC system bus adapter 2173 / 2177 Software installation & configuration

Documentation KL2791. Single channel speed controller terminals for AC motors. Version: Date:

Using WAGO Series 750 DeviceNet IO with an A-B ControlLogix 1756-DNB Scanner Application note

Transcription:

Manual TC3 Power Monitoring TwinCAT 3 Version: Date: Order No.: 1.1 2019-01-03 TF3650

Table of contents Table of contents 1 Foreword... 5 1.1 Notes on the documentation... 5 1.2 Safety instructions... 6 2 Overview... 7 3 Installation... 8 3.1 System requirements... 8 3.2 Installation... 8 3.3 Licensing... 11 4 Technical introduction... 17 4.1 Memory Management... 17 5 PLC API... 19 5.1 General function blocks... 19 5.1.1 FB_PMA_Scaling... 19 5.1.2 FB_PMA_Scaling_EL3773... 24 5.1.3 FB_PMA_Scaling_EL3783... 27 5.1.4 FB_PMA_TaskTransfer_Send... 33 5.1.5 FB_PMA_TaskTransfer_Receive... 36 5.2 Function blocks, single-phase... 39 5.2.1 FB_PMA_Source_1Ph... 39 5.2.2 Time-based... 42 5.2.3 Frequency-based... 56 5.3 Function blocks, three-phase... 75 5.3.1 FB_PMA_Source_3Ph... 75 5.3.2 Time-based... 78 5.3.3 Frequency-based... 92 5.4 Data types... 112 5.4.1 E_PMA_ScalingType... 112 5.4.2 E_PMA_WindowType... 112 5.4.3 InitParameters... 113 5.4.4 Single-phase... 123 5.4.5 Three-phase... 125 5.4.6 E_PMA_InputSelect... 127 5.4.7 ST_PMA_Energy... 128 5.5 Global constants... 128 5.5.1 GVL_PMA... 128 6 Examples... 129 6.1 Time-based example... 129 6.2 Time and frequency-based sample... 130 7 Appendix... 132 7.1 FAQ... 132 7.2 Support and Service... 132 TC3 Power Monitoring Version: 1.1 3

Table of contents 4 Version: 1.1 TC3 Power Monitoring

Foreword 1 Foreword 1.1 Notes on the documentation This description is only intended for the use of trained specialists in control and automation engineering who are familiar with the applicable national standards. It is essential that the documentation and the following notes and explanations are followed when installing and commissioning the components. It is the duty of the technical personnel to use the documentation published at the respective time of each installation and commissioning. The responsible staff must ensure that the application or use of the products described satisfy all the requirements for safety, including all the relevant laws, regulations, guidelines and standards. Disclaimer The documentation has been prepared with care. The products described are, however, constantly under development. We reserve the right to revise and change the documentation at any time and without prior announcement. No claims for the modification of products that have already been supplied may be made on the basis of the data, diagrams and descriptions in this documentation. Trademarks Beckhoff, TwinCAT, EtherCAT, Safety over EtherCAT, TwinSAFE, XFC and XTS are registered trademarks of and licensed by Beckhoff Automation GmbH. Other designations used in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owners. Patent Pending The EtherCAT Technology is covered, including but not limited to the following patent applications and patents: EP1590927, EP1789857, DE102004044764, DE102007017835 with corresponding applications or registrations in various other countries. The TwinCAT Technology is covered, including but not limited to the following patent applications and patents: EP0851348, US6167425 with corresponding applications or registrations in various other countries. EtherCAT is registered trademark and patented technology, licensed by Beckhoff Automation GmbH, Germany Copyright Beckhoff Automation GmbH & Co. KG, Germany. The reproduction, distribution and utilization of this document as well as the communication of its contents to others without express authorization are prohibited. Offenders will be held liable for the payment of damages. All rights reserved in the event of the grant of a patent, utility model or design. TC3 Power Monitoring Version: 1.1 5

Foreword 1.2 Safety instructions Safety regulations Please note the following safety instructions and explanations! Product-specific safety instructions can be found on following pages or in the areas mounting, wiring, commissioning etc. Exclusion of liability All the components are supplied in particular hardware and software configurations appropriate for the application. Modifications to hardware or software configurations other than those described in the documentation are not permitted, and nullify the liability of Beckhoff Automation GmbH & Co. KG. Personnel qualification This description is only intended for trained specialists in control, automation and drive engineering who are familiar with the applicable national standards. Description of symbols In this documentation the following symbols are used with an accompanying safety instruction or note. The safety instructions must be read carefully and followed without fail! Serious risk of injury! DANGER Failure to follow the safety instructions associated with this symbol directly endangers the life and health of persons. Risk of injury! WARNING Failure to follow the safety instructions associated with this symbol endangers the life and health of persons. Personal injuries! CAUTION Failure to follow the safety instructions associated with this symbol can lead to injuries to persons. Damage to the environment or devices NOTE Failure to follow the instructions associated with this symbol can lead to damage to the environment or equipment. Tip or pointer This symbol indicates information that contributes to better understanding. 6 Version: 1.1 TC3 Power Monitoring

Overview 2 Overview Beckhoff offers various terminals for implementing supply network analysis and monitoring in its I/O portfolio. In a single- or three-phase grid, power measurement terminals such as the EL3403 or EL3413 directly provide RMS values for current and voltage, as well as active, reactive and apparent power. The EL3773 and EL3783 power monitoring terminals can also be used to log the raw data for current and voltage, so that grid events can be detected even more accurately, and various values can be calculated in the controller itself. The TC3 Power Monitoring function is a PLC library for evaluating raw current and voltage data provided by the power monitoring terminals. The library provides function blocks for calculating RMS values for current, voltage and power. These can be output as instantaneous or average values. The function block also offers maximum and minimum values. Frequency and frequency spectra can be determined, such as e.g. harmonics in the network and their load in the form of the Total Harmonic Distortion (THD). Furthermore, the library offers function blocks which can be used to determine frequencies and rotary fields. Product information The current version of the power monitoring library is available for download from the Beckhoff website. The PLC library offers various algorithms for analyzing current and voltage in a single- or three-phase grid. Some algorithms are based on implementations of the TwinCAT Condition Monitoring library. Product components The TF3650 power monitoring product consists of the following components: PLC libraries Drivers Tc3_PowerMonitoring.compiled-library Tc3_CM_Base.compiled-library Tc3_Filter.compiled-library Tc3_MultiArray.compiled-library TcCM.sys TcFilter.sys TcMultiArray.sys TC3 Power Monitoring Version: 1.1 7

Installation 3 Installation 3.1 System requirements Engineering system An engineering system describes a computer that is used for the development of program code and does not execute program code. An engineering system must meet the following requirements: TwinCAT 3 XAE (engineering installation) build 4022 or higher Installation of TF3650 power monitoring A 7-day trial license can be activated repeatedly for the engineering system (see also Licensing [} 11]) Runtime system A runtime system describes an Industrial or Embedded PC on which program code is executed. An runtime system must meet the following requirements: TwinCAT 3 XAR (runtime installation) build 4022 or higher 32-bit and 64-bit systems are supported License for TC1200 PLC and for TF3650 Power Monitoring A 7-day trial license can be activated repeatedly for testing purposes. Engineering and runtime on the same system To use engineering and runtime on the same system, the following system requirements have to be met: TwinCAT3 XAE (engineering installation) build 4022 or higher License for TC1200 PLC and for TF3650 Power Monitoring A 7-day trial license can be activated repeatedly for testing purposes. 3.2 Installation The following section describes how to install the TwinCAT 3 Function for Windows-based operating systems. ü The TwinCAT 3 Function setup file was downloaded from the Beckhoff website. 1. Run the setup file as administrator. To do this, select the command Run as administrator in the context menu of the file. ð The installation dialog opens. 8 Version: 1.1 TC3 Power Monitoring

Installation 2. Accept the end user licensing agreement and click Next. 3. Enter your user data. TC3 Power Monitoring Version: 1.1 9

Installation 4. If you want to install the full version of the TwinCAT 3 Function, select Complete as installation type. If you want to install the TwinCAT 3 Function components separately, select Custom. 5. Select Next, then Install to start the installation. ð A dialog box informs you that the TwinCAT system must be stopped to proceed with the installation. 10 Version: 1.1 TC3 Power Monitoring

Installation 6. Confirm the dialog with Yes. 7. Select Finish to exit the setup. ð The TwinCAT 3 Function has been successfully installed and can be licensed (see Licensing [} 11]). 3.3 Licensing The TwinCAT 3 Function can be activated as a full version or as a 7-day test version. Both license types can be activated via the TwinCAT 3 development environment (XAE). The licensing of a TwinCAT 3 Function is described below. The description is divided into the following sections: Licensing a 7-day test version [} 11] Licensing a full version [} 13] Further information on TwinCAT 3 licensing can be found in the Licensing documentation in the Beckhoff Information System (TwinCAT 3 > Licensing). Licensing a 7-day test version 1. Start the TwinCAT 3 development environment (XAE). 2. Open an existing TwinCAT 3 project or create a new project. TC3 Power Monitoring Version: 1.1 11

Installation 3. If you want to activate the license for a remote device, set the desired target system. To do this, select the target system from the Choose Target System drop-down list in the toolbar. ð The licensing settings always refer to the selected target system. When the project is activated on the target system, the corresponding TwinCAT 3 licenses are automatically copied to this system. 4. In the Solution Explorer, double-click License in the SYSTEM subtree. ð The TwinCAT 3 license manager opens. 5. Open the Manage Licenses tab. In the Add License column, check the check box for the license you want to add to your project (e.g. TF6420: TC3 Database Server ). 6. Open the Order Information (Runtime) tab. ð In the tabular overview of licenses, the previously selected license is displayed with the status missing. 12 Version: 1.1 TC3 Power Monitoring

Installation 7. Click 7-Day Trial License... to activate the 7-day trial license. ð A dialog box opens, prompting you to enter the security code displayed in the dialog. 8. Enter the code exactly as it appears, confirm it and acknowledge the subsequent dialog indicating successful activation. ð In the tabular overview of licenses, the license status now indicates the expiration date of the license. 9. Restart the TwinCAT system. ð The 7-day trial version is enabled. Licensing a full version 1. Start the TwinCAT 3 development environment (XAE). 2. Open an existing TwinCAT 3 project or create a new project. 3. If you want to activate the license for a remote device, set the desired target system. To do this, select the target system from the Choose Target System drop-down list in the toolbar. ð The licensing settings always refer to the selected target system. When the project is activated on the target system, the corresponding TwinCAT 3 licenses are automatically copied to this system. 4. In the Solution Explorer, double-click License in the SYSTEM subtree. ð The TwinCAT 3 license manager opens. TC3 Power Monitoring Version: 1.1 13

Installation 5. Open the Manage Licenses tab. In the Add License column, check the check box for the license you want to add to your project (e.g. TE1300: TC3 Scope View Professional ). 6. Open the Order Information tab. ð In the tabular overview of licenses, the previously selected license is displayed with the status missing. A TwinCAT 3 license is generally linked to two indices describing the platform to be licensed: System ID: Uniquely identifies the device Platform level: Defines the performance of the device The corresponding System Id and Platform fields cannot be changed. 14 Version: 1.1 TC3 Power Monitoring

Installation 7. Enter the order number (License Id) for the license to be activated and optionally a separate order number (Customer Id), plus an optional comment for your own purposes (Comment). If you do not know your Beckhoff order number, please contact your Beckhoff sales contact. 8. Click the Generate File... button to create a License Request File for the listed missing license. ð A window opens, in which you can specify where the License Request File is to be stored. (We recommend accepting the default settings.) 9. Select a location and click Save. ð A prompt appears asking whether you want to send the License Request File to the Beckhoff license server for verification: Click Yes to send the License Request File. A prerequisite is that an email program is installed on your computer and that your computer is connected to the internet. When you click Yes, the system automatically generates a draft email containing the License Request File with all the necessary information. Click No if your computer does not have an email program installed on it or is not connected to the internet. Copy the License Request File onto a data storage device (e.g. a USB stick) and send the file from a computer with internet access and an email program to the Beckhoff license server (tclicense@beckhoff.com) by email. 10. Send the License Request File. ð The License Request File is sent to the Beckhoff license server. After receiving the email, the server compares your license request with the specified order number and returns a License Response File by email. The Beckhoff license server returns the License Response File to the same email address from which the License Request File was sent. The License Response File differs from the License Request File only by a signature that documents the validity of the license file content. You can view the contents of the License Response File with an editor suitable for XML files (e.g. XML Notepad ). The contents of the License Response File must not be changed, otherwise the license file becomes invalid. 11. Save the License Response File. TC3 Power Monitoring Version: 1.1 15

Installation 12. To import the license file and activate the license, click License Response File... in the Order Information tab. 13. Select the License Response File in your file directory and confirm the dialog. ð The License Response File is imported and the license it contains is activated. Existing demo licenses will be removed. 14. Restart the TwinCAT system. ð The license becomes active when TwinCAT is restarted. The product can be used as a full version. During the TwinCAT restart the license file is automatically copied to the directory...\twincat\3.1\target \License on the respective target system. 16 Version: 1.1 TC3 Power Monitoring

Technical introduction 4 Technical introduction 4.1 Memory Management The power monitoring library uses parts of the Condition Monitoring library, which internally uses TcCOM objects. The TcCOM objects are provided by the installed drivers. The instances are created dynamically in the TwinCAT AMS router memory. Necessity for dynamic memory management All memory requirements and initializations are implemented or performed during the initialization phase. Since the number of elements of the input data and the internal structures depend on the configuration of the respective function blocks, the memory space for them is allocated dynamically as a matter of principle. This happens automatically when the Condition Monitoring library is used. Since all memory allocations occur during initialization, and therefore the initialization of function blocks may require a relatively large amount of memory under certain circumstances, the initialization at this point may fail due to lack of memory, but not later. The allocated memory is released again once the object is deleted. TwinCAT router memory for dynamically generated objects The buffers reserved by the Condition Monitoring library are created in the TwinCAT AMS router memory when function blocks are initialized, so that they are available for execution under real-time conditions. Certain functions, such as high-resolution histograms and quantiles as well as the calculation of spectra with very high resolutions, require considerably more router memory than conventional control programs. Therefore, the router memory may need to be increased. Adapting the router memory The standard size of the router memory is 32 MB. The current setting is shown in the AMS Router Information dialog. To open the dialog, right-click on the TwinCAT System Service icon in the system tray and select the command Router > Info in the system menu that opens. To increase the router memory, open the real-time settings in TwinCAT Engineering and enter a value in MB in the TwinCAT configuration (TwinCAT project tree > SYSTEM > Real-Time > Settings tab > Router Memory). Then activate the configuration. TC3 Power Monitoring Version: 1.1 17

Technical introduction The adjustment of the router memory necessitates a reboot of the target device. 18 Version: 1.1 TC3 Power Monitoring

5 PLC API 5.1 General function blocks 5.1.1 FB_PMA_Scaling The function block FB_PMA_Scaling is used for scaling raw values. The raw values can be scaled individually or as an array, for example as oversampling values. In addition, it is possible to use single-phase and three-phase input signals. Alternatively, the specialized function blocks FB_PMA_Scaling_EL3773 [} 24] can be used for inputs of the EL3773 EtherCAT Terminal and FB_PMA_Scaling_EL3783 [} 27] for inputs of the EL3783 EtherCAT Terminal. Definition: FUNCTION BLOCK FB_PMA_Scaling stinitpars : ST_PMA_Scaling_InitPars VAR_OUTPUT berror : BOOL; ipresultmessage : I_TcMessage; bnewresult : BOOL; The input parameters of this function block represent initialization parameters and have to be assigned during the declaration of the function block instance (alternatively: Init [} 23] method). They may only be assigned once. A change at runtime is possible by calling the Init [} 23] method again. stinitpars ST_PMA_Scaling_InitPars [} 114] Function block-specific structure with initialization parameters Outputs berror BOOL TRUE if an error occurs. ipresultmessage I_TcMessage The interface offers detailed information about the return value. bnewresult BOOL TRUE when new results were calculated. Methods Methods can be used to scale different systems (single-phase or three-phase) and different resolutions (16- bit or 32-bit). Name Call_1Ph_16Bit [} 20] Call_1Ph_32Bit [} 20] Description The method is called to scale the 16-bit input data of type INT according to the configured parameters. The method is called to scale the 32-bit input data of type DINT according to the configured parameters. TC3 Power Monitoring Version: 1.1 19

Name Call_3Ph_16Bit [} 21] Call_3Ph_32Bit [} 22] Init [} 23] Reconfigure [} 23] Description The method is called to scale the 16-bit input data of type INT according to the configured parameters. The method is called to scale the 32-bit input data of type DINT according to the configured parameters. Alternative to the function block initialization The method is called in order to reconfigure the function block during the runtime. Requirements Development environment Target platform PLC libraries to include TwinCAT v3.1.4022.22 PC or CX (x86, x64) Tc3_PowerMonitoring 5.1.1.1 Call_1Ph_16Bit The method is called to scale the 16-bit input data of type INT according to the configured parameters. METHOD Call_1Ph_16Bit : BOOL pinputbuffer_u : POINTER TO INT; pinputbuffer_i : POINTER TO INT; ninputbuffersize : UDINT; poutputbuffer_u : POINTER TO LREAL; poutputbuffer_i : POINTER TO LREAL; noutputbuffersize : UDINT; pinputbuffer_u POINTER TO INT Pointer to an array of voltage values. These can be added individually or as an oversampling array. pinputbuffer_i POINTER TO INT Pointer to an array of current values. These can be added individually or as an oversampling array. ninputbuffersize UDINT Indicates the size of a single input buffer in bytes. poutputbuffer_u POINTER TO LREAL Pointer to an array in which the scaled voltage values are to be stored. poutputbuffer_i POINTER TO LREAL Pointer to an array in which the scaled current values are to be stored. noutputbuffersize UDINT Indicates the size of a single output buffer in bytes. Call_1Ph_16Bit BOOL Indicates whether the method was executed 5.1.1.2 Call_1Ph_32Bit The method is called to scale the 32-bit input data of type DINT according to the configured parameters. 20 Version: 1.1 TC3 Power Monitoring

METHOD Call_1Ph_32Bit : BOOL pinputbuffer_u : POINTER TO DINT; pinputbuffer_i : POINTER TO DINT ninputbuffersize : UDINT; poutputbuffer_u : POINTER TO LREAL; poutputbuffer_i : POINTER TO LREAL; noutputbuffersize : UDINT; VAR_OUTPUT pinputbuffer_u POINTER TO DINT Pointer to an array of voltage values. These can be added individually or as an oversampling array. pinputbuffer_i POINTER TO DINT Pointer to an array of current values. These can be added individually or as an oversampling array. ninputbuffersize UDINT Indicates the size of a single input buffer in bytes. poutputbuffer_u POINTER TO LREAL Pointer to an array in which the scaled voltage values are to be stored. poutputbuffer_i POINTER TO LREAL Pointer to an array in which the scaled current values are to be stored. noutputbuffersize UDINT Indicates the size of a single output buffer in bytes. Call_1Ph_32Bit BOOL Indicates whether the method was executed 5.1.1.3 Call_3Ph_16Bit The method is called to scale the 16-bit input data of type INT according to the configured parameters. METHOD Call_3Ph_16Bit : BOOL pinputbuffer_ul1 : POINTER TO INT; pinputbuffer_ul2 : POINTER TO INT; pinputbuffer_ul3 : POINTER TO INT; pinputbuffer_il1 : POINTER TO INT pinputbuffer_il2 : POINTER TO INT pinputbuffer_il3 : POINTER TO INT ninputbuffersize : UDINT; poutputbuffer_ul1 : POINTER TO LREAL; poutputbuffer_ul2 : POINTER TO LREAL; poutputbuffer_ul3 : POINTER TO LREAL; poutputbuffer_il1 : POINTER TO LREAL; poutputbuffer_il2 : POINTER TO LREAL; poutputbuffer_il3 : POINTER TO LREAL; noutputbuffersize : UDINT; VAR_OUTPUT TC3 Power Monitoring Version: 1.1 21

pinputbuffer_ul1.. UL3 POINTER TO INT Pointer to an array of voltage values. These can be added individually or as an oversampling array. pinputbuffer_il1.. IL3 POINTER TO INT Pointer to an array of current values. These can be added individually or as an oversampling array. ninputbuffersize UDINT Indicates the size of a single input buffer in bytes. poutputbuffer_ul1.. UL3 POINTER TO LREAL poutputbuffer_il1.. IL3 POINTER TO LREAL Pointer to an array in which the scaled voltage values are to be stored. Pointer to an array in which the scaled current values are to be stored. noutputbuffersize UDINT Indicates the size of a single output buffer in bytes. Call_3Ph_16Bit BOOL Indicates whether the method was executed 5.1.1.4 Call_3Ph_32Bit The method is called to scale the 32-bit input data of type DINT according to the configured parameters. METHOD Call_3Ph_32Bit : BOOL pinputbuffer_ul1 : POINTER TO DINT; pinputbuffer_ul2 : POINTER TO DINT; pinputbuffer_ul3 : POINTER TO DINT; pinputbuffer_il1 : POINTER TO DINT pinputbuffer_il2 : POINTER TO DINT pinputbuffer_il3 : POINTER TO DINT ninputbuffersize : UDINT; poutputbuffer_ul1 : POINTER TO LREAL; poutputbuffer_ul2 : POINTER TO LREAL; poutputbuffer_ul3 : POINTER TO LREAL; poutputbuffer_il1 : POINTER TO LREAL; poutputbuffer_il2 : POINTER TO LREAL; poutputbuffer_il3 : POINTER TO LREAL; noutputbuffersize : UDINT; VAR_OUTPUT pinputbuffer_ul1.. UL3 POINTER TO DINT Pointer to an array of voltage values. These can be added individually or as an oversampling array. pinputbuffer_il1.. IL3 POINTER TO DINT Pointer to an array of current values. These can be added individually or as an oversampling array. ninputbuffersize UDINT Indicates the size of a single input buffer in bytes. 22 Version: 1.1 TC3 Power Monitoring

poutputbuffer_ul1.. UL3 POINTER TO LREAL poutputbuffer_il1.. IL3 POINTER TO LREAL Pointer to an array in which the scaled voltage values are to be stored. Pointer to an array in which the scaled current values are to be stored. noutputbuffersize UDINT Indicates the size of a single output buffer in bytes. Call_3Ph_32Bit BOOL Indicates whether the method was executed 5.1.1.5 Init The Init method is usually not required in a Power Monitoring application. It offers an alternative to function block initialization, which enables encapsulation of the function block. The method FB_init or the attribute 'call_after_init' must be used for this (see TwinCAT 3 PLC > Programming Reference). METHOD Init : BOOL stinitpars : ST_PMA_Scaling_InitPars; stinitpars ST_PMA_Scaling_InitPars [} 114] Function block-specific structure with initialization parameters Init BOOL Indicates whether the method was executed 5.1.1.6 Reconfigure The method is called in order to reconfigure the function block during the runtime. METHOD Reconfigure : BOOL foffsetvoltage : LREAL := 0.0; fgainvoltage : LREAL := 1.0; foffsetcurrent : LREAL := 0.0; fgaincurrent : LREAL := 1.0; TC3 Power Monitoring Version: 1.1 23

foffsetvoltage LREAL Indicates a user-defined offset for the voltage scaling. fgainvoltage LREAL Indicates a user-defined gain factor for the voltage scaling. foffsetcurrent LREAL Indicates a user-defined offset for the current scaling. fgaincurrent LREAL Specifies a user-defined gain factor for the current scaling. Reconfigure BOOL Indicates whether the method was executed 5.1.2 FB_PMA_Scaling_EL3773 The function block FB_PMA_Scaling_EL3773 is a special version of the function block FB_PMA_Scaling [} 19]. It is used for scaling raw values provided by the EL3773 EtherCAT Terminal. The raw values can be scaled individually or as an array, for example as oversampling values. In addition, it is possible to use single-phase and three-phase input signals. Definition: FUNCTION BLOCK FB_PMA_Scaling_EL3773 stinitpars : ST_PMA_Scaling_EL3773_InitPars; VAR_OUTPUT berror : BOOL; ipresultmessage : I_TcMessage; bnewresult : BOOL; The input parameters of this function block represent initialization parameters and have to be assigned during the declaration of the function block instance (alternatively: Init [} 26] method). They may only be assigned once. A change at runtime is possible by calling the Init [} 26] method again. stinitpars ST_PMA_Scaling_EL3773_InitPar s [} 113] Function block-specific structure with initialization parameters Outputs berror BOOL TRUE if an error occurs. ipresultmessage I_TcMessage The interface offers detailed information about the return value. bnewresult BOOL TRUE when new results were calculated. 24 Version: 1.1 TC3 Power Monitoring

Methods Methods can be used to scale different systems (single-phase or three-phase). Name Call_1Ph [} 25] Call_3Ph [} 26] Init [} 26] Reconfigure [} 27] Description The method is called to scale the input data in a single-phase system of type INT according to the configured parameters. The method is called to scale the input data in a three-phase system of type INT according to the configured parameters. Alternative to the function block initialization The method is called in order to reconfigure the function block during the runtime. Requirements Development environment Target platform PLC libraries to include TwinCAT v3.1.4022.22 PC or CX (x86, x64) Tc3_PowerMonitoring 5.1.2.1 Call_1Ph The method is called to scale the input data in a single-phase system of type INT according to the configured parameters. LREAL is output. METHOD Call_1Ph : BOOL pinputbuffer_u pinputbuffer_i ninputbuffersize poutputbuffer_u poutputbuffer_i noutputbuffersize : UDINT; : POINTER TO INT; : POINTER TO INT; : UDINT; : POINTER TO LREAL; : POINTER TO LREAL; pinputbuffer_u POINTER TO INT Pointer to an array of voltage values. These can be added individually or as an oversampling array. pinputbuffer_i POINTER TO INT Pointer to an array of current values. These can be added individually or as an oversampling array. ninputbuffersize UDINT Indicates the size of a single input buffer in bytes. poutputbuffer_u POINTER_TO_LREAL Pointer to an array in which the scaled voltage values are to be stored. poutputbuffer_i POINTER_TO_LREAL Pointer to an array in which the scaled current values are to be stored. noutputbuffersize UDINT Indicates the size of a single output buffer in bytes. Call_1Ph BOOL Indicates whether the method was executed TC3 Power Monitoring Version: 1.1 25

5.1.2.2 Call_3Ph The method is called to scale the input data in a three-phase system of type INT according to the configured parameters. LREAL is output. METHOD Call_3Ph : BOOL pinputbuffer_ul1 : POINTER TO INT; pinputbuffer_ul2 : POINTER TO INT; pinputbuffer_ul3 : POINTER TO INT; pinputbuffer_il1 : POINTER TO INT pinputbuffer_il2 : POINTER TO INT pinputbuffer_il3 : POINTER TO INT ninputbuffersize : UDINT; poutputbuffer_ul1 : POINTER TO LREAL; poutputbuffer_ul2 : POINTER TO LREAL; poutputbuffer_ul3 : POINTER TO LREAL; poutputbuffer_il1 : POINTER TO LREAL; poutputbuffer_il2 : POINTER TO LREAL; poutputbuffer_il3 : POINTER TO LREAL; noutputbuffersize : UDINT; VAR_OUTPUT pinputbuffer_ul1.. UL3 POINTER TO INT Pointer to an array of voltage values. These can be added individually or as an oversampling array. pinputbuffer_il1.. IL3 POINTER TO INT Pointer to an array of current values. These can be added individually or as an oversampling array. ninputbuffersize UDINT Indicates the size of a single input buffer in bytes. poutputbuffer_ul1.. UL3 POINTER_TO_LREAL poutputbuffer_il1.. IL3 POINTER_TO_LREAL Pointer to an array in which the scaled voltage values are to be stored. Pointer to an array in which the scaled current values are to be stored. noutputbuffersize UDINT Indicates the size of a single output buffer in bytes. Call_3Ph BOOL Indicates whether the method was executed 5.1.2.3 Init The Init method is usually not required in a Power Monitoring application. It offers an alternative to function block initialization, which enables encapsulation of the function block. The method FB_init or the attribute 'call_after_init' must be used for this (see TwinCAT 3 PLC > Programming Reference). METHOD Init : BOOL stinitpars : ST_PMA_Scaling_EL3773_InitPars; 26 Version: 1.1 TC3 Power Monitoring

stinitpars ST_PMA_Scaling_EL3773_InitPar s [} 113] Function block-specific structure with initialization parameters Init BOOL Indicates whether the method was executed 5.1.2.4 Reconfigure The method is called in order to reconfigure the function block during the runtime. METHOD Reconfigure : BOOL foffsetvoltage : LREAL := 0.0; fgainvoltage : LREAL := 1.0; foffsetcurrent : LREAL := 0.0; fgaincurrent : LREAL := 1.0; foffsetvoltage LREAL Indicates a user-defined offset for the voltage scaling. fgainvoltage LREAL Indicates a user-defined gain factor for the voltage scaling. foffsetcurrent LREAL Indicates a user-defined offset for the current scaling. fgaincurrent LREAL Specifies a user-defined gain factor for the current scaling. Reconfigure BOOL Indicates whether the method was executed 5.1.3 FB_PMA_Scaling_EL3783 The function block FB_PMA_Scaling_EL3783 is a special version of the function block FB_PMA_Scaling [} 19]. It is used for scaling raw values provided by the EL3783 EtherCAT Terminal. The raw values can be scaled individually or as an array, for example as oversampling values. In addition, it is possible to use single-phase and three-phase input signals. The function block supports the Autorange functionality of the EL3783, which can operate in two current measurement ranges. TC3 Power Monitoring Version: 1.1 27

Definition: FUNCTION BLOCK FB_PMA_Scaling_EL3783 stinitpars : ST_PMA_Scaling_EL3783_InitPars; VAR_OUTPUT berror : BOOL; ipresultmessage : I_TcMessage; bnewresult : BOOL; The input parameters of this function block represent initialization parameters and have to be assigned during the declaration of the function block instance (alternatively: Init [} 32] method). They may only be assigned once. A change at runtime is possible by calling the Init [} 32] method again. stinitpars ST_PMA_Scaling_EL3783_InitPar s [} 113] Function block-specific structure with initialization parameters Outputs berror BOOL TRUE if an error occurs. ipresultmessage I_TcMessage The interface offers detailed information about the return value. bnewresult BOOL TRUE when new results were calculated. Methods Methods can be used to scale different systems (single-phase or three-phase). Name Call_1Ph [} 28] Call_1Ph_Autorange [} 29] Call_3Ph [} 30] Call_3Ph_Autorange [} 31] Init [} 32] Reconfigure [} 33] Description The method is called to scale the input data in a single-phase system of type INT according to the configured parameters. The method is called to scale the input data in a single-phase system of type INT according to the configured parameters. The method is called to scale the input data in a three-phase system of type INT according to the configured parameters. The method is called to scale the input data in a three-phase system of type INT according to the configured parameters. Alternative to the function block initialization The method is called in order to reconfigure the function block during the runtime. Requirements Development environment Target platform PLC libraries to include TwinCAT v3.1.4022.22 PC or CX (x86, x64) Tc3_PowerMonitoring 5.1.3.1 Call_1Ph The method is called to scale the input data in a single-phase system of type INT according to the configured parameters. LREAL is output. 28 Version: 1.1 TC3 Power Monitoring

METHOD Call_1Ph : BOOL pinputbuffer_u : POINTER TO INT; pinputbuffer_i : POINTER TO INT; ninputbuffersize : UDINT; poutputbuffer_u : POINTER TO LREAL; poutputbuffer_i : POINTER TO LREAL; noutputbuffersize : UDINT; buse_5a_range : BOOL; pinputbuffer_u POINTER TO INT Pointer to an array of voltage values. These can be added individually or as an oversampling array. pinputbuffer_i POINTER TO INT Pointer to an array of current values. These can be added individually or as an oversampling array. ninputbuffersize UDINT Indicates the size of a single input buffer in bytes. poutputbuffer_u POINTER_TO_LREAL Pointer to an array in which the scaled voltage values are to be stored. poutputbuffer_i POINTER_TO_LREAL Pointer to an array in which the scaled current values are to be stored. noutputbuffersize UDINT Indicates the size of a single output buffer in bytes. buse_5a_range BOOL If the value is TRUE, the 5 A measuring range of the EL3783 is used. If it is FALSE, the 1 A measurement range is used. Call_1Ph BOOL Indicates whether the method was executed 5.1.3.2 Call_1Ph_Autorange The method is called to scale the input data in a single-phase system of type INT according to the configured parameters. LREAL is output. The EL3783 operates in Autorange mode. METHOD Call_1Ph_Autorange : BOOL pinputbuffer_u : POINTER TO INT; pinputbuffer_i : POINTER TO INT; ninputbuffersize : UDINT; poutputbuffer_u : POINTER TO LREAL; poutputbuffer_i : POINTER TO LREAL; noutputbuffersize : UDINT; bel3783_hcrangeactive : BOOL; ael3783_hcrange : ARRAY [0..3] OF USINT; VAR_OUTPUT TC3 Power Monitoring Version: 1.1 29

pinputbuffer_u POINTER TO INT Pointer to an array of voltage values. These can be added individually or as an oversampling array. pinputbuffer_i POINTER TO INT Pointer to an array of current values. These can be added individually or as an oversampling array. ninputbuffersize UDINT Indicates the size of a single input buffer in bytes. poutputbuffer_u POINTER_TO_LREAL Pointer to an array in which the scaled voltage values are to be stored. poutputbuffer_i POINTER_TO_LREAL Pointer to an array in which the scaled current values are to be stored. noutputbuffersize UDINT Indicates the size of a single output buffer in bytes. bel3783_hcrangeacti ve BOOL Autorange mode is active at the terminal. ael3783_hcrange ARRAY [0..3] OF USINT The current measuring range information for the EL3783. Call_1Ph_Autorange BOOL Indicates whether the method was executed 5.1.3.3 Call_3Ph The method is called to scale the input data in a three-phase system of type INT according to the configured parameters. LREAL is output. METHOD Call_3Ph : BOOL pinputbuffer_ul1 : POINTER TO INT; pinputbuffer_ul2 : POINTER TO INT; pinputbuffer_ul3 : POINTER TO INT; pinputbuffer_il1 : POINTER TO INT pinputbuffer_il2 : POINTER TO INT pinputbuffer_il3 : POINTER TO INT ninputbuffersize : UDINT; poutputbuffer_ul1 : POINTER TO LREAL; poutputbuffer_ul2 : POINTER TO LREAL; poutputbuffer_ul3 : POINTER TO LREAL; poutputbuffer_il1 : POINTER TO LREAL; poutputbuffer_il2 : POINTER TO LREAL; poutputbuffer_il3 : POINTER TO LREAL; noutputbuffersize : UDINT; buse_5a_range VAR_OUTPUT : BOOL; 30 Version: 1.1 TC3 Power Monitoring

pinputbuffer_ul1.. UL3 POINTER TO INT Pointer to an array of voltage values. These can be added individually or as an oversampling array. pinputbuffer_il1.. IL3 POINTER TO INT Pointer to an array of current values. These can be added individually or as an oversampling array. ninputbuffersize UDINT Indicates the size of a single input buffer in bytes. poutputbuffer_ul1.. UL3 POINTER_TO_LREAL poutputbuffer_il1.. IL3 POINTER_TO_LREAL Pointer to an array in which the scaled voltage values are to be stored. Pointer to an array in which the scaled current values are to be stored. noutputbuffersize UDINT Indicates the size of a single output buffer in bytes. buse_5a_range BOOL If the value is TRUE, the 5 A measuring range of the EL3783 is used. If it is FALSE, the 1 A measurement range is used. Call_3Ph BOOL Indicates whether the method was executed 5.1.3.4 Call_3Ph_Autorange The method is called to scale the input data in a three-phase system of type INT according to the configured parameters. LREAL is output. The EL3783 operates in Autorange mode. METHOD Call_3Ph : BOOL pinputbuffer_ul1 pinputbuffer_ul2 pinputbuffer_ul3 pinputbuffer_il1 pinputbuffer_il2 pinputbuffer_il3 ninputbuffersize poutputbuffer_ul1 poutputbuffer_ul2 poutputbuffer_ul3 poutputbuffer_il1 poutputbuffer_il2 poutputbuffer_il3 noutputbuffersize bel3783_hcrangeactive ael3783_hcrange VAR_OUTPUT : POINTER TO INT; : POINTER TO INT; : POINTER TO INT; : POINTER TO INT : POINTER TO INT : POINTER TO INT : UDINT; : POINTER TO LREAL; : POINTER TO LREAL; : POINTER TO LREAL; : POINTER TO LREAL; : POINTER TO LREAL; : POINTER TO LREAL; : UDINT; : BOOL; : ARRAY [0..3] OF USINT; TC3 Power Monitoring Version: 1.1 31

pinputbuffer_ul1.. UL3 POINTER TO INT Pointer to an array of voltage values. These can be added individually or as an oversampling array. pinputbuffer_il1.. IL3 POINTER TO INT Pointer to an array of current values. These can be added individually or as an oversampling array. ninputbuffersize UDINT Indicates the size of a single input buffer in bytes. poutputbuffer_ul1.. UL3 POINTER_TO_LREAL poutputbuffer_il1.. IL3 POINTER_TO_LREAL Pointer to an array in which the scaled voltage values are to be stored. Pointer to an array in which the scaled current values are to be stored. noutputbuffersize UDINT Indicates the size of a single output buffer in bytes. bel3783_hcrangeacti ve BOOL Autorange mode is active at the terminal. ael3783_hcrange ARRAY [0..3] OF USINT The current measuring range information for the EL3783. Call_3Ph_Autorange BOOL Indicates whether the method was executed 5.1.3.5 Init The Init method is usually not required in a Power Monitoring application. It offers an alternative to function block initialization, which enables encapsulation of the function block. The method FB_init or the attribute 'call_after_init' must be used for this (see TwinCAT 3 PLC > Programming Reference). METHOD Init : BOOL stinitpars : ST_PMA_Scaling_EL3783_InitPars; stinitpars ST_PMA_Scaling_EL3783_InitPar s [} 113] Function block-specific structure with initialization parameters Init BOOL Indicates whether the method was executed 32 Version: 1.1 TC3 Power Monitoring

5.1.3.6 Reconfigure The method is called in order to reconfigure the function block during the runtime. METHOD Reconfigure : BOOL foffsetvoltage : LREAL := 0.0; fgainvoltage : LREAL := 1.0; foffsetcurrent : LREAL := 0.0; fgaincurrent : LREAL := 1.0; foffsetvoltage LREAL Indicates a user-defined offset for the voltage scaling. fgainvoltage LREAL Indicates a user-defined gain factor for the voltage scaling. foffsetcurrent LREAL Indicates a user-defined offset for the current scaling. fgaincurrent LREAL Specifies a user-defined gain factor for the current scaling. Reconfigure BOOL Indicates whether the method was executed 5.1.4 FB_PMA_TaskTransfer_Send The function block FB_PMA_TaskTransfer_Send can be used to transfer data from a slow task back to a fast task. This may be necessary if computationally intensive algorithms were swapped out to a slow task and the results are required in another task. Together with the function block FB_PMA_TaskTransfer_Receive [} 36], it forms a function block pair for sending and receiving data. The data is passed to a function block with the target analysis ID after each call of the Call [} 35] method. The output buffers are provided for the function blocks whose ID is entered in the array of target IDs. The buffer to be initialized must be sufficient to cover the data to be transmitted. Definition: FUNCTION BLOCK FB_PMA_TaskTransfer_Send nownid : UDINT; adestids : ARRAY[1..GVL_PMA.cMA_MaxDest] OF UDINT; nresultbuffers : UDINT := 4; ttransfertimeout : LTIME := LTIME#40US; stinitpars : ST_PMA_TaskTransfer_InitPars; VAR_OUTPUT berror : BOOL; ipresultmessage : I_TcMessage; TC3 Power Monitoring Version: 1.1 33

bnewresult ncntresults : BOOL; : ULINT; The input parameters of this function block represent initialization parameters and have to be assigned during the declaration of the function block instance (alternatively: Init [} 35] method). They may only be assigned once. A change at runtime is not possible. nownid UDINT Identifies the function block instance with a unique ID. This must always be greater than zero. A proven approach is to define an enumeration for this purpose. adestids ARRAY[1..GVL_PMA.cMA_Max Dest] OF UDINT The data of the function block is sent to the IDs of the function block instances of the type specified here as an array FB_PMA_TaskTransfer_Receive [} 36]. nresultbuffers UDINT Number of multi-array buffers that are initialized for the results. ttransfertimeout LTIME Setting of the synchronous timeout for internal multi-array forwardings. See Parallel Processing in Transfer Tray. stinitpars ST_PMA_TaskTransfer_InitPars [} 115] Function block-specific structure with initialization parameters. The parameters must match the definition of the input and output buffers. Outputs berror BOOL TRUE if an error occurs. ipresultmessage I_TcMessage The interface offers detailed information about the return value. bnewresult BOOL TRUE once new results have been provided. ncntresults ULINT Count value is incremented with new output data. Methods Name Call [} 35] Init [} 35] Description The method is called in each cycle to write the values to the output buffer. Alternative to the function block initialization NaN incident In rare cases, interrupts may occur in the communication via the transfer tray. If the optional parameter GVL_PMA.cOption_MarkInterruption in the function block FB_PMA_TaskTransfer_Send is set, the first value in the buffer is marked as NaN (Not a Number) in this case. The function block FB_PMA_TaskTransfer_Receive queries the status of this first value at the start of the execution. If the status is NaN, the output bnanvalueoccured in the body of the function block is set to TRUE. No calculation takes place. Requirements Development environment Target platform PLC libraries to include TwinCAT v3.1.4022.22 PC or CX (x86, x64) Tc3_PowerMonitoring 34 Version: 1.1 TC3 Power Monitoring

5.1.4.1 Call The method is called in each cycle to write the values to the output buffer. The output buffer is sent cyclically. METHOD CALL : HRESULT pinputdata : POINTER TO LREAL, ndatainsize : UDINT; noptionpars : DWORD; pinputdata POINTER TO LREAL Pointer to an input buffer of the data to be sent. ndatainsize UDINT Indicates the size of the input buffer in bytes. noptionpars ccma_option_marki nterruption DWORD Several errors can occur and cause interruptions of the time series collection. If the flag is set and the element type is LREAL, the first data buffer element is marked as invalid (NaN). This can be used to detect an interruption in the result data sets, because it is not possible to calculate correct spectra based on fragmented time series. See NaN values. Call BOOL Indicates whether the method was executed 5.1.4.2 Init The Init method is usually not required in a Power Monitoring application. It offers an alternative to function block initialization, which enables encapsulation of the function block. The method FB_init or the attribute 'call_after_init' must be used for this (see TwinCAT 3 PLC > Programming Reference). The Init method may only be called during the initialization phase of the PLC. It cannot be used at runtime. The input parameters of the function block instance may not be assigned in the declaration if the initialization is to take place using the Init method. METHOD Init : HRESULT nownid : UDINT; adestids : ARRAY[1..GVL_PMA.cMA_MaxDest] OF UDINT; nresultbuffers : UDINT := 4; stinitpars : ST_PMA_TaskTransfer_InitPars, TC3 Power Monitoring Version: 1.1 35

nownid UDINT Identifies the function block instance with a unique ID. This must always be greater than zero. A proven approach is to define an enumeration for this purpose. adestids ARRAY[1..GVL_PMA.cMA_Max Dest] OF UDINT The data of the function block is sent to the IDs of the function block instances of the type specified here as an array FB_PMA_TaskTransfer_Receive [} 36]. nresultbuffers UDINT Number of available multi-arrays stinitpars ST_PMA_TaskTransfer_InitPars [} 115] Function block-specific structure with initialization parameters. The parameters must match the definition of the input and output buffers. Init BOOL Indicates whether the method was executed 5.1.5 FB_PMA_TaskTransfer_Receive The function block FB_PMA_TaskTransfer_Receive can be used to transfer data from a slow task back to a fast task. This may be necessary if computationally intensive algorithms were swapped out to a slow task and the results are required in another task. The input buffer is provided via the function block FB_PMA_TaskTransfer_Send [} 33]. The buffer to be initialized must be sufficient to cover the data to be transmitted. Definition: FUNCTION BLOCK FB_PMA_TaskTransfer_Receive nownid : UDINT ttransfertimeout : LTIME := LTIME#500US stinitpars : ST_PMA_TaskTransfer_InitPars; VAR_OUTPUT berror : BOOL; ipresultmessage : I_TcMessage; bnewresult : BOOL; bnanvalueoccured : BOOL; ncntresults : ULINT; The input parameters of this function block represent initialization parameters and have to be assigned during the declaration of the function block instance (alternatively: Init [} 38] method). They may only be assigned once. A change at runtime is not possible. 36 Version: 1.1 TC3 Power Monitoring

nownid UDINT Identifies the function block instance with a unique ID. This must always be greater than zero. A proven approach is to define an enumeration for this purpose. adestids ARRAY[1..GVL_PMA.cMA_Max Dest] OF UDINT Identifies the function block instance with a unique ID. This must always be greater than zero. A proven approach is to define an enumeration for this purpose. nresultbuffers UDINT Number of multi-array buffers that are initialized for the results. ttransfertimeout LTIME Setting of the synchronous timeout for internal multi-array forwardings. See Parallel Processing in Transfer Tray. stinitpars ST_PMA_TaskTransfer_InitPars [} 115] Function block-specific structure with initialization parameters. The parameters must match the definition of the input and output buffers. Outputs berror BOOL TRUE if an error occurs. ipresultmessage I_TcMessage The interface offers detailed information about the return value. bnewresult BOOL TRUE once new results have been provided. ncntresults ULINT Count value is incremented with new output data. Methods Name Call [} 37] Init [} 38] Description The method is called in each cycle to read the values from the input buffer when new data is present. Alternative to the function block initialization Requirements Development environment Target platform PLC libraries to include TwinCAT v3.1.4022.22 PC or CX (x86, x64) Tc3_PowerMonitoring NaN incident In rare cases, interrupts may occur in the communication via the transfer tray. If the optional parameter GVL_PMA.cOption_MarkInterruption in the function block FB_PMA_TaskTransfer_Send is set, the first value in the buffer is marked as NaN (Not a Number) in this case. The function block FB_PMA_TaskTransfer_Receive queries the status of this first value at the start of the execution. If the status is NaN, the output bnanvalueoccured in the body of the function block is set to TRUE. No calculation takes place. 5.1.5.1 Call The method is called in each cycle to read the values from the input buffer when new data is present. The function block waits for input data if the method outputs neither new results nor an error. This is a regular behavior in the process of the analysis chain. TC3 Power Monitoring Version: 1.1 37