PLC

There are several ways of transferring the filters to the PLC in the form of specifications or coefficients. The simplest way is via the context menu, which is opened by right-clicking on the respective Filter Set.

PLC 1:

Copy the data of the designed filter to the clipboard, then go directly to the already existing PLC project, where you can paste the coefficients or corresponding specification. There are currently three different copy options.

Copy IIR Coeff Sos For PLC

Here, the coefficients are broken up into individual biquads and transferred for the FB_FTR_IIRSos in an array that must be specified in a structure, ST_FTR_IIRSos. The instance names of the array and the structure must be manually declared.

//CoeffArray_Sos

: ARRAY [1..1] OF ARRAY [1..6] OF LREAL := [[0.894858606122573, -1.78971721224515, 0.894858606122573, 1, -1.77863177782458, 0.800802646665708]];

: ST_FTR_IIRSos :=(    nOversamples := 1,
                       nChannels := 1,
                       pCoefficientArrayAdr_Sos := ADR(),
                       nCoefficientArraySize_Sos := SIZEOF());

Copy IIR Coeff For PLC

Here, the coefficients are not broken up and are transferred for the FB_FTR_IIRCoeff in two arrays for the coefficients A and B. Instance names must be specified for both arrays. They are to be announced in the structure ST_FTR_IIRCoeff. The structure still requires an instance name.

//DenomCoeffArray_a
: ARRAY [1..3] OF LREAL := [1, -1.77863177782458, 0.800802646665708];
//DenomCoeffArray_b
: ARRAY [1..3] OF LREAL := [0.894858606122573, -1.78971721224515, 0.894858606122573];

: ST_FTR_IIRCoeff := (nOversamples := 1,
                      nChannels := 1,
                      pCoefficientArrayAdr_A := ADR(),
                      nCoefficientArraySize_A := SIZEOF(),
                      pCoefficientArrayAdr_B := ADR(),
                      nCoefficientArraySize_B := SIZEOF());

Copy IIR Spec For PLC

Here, the set specification of the filter is copied in plain text in the form of the structure type ST_FTR_IIRSpec. The structure still requires an instance name.

: ST_FTR_IIRSpec :=(eFilterName := E_FTR_Name.eButterworth,
                    eFilterType := E_FTR_Type.eHighPass,
                    nFilterOrder := 2,
                    fCutoff := 250,
                    fSamplingRate := 10000,
                    nOversamples := 1,
                    nChannels := 1 );

A further option to transfer the filter properties to the PLC is offered by the Transfer Filter Set dialog.

PLC 2:

You can choose between PLC and I/O here. In the case of the PLC it is possible to specify a path, for example to a solution. This is checked for possible POUs of the Filter library, i.e. for instances of the Coeff or Spec structures. The scan procedure is accordingly initiated with the magnifying glass button.

Following the scan, all hits are displayed underneath in a tree view. You can now select which filter structure instance is to be overwritten by the designed filter. This function is also available if the scanned solution is already opened. Visual Studio® draws your attention to the fact that the file has changed externally and offers a reload.