Watchdog Module: Difference between revisions

From Planimate Knowledge Base
Jump to navigation Jump to search
(Created page with "The Watchdog Module provides a way to monitor and automatically close a running model that has become stuck, which is detected by the simulation clock not changing. It is intende...")
 
No edit summary
 
Line 1: Line 1:
The Watchdog Module provides a way to monitor and automatically close a running model that has become stuck, which is detected by the simulation clock not changing. It is intended for batch running of models though it can be used interactively as well.
The Watchdog Module provides a way to monitor and automatically close a running model that has become stuck, which is detected by the simulation clock not changing. It is intended for batch running of models though it can be used interactively as well.  


=== Settings ===
=== Settings ===


The module has 3 settable parameters:
The module has 3 settable parameters:  


'''Interval'''
'''Interval'''  


This is specified in milliseconds and sets how often the watchdog polls the simulation clock for change. A value of 5000 means a poll every 5 seconds.
This is specified in milliseconds and sets how often the watchdog polls the simulation clock for change. A value of 5000 means a poll every 5 seconds.  


Each interval the model will send broadcast WatchDogBC which is configured to send a network message using WatchDogSocket, see below for detail on this.
Each interval the model will send broadcast WatchDogBC which is configured to send a network message using WatchDogSocket, see below for detail on this.  


'''Retries'''
'''Retries'''  


This sets how many Intervals can pass before the watchdog triggers. With the default of 3 intervals and an Interval of 5000ms, If the clock hasn't changed in 15 seconds then the watchdog will take action.
This sets how many Intervals can pass before the watchdog triggers. With the default of 3 intervals and an Interval of 5000ms, If the clock hasn't changed in 15 seconds then the watchdog will take action.  


'''Debug'''
'''Debug'''  


If the debug value is 0, the watchdog does nothing in interactive mode (model editing/run mode with window), only operating in batch mode. If the debug value is 1, the watchdog will operate in interactive mode as well but will not close the model.
If the debug value is 0, the watchdog does nothing in interactive mode (model editing/run mode with window), only operating in batch mode. If the debug value is 1, the watchdog will operate in interactive mode as well but will not close the model.  


=== Behaviour ===
=== Behaviour ===


When the watchdog triggers in batch mode, it will trigger a default beep and close the model and Planimate.
When the watchdog triggers in batch mode, it will trigger a default beep and close the model and Planimate.  


If debug is set, the watchdog also operates in interative mode. The watchdog will be active when the model engine is running and trigger if the clock isn't changing, even if the model is paused or at a dialog (which isn't supported and will likely lead to a crash).
If debug is set, the watchdog also operates in interative mode. The watchdog will be active when the model engine is running and trigger if the clock isn't changing, even if the model is paused or at a dialog (which isn't supported and will likely lead to a crash).  


When the watchdog triggers in interactive mode, the model is stopped but not closed.
When the watchdog triggers in interactive mode, the model is stopped but not closed.  


=== Network Setup and Operation ===
=== Network Setup and Operation ===
 
Every interval the watchdog sends broadcast WatchDogBC. Model code must not listen to this broadcast as it is sent asynchronously to the model. The broadcast is pre-configured to associate with network socket "WatchDogSocket".
 
When the module is pasted into a model, this socket must be manually created under Settings -> TCP/IP Sockets. Select "Add New" and name the socket "WatchDogSocket".
 
The exact settings will depend on how you want to monitor the model. If you configure for client, the server must be running. If you are developing without a server, configure the socket for UDP or as a server on an unused port on your system.
 
Planimate sends broadcast packets in XML format.
 
=== Usage Notes and Caveats ===
 
The watchdog operates using the RealTimeCallback operation and _Real Time Tick broadcasts. Any model using the real time tick mechanism must
 
*Never send the _real time tick broadcast whilst the watch dog is in operation. You can use s.BackgroundRun to test if the /BATCH command line option has been specified.
*Ensure your code immediately passes to exit any _real time tick broadcasts it is not expecting (you can test s.BackgroundRun for this as well).
 
Note that the watchdog enables the s.RealTimeBCInEvent option. This enables the real time broadcast to pre-empt an event rather than being processed after it. If the model is saved with the watchdog active, this parameter will be set in the saved model. It is strongly recommended that this parameter be left off unless the watchdog is in use. The watchdog will reset the parameter if the model is started and the watchdog wont be active (debug is false and working in interactive mode).


Every interval the watchdog sends broadcast WatchDogBC. Model code must not listen to this broadcast as it is sent asynchronously to the model. The broadcast is pre-configured to associate with network socket "WatchDogSocket".


When the module is pasted into a model, this socket must be manually created under Settings -> TCP/IP Sockets. Select "Add New" and name the socket "WatchDogSocket".


The exact settings will depend on how you want to monitor the model. If you configure for client, the server must be running. If you are developing without a server, configure the socket for UDP or as a server on an unused port on your system.


Planimate sends broadcast packets in XML format.


[[Category:Batch]]
[[Category:Batch]]

Latest revision as of 13:50, 29 November 2011

The Watchdog Module provides a way to monitor and automatically close a running model that has become stuck, which is detected by the simulation clock not changing. It is intended for batch running of models though it can be used interactively as well.

Settings

The module has 3 settable parameters:

Interval

This is specified in milliseconds and sets how often the watchdog polls the simulation clock for change. A value of 5000 means a poll every 5 seconds.

Each interval the model will send broadcast WatchDogBC which is configured to send a network message using WatchDogSocket, see below for detail on this.

Retries

This sets how many Intervals can pass before the watchdog triggers. With the default of 3 intervals and an Interval of 5000ms, If the clock hasn't changed in 15 seconds then the watchdog will take action.

Debug

If the debug value is 0, the watchdog does nothing in interactive mode (model editing/run mode with window), only operating in batch mode. If the debug value is 1, the watchdog will operate in interactive mode as well but will not close the model.

Behaviour

When the watchdog triggers in batch mode, it will trigger a default beep and close the model and Planimate.

If debug is set, the watchdog also operates in interative mode. The watchdog will be active when the model engine is running and trigger if the clock isn't changing, even if the model is paused or at a dialog (which isn't supported and will likely lead to a crash).

When the watchdog triggers in interactive mode, the model is stopped but not closed.

Network Setup and Operation

Every interval the watchdog sends broadcast WatchDogBC. Model code must not listen to this broadcast as it is sent asynchronously to the model. The broadcast is pre-configured to associate with network socket "WatchDogSocket".

When the module is pasted into a model, this socket must be manually created under Settings -> TCP/IP Sockets. Select "Add New" and name the socket "WatchDogSocket".

The exact settings will depend on how you want to monitor the model. If you configure for client, the server must be running. If you are developing without a server, configure the socket for UDP or as a server on an unused port on your system.

Planimate sends broadcast packets in XML format.

Usage Notes and Caveats

The watchdog operates using the RealTimeCallback operation and _Real Time Tick broadcasts. Any model using the real time tick mechanism must

  • Never send the _real time tick broadcast whilst the watch dog is in operation. You can use s.BackgroundRun to test if the /BATCH command line option has been specified.
  • Ensure your code immediately passes to exit any _real time tick broadcasts it is not expecting (you can test s.BackgroundRun for this as well).

Note that the watchdog enables the s.RealTimeBCInEvent option. This enables the real time broadcast to pre-empt an event rather than being processed after it. If the model is saved with the watchdog active, this parameter will be set in the saved model. It is strongly recommended that this parameter be left off unless the watchdog is in use. The watchdog will reset the parameter if the model is started and the watchdog wont be active (debug is false and working in interactive mode).