The watchdog system shown in Figure 1 consists of the watchdog itself and three event generators, emitting On events, Off events and deadlineSignal events.
WatchDog System
A Modelica model of the watchdog system follows below, consisting of the watchdog itself and the three event generators. The watchdog is formulated using an algorithm section since otherwise the multiple when-equations would cause multiple assignments to be reported for the variable watchdogActive.
This version of the WatchDog receives three events: two commands to switch the watchdog on and off, and a "deadline" event. The watchdog must emit an "alarm" whenewer the deadline occurs when the watchdog is on. Initially it is turned of.
This is the algorithmic implementation.
This version of the WatchDog receives three events: two commands to switch the watchdog on and off, and a "deadline" event. The watchdog must emit an "alarm" whenewer the deadline occurs when the watchdog is on. Initially it is turned off. This is the equation-based inplementation of the watchdog1.
A clocked version of the model called WatchDogSystemClocked, is shown below. The main difference is that a global clocked timer variable has been introduced, and that the event generator detects when to emit a clocked signal synchronized with the clock ticks of the global clock by the equation dOutput = timecmp==true and previous(timecmp)==false. An if-then-else statement is used instead of the when-statements in the unclocked version since clocked when-statements are currently not available in the Modelica language.
This model contains clocked synchronous constructs that are not yet fully supported by OpenModelica as of October 2015, but may start working within the near future.Hence the Simulation of this models does not work