Full Library / Math Operator / Counter / Counter_Loop_Port
Block Name: Counter_Loop_Port
Code File Location: VisualSim/actor/lib/Counter_Loop_Port
Block Overview
- This
block contains a counter that is incremented or decremented, whenever a
value is received on the ready_input port. The "ready_input" triggers
the loop increment (or decrement) and outputs the loop counter value to
the "counter_output", unless the "final_input" value is exceeded in
either a positive, or negative direction. Once the "final_input" value
is exceeded, then the "done_output" is activated. The initial counter,
final counter and increment (or decrement) counter values are sent by
initializing this block with values on the three input ports: initial_input, final_input, increment_input. When done_output is activated, the internal counter is reset to the initial value.
initial_input
public TypedIOPort initial_input
- Initial
counter state input via "initial_input" port. Type can be integer,
long, or double. The inital counter value is also output on the
loop_index_output port.
final_input
public TypedIOPort final_input
- Final counter state input via "final_input" port. Type can be integer, long, or double.
increment_input
public TypedIOPort increment_input
- Specifies
the positive or negative value that the counter must be incremented by
whenever a trgger is received on the ready_input port.Type can be
integer, long, or double.
ready_input
public TypedIOPort ready_input
- "ready_input"
input increments counter from initial counter state. If the three
inputs, initial, final, and increment have not been set prior to
triggering the "ready_input", then an exception is set.
counter_output
public TypedIOPort loop_index_output
- "loop_index_output"
port sends out the current state of the loop counter. The first output
appears when the "initial_input" is set. Subsequent outputs appear when
the "ready_input" is triggered, which increment the loop counter.
done_output
public TypedIOPort done_output
- "done_output" fires when the counter reaches the final counter value instead of the "loop_index_output".
Created with the Personal Edition of HelpNDoc: Easily create EBooks