Using Splitter Elements to Route Discrete Changes Based on Their Value

In some situations, you may want to route a discrete change signal based on the Value it is carrying.  For example, based on the Value associated with the discrete change signal, you may want to route the item to different processing streams.

This can be accomplished by using a Splitter to route the discrete change signal based on its Value.  This is possible because 1) a Splitter can accept (and route) discrete change signals; and 2) the specified fraction (or amount) for a Splitter output can reference the value of the signal using the ~Amount local property.

To illustrate this, it is instructive to consider a simple example. This example can be found in the file Splitter.gsm in the General Examples folder of your GoldSim directory (accessed by selecting File | Open Example... from the main menu).

In this example, a discrete change signal with an “Add” instruction is generated.  If the value is less than 100, we want to send it to one set of processes; if it is greater than 100, we want to send it to a different set of processes.  The Splitter is used to route it in the appropriate direction:

The Splitter accomplishes this by referencing "~Amount", which is a locally available property within the Splitter dialog:

This technique works because a Splitter does not propagate a discrete change signal with a value of zero and an “Add” instruction (“Replace” and “Push” instructions with zero values would be propagated).  Hence, given the logic specified above, only one signal is propagated whenever a discrete change signal is received by the Splitter.

   Note: If you only wanted to adjust the delay time for a single process, you could do so without using the Splitter at all by defining a single Discrete Change Delay and referencing the ~DC_Value.  The example above is simply meant to illustrate how you could split a signal into one of several processing directions (which might each have many subsequent processing steps).

Related Topics…

Learn more about: