-

Signal sequence: Competing write and read accesses to the same data set

The following signal sequence diagram shows the behavior of the recipe FBs SF_RecipeWrite and SF_RecipeRead if they simultaneously access to the same recipe file and data set. Due to the competing operations, only one FB can complete its operation successfully.

Note
1) For reasons of clarity, the duration of one Safety PLC cycle is assumed in the signal sequence for each status transition of the FBs. In reality, several cycles may be necessary for this. The time required to completely write/read recipe data also varies and depends on the amount of data to be written/read.

Further Info
Refer to the application example to see a basic code sample how to prevent multiple and competing accesses to recipe files.

0After the startup of the Safety PLC, both FBs are deactivated. As a result, the Done output of both FBs is SAFEFALSE, both DiagCode outputs show 0000 (Idle state).
1SF_RecipeWrite and SF_RecipeRead are activated by switching their Activate input to TRUE.

As a result, both FBs run through the states 8002 (Prepare), 8004 (Wait for Ready) to 8006 in which they wait for the trigger command at input CommandWrite or CommandRead, respectively.
2A rising edge at CommandWrite and CommandRead starts the execution of the FBs.

For both function blocks, the same values are applied to the inputs IDRecipeFile and IDRecipeDataSet.

SF_RecipeWrite sends a request to the Safety PLC for writing the addressed data set.

SF_RecipeRead reads the data from the addressed data set and then validates the read data.
3SF_RecipeWrite: After writing/updating the data set, the FB waits for the confirmation of the Safety PLC that the file has been written to the file system in the flash memory of the standard controller.

The validation of SF_RecipeRead is not successful as the read data has been overwritten meanwhile. Output Done remains SAFEFALSE and output DiagCode shows C050.
4SF_RecipeWrite validates the written data. For that purpose, data is read from the RAM and the FB validates by means of a CRC comparison that the data set has not been overwritten or deleted meanwhile. Furthermore, the FB validates that the values applied to the PayloadWrite inputs have not been modified.

SF_RecipeRead remains in the error state C050.
5SF_RecipeWrite has validated the data and completed its operations successfully. Output Done switches to SAFETRUE (DiagCode = 8000).

SF_RecipeRead remains in the error state C050.