Class SoTimeCounter
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.misc.SoBase
-
- com.openinventor.inventor.fields.SoFieldContainer
-
- com.openinventor.inventor.engines.SoEngine
-
- com.openinventor.inventor.engines.SoTimeCounter
-
- All Implemented Interfaces:
SafeDisposable
public class SoTimeCounter extends SoEngine
Timed integer counter. This engine is a counter that outputs numbers, starting at a minimum value, increasing by a step value, and ending with a number that does not exceed the maximum value. When the maximum number is reached, it starts counting from the beginning again.The difference between this engine and the
SoCounterengine, is that this engine also has atimeIninput, which allows the counting cycles to be timed. This engine counts automatically over time; it does not need to be triggered to go to the next step. By default, thetimeIninput is connected to the realTime global field. It can, however, be connected to any time source.The
frequencyinput field controls how many min-to-max cycles are performed per second. For example, afrequencyvalue of 0.5 means that it will take 2 seconds to complete a single min-to-max cycle.The steps in the count cycle do not necessarily all have the same duration. Using the
dutyinput field, you can arbitrarily split the time period of the count cycle between the steps. For example, if there are 5 steps in the cycle, a duty input of (1., 2., 2., 2., 1.) will make the second, third, and fourth steps take twice as long as the first and last steps.At any time the counter can be reset to a specific value. If you set the
resetinput field to a value, the engine will continue counting from there. Note that the counter will always output numbers based on themin,maxandstepvalues, and setting theresetvalue does not affect the those input fields. If the reset value is not a legal counter value, the counter will still behave as though it is:- If
resetis greater thanmax, the counter is set tomax. - If
resetis less thanmin, the counter is set tomin. - If
resetis between step values, the counter is set to the lower step.
Each time a counting cycle is started, the
syncOutoutput is triggered. This output can be used to synchronize some other event with the counting cycle. Other events can also synchronize the counter by triggering thesyncIninput.You can pause the engine, by setting the
oninput to false, and it will stop updating the output field. When you turn off the pause, by settingonto true, it will start counting again from where it left off.File format/default:
TimeCounter {
min 0 max 1 step 1 on true frequency 1 duty 1 timeIn <current time> syncIn reset 0 - See Also:
SoCounter,SoElapsedTime,SoEngineOutput
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
Fields Modifier and Type Field Description SoMFFloatdutyDuty cycle values.SoSFFloatfrequencyNumber of min-to-max cycles per second.SoSFShortmaxMaximum value for the counter.SoSFShortminMinimum value for the counter.SoSFBoolonCounter pauses if this is set to false.SoEngineOutputoutput(SoSFShort) Counts min-to-max, in step increments.SoSFShortresetReset the counter to the specified value.SoSFShortstepCounter step value.SoSFTriggersyncInRestart at the beginning of the cycle.SoEngineOutputsyncOut(SoSFTrigger) Triggers at cycle start.SoSFTimetimeInRunning time.-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoTimeCounter()Constructor.
-
Method Summary
-
Methods inherited from class com.openinventor.inventor.engines.SoEngine
copy, getByName, getOutput, getOutputName
-
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable, touch
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Field Detail
-
min
public final SoSFShort min
Minimum value for the counter.
-
max
public final SoSFShort max
Maximum value for the counter.
-
step
public final SoSFShort step
Counter step value.
-
on
public final SoSFBool on
Counter pauses if this is set to false.
-
frequency
public final SoSFFloat frequency
Number of min-to-max cycles per second.
-
duty
public final SoMFFloat duty
Duty cycle values.
-
timeIn
public final SoSFTime timeIn
Running time.
-
syncIn
public final SoSFTrigger syncIn
Restart at the beginning of the cycle.
-
reset
public final SoSFShort reset
Reset the counter to the specified value.
-
output
public final SoEngineOutput output
(SoSFShort) Counts min-to-max, in step increments.
-
syncOut
public final SoEngineOutput syncOut
(SoSFTrigger) Triggers at cycle start.
-
-