cancel
Showing results for 
Search instead for 
Did you mean: 

How to detect ctrlx device shutdown event?

How to detect ctrlx device shutdown event?

ZhangKeke001
New Poster

I am using datalayer library to consume the data from PLC. But once PLC is shutdown and repower, the subscribe pipe line will break down. I can/t receive the subscribe data. And the connection state from datalayer is still connected.

So how to detect shutdown event and triggle reconnect action.

13 REPLIES 13

CodeWasi
Occasional Contributor

Hello ,

could you please expand the description about the calling application a bit (SDK, Nodered, ?)
Thanks! 
Do you know these states to check?

CodeWasi_0-1731421826109.png

 

 

Bye

For example, in node red, you can see the node state is still authenticated, but the virtual environment already stopped.

So how to get the Ctrlx PLC state and monitor the shutdown the event?

ZhangKeke001_0-1731450398397.png

 

As the READ node in your picture above is event driven you would have to trigger it again to get a response that provider is not longer available. If you are using subscription you should automatically get a message that connection timed out. Feel free to have a look to our Node-RED examples that are part of the node-red-contrib-ctrlx-automation.

It works sometimes, but not for each time.

Is it related to the virtual environment?

ZhangKeke001_0-1731510367320.png

 

When I redeploy the node red project, subscribe status turns to failed

ZhangKeke001_1-1731510550744.png

 

Sgilk
Frequent Contributor

@ZhangKeke001 ,

Are the subscription nodes to the localhost? In other words, is Node-RED running on the VirtualControl that is offline? In this case, Node-RED would be completely unresponsive.

If not, check your error interval and keep alive interval on the subscriptions.

Sgilk_0-1731510703285.png

 

No, node red is not running on the virtual machine, it is running on the localhost.(A standart node red instance)

I use the default configuration.

ZhangKeke001_0-1731510799395.png

 

Sgilk
Frequent Contributor

@ZhangKeke001 ,

By default, this will only check the subscription connection once per 60s. Try reducing this to 10s and trying again. In this case, you should wait a maximum of 10s after the control goes offline for an error message.

I find there is a rule, when double click the stop button, the connection state won't be updated.

But when I click the stop button for one time, when the virtual environment turns offline, the state below node will also be updated(to subscribed failed).

The ctrlx works version is ctrlX WORKS WRK-V-0120.2.

It is so interesting.

 

Beware that clicking stop once will shutdown the ctrlX COREvirtual ending all processes properly. When clicking twice the emulation will be killed, like as holding shutdown button on a PC or removing power.

If I use standalone node-red project to subscribe a variable from the real ctrlx PLC. What will happens if I power off the ctrl PLC instead of stoping it in ctrlx works. Will the subscribe status turns to failed or stay the same just as I double click the stop button in virtual test environment?

Because, when I use CtrlxCore library to connect ctrlx PLC and subscribe the data, when PLC is powered off, my connect status won't change.
What't the reason for it?

As I do not get your last sentence and complete topology completelycould you please confirm my summary:

A Node-RED installation on a PC is used and there our  node-red-contrib-ctrlx-automation library to subscribe to data on a ctrlX CORE connected that PC. When switching off the ctrlX COREs power supply, the subscription node does not react to this, even if you lowered the timeout settings mentioned above?

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist