1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Switching units on/off in Core

Discussion in 'Building With Reaktor' started by destination sirius, May 16, 2014.

  1. destination sirius

    destination sirius New Member

    Messages:
    8
    Hello,

    In my oscillator I have incoming phase signal (Ph) that ramps between -1 and 1.
    This domain is divided into intervals: -1...-0.5, -0.5...0, 0...0.5, 0.5...1.
    The output signal takes on following values depending on which interval the phase belongs to:
    Code:
    if       (  -1<=Ph<-0.5  )  out=F1(Ph);
    else if  (  -0.5<=Ph<0   )  out=F2(Ph);
    else if  (  0<=Ph<0.5    )  out=F3(Ph);
    else if  (  0.5<=Ph<=1   )  out=F4(Ph);
    Here is a screenshot of my core implementation of this stuff:
    Phases.png

    It works great, but all the functions (F1, F2, F3 anf F4) work every time, no matter which value the phase takes on.

    I want to suspend unused functions while the phase is out of corresponding range, because they are very CPU-hungry.

    Following implementation doesn't work:
    Phases2.png
    F1...4 units seem to stay connected to the output and being calculated every time regardless of the each router's state.
    CPU usage drops when I disconnect them manually.

    Is there any way to suspend unused modules for this case?
     
    Last edited: May 16, 2014
  2. colB

    colB NI Product Owner

    Messages:
    3,969
    As usual, the obvious response is: post the ensemble!

    It is not possible to say for sure what the problem is without seeing the internal structure of F1-4.

    The usual problem is that somewhere in those structures, there are SR.C connections. You would need to remove them and pass in clock events that are only routed to the function that you want to be 'on'

    As far as the part that you have shown, all you needed to do to the structure in the first picture is pass the outputs of the routers into the inputs of the functions.

    So top out of first router into F1, top out of second router into F2, top out of third router into F3 and bottom output of third router into F4, you could have also then removed the latches, passing the outputs of the function macros straight to the merge.
     

    Attached Files:

    • Like Like x 2
  3. destination sirius

    destination sirius New Member

    Messages:
    8
    Looks obvious, but even so I couldn't realize it. Thanks a lot!