• Not Answered

String array with dynamic reference

Hello the community.

I would like to use a table with two temperature and concentration variables.

And I want to make a while loop that allows to compare the temperature measurement and the concentration with the values ​​defined in the table and to choose the value of the corresponding density.

And I want to use two dynamic references to browse rows and columns.

Thank you in advance.

Best regards.

Butler faith.

4 Replies

  • I'm not sure what your goal is but it sounds like a signal characterizer block would suit the functionality you have described.
  • At first I agreed with Chips answer, but then I realized that you are asking for 2 inputs to generate 1 output. The Signal Characterizer doesn't do that as far as I can tell.

    As I see it (off the cuff) you have a few options:

    1. Use a floating point array and make it 3 columns by n rows.
    2. Develop a clever ability to reduce the number of inputs down to 1
      1. By this I mean some mathematical function that allows for a unique number to be generated
    3. Using a chart of X1, X2 and Y create an equation that gives you the correct answer.  I have done this before using a software package called Eureqa Formulize.
    4. Use OPC to ship the data off to some external processing engine and get a result that way.

    For Option #1, Search in books online for how to access "Matrix Parameter References." I think this will get you what you want without the burden of Dynamic References.

    If you really want to go the Dynamic References direction to do this, you can certainly do that, but:

    1. It will be slow.  Dynamic references take a scan to establish.  
      1. In scan 1, you "create" the reference.  You must allow this scan to complete.
      2. In scan 2, you can access the data established in the reference.
    2. You will need to create a non-traditional looping structure.  Basically, you will have to use each scan as a iteration of the loop.

    I hope this helps,
    Dave

  • Not sure I understand exactly what you are trying to do. Could you clarify a bit more about the science/chemistry? It seems you want to determine the Density of the product based on the current temperature and Concentration.

    Here's an idea. Using Signal Characterizers, you can create a "surface" plot based on the three variables. A signal Characterizer has up to 21 data points, so you could use up to 22 Signal Characterizers. 21 of them are used to create 21 separate curves for two of the variables, based on a known value of the third. You can then use these 21 curves to program the data points of the 22nd curve.

    I'm thinking in your case, if Density is a function of concentration and Temperature, you would choose 21 temperature values, and for each of these temperatures, define the density curve based on Concentration. You will feed the concentration value into all of these curves, which will generate 21 density values. Then you can programmatically configure the last Signal Characterizer with the density values for each of the Known Temperature curves. You feed Temperature into this signal characterizer and it will output the Density at the given Temperature and Concentration. The Signal Characterizers interpolate between the data values, so the final Curve will give you the density as a function of concentration and temperature.

    If the curves are relatively simple, you can use fewer blocks. Also, if the curves have a strong inflection point, you can assign more data values in that area to yield a more accurate value.

    The Signal Characterizer block is a pretty efficient block and effectively does an interpolation calculation between two data values, based on the input. A CALC block is used to read the 21 Density values for the 21 Temperature curves, and plots this as Density vs Temperature. The temperature values are fixed based on the selected value for each initial curve. The actual temperature then gives the interpolated density at the given Temperature and concentration.

    Assuming density is a function of Concentration and Temperature.

    You can then fine tune the plot by selecting the best data points in each curve. In each initial Density vs Concentration curve and Temperature x1, you can choose to plot the data points to give the best result. If the inflection point moves such that there is a minimum density at a different concentration for each temperature, you would want to ensure you have a data point at this minimum point. No problem. Each curve operates independently to give you the most accurate curve at that temperature. Similarly, the temperature values do not have to be equidistance. You could concentrate more curves around the normal operating temperature where accuracy is most important.

    This works very well and is easy to maintain. You can setup a spread sheet to represent the Signal Characterizer data points and plot these in Excel. Once you have a satisfactory model, you simply write the values to the module. I setup the spreadsheet using the DeltaV Excel Addin, which allows me to simply write the array data on demand from the spread sheet.

    Andre Dicaire

  • In reply to dave_marshall:

    Note that the Dynamic reference gives you a .CST (Connection Status) to indicate the reference is bound. This value should be 0. As dave indicates, it should be good on the second scan, but you should check the CST. If the connection is to a remote module in another controller, the connection might not be good, especially if you are scanning at 100 ms. (if '^/DYN_REF.CST = 0 then....)

    Andre Dicaire