FB_RoboticsAutoTunePSeries - WriteFile (Method)

Overview

Type:

Method

Available as of:

V2.0.0.0

This chapter provides information on:

oTask

oDescription

oInterface

oDiagnostic Messages

Task

Write a file to the file system of the controller which includes the status of tuning, the configuration and parameterization of RoboticsAutoTune.

Description

With the method WriteFile(…), a file with the specified name is written on the specified directory.

If only the file name is given, the path ide0:/ and the file name extension .DAT is added automatically.

If the file does not exist, it is created. If the file exists, the content is deleted and replaced.

Valid example names:

oExample -> the file ide0:/Example.DAT is written to ide0:

oide0:/Example.DAT -> the file ide0:/Example.DAT is written to ide0:

ousb2msd:1/Example.DAT -> the file usb2msd:1/Example.DAT is written to an USB device.

Valid but not a good practice:

oExample.DAT would result in writing the file ide0:/Example.DAT.DAT

NOTE: The processing time of this function is a few hundred milliseconds. Therefore, it is a good practice that the call of this method is done in a dedicated file handling task, or that the cycle check of the task is increased with the function FC_CycleCheckTimeSet(…) when calling this method.

Interface

Input

Data type

Description

i_sFileName

STRING[255]

File name of the file to be written.

i_xWriteAdditionalData

BOOL

Additional data that is written into the file.

Output

Data type

Description

q_etDiag

GD.ET_Diag

General library-independent statement on the diagnostic. A value unequal to GD.ET_Diag.Ok corresponds to a diagnostic message.

q_etDiagExt

ET_DiagExt

POU-specific output on the diagnostic.

q_etDiag = GD.ET_Diag.Ok -> Status message

q_etDiag <> GD.ET_Diag.Ok -> Diagnostic message

q_sMsg

STRING[255]

Event-triggered message that gives more detailed information on the diagnostic state.

Diagnostic Messages

q_etDiag

q_etDiagExt

Enumeration value

Description

OK

Ok

0

Ok

AdditionalDataRange

37

Size of additional data slots is invalid.

ExecutionAborted

NotConfigured

33

The robot is not configured.

TooManyFilesOpen

45

Too many files open.

WriteException

51

Attempt to write to an invalid file type.

ControllerConditionInvalid

SystemOutOfMemory

50

Not enough space to save the file.

UnexpectedProgramBehavior

UnexpectedFeedback

1

A feedback value was invalid.

AdditionalDataRange

Enumeration name:

AdditionalDataRange

Enumeration value:

37

Description:

Size of additional data slots is invalid.

Issue

Cause

Solution

Writing of the file was successful.

i_xWriteAdditionalData was set to TRUE but either the property xEnableAdditionalData is not set to TRUE or GPL.Gc_udiMaxNumberOfAdditionalData is zero.

oDo not set i_xWriteAdditionalData in case no additional data is used.

oEnable the usage of additional data and set GPL.Gc_udiMaxNumberOfAdditionalData to a value greater than 0.

NotConfigured

Enumeration name:

NotConfigured

Enumeration value:

33

Description:

The robot is not configured.

Issue

Cause

Solution

Configuration is not valid.

Not configured. Call method Configuration first

Verify that the method Configuration is called successfully.

Ok

Enumeration name:

Ok

Enumeration value:

0

Description:

Ok

Writing of the file was successful.

SystemOutOfMemory

Enumeration name:

SystemOutOfMemory

Enumeration value:

50

Description:

Not enough space to save the file.

Issue

Cause

Solution

System out of memory.

Not enough memory space to save the file.

Provide free memory space to save the file.

TooManyFilesOpen

Enumeration name:

TooManyFilesOpen

Enumeration value:

45

Description:

Too many files open.

Issue

Cause

Solution

Too many files opened.

Too many files opened.

Close opened files.

WriteException

Enumeration name:

WriteException

Enumeration value:

51

Description:

Attempt to write to an invalid file type.

Issue

Cause

Solution

Write exception.

Device invalid.

Choose another device.

File name invalid.

Choose another file name.

UnexpectedFeedback

Enumeration name:

UnexpectedFeedback

Enumeration value:

1

Description:

A feedback value was invalid.

Writing the file was unsuccessful.