FP_FTP_SET_MODE_TRANSFER_LOG

Set FTP transfer mode for data recording files

This FP instruction defines the transfer settings for data recording files via FTP protocol.

Parameters

Input

nLogID (WORD, INT, UINT)

LOG number (permissible range: 0–15). The compiler generates internally the string for the log file number, e.g. 'LOG=0'

sOperation (STRING)

Set the transfer method parameters.

  • Server address (required parameter)

    Only one server can be specified at the same time. Specify an FTP server number with one-byte three characters.

    Keyword: SV

    Values: SV0–SV3 (Server 0–Server 3)

  • Transfer method (optional parameter)

    Syntax

    Transfer method

    'MODE=OVW'

    Overwrite method (default)

    Perform file transfer with file names specified by the data recording setting. When the transfer is interrupted due to any trouble with network or servers, the file transfer may have been executed only partially. Check if the transfer has been completed successfully with an instruction such as FP_FTP_GET_STATUS.

    'MODE=REN'

    Rename method

    Perform file transfer with temporary file names, and rename them to specified file names after the success of the transfer. To check whether the file transfer has been completed successfully, compare the actual file names with the file names specified by the data recording setting. The processing time is longer than that of the overwrite method.

Example: Send send data recording file to FTP server 3 using rename method: 'SV3,MODE=REN'

sFTPServerDirectory (STRING)

Set the destination directory (max. 256 characters). It will be created with a relative path from the home directory which has been assigned to the user after logging into the FTP server. When the destination directory does not exist, it wil be automatically created with up to eight hierarchies.

Output

bError (BOOL)

Turns to TRUE under the following conditions:

  • if a timeout of the connection is exceeded

  • if an IP address is invalid

When an error occurs, check the system variable sys_iEthernetConnectionErrorCode for the error code number.

Remarks

  • Separate all keyword entries by comma. e.g. 'NAME=abcd,FROM=sender@server.com'

  • Do not change the order of keywords. Specify the keywords and their setting parameters in the order they are listed here.

  • The number of characters for string data must not exceed 256.

  • This instruction is not available in interrupt programs.

  • Before you execute the instruction, you need to specify the FTP server using FP_FTP_SET_CONNECTION or the setting dialog of the FTP client.

  • Upper and lower case characters can be used for operands for which a character constant can be specified. "Abcd", "ABCD" and "abcd" are synonymous, however, file names are case-sensitive.

  • The instruction can only be executed when the transfer request flag for the specified nLogID number is FALSE. When the transfer request flag is TRUE, an operation error occurs.

  • Before you execute the instruction, make sure that sys_bIsEthernetInitializing is FALSE. sys_bIsEthernetInitializing turns to TRUE when the instruction is executed. When you execute the instruction while sys_bIsEthernetInitializing is TRUE, an error occurs.

  • When this instruction has been executed successfully, the system variables sys_bIsCarry and sys_iEthernetConnectionErrorCode are reset.

  • The instruction stores the data recording transfer settings of sOperation and sFTPServerDirectory in the LOG file number specified by nLogID.

  • When an error occurs, check the system variable sys_iEthernetConnectionErrorCode for the error code number.

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • if the transfer request flag for a specified nLogID number is TRUE, e.g. if sys_blsLog0DataRecordingActive is TRUE.

  • if the data recording condition of a specified nLogID number is not registered.

  • if a value specified for a parameter is outside the permissible range.

  • if the instruction is executed in an interrupt program

  • if the number of characters for string data exceeds 256.

  • if an FTP server that has not been configured with the instruction FP_FTP_SET_CONNECTION or the setting dialog of the FTP client is specified.

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if the transfer request flag for a specified nLogID number is TRUE, e.g. if sys_blsLog0DataRecordingActive is TRUE.

  • if the data recording condition of a specified nLogID number is not registered.

  • if a value specified for a parameter is outside the permissible range.

  • if the instruction is executed in an interrupt program

  • if the number of characters for string data exceeds 256.

  • if an FTP server that has not been configured with the instruction FP_FTP_SET_CONNECTION or the setting dialog of the FTP client is specified.

sys_bIsCarry (turns to TRUE for one scan)
  • if the instruction is executed during the initialization of Ethernet, sys_iEthernetConnectionErrorCode is set to "11: Ethernet is being initialized".

Example

POU header

All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.

	VAR
		bSetLogTransferFTP: BOOL:=FALSE;
		bIsError: BOOL:=FALSE;
		bDisableLogTransferFTP: BOOL:=FALSE;
	END_VAR

POU body

If bSetLogTransferFTP and bDisableLogTransferFTP are set to TRUE, the instruction is carried out.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 6 ;
        NETWORK_BODY
B(B_VARIN,,0,18,2,20,4,);
B(B_VARIN,,'SV0',18,3,20,5,);
B(B_VARIN,,'LogData',18,4,20,6,);
B(B_VAROUT,,bIsError,37,2,39,4,);
B(B_CONTACT,,bSetLogTransferFTP,5,1,7,3,);
B(B_F,FP_FTP_SET_MODE_TRANSFER_LOG!,,20,0,37,6,,?DEN?DnLogID?DsOperation?DsFTPServerDirectory?AENO?CbError);
L(1,2,5,2);
L(7,2,20,2);
L(1,0,1,6);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 5 ;
        NETWORK_BODY
B(B_CONTACT,,bDisableLogTransferFTP,5,1,7,3,);
B(B_VARIN,,0,18,2,20,4,);
B(B_VARIN,,'DISABLE',18,3,20,5,);
B(B_VAROUT,,bIsError,39,2,41,4,);
B(B_F,FP_FTP_TRANSFER_CONTROL_LOG!,,20,0,37,5,,?DEN?DnLogID?DsControl?AENO?AbError);
L(1,2,5,2);
L(37,3,39,3);
L(7,2,20,2);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

If (bSetLogTransferFTP) Then
    FP_FTP_SET_MODE_TRANSFER_LOG(nLogID := 0, sOperation := 'SV0',
                                 sFTPServerDirectory := 'LogData', 
                                 bError => bIsError);
End_if;
If (bDisableLogTransferFTP) Then
    FP_FTP_TRANSFER_CONTROL_LOG(nLogID := 0, sControl := 'DISABLE', bError => bIsError);
End_if;

Modified on: 2024-03-06Feedback on this pagePanasonic hotline