SciData
1. Install Prerequisites (Scilab)
2. Install SciData
-Scilab
-DAQ Flex
Note: DAQ Flex is used to provide integrated data acquisition. SciData DAQ operation works with any DAQ Flex supported products.
http://www.mccdaq.com/daq-software/DAQFlex.aspx
ftp://ftp.mccdaq.com/downloads/DAQFlex/
-MathCAD (Supports v14-15)
Note: SciData can interact with MathCAD and Scilab
http://www.ptc.com/product/mathcad/
-SDS: Scientific Dataset library and tools
Note: The latest version (1.3) offers an updated dataset viewer
http://research.microsoft.com/en-us/projects/sds/
SciData provides Data Management for MathCAD and Scilab. Furthermore, you can:
- Separate data from analysis
- Batch process datasets with a single analysis file
- Include metadata with data
- Filter and sort the data collection
- Collect data easily with built in data acquisition (DAQ)
1. Start SciData (Start>SciData>SciData)
2. Click “Start a New File”
3. Create a folder “Mortgage Calculator” (anywhere is OK). Save the file “Mortgage Calculations Table.sdat” in the folder.
4. Create a Constant Column called “loan_amount”
a. Click ‘Edit Columns’
b. Choose ‘Constant’ type
c. Type “loan_amount” in the textbox and click ‘Add’ (or hit enter)
d. Add the unit “$” and the format “C”
i. Note: Visit http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx for available formats
5. Add Constant Column “APR” with Unit “%”
6. Add 5 rows
a. Click ‘New Row(s)’ button
b. Input 5 to the ‘Number of Rows to Add’ textbox
c. Click ‘OK’
7. Edit the rows to enter 5 different loan amounts and APRs. For this example, historic national average values are chosen from the last 20 years, as shown below (Note, this data comes from http://www.jparsons.net/housingbubble/)
8. Add a MathCAD File (Row>Add New File>Add MathCAD File). Name the file “Mortgage Math”
9. Select the file from the file selector
10. Open the file by clicking the ‘Open’ button
11. Select a row and click ‘Send Row’
12. Switch to MathCAD. Delete the original template and then check the variables: ‘loan_amount’ and ‘APR’ as shown below. You should see the values from the row you selected.
13. Edit the MathCAD document to calculate the payment and interest (see below). We are interested in the total interest for this example.
14. To export the total interest to SciData, add a WRITEPRN export call. Inside the WRITEPRN call is:
a. a ‘#’ tag to represent exporting a single value
b. the name to assign the value (‘total_int’)
c. a unit, written between square brackets (‘[$k]’)
15. Click ‘Scan File’ to add the result column to the table.
16. Now click ‘Process Row’. The total interest, ‘total_int’, value is now retrieved to the table.
17. The rest of the values can be calculated through a batch process by clicking the ‘All Filtered Rows’ button.
18. We can also export arrays to SciData. This is done using the same method as constants, except the ‘@’ tag is used. Switch to the MathCAD document and add the array export calls for ‘payment’, ‘int’, ‘p’, and ‘balance’, as shown.
19. Click the ‘Scan’ button again and the new tagged exports will show up in SciData.
20. By clicking the ‘All Filtered Rows’ button again, the result arrays will be exported and stored in SciData.
21. Note: the table displays the number of rows in the array. To see the actual data, double click the row header to open the row in sheet view.
22. Now we would like to produce a plot of our results, the year vs. total int. We will switch now to the ‘Table’ tab and create another new MathCAD file for table calculations.
a. Switch to ‘Table’ tab
b. Click ‘Add New File>Add MathCAD File’
c. Name the file ‘Plot’
d. Select the file from the file selector
e. Click the ‘Open’ button
23. Now click ‘Send Lite’. Now the MathCAD file ‘Plot.xmcd’ has all the data in the table (except the arrays). Note that all information sent to MathCAD changes color to pink to indicate it has been successfully exported.
a. Note: ‘Send Lite’ exports all data except arrays to MathCAD. This saves memory and increases performance. Use this option if the arrays are not needed.
24. Now we can easily produce a plot of ‘total_int’ vs. ‘year’ by implementing the below MathCAD code.
a. Note: The column ‘Name’ is sent as a string value. Therefore this must be converted to a number so it can be plotted by using the ‘str2num’ function.
25. The SciData table can be filtered so that the data sent to MathCAD is specific to your criteria. For example, the year column can be filtered to show just years 1992 and 2012.
a. Hover the mouse over the ‘Name’ column
b. Click
the dropdown filter button
c. Select the years ‘1992’ and ‘2012’
26. Now click ‘Send Full’. As can be seen now in ‘Plot.xmcd’, the total interest plot is adjusted and only shows the years 1992 and 2012. Since ‘Send Full’ was used the arrays ‘int’, ‘principal’, etc. were sent. Therefore a plot can be made to compare the interest payment over the life of the loan for the two years, as shown.