CreateOrUpdate

TwinCAT TIA
Devices DEPRAG devices Sequence controller ActiveDevices One client Screwdriving sequence

ns=2;s=DEPRAG Smart/Devices/DEPRAG/AST/ActiveDevices/0/ScrewdrivingSequence/CreateOrUpdate

Creates or modifies an existing screwdriving sequence.

Parameters:

Returns:

Examples:

In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:

Beckhoff parameter:

    bAstCreateOrUpdate
    A boolean variable that can be used to trigger the execution of the CreateOrUpdate command.
    outputAstCreateOrUpdate
    An instance of the ST_VoidOutputData structure into which the return value of the CreateOrUpdate method is written.
    hrAstCreateOrUpdate
    This can be used to monitor the execution of the command. Error codes have the type HRESULT.
    fbAst
    An instance of the FB_AST function block supplied with the DEPRAG Smart library.
    sDeviceId
    A string value that specifies the device for which a screwdriving sequence is to be generated.
    sSequenceJson
    The string variable contains the screwdriving sequence as JSON string, which is passed to the Smart OPC UA Server.
    SizeOfSequenceJson
    The UINT variable specifies the length of the screwdriving sequence string that is passed as JSON string to the Smart OPC UA Server.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
     bAstCreateOrUpdate      : BOOL;  
     outputAstCreateOrUpdate     : ST_VoidOutputData                                            
     hrAstCreateOrUpdate      : HRESULT;

     fbAst   : FB_AST;
END_VAR

hrAstCreateOrUpdate := fbAst.CreateOrUpdate(
       bExecute     := bAstCreateOrUpdate,   
       ConnectionHandle  := depragSmartConnection.ConnectionHandle,
       sDeviceId    := '0',
       sSequenceJson   := ADR('my screwdriving sequence string'),
       SizeOfSequenceJson  := SIZEOF('my screwdriving sequence string'),  
       OutputData    => outputAstCreateOrUpdate);
IF hrAstCreateOrUpdate <> S_FALSE THEN 
 bAstCreateOrUpdate := FALSE;
END_IF 
                                                    

For examples and explanations regarding the calls of nodes via Siemens TIA Portal please refer to the sub-menu "Siemens TIA Portal" in section "Getting Started".