3.3. EC-Master startup

The EC-Master stack has to be initialized once when the application is starting. After this one-time initialization one or more clients may register with the EC-Master. Finally, after all clients are registered the MainDevice can be started. Starting the MainDevice means that all SubDevices will be set into the operational state. Every time the state of the MainDevice has changed the clients are notified about this state-change.

3.3.1. Asynchronous (deferred) startup

skinparam ParticipantBorderColor black
skinparam SequenceMessageAlign direction
hide footbox

!define APPCOLOR FFD965
!define CORECOLOR F4A77D

participant App as "Application" #APPCOLOR
participant EcMaster as "EC-Master" #CORECOLOR

activate App #APPCOLOR
App->EcMaster : emInitMaster()
activate EcMaster #CORECOLOR
return

App->App : Create Job Task

App->EcMaster : emConfigureNetwork()
activate EcMaster #CORECOLOR
return

autonumber "<b>(<u>##</u>)"
App->EcMaster : emRegisterClient()
activate EcMaster #CORECOLOR
autonumber stop
return

autonumber resume
App->EcMaster : emSetMasterStateReq(<Time-out>, eEcatState_OP)
activate EcMaster #CORECOLOR
EcMaster->App : return

EcMaster->EcMaster : INIT
EcMaster->App : emNotify()
autonumber stop
EcMaster->EcMaster : PREOP
EcMaster->App : emNotify()
EcMaster->EcMaster : SAFEOP
EcMaster->App : emNotify()
EcMaster->EcMaster : OP
autonumber resume
EcMaster->App : emNotify()
deactivate EcMaster

  • Application calls emInitMaster() (…)

  • Application creates Job Task. See EC-Master lifecycle

  • Application calls emConfigureMaster() (…)

  • Application calls emConfigureNetwork() (…) (See “1” )

  • Application calls emSetMasterStateReq() (…) with an appropriate timeout value (See “2” )

  • Function emSetMasterStateReq() (…) returns immediately (See “3” )

  • emSetMasterStateReq() (…) initiated the MainDevice startup procedure (See “4” )

  • The MainDevice initializes all SubDevices until all SubDevices reach OPERATIONAL state

  • After every state change the application will be notified (See “5” )

  • After reaching the OPERATIONAL state the system is ready (See “6” )

3.3.2. Synchronous startup

skinparam ParticipantBorderColor black
skinparam SequenceMessageAlign direction
hide footbox

!define APPCOLOR FFD965
!define CORECOLOR F4A77D

participant App as "Application" #APPCOLOR
participant EcMaster as "EC-Master" #CORECOLOR

activate App #APPCOLOR
App->EcMaster : emInitMaster()
activate EcMaster #CORECOLOR
return

App->App : Create Job Task

App->EcMaster : emConfigureNetwork()
activate EcMaster #CORECOLOR
return

autonumber "<b>(<u>##</u>)"
App->EcMaster : emRegisterClient()
activate EcMaster #CORECOLOR
autonumber stop
return

autonumber resume
App->EcMaster : emSetMasterState(<Time-out>, eEcatState_OP)
activate EcMaster #CORECOLOR
EcMaster->EcMaster : INIT
EcMaster->EcMaster : PREOP
EcMaster->EcMaster : SAFEOP
EcMaster->EcMaster : OP
return

  • Application calls emInitMaster() (…)

  • Application creates Job Task. See EC-Master lifecycle.

  • Application calls emConfigureNetwork() (…)

  • Application calls emRegisterClient() (…) (See “1” )

  • Application calls emSetMasterState() (…) with an appropriate timeout value (See “2” )

  • Inside emSetMasterState() (…) the MainDevice startup procedure will be initiated (See “3” )

  • The application is blocked until the whole startup has finished (See “7” )

  • The MainDevice initializes all SubDevices until all SubDevices reach OPERATIONAL state (See “3-6” )

  • After reaching the OPERATIONAL state the system is ready (See “6” )

  • emSetMasterState() (…) returns (See “7” )