Menu

SF1011_SysFile

Overview

SF1011 is an asynchronous file component capable of performing operations such as opening, closing, reading, and writing on folders and files. Through this component, a series of operations can be executed on folders and files in the industrial computer.

The following table outlines each product component:

Product Component Description
cmpsysfile_0.0.1-rc.3_amd64.deb ACP client component for asynchronous files
asyncfile-service_0.0.3_amd64.deb ACP server component for asynchronous files
SysFilePLC.library PLC engineering library file
SysFileLib.project PLC quick-start project
Sinsegye.Ide.DeviceManager_0.0.1.9 Industrial computer device management system

Installation and Uninstallation

Installation Requirements

  • Sinsegye industrial computers shipped from the factory;

  • Personal computer with Sinsegye IDE MetaFacture software installed;

  • Industrial computer device management system Sinsegye.Ide.DeviceManager.

Installation Process

1. Install ACP client, server, and ACP service components for asynchronous files

  • Upload the deb package to the /home/sinsegye directory in the industrial computer's Linux environment.

  • After the upload is complete, execute the installation commands on the industrial computer (refer to the screenshot below; if the module file name changes, modify the file name in the command line accordingly):

shell Copy
sudo dpkg -i cmpsysfile_0.0.1-rc.3_amd64.deb
sudo dpkg -i asyncfile-service_0.0.3_amd64.deb
sudo dpkg -i libacp_0.2.0-rc.3_amd64.deb 
  • Modify the RTE configuration file, and add sf1011_sysfile under the ComponentManager module:
shell Copy
sudo vim /usr/local/etc/SinsegyeRTE/SinsegyeRTE.cfg
shell Copy
[ComponentManager]
Component.0=CmpCanBusUtils
Component.1=CmpLedManager
Component.2=CmpSinsegyeLibs
Component.3=retainDeamon
Component.4=SE4100&
Component.5=sf1011_sysfile 
  • Restart the RTE service to enable the newly added sf1011_sysfile and ensure the asynchronous file ACP server component runs properly:
shell Copy
sudo systemctl restart sinsegyerte.service
sudo systemctl start asyncfile-service.service
sudo systemctl status asyncfile-service.service 

2. Deploy the SF1011_SysFile library on the IDE side

  • In MetaFacture, click the top menu bar "Tools" -- "Library Storage";

  • In the pop-up dialog box, click "Install" -- select SysFileLib.library -- click "Open";

  • Double-click "Library Manager" in the project -- "Add Library" -- click Miscellaneous -- double-click "SysFileLib" to complete the library loading.

Update Installation

1. Upgrade ACP client and server for asynchronous files

  • Upload the upgraded deb package to the /home/sinsegye directory in the industrial computer's Linux environment; refer to the appendix for the upload method.

  • After the upload is complete, execute the installation commands on the industrial computer (refer to the screenshot below; if the module file name changes, modify the file name in the command line accordingly):

shell Copy
sudo dpkg -i cmpsysfile_0.0.1-rc.3_amd64.deb
sudo dpkg -i asyncfile-service_0.0.3_amd64.deb 
  • Restart the RTE service to enable the newly upgraded SF1011_SysFile:
shell Copy
sudo systemctl restart sinsegyerte.service 

2. Upgrade the SF1011_SysFile library on the IDE side

  • In MetaFacture, click the top menu bar "Tools" -- "Library Storage";

  • In the pop-up dialog box, click "Install" -- select SysFileLib.library -- click "Open";

  • Double-click "Library Manager" in the project -- "Add Library" -- click Miscellaneous -- double-click "SysFileLib" to complete the library loading;

Uninstallation Process

1. Uninstall ACP client and server for asynchronous files

  • Execute the uninstallation commands on the industrial computer:
shell Copy
sudo dpkg -r cmpsysfile_0.0.1-rc.3_amd64.deb
sudo dpkg -r asyncfile-service_0.0.3_amd64.deb 
  • Modify the RTE configuration file, and remove sf1011_sysfile from the ComponentManager module:
shell Copy
sudo vim /usr/local/etc/SinsegyeRTE/SinsegyeRTE.cfg 
  • Restart the RTE service:
shell Copy
 sudo systemctl restart sinsegyerte.service

2. Uninstall the SF1011_SysFile library on the IDE side

  • On the MetaFacture interface, click "Tools" -- "Library Storage".

  • In the dialog box, select the installed SysFileLib library and click "Uninstall".


Quick Start

I. Software and Hardware Configuration for This Example

Hardware: Software:
1.SX20 1.MetaFacutre V1.0.6.3
2.Win11PC 2. Sinsegye.Ide.DeviceManager0.0.1.9

II. Experimental Operation Steps for This Example

  1. Experimental Requirements

a. The industrial computer has successfully installed relevant components.

b. MetaFacture has successfully installed the library file SysFileLib.library.

You can refer to the SysFileLib.project in the product components for this experiment.

  1. Experimental Content

DirOpen

Open a directory; the returned handle will be used in subsequent operations. To obtain entries in the directory, you need to call DirList to get them one by one.

DirClose

Close a directory.

DirList

Read directory entries; each read operation retrieves one entry, and the read content is stored in a structure.

The mechanism is set such that each read operation only retrieves one directory information (you need to traverse to read all).

DirCreate

Create a subdirectory.

DirCopy

Copy a directory; you can specify whether to copy subdirectories or overwrite via parameters.

xRecursive (Recursive Copy)

  • TRUE: Copy all subdirectories and their contents.

  • FALSE: Do not copy subdirectories.

xOverWrite (Overwrite Files)

  • TRUE: Overwrite existing files.

  • FALSE: Keep existing files unchanged.

xRecursive=false xOverWrite=false

xRecursive=true xOverWrite=false


xRecursive=true xOverWrite=true


DirRename

Rename a directory (it is not recommended to use this function to move files; use Rename instead).

DirRemove

Delete a directory (there may be files that have been opened with Open).

If the directory contains content and xRecursive=true is not selected, an error NOT_EMPTY will be prompted.

FileOpen

Open a file and generate a handle, which can be used for Read, Write, and Close (the xExclusive parameter is not supported by codesys).

The returned handle after opening is a large number, but the result is still normal.

In MREADPLUS mode, the original data in the text will be retained only when closed; the default MODE will overwrite, resulting in empty data.

FileClose

Close the file handle.

FileRead

Read data into the buffer.

FileWrite

Write the buffer into the file.

Open the file (the mode must be mreadplus; otherwise, writing will fail and an error will be reported).

Write.

Close.

Successfully written.

FileCopy

Copy a file; create it if it does not exist, and choose to overwrite based on parameters if it exists.

If the file already exists and overwriting is not selected, the corresponding error code will be returned; if the file already exists and overwriting is selected, the file will be overwritten.

Error when the file already exists.

Success.
FileDelete

Delete a file; it will be deleted even if it is Open.

FileRename

Rename a file; it can also be used to move files, but not directories.

FileSetPos

Move the read/write position of the currently open file.

Set POS after opening the file.
FileGetPos

Read the read/write position of the currently open file.

The same POS is obtained again after the above SETPOS.
FileEOF

Used to determine whether the current read/write position has reached the end of the file.

The EOF status will be returned only after calling the FileRead function block and then calling this interface again; it needs to be used with FileRead.

FileFlush

Force data in the buffer to be written to the disk.

By default, data is not directly written after write (it is still in the buffer). After using this function block, the written data can be seen immediately without closing.
FileGetAttribute

Obtain the file attributes of the currently open file; the definition of file attributes is in the enumeration variable ATTRIB.

FileGetSize

Get the size of the file pointed to by the file name.

FileGetTime

Get the latest modification date of the file pointed to by the file name.

Note: The default obtained time is UTC time; if local time is needed, manual time conversion is required.

Proof: The test result using codesys's CAA File function is consistent.

Last modified: 2025-07-31