Y_CO_ReName_FTP_RecordData
Parameters
| * | Parameter | Data Type | Description | Default |
|---|---|---|---|---|
| VAR_IN_OUT | ||||
| V | RecordedData | Yt_CO_ReName_RecordedUserData | User customizable structure containing the data to be recorded. See examples below. | |
| V | NewSample | Yt_CO_ReName_RecordedSample | A single element of the many samples in one of the databanks. All the data in one sample is collected in one time slice. | |
| VAR_INPUT | ||||
| B | Enable | BOOL | The function will continue to execute every scan while Enable is held high and there are no errors. | FALSE |
| V | Stream | BOOL | If Stream is True, a Sample will be added to the UserData structure every task interval. | FALSE |
| B | Trigger | BOOL | If Stream is False, Samples can be added to the UserData structure only upon the rising edge of Trigger. | FALSE |
| VAR_OUTPUT | ||||
| B | Valid |
BOOL | Indicates that the function is operating normally and the outputs of the function are valid. |
|
| B | Error | BOOL | Set high if an error has occurred during the execution of the function block. This output is cleared when 'Execute' or 'Enable' goes low. | |
| E | ErrorID | UINT | If Error is true, this output provides the Error ID. This output is reset when 'Execute' or 'Enable' goes low. | |
| V | ErrorString | Yt_String256 | If 'Error' is true and it is an FTP response code related error then this output contains the response string from the FTP server. | |
Notes
- This block utilizes FTP, not SFTP because SSL is not supported by the MPiec firmware. As a result, all FTP traffic sent and received (e.g. username, password, file data) is sent unencrypted in plain text and is visible to anyone with access to the network. This should not be a problem if the data being sent is not of a sensitive matter and the FTP server account is CHROOT'd properly (talk to your IT professional about using FTP).
- The FTP server should either have an internal/external domain name or use a static IP address because if the address changes, it will prevent the function from transferring files. See "Setup" for more details.
- The FTP user account must have "Write" privileges to successfully write files to the server. Optionally, the account may also have "Append" privileges. If files already exists and the FTP account only has "Write" privileges, then the file will be overwritten. If the file exists and the user account has "Append" privileges, then the file contents transferred will be appended to the existing file.
Error Description
Example
(It is assumed that an FTP server is configured and access is possible.)
- Open your project.
- Open the Comm Toolbox in a second copy of iCube Engineer.
- In the second copy (Comm Toolbox) Project Tree Window, select Y_CO_ReName_FTP_SendFile and Y_CO_ReName_FTP_RecordData and Copy.
- In the main project, Project Tree Window, right click on Logical POUs and select Paste.
- For both of the new function blocks in your project, right click on them to access the properties page and rename the function blocks.
DataTypes
Create a datatype which describes the information to be recorded. The four datatypes shown below make up "MyRecordedUserData" which must be connected to the function blocks. Customize the detailed information to be recorded as shown on lines 5 through 11. Add or subtract as many variables are required. All code shown here was copied and pasted from the Comm Toolbox, then all instances of "Yt_CO_ReName_" were changed to "My." Change to anything meaningful and appropriate. The only datatype which does not require modification and can remain in the Comm Toolbox is Yt_CO_RecordStatusData.
Initialization
Editing the variables worksheets
Variables worksheet for Y_CO_ReName_FTP_RecordData:
Rename the dataypes.
Variables worksheet for Y_CO_ReName_FTP_SendData:
Rename the datatype.
Function Blocks added to the Project:
MyFTP_RecordData_1 is in a "fast" task:
MyFTP_SendData is in the DEFAULT task: