Useful Code Snippets

|

Models Containing Useful Generic Code Snippets

All the models assigned to the selected category are listed below.

You can filter the list by entering keywords or phrases into the search field:

  • Add Scalar to Vector

    This model demonstrates how you can take a scalar value and add it to one of the items of a vector using an Expression. It includes an illustrative Dashboard.

  • Random Sequence Generation

    This model addresses the need to randomly order a given number of indexed items

  • Rank Data Vector

    Take any vector of values and rank them according to their respective value from highest to lowest or the opposite.

  • Yearly Minimum and Maximum

    Demonstration of how an Extrema can be used to track year-to-date and annual values

  • Moving Discrete Items

    This simple model illustrates how to move discrete items from one state to another.

  • Day, Month, Year from Date

    A Script element is used to calculate various components from a date or datetime output, like Year, Month, Day, Minute, Second

  • Polynomial Root Finder

    This model compares the bisection and secant methods for finding roots of 2nd order polynomials (i.e. of the form C1*x^2 + C2*x + C3).

  • Spline Interpolation

    This model implements a spline interpolation method to generate smoothly-varying dependent variable values from a 1-D Lookup Table.

  • Mass Balance Check

    Check that inflows, outflows, and changes in storage within your flow model balance.

  • On - Off Reservoir Discharge

    This model demonstrates the use of a Status element to control discharges from a reservoir.

 

Making Better Decisions In An Uncertain World