Cascade: Example

From Nova Documentation
Jump to: navigation, search

Here is an example of setting up a cascade plug-in with a simple converter.

  • Step 1: Set the cascade plug-in as Compact and Count to 4.
Cascade properties

  • Step 2: Set up initial values and a converter CodeChip' as the method of conversion for each element in Count.
CodeChip for converting input

We set up a simple function inside of our converter_1 CodeChip to act as the method of conversion for each element in Count. This function takes in parameters prev_value, id, and curr_value, which are the previous element's value in the cascade, the index of the current element, and the value of the current element in the cascade, respectively. This function returns prev_value multiplied (or scaled) by input c - which will be an input into the CodeChip from a term that we will label scaler and will have a value of 3.

CodeChip for Initial Terms

We set up an init_terms_1 term to contain an array of length 4. Each element in the array is a value for the cascade - Example_Cascade. The in_term_1 term is a value - 5 - that is added to the top level of the cascade with each time increment.

The overall structure of a basic, working cascade

  • Step 3: Run the basic cascade model.
Cascade times

At time 0, time 1, and time 2, Note: the in_term_1 value is added at the top element of the cascade with each iteration. Each element afterwards has the converter_1 f function applied to it: the value of the previous element in the cascade (prev_value) is multiplied by the scaler and then becomes the value of the current element.

  • Step 4: Create output values.
An output term

Now we create out_values to house the output of the cascade plug-in. Additionally, we create a Spy plug-in to see the values of our out_values term, which is summing the current values in the cascade.

Output with Spy

And the overall structure of our completed model.

Complete cascade model with output and spy