How to Link CADSIM to Mill Data

...via Excel and DDE.

You can use Microsoft Excel to download data from your mill's data logger and then link it to your CADSIM Plus simulation.

Assume you have a list of values from your data logger, which consists of volumetric flow, temperature, and time (see Excel screen at right). Start by creating a simulation Input/Output (I/O) area on an Excel worksheet. Create the headings 'time', 'flow', and 'temperature', where time will be an input from CADSIM Plus and flow and temperature will be output to CADSIM Plus.dyndataxls

Click the cell immediately below each of these headings, and select Insert > Name > Define. Excel will automatically pick up the heading of the cell above. Click OK to accept the name of the cell. Now cell A3 will be named time, and no matter where you move the cell later, CADSIM Plus will maintain its link by that name. Also, create a heading and cell named 'match' which will be described later.

CADSIM Plus will send a time value to Excel, and Excel will then return the appropriate values for flow and temperature that correspond to that time value. Use Excel's INDEX function to do this. For example, placing INDEX(B10:B307,time) in the cell named flow (B3) will make a range of flow values available to that cell -- in this case our sample mill data for flow starts at B10 and ends at B307. A similar index is used to get temperature values for the cell named temperature (C3) in column C.

If all of the time increments were equal, CADSIM Plus could auto-increment to obtain the values it needed from the table without requiring this indexed look up method. But how do we accommodate time with non-uniform time steps? In Figure 1, note that the rows for time 4 and 5 have been removed -- possibly due to bad data. Excel has a MATCH function that makes this task easy.

Use the formula MATCH(time, A10:A307,1) in cell match (A5). This will look down the time column and return the appropriate data row. However, note that the MATCH function for time 3, 4, or 5 returns the same row of data (data for time 3).

Now we can use the cell value of match instead of time in our INDEX functions. Place INDEX(B10:B307,match) in the cell named flow (B3) and INDEX(C10:C307,match) in the cell named temperature (C3). The worksheet is now ready for communication with CADSIM Plus.dyndatacp

Create a CADSIM Plus DDE Client communication link to the Excel worksheet (CADSIM Plus drawing at right) by following the directions in the online module help files (under DDEClient). Note the identification of the specific worksheet and the list of variable names in pairs, first the CADSIM Plus variable name shown in uppercase, followed by the cell's name in parenthesis (see CADSIM Plus drawing).

A CADSIM Plus TIME module has been added to the model to provide the simulation time to Excel in minutes. Caution: a time value of zero will result in "#N/A" in each of the match, flow, and temperature cells, and result in invalid data being returned to CADSIM Plus. To avoid this, use a Linear specification to add 1.0 to the time so that it can never be less than 1.0.

The returned values for flow and temperature are shown linked to values for a process stream using CADSIM Plus Equate specifications.

Since you do not want to exceed the amount of data that you have collected in Excel, as a final touch you can include a CADSIM Plus WARNING module that will pop up when simulated time has reached the end of the data in Excel.