Transfer Data to the Synthesis Data Warehouse (SDW)

The Synthesis Data Warehouse (SDW) — formerly called "Reliability Data Warehouse" — is a temporary data storage location in a Synthesis repository. With the Synthesis API, you can transfer data from external sources into the SDW of a repository for use in Weibull++, ALTA or RGA standard folios.

In this tutorial, you'll create a simple solution for copying data from a Microsoft Excel&#174; file over to the SDW. Note that the tutorial only demonstrates one particular approach for extracting data from Excel. It's for demonstration purposes only; it doesn't take efficiency into account and doesn't include any exception handling.

Prerequisites
Before you begin:


 * Reference the Microsoft Excel Object Library in your code. (In Visual Studio, choose Project > Add Reference, and in the COM tab, select the latest version of the Microsoft Excel Object Library. Click OK.)


 * Create a Synthesis repository for testing purposes.


 * You'll also need to create a sample Excel file to complete the tutorial successfully. Copy and paste the following data to an Excel file. Be sure to select cell A1 in Sheet1 of the workbook when pasting the data. Name the Excel file, "SampleData."

Tutorial: Transfer Data from an Excel File to the SDW
The following example demonstrates how to transfer data from an Excel file to the Synthesis Data Warehouse (SDW). A discussion of the example follows.

A VBA version of the code sample is available here.

VB.NET SynthesisAPI Microsoft.Office.Interop.Excel Module1 Main DataCollection RawDataSet DataCollection.ExtractedName = DataCollection.ExtractedType = RawDataSetType.Weibull Row RawData Excel Application Workbook Workbook Sheet Worksheet Workbook = Excel.Workbooks.Open Sheet = Workbook.Sheets(1) i Integer, MaxRow  Integer MaxRow = 20 i = 2 MaxRow Row = RawData Row.StateFS = sheet.Cells(i, 1).text Row.StateTime = sheet.Cells(i, 2).value Row.FailureMode = sheet.Cells(i, 3).text DataCollection.AddDataRow(Row) i       Workbook.Close Excel.Quit MyRepository Repository MyRepository.ConnectToRepository MyRepository.DataWarehouse.SaveRawDataSet(DataCollection)

Discussion
Begin by creating an SDW data collection. The RawDataSet class represents the data collection. For this example, we've set it to contain data sets for Weibull++.

DataCollection RawDataSet DataCollection.ExtractedName = DataCollection.ExtractedType = RawDataSetType.Weibull

Next, declare a RawData object, which represents a single data point. We will use this object to represent each row of data in the Excel file.

Row RawData

The following section of code demonstrates one way to extract a row of data from the Excel file. First, the code opens a connection to the Excel file and specifies the active sheet (in this case, Sheet1). Then, it creates a new   object and uses the values in row #2 of the Excel file to define the data point.

After the code finishes reading the row of data, it adds the data point to the data collection. When the code reaches, it increases   with 1 and jumps back to the   statement, which creates a new   object to represent the data point in row #3 of the Excel sheet, and so on. The loop continues until  reaches the specified number of rows (MaxRow). Finally, the code closes the connection to the Excel file.

Excel Application Workbook Workbook Sheet Worksheet Workbook = Excel.Workbooks.Open Sheet = Workbook.Sheets(1) i Integer, MaxRow  Integer MaxRow = 20 i = 2 MaxRow Row = RawData Row.StateFS = sheet.Cells(i, 1).text Row.StateTime = sheet.Cells(i, 2).value Row.FailureMode = sheet.Cells(i, 3).text DataCollection.AddDataRow(Row) i  Workbook.Close Excel.Quit

Now that we've filled the data collection with the data points, the next step is to send the data collection to the Synthesis repository. First, connect to a Synthesis repository (for details, see this tutorial.)

MyRepository Repository MyRepository.ConnectToRepository

Then use the Repository.DataWarehouse.SaveRawDataSet method to save the data collection to the Synthesis repository, as shown below.

MyRepository.DataWarehouse.SaveRawDataSet(DataCollection)

To verify that the data were imported, launch Weibull++, open the SDW (Home > Synthesis > Synthesis Data Warehouse) and then select the new data collection. (To view the data, you may need to display the StateTime, StateFS and FailureMode columns by right-clicking a column header and choosing Select Columns.)