hades.models.dcf77
Class Dcf77Clock

java.lang.Object
  extended byhades.simulator.SimObject
      extended byhades.models.dcf77.Dcf77Clock
All Implemented Interfaces:
java.lang.Cloneable, ContextToolTip, java.io.Serializable, Simulatable, Wakeable

public class Dcf77Clock
extends SimObject
implements Wakeable

Dcf77Clock: A simple model of a DCF77 radio-controlled digital clock, written as a behavioral model for HADES.

In a nutshell, the DCF77 timecode --- as broadcast worldwide by the German normal-time sender on 77 KHz --- consists of 59 bits distributed each minute that specify the time and date for the following minute. A '1' bit is coded as a 200 msec. pause at the start of each 1 sec. interval of the 77 KHz signal, while a '0' bit is coded as a 100 msec. pause. At the 60th bit, no pause is used to signal the start of a minute at the next pause. For the details of the code, see the documentation (or study the source-code of this class).

The model uses a 'dynamic symbol' to display the current time, date and receiver status.

See Also:
Serialized Form

Field Summary
 int S_0000
           
 int S_000X
           
 int S_0011
           
 int S_001X
           
 int S_00XX
           
 int S_0XXX
           
 int S_MINUTE
           
 int S_UNKNOWN
           
 int S_WAIT
           
 
Fields inherited from class hades.simulator.SimObject
classloader, console, debug, editor, name, parent, ports, propertySheet, symbol, versionId, visible
 
Constructor Summary
Dcf77Clock()
           
 
Method Summary
 void configure()
          create and display a 'ConfigDialog' to set the parameters for a SimObject.
 void constructDynamicSymbol()
           
 void elaborate(java.lang.Object arg)
          elaborate(): This method tries to register a wakeupEvent with the current parent's Simulator.
 void evaluate(java.lang.Object arg)
          evaluate(): called by the simulation engine on all events that concern this object.
 java.lang.String getDateString()
           
 int getDay()
           
 int getDbglevel()
           
 int getHours()
           
 int getMinutes()
           
 int getMonth()
           
 int getSeconds()
           
 java.lang.String getTimeString()
           
 int getWeekday()
           
 int getYear()
           
 boolean needsDynamicSymbol()
           
 void setDay(int i)
           
 void setDay(java.lang.String s)
           
 void setDbglevel(int i)
           
 void setDbglevel(java.lang.String s)
           
 void setHours(int i)
           
 void setHours(java.lang.String s)
           
 void setMinutes(int i)
           
 void setMinutes(java.lang.String s)
           
 void setMonth(int i)
           
 void setMonth(java.lang.String s)
           
 void setSeconds(int i)
           
 void setSeconds(java.lang.String s)
           
 void setWeekday(int i)
           
 void setWeekday(java.lang.String s)
           
 void setYear(int i)
           
 void setYear(java.lang.String s)
           
 java.lang.String toString()
          generate a textual represenation of this DCF77 clock, including class name, full Hades instance name, and the DCF77 model time.
 void wakeup(java.lang.Object arg)
          wakeup(): The central part of the DCF77-Clock model.
 
Methods inherited from class hades.simulator.SimObject
copy, getBindkey, getClassLoader, getDebug, getEditor, getExternalResources, getFullName, getName, getParent, getPort, getPorts, getPropertySheet, getResourceAsStream, getSimulator, getSymbol, getSymbolResourceName, getToolTip, getVersionId, initialize, isVisible, keyPressed, message, mousePressed, needsExternalResources, setClassLoader, setConsole, setDebug, setEditor, setName, setParent, setPorts, setSimulator, setSymbol, setVersionId, setVisible, tearDown, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface hades.simulator.Simulatable
message
 

Field Detail

S_UNKNOWN

public final int S_UNKNOWN
See Also:
Constant Field Values

S_0XXX

public final int S_0XXX
See Also:
Constant Field Values

S_00XX

public final int S_00XX
See Also:
Constant Field Values

S_000X

public final int S_000X
See Also:
Constant Field Values

S_0000

public final int S_0000
See Also:
Constant Field Values

S_001X

public final int S_001X
See Also:
Constant Field Values

S_0011

public final int S_0011
See Also:
Constant Field Values

S_WAIT

public final int S_WAIT
See Also:
Constant Field Values

S_MINUTE

public final int S_MINUTE
See Also:
Constant Field Values
Constructor Detail

Dcf77Clock

public Dcf77Clock()
Method Detail

needsDynamicSymbol

public boolean needsDynamicSymbol()
Overrides:
needsDynamicSymbol in class SimObject

constructDynamicSymbol

public void constructDynamicSymbol()
Overrides:
constructDynamicSymbol in class SimObject

getSeconds

public int getSeconds()

getMinutes

public int getMinutes()

getHours

public int getHours()

getDay

public int getDay()

getWeekday

public int getWeekday()

getMonth

public int getMonth()

getYear

public int getYear()

setSeconds

public void setSeconds(int i)

setMinutes

public void setMinutes(int i)

setHours

public void setHours(int i)

setDay

public void setDay(int i)

setWeekday

public void setWeekday(int i)

setMonth

public void setMonth(int i)

setYear

public void setYear(int i)

setSeconds

public void setSeconds(java.lang.String s)

setMinutes

public void setMinutes(java.lang.String s)

setHours

public void setHours(java.lang.String s)

setDay

public void setDay(java.lang.String s)

setWeekday

public void setWeekday(java.lang.String s)

setMonth

public void setMonth(java.lang.String s)

setYear

public void setYear(java.lang.String s)

getDbglevel

public int getDbglevel()

setDbglevel

public void setDbglevel(int i)

setDbglevel

public void setDbglevel(java.lang.String s)

getTimeString

public java.lang.String getTimeString()

getDateString

public java.lang.String getDateString()

configure

public void configure()
Description copied from class: SimObject
create and display a 'ConfigDialog' to set the parameters for a SimObject. The default ConfigDialog for the base class (SimObject) itself is empty except for the 'instance name' of the SimObject.

Overrides:
configure in class SimObject

wakeup

public void wakeup(java.lang.Object arg)
wakeup(): The central part of the DCF77-Clock model. The basic idea is to register wakeup()s every 50msec. with the Simulator. On each wakeup, we sample the input value of the dcf_in Signal, update our internal state, and set the corresponding output values.

In order to handle noisy input signals, much higher oversampling is required. You might try just to insert a low-pass filter between the antenna and the dcf_in Signal of this clock.

Specified by:
wakeup in interface Wakeable
Parameters:
arg - - unused argument

elaborate

public void elaborate(java.lang.Object arg)
elaborate(): This method tries to register a wakeupEvent with the current parent's Simulator. If successful, all subsequent activity is handled by our wakeup() method.

Specified by:
elaborate in interface Simulatable
Overrides:
elaborate in class SimObject

evaluate

public void evaluate(java.lang.Object arg)
Description copied from interface: Simulatable
evaluate(): called by the simulation engine on all events that concern this object. The object is responsible for updating its internal state and for scheduling all pending output events.

Specified by:
evaluate in interface Simulatable
Overrides:
evaluate in class SimObject
Parameters:
arg - an arbitrary object argument

toString

public java.lang.String toString()
generate a textual represenation of this DCF77 clock, including class name, full Hades instance name, and the DCF77 model time.

Overrides:
toString in class SimObject