User Guide

General Framework Architecture

The present framework adopts a structured three-layer approach. These are named ITFC, HOST, and SUBMODEL. Each layer contains specific applications, each designed to serve a distinct purpose:

ITFC: Interfaces are the lowest-level applications, responsible for tasks such as sensor reading and providing input to actuators, effectively connecting to the physical layer. Ideally, ITFC apps can be developed by the owner of the hardware. The use of an ITFC layer is only necessary when data exchange towards sensors or equipment is required. Multiple ITFC apps are permitted. ITFC applications share variables through a shared variable interface (SVI), and these can be read from and written to by a HOST app.

When created within PAL, ITFC apps solely consist of user-defined time histories for predefined variables. As a result, their function is restricted to serving as tools for testing interfaces; they won’t operate live, and no connections to sensors or actuations are established. The utility of ITFC apps in PAL relies entirely on the SVI they provide, which is exchanged with the HOST layer and used for testing. This SVI must precisely replicate the one from the ITFC app developed by the hardware owner, as it is the version that will be active during live applications.

HOST: This application operates in the middle layer and is responsible for tasks like data reading and writing to and from ITFC applications. HOST also manages variables crucial for experiment execution, monitoring, and communication between SUBMODEL applications. It generates output files in text format. Please note that as of release 1.0, each project supports only one HOST application. Data sharing is performed through a SVI, allowing read and write access by SUBMODEL apps.

SUBMODEL: This is the top layer, comprising the primary application models, based on Simulink models. Simulink inputs and outputs are connected to an HOST SVI. Any number of SUBMODELS can be implemented within a project.

One sampling frequency must be specified for the execution of the whole framework. As of release 1.0, different frequency execution for different applications is not supported. An exemplary sketch of the framework data flow is shown in Figure 1.

Empty C source projects should be generated for each PLC application through Bachmann SolutionCenter. These source codes are then automatically modified by the framework to incorporate all the necessary variable interconnections required by the different applications.

The framework is equipped with a Graphic User Interface (GUI) that simplifies the development and testing process and is divided into Develop/Deploy and Test.

_images/data_flow_chart.png

Figure 1 Data flow between the different layers

Project Definition

When a new project is created using the Graphical User Interface (GUI), a folder is automatically generated with the project name. Two additional folders, ReferenceCFiles and SimulinkModels, are created to store the reference PLC source code and necessary Simulink models for the SUBMODEL apps.

Additionally, two Excel files, inputfile.xlsx and SVI_definition.xlsx are created along with the folders. These files are crucial for project definition, describing the layers of the applications architecture, and explaining how data is exchanged among each application. Both these files are described in the following paragraphs.

Inputfile.xlsx

This file holds essential project information like folders, settings, and application layers definition. Its main tabs are detailed below.

Main Folders

In this section, users will find the necessary subfolder structure for each project, which is automatically generated upon initiating a new project. No modification by the user is usually necessary for this tab. A detailed description of each table entry is provided:

Table 1 Inputfile - Main Folders tab

KeyName

KeyType

Description

PLCApp

Absolute folder path

Location of PLC code after generation.

InterfaceFiles

Relative folder path

Main folder containing the dictionary for data type conversion between Matlab and the PLC. Do not change it.

ReferenceCFiles

Absolute folder path

Location of Reference C files from PLC.

SimulinkCCode

Absolute folder path

Location of Simulink Coder outputs.

SimulinkModels

Absolute folder path

Location of Simulink Models.

Settings

The “Settings” tab manages important aspects of project execution and compilation. Users must specify parameters such as sample time execution and PLC System settings. Additionally, the location of the “SVI_Definition.xlsx” file needs to be specified:

Table 2 Inputfile - Settings tab

KeyName

KeyType

Description

ExcelPLCFileName

Absolute folder path

Location of the file “SVI_Definition.xlsx”. Automatically defined

FlagGenerate_ITFC

TRUE/FALSE

If flag is TRUE, ITFC applications will load the user-defined test interfaces specified in the ITFC tab

FlagGenerate_PLCApps

TRUE/FALSE

Master switch to control PLC code generation of applications. Default is TRUE

SaveModelParametersFlag

TRUE/FALSE

If flag is on, Simulink model parameters are saved as “.mat” files after each deployment. Default is TRUE

sample_time

Double

Sample time of execution for the framework, in seconds

PLC_system

String

Type of PLC system for deployment, as of the present version, only “Bachmann” is supported

DataTypes_dict_filename

String

Dictionary filename for the conversion of data types between PLC and Matlab

ITFC

In this tab, a row is dedicated to each ITFC application. Each application can read a test interface in the form of a “.mat” file as input. The system supports the inclusion of multiple ITFC applications:

Table 3 Inputfile - ITFC tab

KeyName

KeyType

Description

appTag

String

Tag name of the application

PLCApp_folder

String

Name of PLC application folder in ProjectName\PLCApp

refC_name

String

Name of PLC reference C file in ProjectName\ReferenceCFiles\Originals

Flag_Generate_PLC_app

TRUE/FALSE

If flag is TRUE, PLC code is generated for the ITFC application

Flag_Create_test_ITFC

TRUE/FALSE

If flag is TRUE, test interface is created and loaded, default is FALSE

test_ITFC_filename

Relative filename path

Location of test interface “.mat” file

Comment

String

Comment string

HOST

In this tab, a row is dedicated to each HOST application. IMPORTANT: as of this version, only one HOST application per project can be used.

Table 4 Inputfile - HOST tab

KeyName

KeyType

Description

appTag

String

Same as ITFC

PLCApp_folder

String

Same as ITFC

refC_name

String

Same as ITFC

Flag_Generate_PLC_app

TRUE/FALSE

Same as ITFC

FAST_FREQ_RATIO

Integer

Sample time of output data generation of “FAST” data. Expressed in integer multiples of “sample_time”. Default is 1

SLOW_FREQ_RATIO

Integer

Sample time of output data generation of “SLOW” data. Expressed in integer multiples of “sample_time”. Default is 10

CTRL_FREQ_RATIO

Integer

Sample time of output data generation of “CONTROL” data. Expressed in integer multiples of “sample_time”. Default is 10

out_filename

String

Filename of output files in PLC

output_path_in_PLC

Absolute folder path

Location of folder in PLC (WARNING: the folder must be created before running the applications on the PLC)

output_file_duration_s

Double

Length of output data time histories [s]

Comment

String

Same as ITFC

SUBMODELS

In this tab, one row is dedicated to each SUBMODEL. Each submodel must have a single Simulink model associated. There is no specific limit to the number of SUBMODEL apps permitted for each project:

Table 5 Inputfile - SUBMODELS tab

KeyName

KeyType

Description

modelTag

String

Same as ITFC

PLCApp_folder

String

Same as ITFC

slmodel_folder

String

Name of Simulink model folder in ProjectName\SimulinkModels

slmodel_name

String

Name of Simulink model in ProjectName\SimulinkModels\slmodel_folder

slccode_folder

String

Name of Simulink code generation folder in ProjectName\SimulinkCCodes

refC_name

String

Same as ITFC

Flag_Generate_PLC_app

TRUE/FALSE

Same as ITFC

host_apptag

String

appTag of HOST application connected to Submodel (WARNING: as of the present version, only one HOST per project is supported)

Comment

String

Same as ITFC

SVI_Definition.xlsx

This Excel file defines the data flow among different layers in each project. It outlines the variables for each application and defines their transmission to other applications.

In general, each application manages a shared variable interface (SVI), which is read and written by other applications. The SVI_Definition.xlsx file comprises three tabs, each dedicated to a layer of the framework (ITFC, HOST, SUBMODEL). Common variable data types are detailed in the appendix.

ITFC

To promote the separation between hardware-specific and research-specific operations, the ITFC layer should be ideally developed by the hardware owner. Within the present framework, as already mentioned, this layer serves the unique purpose of testing, ensuring the proper functioning of the framework applications, primarily the Simulink submodels. Thus, it is crucial that the SVI of ITFC applications precisely replicates the one encountered during experimentation.

ITFC applications are “inert,” meaning they do not actively perform reading or writing operations on any other application’s SVI. HOST applications, on the other hand, can read and write information to ITFC SVIs.

In addition to the mentioned data types, ITFC variables can also be implemented as structures, where all subfields share the same “Access” property. Numerical arrays for subfields are not yet supported (except for string arrays). A detailed description of all table elements is provided below.

Table 6 SVI_Definition - ITFC tab

KeyName

KeyType

Description

InputNumber

String

Unique number identifying a “main ITFC variable”. Consecutive entries with same input number are considered subfields of the main structure

TagName

String

Tag name of the structure/subfield variable

VarName

String

Internal variable name in generated code. For all practical purposes, this can be set equal to TagName

AppName

String

appTag of ITFC application the variable belongs to. Not necessary for subfields. ITFC must be present in “inputfile.xlsx”

VarType

String/struct

Matlab data type of the variable. Must be included in data type conversion dictionary between Matlab and PLC. If variable is a structure, it must be set to “struct”

VarSize

Integer

If variable is a structure, VarSize should be the sum of the Bytes of its subfields. See the example for details. If variable is a subfield, only VarSize equal to 1 is allowed for numerical variables, while it can be longer for “char” variables. If variable is a main variable, any array length is supported.

Access

READ/WRITE

It must match the “Action” of the corresponding HOST variable. Set READ if the variable is read by HOST or WRITE if the variable is written by HOST

Create

TRUE/FALSE

When set to FALSE, the variable is ignored

HOST

A HOST variable can READ/WRITE data to an ITFC variable, but cannot be transmitted to SUBMODEL variables.

HOST variables serve various purposes, including:

  1. Reading variables from ITFC and host them to be read by SUBMODEL apps.

  2. Read variable from ITFC for monitoring purposes

  3. Creating static variables for SUBMODEL, particularly useful for constant definitions

  4. Receiving outputs from SUBMODEL and writing it back to ITFC

  5. Receiving SUBMODEL outputs for monitoring purposes

  6. Receiving the AppStatus variable from SUBMODEL to assess the application’s operation

Except string variables, HOST variables VarSize MUST be equal to 1; arrays are not allowed. When exchanging variables with an ITFC app, the Action of a HOST Variable must align with the Access of an ITFC Variable. By default, HOST applications generate three “.txt” outputs at different sampling times: fast, slow, ctrl. For each HOST variable, this behavior can be controlled by the output_freq field.

Table 7 SVI_Definition - HOST tab

KeyName

KeyType

Description

TagName

String

Variable tag name

VarName

String

Internal variable name in generated code. For all practical purposes, this can be set equal to TagName

AppName

String

appTag of HOST application the variable belongs to. HOST must be present in “inputfile.xlsx”

VarType

String

Matlab data type of the variable. Must be included in data type conversion dictionary between Matlab and PLC. If the variable is exchanged with an ITFC app, VarType can be inherited by setting VarType value as “inherit”

VarSize

Integer

Size of the variable. Set “-1” in combination with “VarType” equal to “inherit” to retrieve the size from the ITFC app. Numeric variables must have “VarSize” equal to 1. Strings can have any VarSize

Create

TRUE/FALSE

When set to FALSE, the variable is ignored

parent_App

String

“AppName” of the parent ITFC app, if the variable is exchanged with a ITFC app. In such case “Action” must be set. It can be left blank otherwise

parent_TagName

String

“TagName” of the main parent ITFC variable. Necessary only if the variable is exchanged with a ITFC app. If the ITFC variable belongs to a structure, “parent_TagName” is the “TagName” of the ITFC structure. If the ITFC variable is not a structure “parent_TagName” is the “TagName” of the ITFC variable

parent_SubVar

String/Integer

“TagName” of the parent ITFC variable, if the variable is exchanged with a ITFC app. If ITFC variable belongs to a structure, “parent_SubVar” is the “TagName” of the subvariable. If the ITFC variable is an array, it corresponds to the index to read (1-based numbering)

Action

READ/WRITE/-

It must match the “Access” of the corresponding ITFC variable. Set READ if the variable is read by HOST or WRITE if the variable should be written back into the ITFC variable

Flag_Assign_InitialValue

TRUE/FALSE

Set to TRUE to assign an initial value to the variable. Only numerical values are supported.

Initial_Value

double

Initial value of the variable

Units

String

Units of measure of variable to be written in output file

Print_output

TRUE/FALSE

If set to TRUE, the variable will be written to the output files

output_freq

fast/slow/ctrl

Frequency at which the variable should be written to the output file

Comments

String

Comment string

SUBMODEL

SUBMODEL variables can perform READ/WRITE operations to a HOST variable, but not on other SUBMODEL apps. For each Simulink model, it is recommended to include all model inputs and outputs as SUBMODEL variables (with the correct port numbering). Additionally, for each SUBMODEL app, include an AppStatus status variable, which informs the HOST application about whether the SUBMODEL is running.

SUBMODEL variables must be single numerical values; arrays are not allowed. The IO type field must match the type of the Simulink model port, except for “status” variables. Generally, each SUBMODEL will contain nI + nO + 1 variables, where nI/nO indicates the number of input/output ports of a Simulink model.

Table 8 SVI_Definition - SUBMODELS tab

KeyName

KeyType

Description

modelTag

String

Tag name of the Simulink model

TagName

String

Same as HOST

VarName

String

Same as HOST

IO

input/output/status

Variable block type in Simulink model. A single status variable must be present for each SUBMODEL, in which case “IO” should be set to “status”

PortNumber

Integer

Port numbering of Simulink model. Status variables are not numbered. WARNING: different numberings for input and output!

PortName

String

Port name in Simulink model

Create

TRUE/FALSE

Same as HOST

VarType

String

Similar to HOST, but “inherit” is not supported

parent_App

String

“AppName” of the parent HOST app, if the variable is exchanged with a HOST app. In such case “Action” must be set. It can be left blank otherwise

parent_TagName

String

“TagName” of parent HOST variable, if the variable is exchanged with a HOST app

Action

READ/WRITE/-

Action to perform on each variable. Normally, Simulink inputs are “read” and outputs are “write”

Below in Figure 2, an illustrative sketch exemplifies the data transmission involving two ITFC variables (a structure and an array). These variables are exchanged with a Simulink model.

_images/org_chart.png

Figure 2 Example of data transmission among ITFC, HOST, and SUBMODEL layers

Graphic User Interface

To start a new session, launch the App Designer file “main.mlapp” and run it. A new GUI will open, featuring two primary tabs which focus on distinct operations within the framework: the Develop/Deploy and the Test tab.

Develop/Deploy

The Develop/Deploy tab allows the definition of the applications for each layer. A sample of the GUI for the sample project “met_mast_reader” is illustrated in Figure 3.

_images/paldd_1.png

Figure 3 Develop/Deploy Tab

The following table provides a description of the Develop/Deploy tab.

Table 9 GUI - description of Develop/Deploy tab

KeyName

Description

1

Load button

Button to load an “inputfile.xlsx”

2

“New project” switch

Button to create a new project. Must specify project folder and name

3

Add Submodel button

Button to add a new submodel to the project, which will appear in the SUBMODEL panel

4

Submodel panel

Overview of the project SUBMODEL apps

5

Add ITFC button

Button to add a new ITFC to the project, which will appear in the ITFC panel

6

ITFC panel

Overview of the project ITFC apps

7

Add HOST button

Button to add a new HOST to the project, which will appear in the HOST panel

8

HOST panel

Overview of the project HOST apps

9

Save button

Button to save current data to “inputfile.xlsx”

10

Generate PLC button

Button to generate PLC code of selected applications

11

Refresh button

Button to refresh the application panels

New applications can be generated for each layer through dedicated buttons. Specific application panels are detailed for each layer.

SUBMODEL

Upon generating a new SUBMODEL, various options and flags become visible.

Table 10 GUI - SUBMODEL panel

KeyName

Description

modelTag

Name of SUBMODEL

GeneratePLC

Checkbox used to set whether to generate PLC code of Simulink mode. Linked to “Flag_Generate_PLC_app” in “inputfile.xlsx”

C ref found

This light turns green if the reference source code file is found in the folder “ReferenceCFiles\originals”. Additional fields MUST be added before code generation by right-clicking and selecting “Add Matlab Fields”

SLmodel-Ready

This light turns turn green if a Simulink model with the designated name is found in the folder “SimulinkModels” folder

PLCgen-Ready

This light indicates whether the App is ready for code generation. WARNING: remember to “Add Matlab Fields”!

Create Simulink Model

Create a new empty Simulink model. This action generates, alongside an empty Simulink model, an initialization .m file, which can be used for configuring specific model parameters

Details

Open a tab to modify the SUBMODEL parameters of “inputfile.xlsx”

If a user intends to use an externally developed Simulink model, it is advisable to copy-paste its content into a newly created one. This ensures the retention of the Simulink model settings defined via the “Create Simulink Model” button. This action generates, alongside an empty Simulink model, an initialization .m file, which can be used for configuring specific model parameters.

ITFC

Table 11 GUI - ITFC panel

KeyName

Description

appTag

Name of ITFC

GeneratePLC

Same as SUBMODEL

C ref found

Same as SUBMODEL

PLCgen-Ready

Same as SUBMODEL

Create Empty ITFC

Generate an empty test interface according to the specifics defined in the “SVI_Definition.xlsx”. All numeric values will be set to 0. Filename is set as “test_ITFC_filename” of the “inputfile.xlsx”

Create Random ITFC

Generate an random test interface according to the specifics defined in the “SVI_Definition.xlsx”. Preferred option for testing. Filename is set as “test_ITFC_filename” of the “inputfile.xlsx”

Load ITFC

Load the filename “test_ITFC_filename” of the “inputfile.xlsx”

Details

Same as SUBMODEL

HOST

The definion of a HOST is equivalent to that of a SUBMODEL panel.

Test

After the generation of PLC applications, the framework can be executed on the PLC hardware. The HOST application generates “.txt” outputs, which can be used through the Test tab to verify the correctness of the data transmission between the different applications. The tab provides tools for reading HOST outputs and comparing results between PLC and Simulink, among other functions. It is important to mention that, since applications must be loaded onto the PLC sequentially, from lower to higher layers (ITFC, HOST, and then SUBMODEL), a residual delay exists between test ITFC data and HOST data, which is of course not physical but purely introduced by this delay.

An example of the GUI for the example project “met_mast_reader” is shown in Figure 4.

_images/paltest.png

Figure 4 Test tab

Table 12 GUI - overview Test tab

KeyName

Description

1

Generate MAT file from HOST outputs

Aggregate HOST output files. Select all HOST “.txt” files to convert them to a unique “.mat” file

2

Run Simulink models

Run the Simulink models with the HOST inputs currently loaded. WARNING: trim unphysical data before use!

3

Select HOST

Select the HOST app to Test. Currently only one HOST app is supported for each project

4

Load HOST Data

Load MAT file generate by the button “Generate MAT file from HOST outputs”

5

Select HOST entry

Select HOST entry to plot. ITFC and SUBMODEL curves will be added, if present

6

Comparison plot

Axes on which the variables are displayed

7

Find delay

Run cross correlation to identify delay between HOST and ITFC

8

Adjust delay

Manually specify or adjust the delay between HOST and ITFC

9

Save

Save current framework as “.mat” file

10

Brush data

Select data to keep after syncronization. See the example for details

Before running Simulink models, unphysical data should be trimmed using the Brush function, along with the “Brush Data/sync ITFC app” (right-click on the figure). Users should familiarize themselves with the testing functionality by following the examples provided.

Examples

The following subsections describe two examples derived from wind energy applications: a Met-Mast data reader, which can be used to read data from a met-mast and perform moving averages for monitoring purposes, and a SCADA-data reader.

Example 1: Met-Mast Data Reader

In this first example, the user creates a simple framework to read data from a Met-Mast ITFC app, calculate moving averages, and determine additional inflow quantities, which are then written back to the ITFC.

To begin, open the framework by double-clicking on the file “main.mlapp” to open the main GUI. Two options are available: loading an existing file or creating a new one. Click on “new.” Specify the folder for your new project. Open the “Examples” folder and click OK.

Specify the new project name. Call it “met_mast_reader” and click OK (Figure 5). This will create a set of subfolders, as explained in Project Definition.

_images/mmr_new.png

Figure 5 Define new project view

Now create three applications, one for each data layer:

  1. A SUBMODEL, performing the averaging function

  2. An ITFC for data transmission and testing

  3. A HOST, responsible for managing output data

Create a new SUBMODEL

  1. To begin, create a SUBMODEL by selecting “Add SUBMODEL” and providing a name, such as calc_avg. Click OK. The underlying Simulink model will process inputs from wind speed and wind direction data to calculate averages based on the desired window size. A new model will appear in the relative panel first row with several red indicator lights (Figure 6).

    _images/mmr_new2.png

    Figure 6 Overview of newly create”calc_avg”

  2. Generate an empty Simulink model by clicking “Create” in the “Create Simulink Model” column. This action creates the Simulink model in the model folder along with an “init_MODELTAG.m” file, which can be used for initializing data and constants. A green light under “SLmodel-Ready” indicates the model’s presence in the Matlab path.

  3. Create a new Bachman Empty project within SolutionCenter, following the steps in the Create Bachmann Applications section. Call the application calavg. Ensure the main application source file is copied into the reference C folder, located in “ProjectName\ReferenceCfiles\Originals.” If the source file name, without the appendix “_app.c” is different than the project name, update it by clicking “Details” and changing the field refC_name to the new name (e.g., calavg in the present case). A green “C ref found” light indicates the presence of the reference C file in the Matlab’s path.

  4. Right-click on the “C ref found” light and select “Add Matlab Fields” (Figure 7). This modifies the reference files, enabling the interconnection of variables.

    _images/mmr_new3.png

    Figure 7 Add Matlab Fields for the SUBMODEL “calc_avg”

  5. Create the Simulink model in the appropriate folder. You can either modify the empty one, copy and paste into the existing model, or use the example provided under “Examples\met_mast_reader_sample\SimulinkModels\calc_avg.” If you plan to use a custom Simulink model, note that some model settings may differ, so it is advisable to copy the content of your model into the newly created one, as previously mentioned.

  6. Open the model provided. The model has three main inputs:

    • Met mast wind speed at 110m

    • Met mast wind speed at 60m

    • Met mast wind direction at 110m

      The reference heights in this example are based on the IEA Task 37 reference wind turbine. The model checks if variables are correctly being transmitted (e.g., ensuring the signals are not frozen) and then calculates moving averages. Several outputs are computed:

    • Moving average of the wind speed at 110m

    • Turbulence intensity calculated from the wind speed at 110m

    • Moving average of the wind speed at 60m

    • Power-law shear exponent

    • Moving average of the wind direction at 110m

    • Status check to monitor runtime activity

  7. The model requires specific quantities to be defined, which can be found in the file “init_calc_avg.m” file

  8. Quantities like startup time, moving average interval, and error time are here set to 600 s

  9. With these settings in place, the Simulink model is ready to use

Create a new ITFC

  1. Click on the “Add ITFC” button, and in the dialog box that appears, assign the name “met_mast_ITFC” to the ITFC app.

  2. Similarly to the steps taken for the “calc_avgSUBMODEL, you will need to generate a new empty PLC code. Refer to the Create Bachmann Applications section for detailed guidance. Within SolutionCenter, name this application “mmitfc.” Copy and paste the reference app file into the “Originals” folder and update the “refC_name” to the new name through “Details”.

  3. Right-click on the “C ref found” light and select “Add Matlab Fields” (Figure 7).

Create a new HOST

  1. Click on the “Add HOST” button. Assign “host_calc_avg,” to your new host application AppName.

  2. Complete all the required fields by clicking the “Details” button. Detailed guidance on these fields is provided in the inputfile definition section.

  3. Similarly to the previous steps, generate a new empty PLC code for the host application following the instructions in the Create Bachmann Applications section. Name this source application hcalc.

  4. Copy and paste the reference app file into the “Originals” folder, updating the details of the app accordingly. Right-click on the C ref found light, and from the menu that appears, select “Add Matlab Fields.”.

  5. Set the out_filename field in the “Details” section as hcalc_outputs and provide the output_path_in_PLC (note that this will be dependent on your PLC folder path). Ensure that the corresponding folder is pre-created on the PLC to prevent potential issues during framework startup.

  6. The basic applications – SUBMODEL, ITFC, and HOST – have been successfully created. Save your progress by clicking the “Save” button below, which updates the excel file “inputfile.xlsx.”

Modify the “inputfile.xlsx”

Open the “inputfile.xlsx” to configure the main settings for the met_mast_reader project. Changes made to the Submodels, ITFC, and HOST tabs will be reflected in the GUI upon the next project load.

  1. Click on the Settings tab. Adjust the sample_time parameter to your desired value. Here, 0.1 seconds is chosen. This parameter determines the operating frequency for all the project applications. Note that only Bachmann systems can be selected in the PLC_system column.

  2. Navigate to the Submodels tab. In the “host_apptag” column for “calc_avg”, specify “host_calc_avg”. This designates the host application with which the SUBMODEL application exchanges data. As mentioned earlier, it is crucial to use the same host application for every SUBMODEL. Save your changes and close the file.

Below, an overview of the different tabs in “inputfile.xlsx” for the “met_mast_reader” project.

Table 13 met_mast_reader - “inputfile.xlsx” - SUBMODEL

modelTag

PLCApp_folder

slmodel_folder

slmodel_name

slccode_folder

refC_name

Flag_Generate_PLC_app

host_apptag

Comment

calc_avg

calc_avg

calc_avg

calc_avg

calc_avg

calavg

FALSE

host_calc_avg

Table 14 met_mast_reader - “inputfile.xlsx” - ITFC

appTag

PLCApp_folder

refC_name

Flag_Generate_PLC_app

Flag_Create_test_ITFC

test_ITFC_filename

Comment

met_mast_ITFC

met_mast_ITFC

mmitfc

FALSE

FALSE

Table 15 met_mast_reader - “inputfile.xlsx” - HOST

appTag

PLCApp_folder

refC_name

Flag_Generate_PLC_app

FAST_FREQ_RATIO

SLOW_FREQ_RATIO

CTRL_FREQ_RATIO

out_filename

output_path_in_PLC

output_file_duration_s

Comment

host_calc_avg

host_calc_avg

hcalc

FALSE

1

10

10

hcalc_outputs

/usbBulk0/CALCAVG/

600

Table 16 met_mast_reader - “inputfile.xlsx” - Settings

KeyName

KeyValue

Comment

ExcelPLCFileName

root\PAL\Examples\met_mast_reader\SVI_definition.xlsx

FlagGenerate_ITFC

TRUE

FlagGenerate_PLCApps

TRUE

SaveModelParametersFlag

TRUE

sample_time

0.1

PLC_system

Bachmann

DataTypes_dict_filename

dictionary_bachmann.xlsx

Modify the “SVI_Definition”

In this step, you will define the variables for each application and establish the necessary variable interconnections across different layers. Open “SVI definition.xlsx”. A separate description is given for each respective layer.

ITFC

As a first step, it is necessary to create a dummy interface. For the current met-mast case, define two variables in the “ITFC”:

  1. Create a structure named “met_mast”. Set both TagName and VarName to “met_mast.” Set InputNumber to 1, ensuring AppName matches the HOST app in “inputfile.xlsx.” Specify VarType as “struct,” type “READ” in the Access field, and set Create to true. Note that structures can handle variables of different data types, but their size should be 1 for all numeric variables. You can leave the VarSize field empty for now.

  2. Define three subvariables under “met_mast”:

    1. Wind Speed at 110 m, named “ws_110m

    2. Wind Speed at 60 m, named “ws_60m

    3. Wind Direction at 110 m, named “wd_110m

    For each subvariable, ensure InputNumber matches that of the structure, leave AppName empty, set VarType as “double,” VarSize to 1, and mark Create as true. The Access field can be left empty since it will be inherited from the structure variable.

  3. Create a variable named “exchange_data_mm” to store and write output values from the HOST to the ITFC. Set InputNumber to 2, VarType to double, VarSize to 5, and Access to “WRITE”.

The resulting sheet can be viewed in the following table.

Table 17 met_mast_reader - “SVI_Definition.xlsx” - ITFC

InputNumber

TagName

VarName

AppName

VarType

VarSize

Access

Create

1

met_mast

met_mast

met_mast_ITFC

struct

24

READ

TRUE

1

ws_110m

ws_110m

double

1

TRUE

1

ws_60m

ws_60m

double

1

TRUE

1

wd_110m

wd_110m

double

1

TRUE

2

exchange_data_mm

exchange_data_mm

met_mast_ITFC

double

5

WRITE

TRUE

HOST

The “host_calc_avg” app is equipped with 10 variables:

  1. Create three variables corresponding to the inputs of your Simulink model. These variables, being read from the interface structure, necessitate defining parent_App,*parent_TagName*, and parent_SubVar. Set Action to “READ” and output_freq as “fast” for these input variables.

  2. Specify the outputs of the Simulink model, which comprises six variables. Among these, five are exchanged with the interface. Therefore, provide information in the parent_App, parent_TagName, and parent_SubVar fields for these. The last variable, “avg_inflow State, will not be written back to the interface. For the averaged quantities, set output_freq as “slow,” while for the “avg_inflowState,” can be printed at “ctrl” frequency.

  3. Include a mandatory “AppStatus” variable for each submodel in the framework. As there is a single submodel named “calc_avg” in this example, add the variable “avg_inflow_AppStatus.” The type of this quantity can be a 16-bit unsigned integer. Output this variable at “ctrl” frequency.

The resulting sheet can be viewed in the following table.

Table 18 met_mast_reader - “SVI_Definition.xlsx” - HOST

TagName

VarName

AppName

VarType

VarSize

Create

parent_App

parent_TagName

parent_SubVar

Action

Flag_Assign_InitialValue

Initial_Value

Units

Print_output

output_freq

Comments

mm_ws_110m

mm_ws_110m

host_calc_avg

inherit

-1

1

met_mast_ITFC

met_mast

ws_110m

READ

0

0

[m/s]

1

fast

mm_ws_60m

mm_ws_60m

host_calc_avg

inherit

-1

1

met_mast_ITFC

met_mast

ws_60m

READ

0

0

[m/s]

1

fast

mm_wd_110m

mm_wd_110m

host_calc_avg

inherit

-1

1

met_mast_ITFC

met_mast

wd_110m

READ

0

0

[deg]

1

fast

avg_TI

avg_TI

host_calc_avg

inherit

-1

1

met_mast_ITFC

exchange_data_mm

1

WRITE

0

0

[-]

1

slow

avg_ws_110m

avg_ws_110m

host_calc_avg

inherit

-1

1

met_mast_ITFC

exchange_data_mm

2

WRITE

0

0

[m/s]

1

slow

avg_ws_60m

avg_ws_60m

host_calc_avg

inherit

-1

1

met_mast_ITFC

exchange_data_mm

3

WRITE

0

0

[m/s]

1

slow

avg_shearExp

avg_shearExp

host_calc_avg

inherit

-1

1

met_mast_ITFC

exchange_data_mm

4

WRITE

0

0

[-]

1

slow

avg_wd_110m

avg_wd_110m

host_calc_avg

inherit

-1

1

met_mast_ITFC

exchange_data_mm

5

WRITE

0

0

[deg]

1

slow

avg_inflowState

avg_inflowState

host_calc_avg

double

1

1

0

0

[-]

1

ctrl

avg_inflow_AppStatus

avg_inflow_AppStatus

host_calc_avg

uint16

1

1

0

0

[-]

1

ctrl

SUBMODEL

The SUBMODEL “calc_avg” must be defined, according to the input port of the underlying Simulink model and its application status.

  1. Define three variables, corresponding to the inputs of the Simulink model. Set IO as “input.” Specify the fields parent_App and parent_TagName. Ensure that the Action is set as “READ.”

  2. Define six variables corresponding to the outputs of the Simulink model. Set IO as “output.” Specify the fields parent_App and parent_TagName. Ensure that the Action is set as “WRITE.”

  3. Correctly define the PortNumber for both input and output variables based on the port numbering of the Simulink model. Additionally, ensure that the PortName matches the names in the Simulink model.

  4. Create an “AppStatus” variable, denoted by the IO field set as “status.” This variable does not require a port number. The port name should be set as “AppStatus.” Set this variable to “WRITE.”

Remember to save and close the “SVI_Definition” file after making these modifications.

Table 19 met_mast_reader - “SVI_Definition.xlsx” - SUBMODELS

modelTag

TagName

VarName

IO

PortNumber

PortName

Create

VarType

parent_App

parent_TagName

Action

calc_avg

ws_110m

ws_110m

input

1

input_ws_110m

1

double

host_calc_avg

mm_ws_110m

read

calc_avg

ws_60m

ws_60m

input

2

input_ws_60m

1

double

host_calc_avg

mm_ws_60m

read

calc_avg

wd_110m

wd_110m

input

3

input_wd_110m

1

double

host_calc_avg

mm_wd_110m

read

calc_avg

avg_TI

avg_TI

output

1

output_TI

1

double

host_calc_avg

avg_TI

write

calc_avg

avg_ws_110m

avg_ws_110m

output

2

output_ws_110m

1

double

host_calc_avg

avg_ws_110m

write

calc_avg

avg_ws_60m

avg_ws_60m

output

3

output_ws_60m

1

double

host_calc_avg

avg_ws_60m

write

calc_avg

avg_shearExp

avg_shearExp

output

4

output_shearExp

1

double

host_calc_avg

avg_shearExp

write

calc_avg

avg_wd_110m

avg_wd_110m

output

5

output_wd_110m

1

double

host_calc_avg

avg_wd_110m

write

calc_avg

inflowState

inflowState

output

6

output_InflowOK

1

double

host_calc_avg

avg_inflowState

write

calc_avg

AppStatus

AppStatus

status

AppStatus

1

uint16

host_calc_avg

avg_inflow_AppStatus

write

Generate the test interface

After modifying the “SVI_Definition.xlsx,” the project requires reloading. An error will now occur, indicating:

ITFC App “met_mast_ITFC” - variable “met_mast” is a struct of size NaN Bytes, but its subvariables sum up to 24. Please check the excel file.

This error results from leaving the “VarSize” field of the ITFC variable “met_mast” empty. To resolve this, insert 24 in the field (3 doubles of 8 bytes each).

Now, proceed with creating a dummy interface:

  1. Open the details of the ITFC app “met_mast_ITFC” and fill in the “test_ITFC_filename” for your ITFC app, including any relative path. Create this file in “./Examples/met_mast_reader/mm_ITFC.mat.”

  2. Click on the “Create Random ITFC” button. Specify the duration of the time histories; the default is 100 seconds. Keep in mind storage considerations on your PLC. If the duration is too long, it might pose storage issues on your PLC. However, in this case, since we have only a few variables, it should not be a problem. Set it to 1000 seconds and click “OK.”

  3. A new “mm_ITFC.mat” file is generated. If you open it, you will find the “met_mast” structure and the “exchange_data_mm” array. Initially, these variables are populated with random data based on their data type. However, this might not be realistic for wind speed and direction data. You have two options: replace the random data with your own or use the provided dummy variables included within the folder “Examples\met_mast_reader_sample”, which contains with realistic data. By default, only the “read” variables are filled with random numbers, while “WRITE” variables are set to 0.

  4. Open the details of your ITFC_App and set its Flag_Create_test_ITFC to TRUE. Click on “Load ITFC.”

Generate the PLC code

To generate the PLC code, make sure all “Generate PLC” checkboxes are ticked, save your project, and then click on the “Generate PLC” button at the bottom of the GUI.

As a result, three folders will be created under the directory labeled PLCApps. To complete this process, transfer the contents of each of these folders into the corresponding applications folder within your PLC path.

Testing the framework

  1. Now, you can run the applications on the PLC through the Bachmann SolutionCenter. It is critical to follow a specific installation order: start with the ITFC, proceed to HOST, and conclude with SUBMODEL apps.

  2. Within the HOST applications, a variable called Flag_Record is created. Use it to control the generation of output files. Wait now for the test to complete, which will take 1000 seconds. Once done, copy the output files back to the Matlab folder of the project.

  3. In the GUI “Test” tab, generate a “.mat” file that aggregates the HOST outputs by clicking “Generate MAT file from HOST outputs.” Select all the outputs (FAST, SLOW, and CTRL). This creates a file named “hcalc_outputs.mat.”

  4. Choose the HOST “host_calc_avg” from the dropdown menu, and load its data through the “Load Host data” button, using the “.mat” file you just created. All the host variables will be visible in the dropdown menu.

  5. Select a variable, such as “mm_ws_110m.” You will see two curves, one from the ITFC data and the other from the HOST application. Use the figurer to verify whether the two signals are identical. In the present case, you will see something like this:

_images/mmr_new4.png

Figure 8 Data trasmission error: excessive HOST recording time

At the end of the time history, unphysical values are provided by the “host_calc_avg” application. This anomaly occurs because, after the 1000 seconds embedded in the ITFC application, random values are transmitted to the HOST application. To rectify this, you will need to trim the unnecessary data. The “Brush Data” feature facilitates this process.

  1. Use “Brush Data” to select the data you wish to retain.

  2. Right-click and choose “Brush Data / Sync ITFC App.”

_images/mmr_new5.png

Figure 9 Data brushing to trim time history endings

The signals might still be affected by a time shift because the ITFC application was started earlier than the HOST application.

_images/mmr_new6.png

Figure 10 Data brushing to trim time history endings

To correct this time shift, click “Find delay” and manually adjust the ITFC signal using the “+” and “-” buttons. Once synchronization is achieved, select the data to keep and use the “Brush Data / Sync ITFC App” function once more. This function will synchronize all variables originating from the same ITFC application, eliminating the need to do it individually for each HOST variables, such as “mm_ws_60m” and “mm_wd_110m.” After this synchronization, check whether the data are perfectly coincident or if there are still some transmission errors, which may be a sign of incorrect setup of the “SVI_Definition.xlsx” or some PLC errors.

_images/mmr_new7.png

Figure 11 Syncronized data

When you select “avg_ws_110m” or any variable that should be an output of a Simulink model, you might observe that only the “host_calc_avg” results are visible. To check whether the Simulink model works the same way in both the PLC and Matlab, run the Simulink model by clicking “Run Simulink models.” This uses the same inputs as the host application, allowing you to compare and ensure the C model is functioning correctly. Simulink outputs will be displayed as well.

_images/mmr_new8.png

Figure 12 PLC vs Simulink time histories for the entry “avg_ws_60m

The comparison should align well after the initial ramp-up time required for the moving average. Verify the last two variables, “avg_inflow_AppStatus,” which should be 0 when the submodel “calc_avg” was not running and 1 otherwise, and “avg_inflowState,” which should be 0 when the submodel is running correctly and a number between 1 and 7 otherwise.

Save your results by clicking on “Save” with the desired output file name to generate a “.mat” file for future reference. This concludes the present tutorial. Your applications are now ready for execution.

Example 2: SCADA data reader

The second example in this tutorial focuses on developing a SCADA data reader for wind energy applications. It assumes that users have already followed the “Met-Mast Data Reader” tutorial, as this example will only highlight the differences between the two cases.

Begin by creating a new project and naming it “SCADA_reader.”

In this tutorial, several applications will be created:

  1. 3 SUBMODEL apps: These are connected to Simulink models responsible for inflow averaging, wind farm monitoring, and loads post-processing

    1. avg_inflow: A SUBMODEL connected to a Simulink model performing inflow averaging

    2. WF_status: A SUBMODEL monitoring wind farm status

    3. loads_process: A SUBMODEL for loads post-processing

  2. 3 ITFC apps: These ITFC applications simulate data provided by different clients

    1. itfc_scada: Simulating data from SCADA for different turbines, including rotor speed, pitch, power, vibrations, and control variables

    2. itfc_mm: Simulating data from a meteorological mast, replicating “met_mast_ITFC” from the previous example

    3. itfc_loads: Simulating data for blade loads on three wind turbines.

  3. An HOST app:

    1. host_scada: A HOST application coordinating the overall functionality and data output

Create SUBMODEL apps

The procedure to create new SUBMODEL is the same described in the previous example example (GUI):

  1. Create three SUBMODEL, named “avg_inflow”, “WF_status”, “loads_process

  2. Create empty Simulink models for all the SUBMODEL apps

  3. Create new Bachmann C projects and name them “avginflw”, “wfstatus”, “loadsprc”. Copy them into the reference C folder. Update the refC_name field using the “Details” menu

  4. Right-click on the “C ref found” light and select “Add Matlab Fields

  5. Create the Simulink models. For simplicify, use the models provided under “Examples\SCADA_reader_sample”

  6. Inspect the Simulink models; “avg_inflow” corresponds to “avg_calc” from the previous example. “WF_status” checks turbine power production and wind direction within a specified range. “loads_process” calculates out-of-plane and in-plane blade root bending moments from flapwise and edgewise bending moments.

Create ITFC apps

  1. Create three ITFC apps, named “itfc_scada”, “itfc_mm” and “itfc_loads”.

  2. As already done for the SUBMODEL apps, create empty PLC code and paste the reference source codes. Name them “ifcscada”, “ifcmm”, “ifcloads

  3. Update “Details” reference C codes.

  4. Right-click on the “C ref found” light and select “Add Matlab Fields

Create HOST apps

  1. Create one HOST apps, named “host_scada

  2. As already done for the SUBMODEL apps, create empty PLC code and paste the reference source codes. Name it “hstscada

  3. Update “Details” reference C codes.

  4. Right-click on the “C ref found” light and select “Add Matlab Fields

  5. Specify out_filename field in “Details” as “host_scada” and provide the output_path_in_PLC (note that this may vary on your PLC). Ensure the corresponding folder is pre-created on the PLC; otherwise, the entire framework will crash on startup

  6. Save

Modify the “inputfile.xlsx”

The steps to modify the “inputfile.xlsx” are the same described in the previous example. The different tabs are reported below, for completeness.

Table 20 SCADA_reader - “inputfile.xlsx” - SUBMODEL

modelTag

PLCApp_folder

slmodel_folder

slmodel_name

slccode_folder

refC_name

Flag_Generate_PLC_app

host_apptag

Comment

avg_inflow

avg_inflow

avg_inflow

avg_inflow

avg_inflow

avginflw

FALSE

host_scada

WF_status

WF_status

WF_status

WF_status

WF_status

wfstatus

FALSE

host_scada

loads_process

loads_process

loads_process

loads_process

loads_process

loadsprc

FALSE

host_scada

Table 21 SCADA_reader - “inputfile.xlsx” - ITFC

appTag

PLCApp_folder

refC_name

Flag_Generate_PLC_app

Flag_Create_test_ITFC

test_ITFC_filename

Comment

itfc_scada

itfc_scada

ifcscada

FALSE

FALSE

itfc_mm

itfc_mm

ifcmm

FALSE

FALSE

itfc_loads

itfc_loads

ifcloads

FALSE

FALSE

Table 22 SCADA_reader - “inputfile.xlsx” - HOST

appTag

PLCApp_folder

refC_name

Flag_Generate_PLC_app

FAST_FREQ_RATIO

SLOW_FREQ_RATIO

CTRL_FREQ_RATIO

out_filename

output_path_in_PLC

output_file_duration_s

Comment

host_scada

host_scada

hstscada

FALSE

1

10

10

host_scada

/usbBulk0/SCADA/

60

Table 23 SCADA_reader - “inputfile.xlsx” - Settings

KeyName

KeyValue

Comment

ExcelPLCFileName

root\PAL\Examples\SCADA_reader\SVI_definition.xlsx

FlagGenerate_ITFC

TRUE

FlagGenerate_PLCApps

TRUE

SaveModelParametersFlag

TRUE

sample_time

0.1

PLC_system

Bachmann

DataTypes_dict_filename

dictionary_bachmann.xlsx

Modify the “SVI_Definition”

For the “SCADA_reader,” a more intricate variable mapping is required compared to the “met_mast_reader.” Each layer, including ITFC, HOST, and SUBMODEL, is detailed in the following sections.

ITFC

The ITFC applications simulate a realistic scenario with data coming from various hardware and applications in a three-wind-turbine wind farm. Each ITFC application includes the following variables:

  1. itfc_scada contains 6 variables. SCADA data is provided through a structure variable, one for each turbine. Each structure includes subfields related to different quantities such as rotorspeed, pitch, power, and so on. In addition, vibrations are measured as well for each turbine and in the three directions, through double arrays

  2. itfc_mm contains 1 structure. This ITFC app is identical to “met_mast_ITFC” of the “met_mast_reader” example

  3. itfc_loads contains 1 structure, which provides data in terms of blade loads for the three wind turbines

  4. Two additional “WRITE” variables are included within the ITFC app “itfc_scada”:

    1. A 10-element double array used for control purposes.

    2. A structure in which the in-plane and out-of-plane bending loads are written by the HOST.

An overview of the ITFC variables is shown below

Table 24 SCADA_reader - “SVI_Definition.xlsx” - ITFC

InputNumber

TagName

VarName

AppName

VarType

VarSize

Access

Create

1

WT1_scada

WT1_scada

itfc_scada

struct

127

READ

1

1

Timestamp_UTC

Timestamp_UTC

char

32

1

1

GeneratorSpeed

GeneratorSpeed

double

1

1

1

ConverterTorque

ConverterTorque

double

1

1

1

NacelleDirection

NacelleDirection

double

1

1

1

PitchAngle

PitchAngle

double

1

1

1

PitchAngle1

PitchAngle1

double

1

1

1

PitchAngle2

PitchAngle2

double

1

1

1

PitchAngle3

PitchAngle3

double

1

1

1

Power

Power

double

1

1

1

RotorRpm

RotorRpm

double

1

1

1

TurbineState

TurbineState

uint16

1

1

1

WindSpeed

WindSpeed

double

1

1

1

YawError

YawError

double

1

1

1

ref_signal

ref_signal

single

1

1

1

isConnected

isConnected

logical

1

1

2

WT2_scada

WT2_scada

itfc_scada

struct

127

READ

1

2

Timestamp_UTC

Timestamp_UTC

char

32

1

2

GeneratorSpeed

GeneratorSpeed

double

1

1

2

ConverterTorque

ConverterTorque

double

1

1

2

NacelleDirection

NacelleDirection

double

1

1

2

PitchAngle

PitchAngle

double

1

1

2

PitchAngle1

PitchAngle1

double

1

1

2

PitchAngle2

PitchAngle2

double

1

1

2

PitchAngle3

PitchAngle3

double

1

1

2

Power

Power

double

1

1

2

RotorRpm

RotorRpm

double

1

1

2

TurbineState

TurbineState

uint16

1

1

2

WindSpeed

WindSpeed

double

1

1

2

YawError

YawError

double

1

1

2

ref_signal

ref_signal

single

1

1

2

isConnected

isConnected

logical

1

1

3

WT3_scada

WT3_scada

itfc_scada

struct

127

READ

1

3

Timestamp_UTC

Timestamp_UTC

char

32

1

3

GeneratorSpeed

GeneratorSpeed

double

1

1

3

ConverterTorque

ConverterTorque

double

1

1

3

NacelleDirection

NacelleDirection

double

1

1

3

PitchAngle

PitchAngle

double

1

1

3

PitchAngle1

PitchAngle1

double

1

1

3

PitchAngle2

PitchAngle2

double

1

1

3

PitchAngle3

PitchAngle3

double

1

1

3

Power

Power

double

1

1

3

RotorRpm

RotorRpm

double

1

1

3

TurbineState

TurbineState

uint16

1

1

3

WindSpeed

WindSpeed

double

1

1

3

YawError

YawError

double

1

1

3

ref_signal

ref_signal

single

1

1

3

isConnected

isConnected

logical

1

1

4

WT1_XYZ_vibrations

WT1_XYZ_vibrations

itfc_scada

double

3

READ

1

5

WT2_XYZ_vibrations

WT2_XYZ_vibrations

itfc_scada

double

3

READ

1

6

WT3_XYZ_vibrations

WT3_XYZ_vibrations

itfc_scada

double

3

READ

1

7

met_mast

met_mast

itfc_mm

struct

88

READ

1

7

Timestamp_UTC

Timestamp_UTC

char

32

1

7

ws_110m

ws_110m

double

1

1

7

ws_60m

ws_60m

double

1

1

7

wd_110m

wd_110m

double

1

1

7

wd_60m

wd_60m

double

1

1

7

temperature

temperature

double

1

1

7

humidity

humidity

double

1

1

7

pressure

pressure

double

1

1

8

wf_loads

wf_loads

itfc_loads

struct

176

READ

1

8

Timestamp_UTC

Timestamp_UTC

char

32

1

8

wt1_blade1_root_edge

wt1_blade1_root_edge

double

1

1

8

wt1_blade1_root_flap

wt1_blade1_root_flap

double

1

1

8

wt1_blade2_root_edge

wt1_blade2_root_edge

double

1

1

8

wt1_blade2_root_flap

wt1_blade2_root_flap

double

1

1

8

wt1_blade3_root_edge

wt1_blade3_root_edge

double

1

1

8

wt1_blade3_root_flap

wt1_blade3_root_flap

double

1

1

8

wt2_blade1_root_edge

wt2_blade1_root_edge

double

1

1

8

wt2_blade1_root_flap

wt2_blade1_root_flap

double

1

1

8

wt2_blade2_root_edge

wt2_blade2_root_edge

double

1

1

8

wt2_blade2_root_flap

wt2_blade2_root_flap

double

1

1

8

wt2_blade3_root_edge

wt2_blade3_root_edge

double

1

1

8

wt2_blade3_root_flap

wt2_blade3_root_flap

double

1

1

8

wt3_blade1_root_edge

wt3_blade1_root_edge

double

1

1

8

wt3_blade1_root_flap

wt3_blade1_root_flap

double

1

1

8

wt3_blade2_root_edge

wt3_blade2_root_edge

double

1

1

8

wt3_blade2_root_flap

wt3_blade2_root_flap

double

1

1

8

wt3_blade3_root_edge

wt3_blade3_root_edge

double

1

1

8

wt3_blade3_root_flap

wt3_blade3_root_flap

double

1

1

9

exchange_data_ctrl

exchange_data_ctrl

itfc_scada

double

10

WRITE

1

10

exchange_data_loads

exchange_data_loads

itfc_scada

struct

48

WRITE

1

10

wt1_blade1_IP

wt1_blade1_IP

double

1

1

10

wt1_blade2_IP

wt1_blade2_IP

double

1

1

10

wt1_blade3_IP

wt1_blade3_IP

double

1

1

10

wt1_blade1_OOP

wt1_blade1_OOP

double

1

1

10

wt1_blade2_OOP

wt1_blade2_OOP

double

1

1

10

wt1_blade3_OOP

wt1_blade3_OOP

double

1

1

HOST

The table below presents the list of HOST variables implemented in the “SVI_Definition.xlsx.” The variables fed to “exchange_data_ctrl” have been assigned an initial value equal to 1. Besides the greater number of variables, the data handling is similar to that of “met_mast_reader.”

Table 25 SCADA_reader - “SVI_Definition.xlsx” - HOST

TagName

VarName

AppName

VarType

VarSize

Create

parent_App

parent_TagName

parent_SubVar

Action

Flag_Assign_InitialValue

Initial_Value

Units

Print_output

output_freq

Comments

WT1_Timestamp_UTC

WT1_Timestamp_UTC

host_scada

inherit

-1

1

itfc_scada

WT1_scada

Timestamp_UTC

READ

0

0

[-]

1

fast

WT1_GeneratorSpeed

WT1_GeneratorSpeed

host_scada

inherit

-1

1

itfc_scada

WT1_scada

GeneratorSpeed

READ

0

0

[RPM]

1

fast

WT1_ConverterTorque

WT1_ConverterTorque

host_scada

inherit

-1

1

itfc_scada

WT1_scada

ConverterTorque

READ

0

0

[Nm]

1

fast

WT1_NacelleDirection

WT1_NacelleDirection

host_scada

inherit

-1

1

itfc_scada

WT1_scada

NacelleDirection

READ

0

0

[deg]

1

slow

WT1_PitchAngle

WT1_PitchAngle

host_scada

inherit

-1

1

itfc_scada

WT1_scada

PitchAngle

READ

0

0

[deg]

1

fast

WT1_PitchAngle1

WT1_PitchAngle1

host_scada

inherit

-1

1

itfc_scada

WT1_scada

PitchAngle1

READ

0

0

[deg]

1

fast

WT1_PitchAngle2

WT1_PitchAngle2

host_scada

inherit

-1

1

itfc_scada

WT1_scada

PitchAngle2

READ

0

0

[deg]

1

fast

WT1_PitchAngle3

WT1_PitchAngle3

host_scada

inherit

-1

1

itfc_scada

WT1_scada

PitchAngle3

READ

0

0

[deg]

1

fast

WT1_Power

WT1_Power

host_scada

inherit

-1

1

itfc_scada

WT1_scada

Power

READ

0

0

[kW]

1

fast

WT1_RotorRpm

WT1_RotorRpm

host_scada

inherit

-1

1

itfc_scada

WT1_scada

RotorRpm

READ

0

0

[RPM]

1

fast

WT1_TurbineState

WT1_TurbineState

host_scada

inherit

-1

1

itfc_scada

WT1_scada

TurbineState

READ

0

0

[-]

1

fast

WT1_WindSpeed

WT1_WindSpeed

host_scada

inherit

-1

1

itfc_scada

WT1_scada

WindSpeed

READ

0

0

[m/s]

1

fast

WT1_YawError

WT1_YawError

host_scada

inherit

-1

1

itfc_scada

WT1_scada

YawError

READ

0

0

[deg]

1

fast

WT1_ref_signal

WT1_ref_signal

host_scada

inherit

-1

1

itfc_scada

WT1_scada

ref_signal

READ

0

0

[-]

1

fast

WT1_isConnected

WT1_isConnected

host_scada

inherit

-1

1

itfc_scada

WT1_scada

isConnected

READ

0

0

[-]

1

slow

WT2_Timestamp_UTC

WT2_Timestamp_UTC

host_scada

inherit

-1

1

itfc_scada

WT2_scada

Timestamp_UTC

READ

0

0

[-]

1

fast

WT2_GeneratorSpeed

WT2_GeneratorSpeed

host_scada

inherit

-1

1

itfc_scada

WT2_scada

GeneratorSpeed

READ

0

0

[RPM]

1

fast

WT2_ConverterTorque

WT2_ConverterTorque

host_scada

inherit

-1

1

itfc_scada

WT2_scada

ConverterTorque

READ

0

0

[Nm]

1

fast

WT2_NacelleDirection

WT2_NacelleDirection

host_scada

inherit

-1

1

itfc_scada

WT2_scada

NacelleDirection

READ

0

0

[deg]

1

slow

WT2_PitchAngle

WT2_PitchAngle

host_scada

inherit

-1

1

itfc_scada

WT2_scada

PitchAngle

READ

0

0

[deg]

1

fast

WT2_PitchAngle1

WT2_PitchAngle1

host_scada

inherit

-1

1

itfc_scada

WT2_scada

PitchAngle1

READ

0

0

[deg]

1

fast

WT2_PitchAngle2

WT2_PitchAngle2

host_scada

inherit

-1

1

itfc_scada

WT2_scada

PitchAngle2

READ

0

0

[deg]

1

fast

WT2_PitchAngle3

WT2_PitchAngle3

host_scada

inherit

-1

1

itfc_scada

WT2_scada

PitchAngle3

READ

0

0

[deg]

1

fast

WT2_Power

WT2_Power

host_scada

inherit

-1

1

itfc_scada

WT2_scada

Power

READ

0

0

[kW]

1

fast

WT2_RotorRpm

WT2_RotorRpm

host_scada

inherit

-1

1

itfc_scada

WT2_scada

RotorRpm

READ

0

0

[RPM]

1

fast

WT2_TurbineState

WT2_TurbineState

host_scada

inherit

-1

1

itfc_scada

WT2_scada

TurbineState

READ

0

0

[-]

1

fast

WT2_WindSpeed

WT2_WindSpeed

host_scada

inherit

-1

1

itfc_scada

WT2_scada

WindSpeed

READ

0

0

[m/s]

1

fast

WT2_YawError

WT2_YawError

host_scada

inherit

-1

1

itfc_scada

WT2_scada

YawError

READ

0

0

[deg]

1

fast

WT2_ref_signal

WT2_ref_signal

host_scada

inherit

-1

1

itfc_scada

WT2_scada

ref_signal

READ

0

0

[-]

1

fast

WT2_isConnected

WT2_isConnected

host_scada

inherit

-1

1

itfc_scada

WT2_scada

isConnected

READ

0

0

[-]

1

slow

WT3_Timestamp_UTC

WT3_Timestamp_UTC

host_scada

inherit

-1

1

itfc_scada

WT3_scada

Timestamp_UTC

READ

0

0

[-]

1

fast

WT3_GeneratorSpeed

WT3_GeneratorSpeed

host_scada

inherit

-1

1

itfc_scada

WT3_scada

GeneratorSpeed

READ

0

0

[RPM]

1

fast

WT3_ConverterTorque

WT3_ConverterTorque

host_scada

inherit

-1

1

itfc_scada

WT3_scada

ConverterTorque

READ

0

0

[Nm]

1

fast

WT3_NacelleDirection

WT3_NacelleDirection

host_scada

inherit

-1

1

itfc_scada

WT3_scada

NacelleDirection

READ

0

0

[deg]

1

slow

WT3_PitchAngle

WT3_PitchAngle

host_scada

inherit

-1

1

itfc_scada

WT3_scada

PitchAngle

READ

0

0

[deg]

1

fast

WT3_PitchAngle1

WT3_PitchAngle1

host_scada

inherit

-1

1

itfc_scada

WT3_scada

PitchAngle1

READ

0

0

[deg]

1

fast

WT3_PitchAngle2

WT3_PitchAngle2

host_scada

inherit

-1

1

itfc_scada

WT3_scada

PitchAngle2

READ

0

0

[deg]

1

fast

WT3_PitchAngle3

WT3_PitchAngle3

host_scada

inherit

-1

1

itfc_scada

WT3_scada

PitchAngle3

READ

0

0

[deg]

1

fast

WT3_Power

WT3_Power

host_scada

inherit

-1

1

itfc_scada

WT3_scada

Power

READ

0

0

[kW]

1

fast

WT3_RotorRpm

WT3_RotorRpm

host_scada

inherit

-1

1

itfc_scada

WT3_scada

RotorRpm

READ

0

0

[RPM]

1

fast

WT3_TurbineState

WT3_TurbineState

host_scada

inherit

-1

1

itfc_scada

WT3_scada

TurbineState

READ

0

0

[-]

1

fast

WT3_WindSpeed

WT3_WindSpeed

host_scada

inherit

-1

1

itfc_scada

WT3_scada

WindSpeed

READ

0

0

[m/s]

1

fast

WT3_YawError

WT3_YawError

host_scada

inherit

-1

1

itfc_scada

WT3_scada

YawError

READ

0

0

[deg]

1

fast

WT3_ref_signal

WT3_ref_signal

host_scada

inherit

-1

1

itfc_scada

WT3_scada

ref_signal

READ

0

0

[-]

1

fast

WT3_isConnected

WT3_isConnected

host_scada

inherit

-1

1

itfc_scada

WT3_scada

isConnected

READ

0

0

[-]

1

slow

WT1_X_vibration

WT1_X_vibration

host_scada

inherit

-1

1

itfc_scada

WT1_XYZ_vibrations

1

READ

0

0

[m/s2]

1

fast

WT1_Y_vibration

WT1_Y_vibration

host_scada

inherit

-1

1

itfc_scada

WT1_XYZ_vibrations

2

READ

0

0

[m/s2]

1

fast

WT1_Z_vibration

WT1_Z_vibration

host_scada

inherit

-1

1

itfc_scada

WT1_XYZ_vibrations

3

READ

0

0

[m/s2]

1

fast

WT2_X_vibration

WT2_X_vibration

host_scada

inherit

-1

1

itfc_scada

WT2_XYZ_vibrations

1

READ

0

0

[m/s2]

1

fast

WT2_Y_vibration

WT2_Y_vibration

host_scada

inherit

-1

1

itfc_scada

WT2_XYZ_vibrations

2

READ

0

0

[m/s2]

1

fast

WT2_Z_vibration

WT2_Z_vibration

host_scada

inherit

-1

1

itfc_scada

WT2_XYZ_vibrations

3

READ

0

0

[m/s2]

1

fast

WT3_X_vibration

WT3_X_vibration

host_scada

inherit

-1

1

itfc_scada

WT3_XYZ_vibrations

1

READ

0

0

[m/s2]

1

fast

WT3_Y_vibration

WT3_Y_vibration

host_scada

inherit

-1

1

itfc_scada

WT3_XYZ_vibrations

2

READ

0

0

[m/s2]

1

fast

WT3_Z_vibration

WT3_Z_vibration

host_scada

inherit

-1

1

itfc_scada

WT3_XYZ_vibrations

3

READ

0

0

[m/s2]

1

fast

mm_Timestamp_UTC

mm_Timestamp_UTC

host_scada

inherit

-1

1

itfc_mm

met_mast

Timestamp_UTC

READ

0

0

[-]

1

fast

mm_ws_110m

mm_ws_110m

host_scada

inherit

-1

1

itfc_mm

met_mast

ws_110m

READ

0

0

[m/s]

1

fast

mm_ws_60m

mm_ws_60m

host_scada

inherit

-1

1

itfc_mm

met_mast

ws_60m

READ

0

0

[m/s]

1

fast

mm_wd_110m

mm_wd_110m

host_scada

inherit

-1

1

itfc_mm

met_mast

wd_110m

READ

0

0

[deg]

1

fast

mm_wd_60m

mm_wd_60m

host_scada

inherit

-1

1

itfc_mm

met_mast

wd_60m

READ

0

0

[deg]

1

fast

mm_temperature

mm_temperature

host_scada

inherit

-1

1

itfc_mm

met_mast

temperature

READ

0

0

[°C]

1

slow

mm_humidity

mm_humidity

host_scada

inherit

-1

1

itfc_mm

met_mast

humidity

READ

0

0

[%]

1

slow

mm_pressure

mm_pressure

host_scada

inherit

-1

1

itfc_mm

met_mast

pressure

READ

0

0

[Pa]

1

slow

loads_Timestamp_UTC

loads_Timestamp_UTC

host_scada

inherit

-1

1

itfc_loads

wf_loads

Timestamp_UTC

READ

0

0

[-]

1

fast

wt1_blade1_root_edge

wt1_blade1_root_edge

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt1_blade1_root_edge

READ

0

0

[Nm]

1

fast

wt1_blade1_root_flap

wt1_blade1_root_flap

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt1_blade1_root_flap

READ

0

0

[Nm]

1

fast

wt1_blade2_root_edge

wt1_blade2_root_edge

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt1_blade2_root_edge

READ

0

0

[Nm]

1

fast

wt1_blade2_root_flap

wt1_blade2_root_flap

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt1_blade2_root_flap

READ

0

0

[Nm]

1

fast

wt1_blade3_root_edge

wt1_blade3_root_edge

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt1_blade3_root_edge

READ

0

0

[Nm]

1

fast

wt1_blade3_root_flap

wt1_blade3_root_flap

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt1_blade3_root_flap

READ

0

0

[Nm]

1

fast

wt2_blade1_root_edge

wt2_blade1_root_edge

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt2_blade1_root_edge

READ

0

0

[Nm]

1

fast

wt2_blade1_root_flap

wt2_blade1_root_flap

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt2_blade1_root_flap

READ

0

0

[Nm]

1

fast

wt2_blade2_root_edge

wt2_blade2_root_edge

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt2_blade2_root_edge

READ

0

0

[Nm]

1

fast

wt2_blade2_root_flap

wt2_blade2_root_flap

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt2_blade2_root_flap

READ

0

0

[Nm]

1

fast

wt2_blade3_root_edge

wt2_blade3_root_edge

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt2_blade3_root_edge

READ

0

0

[Nm]

1

fast

wt2_blade3_root_flap

wt2_blade3_root_flap

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt2_blade3_root_flap

READ

0

0

[Nm]

1

fast

wt3_blade1_root_edge

wt3_blade1_root_edge

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt3_blade1_root_edge

READ

0

0

[Nm]

1

fast

wt3_blade1_root_flap

wt3_blade1_root_flap

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt3_blade1_root_flap

READ

0

0

[Nm]

1

fast

wt3_blade2_root_edge

wt3_blade2_root_edge

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt3_blade2_root_edge

READ

0

0

[Nm]

1

fast

wt3_blade2_root_flap

wt3_blade2_root_flap

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt3_blade2_root_flap

READ

0

0

[Nm]

1

fast

wt3_blade3_root_edge

wt3_blade3_root_edge

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt3_blade3_root_edge

READ

0

0

[Nm]

1

fast

wt3_blade3_root_flap

wt3_blade3_root_flap

host_scada

inherit

-1

1

itfc_loads

wf_loads

wt3_blade3_root_flap

READ

0

0

[Nm]

1

fast

check_isWFon

check_isWFon

host_scada

inherit

-1

1

itfc_scada

exchange_data_ctrl

1

WRITE

1

1

[-]

1

ctrl

check_WindInSector

check_WindInSector

host_scada

inherit

-1

1

itfc_scada

exchange_data_ctrl

2

WRITE

1

1

[-]

1

ctrl

check_all

check_all

host_scada

inherit

-1

1

itfc_scada

exchange_data_ctrl

3

WRITE

1

1

[-]

1

ctrl

ctrl_check_4

ctrl_check_4

host_scada

inherit

-1

0

itfc_scada

exchange_data_ctrl

4

WRITE

1

1

[-]

1

ctrl

ctrl_check_5

ctrl_check_5

host_scada

inherit

-1

0

itfc_scada

exchange_data_ctrl

5

WRITE

1

1

[-]

1

ctrl

ctrl_check_6

ctrl_check_6

host_scada

inherit

-1

0

itfc_scada

exchange_data_ctrl

6

WRITE

1

1

[-]

1

ctrl

ctrl_check_7

ctrl_check_7

host_scada

inherit

-1

0

itfc_scada

exchange_data_ctrl

7

WRITE

1

1

[-]

1

ctrl

ctrl_check_8

ctrl_check_8

host_scada

inherit

-1

0

itfc_scada

exchange_data_ctrl

8

WRITE

1

1

[-]

1

ctrl

ctrl_check_9

ctrl_check_9

host_scada

inherit

-1

0

itfc_scada

exchange_data_ctrl

9

WRITE

1

1

[-]

1

ctrl

ctrl_check_10

ctrl_check_10

host_scada

inherit

-1

0

itfc_scada

exchange_data_ctrl

10

WRITE

1

1

[-]

1

ctrl

wt1_blade1_IP

wt1_blade1_IP

host_scada

inherit

-1

1

itfc_scada

exchange_data_loads

wt1_blade1_IP

WRITE

1

0

[Nm]

1

fast

wt1_blade2_IP

wt1_blade2_IP

host_scada

inherit

-1

1

itfc_scada

exchange_data_loads

wt1_blade2_IP

WRITE

1

0

[Nm]

1

fast

wt1_blade3_IP

wt1_blade3_IP

host_scada

inherit

-1

1

itfc_scada

exchange_data_loads

wt1_blade3_IP

WRITE

1

0

[Nm]

1

fast

wt1_blade1_OOP

wt1_blade1_OOP

host_scada

inherit

-1

1

itfc_scada

exchange_data_loads

wt1_blade1_OOP

WRITE

1

0

[Nm]

1

fast

wt1_blade2_OOP

wt1_blade2_OOP

host_scada

inherit

-1

1

itfc_scada

exchange_data_loads

wt1_blade2_OOP

WRITE

1

0

[Nm]

1

fast

wt1_blade3_OOP

wt1_blade3_OOP

host_scada

inherit

-1

1

itfc_scada

exchange_data_loads

wt1_blade3_OOP

WRITE

1

0

[Nm]

1

fast

avg_TI

avg_TI

host_scada

double

1

1

0

0

[-]

1

slow

avg_ws_110m

avg_ws_110m

host_scada

double

1

1

0

0

[m/s]

1

slow

avg_ws_60m

avg_ws_60m

host_scada

double

1

1

0

0

[m/s]

1

slow

avg_shearExp

avg_shearExp

host_scada

double

1

1

0

0

[-]

1

slow

avg_wd_110m

avg_wd_110m

host_scada

double

1

1

0

0

[deg]

1

slow

avg_inflowState

avg_inflowState

host_scada

double

1

1

0

0

[-]

1

ctrl

avg_inflow_AppStatus

avg_inflow_AppStatus

host_scada

uint16

1

1

0

0

[-]

1

ctrl

loads_process_AppStatus

loads_process_AppStatus

host_scada

uint16

1

1

0

0

[-]

1

fast

WF_status_AppStatus

WF_status_AppStatus

host_scada

uint16

1

1

0

0

[-]

1

ctrl

SUBMODEL

Similarly, an overview of the SUBMODELS variables is provided below.

Table 26 SCADA_reader - “SVI_Definition.xlsx” - SUBMODEL

modelTag

TagName

VarName

IO

PortNumber

PortName

Create

VarType

parent_App

parent_TagName

Action

avg_inflow

ws_110m

ws_110m

input

1

input_ws_110m

1

double

host_scada

mm_ws_110m

read

avg_inflow

ws_60m

ws_60m

input

2

input_ws_60m

1

double

host_scada

mm_ws_60m

read

avg_inflow

wd_110m

wd_110m

input

3

input_wd_110m

1

double

host_scada

mm_wd_110m

read

avg_inflow

avg_TI

avg_TI

output

1

output_TI

1

double

host_scada

avg_TI

write

avg_inflow

avg_ws_110m

avg_ws_110m

output

2

output_ws_110m

1

double

host_scada

avg_ws_110m

write

avg_inflow

avg_ws_60m

avg_ws_60m

output

3

output_ws_60m

1

double

host_scada

avg_ws_60m

write

avg_inflow

avg_shearExp

avg_shearExp

output

4

output_shearExp

1

double

host_scada

avg_shearExp

write

avg_inflow

avg_wd_110m

avg_wd_110m

output

5

output_wd_110m

1

double

host_scada

avg_wd_110m

write

avg_inflow

inflowState

inflowState

output

6

output_InflowOK

1

double

host_scada

avg_inflowState

write

avg_inflow

AppStatus

AppStatus

status

AppStatus

1

uint16

host_scada

avg_inflow_AppStatus

write

loads_process

b1_flap

b1_flap

input

1

b1_flap

1

double

host_scada

wt1_blade1_root_flap

read

loads_process

b1_edge

b1_edge

input

2

b1_edge

1

double

host_scada

wt1_blade1_root_edge

read

loads_process

b1_pitch

b1_pitch

input

3

b1_pitch

1

double

host_scada

WT3_PitchAngle1

read

loads_process

b2_flap

b2_flap

input

4

b2_flap

1

double

host_scada

wt1_blade2_root_flap

read

loads_process

b2_edge

b2_edge

input

5

b2_edge

1

double

host_scada

wt1_blade2_root_edge

read

loads_process

b2_pitch

b2_pitch

input

6

b2_pitch

1

double

host_scada

WT3_PitchAngle2

read

loads_process

b3_flap

b3_flap

input

7

b3_flap

1

double

host_scada

wt1_blade3_root_flap

read

loads_process

b3_edge

b3_edge

input

8

b3_edge

1

double

host_scada

wt1_blade3_root_edge

read

loads_process

b3_pitch

b3_pitch

input

9

b3_pitch

1

double

host_scada

WT3_PitchAngle3

read

loads_process

b1_oop

b1_oop

output

1

b1_oop

1

double

host_scada

wt1_blade1_IP

write

loads_process

b1_ip

b1_ip

output

2

b1_ip

1

double

host_scada

wt1_blade2_IP

write

loads_process

b2_oop

b2_oop

output

3

b2_oop

1

double

host_scada

wt1_blade3_IP

write

loads_process

b2_ip

b2_ip

output

4

b2_ip

1

double

host_scada

wt1_blade1_OOP

write

loads_process

b3_oop

b3_oop

output

5

b3_oop

1

double

host_scada

wt1_blade2_OOP

write

loads_process

b3_ip

b3_ip

output

6

b3_ip

1

double

host_scada

wt1_blade3_OOP

write

loads_process

AppStatus

AppStatus

status

AppStatus

1

uint16

host_scada

loads_process_AppStatus

write

WF_status

wt1_status

wt1_status

input

1

wt1_status

1

double

host_scada

WT1_TurbineState

read

WF_status

wt2_status

wt2_status

input

2

wt2_status

1

double

host_scada

WT2_TurbineState

read

WF_status

wt3_status

wt3_status

input

3

wt3_status

1

double

host_scada

WT3_TurbineState

read

WF_status

avg_ws

avg_ws

input

4

avg_ws

1

double

host_scada

avg_ws_110m

read

WF_status

avg_wd

avg_wd

input

5

avg_wd

1

double

host_scada

avg_wd_110m

read

WF_status

check_isWFon

check_isWFon

output

1

check_isWFon

1

logical

host_scada

check_isWFon

write

WF_status

check_WindInSector

check_WindInSector

output

2

check_WindInSector

1

logical

host_scada

check_WindInSector

write

WF_status

check_all

check_all

output

3

check_all

1

logical

host_scada

check_all

write

WF_status

AppStatus

AppStatus

status

AppStatus

1

uint16

host_scada

WF_status_AppStatus

write

Generate the test interface

After modifying the “SVI_Definition.xlsx”, the project needs to be reloaded. Similarly to the “met_mast_reader”, the correct size will need to be provided for the structure variables.

  1. Dummy interfaces need to be generated for the different ITFC applications. Define the “test_ITFC_filename” fields for each ITFC app, named:

    1. ./Examples/SCADA_reader/itfc_scada.mat

    2. ./Examples/SCADA_reader/itfc_mm.mat

    3. ./Examples/SCADA_reader/itfc_loads.mat

  2. Click on “Create Random ITFC”

  3. New “.mat” files are generated for the three ITFC applications. Note that this data will not contain realistic values. You have two options:

    1. Replace the random data with your own.

    2. Use the provided dummy variables (located in “root\PAL\Examples\SCADA_reader_sample”) containing realistic data. By default, only the read variables will be filled with random numbers, while the others will be set to 0.

  4. Open the details of the ITFC apps and set their “Flag_Create_test_ITFC” to TRUE. Click on “Load ITFC”.

Generate the PLC code

See previous example

Testing the framework

The testing of the project follows very closely what was done for the “met_mast_reader”. A few remarks:

  1. The syncronization must be performed on all three ITFC applications

  2. SUBMODELS will be run at “FAST” frequency, which may differ from the HOST variables frequency

Appendix

Create Bachmann Applications

To create e new PLC application in Bachmann, open the Bachmann SolutionCenter and follow the steps:

  1. In the Solution Navigator: right click C/C++ projects, new, C Project.

  2. Define a project name, which could be any name. Under Project Type, select Bachmann module -> C Template. Under Toolchains, select Bachmann 2.95 Toolchain. Next.

  3. Insert your module name, which should be your “AppName”. Check the “SVI client for reading SVI variables”. Finish.

  4. A new C project will be created. Under its “Source Files” folder, copy the “AppName_app.c” file into “ReferenceCFiles\Originals”. IMPORTANT: this file name, without the appendix “_app.c” is the “refC_name” to be written in “inputfile.xlsx”. This is the main application file, which needs to be modified to include the app interconnections.

Supported Data Types

Table 27 Supported Matlab data types for PLC implementation

Matlab data type

C data type

single

float

double

double

char

char

logical

unsigned char

uint16

unsigned short

int8

signed char

int16

short