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.
- Step 2: Set up initial values and a converter CodeChip' as the method of conversion for each element in Count.
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.
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.
- Step 3: Run the basic cascade model.
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.
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.
And the overall structure of our completed model.