VariableClock

Parent Previous Next

Full Library / Source / Clock / VariableClock
Block Name: VariableClock

Code File Location: VisualSim/actor/lib/VariableClock

Block Overview

o       It produces a periodic signal, a generalized square wave that sequences through N output values with arbitrary duty cycles and period. This block differs from the Clock block, in that, it has a periodControl input. 

Description

This actor is identical to Clock except that it has an additional input port, periodControl. If this port has a token when the actor fires, then the value read from that port is used to set the parameter value. The initial value of the period parameter is used before any input is observed on periodControl.

This actor can be fairly tricky to use with multiple values and offsets because of the constraint that all offsets must be less than the period. The output value, by default, is just the constant integer 1, and the offset is 0.0. The default value of period is changed to 1.0. This gives a very simply behavior, where the output is always the same, but the time between outputs is controlled by the periodControl input.

In some simulators, such as Digital, an input at periodControl is sufficient to trigger a execution. This can be somewhat counterintuitive, since an output from the clock may not be expected at that time. To avoid this, simply ensure that events at periodControl arrive only at times when an output is expected.

Refer VariableClock Demo Model.

Parameter

Explanation

Type

Example

stopTime

The stop time of the model. 

Integer

Infinity

period

The period of the output waveform. 

Double

2.0

offsets

The offsets at which the specified values will be produced. 

Array

{0.0, 1.0}

values

The values that will be produced at the specified offsets. 

Array

{1, 0}

numberOfCycles

The number of cycles to produce, or -1 to specify no limit. 

Integer

-1

Port

Explanation

Type

Output

At every rising and trailing edge a value is output on this port for example 1 or 0;

Integer

Period

This input port is used to define the period of the output waveform. This is an optional port and the block can be used without the period value.

Double

trigger

This input port is used to start the generation of events from this block.  This is an optional port and the block can be used without the input trigger.

Any value

periodControl

The port that controls the value of the period parameter. 

Double

Created with the Personal Edition of HelpNDoc: Free help authoring tool