Granta MI - optiSLang Connector
=================================
Description
-----------
**Overview**

This collection of scripts is designed to enable users to analyze their materials data from Granta MI in optiSLang, to better understand the relationships between their data and carry-out design analysis for the purposes of optimisation and robustness analysis. It has value for any customer wishing to better understand the data they have in Granta MI, but is primarily aimed at (but is by no means exclusively for) materials manufacturers. These could be traditional materials manufacturers mixing and processing raw materials, but it could equally be applied to any customer who has "production authority", i.e. the ability to influence the composition and processing parameters of the materials they use. This could, for example, include companies using composite materials where they add reinforcements to polymer matrices and cure the materials into products, or a company who has the ability to order materials from primary producers, where they can dictate the composition and processing parameters they use.

The script utilises the Python/PLM integration possibilities in optiSLang. The scripts are integrated using an optiSLang data receive node. This is a two-part process. The first part involves a Graphical User Interface (GUI), launched when the user selects the Granta MI integration from the optiSLang data receive node. After starting a new MI session, this node allows the user to browse the databases and tables in their MI Server, and select a record and exporter. This information
(including log-in information) is then passed to optiSLang as a .json file. 

When called to by the user, optiSLang can use the data in the .json to:
* Log-on to MI
* Export the data for the selected record(s) and its exporter.
* Turn this information into optiSLang designs via file exported.

**Use-cases**

The scripts can in general be used by customers wanting to better understand relationships within their data. If dependent and independent variables can be parameterised (i.e. described numerically as attributes), and this collected into Granta MI records, then this approach can be used. However, more specific use cases could be as follows:
*Import one or multiple material cards from Granta. With OOT optiSLang functionality you could then run multiple simulations to select the best material.  The aim of this example is to connect to Granta and import the material cards. Running the simulations and comparing the results will be out of scope for this example, as it can be done independently of Granta once the material library has been imported. 
From this the Granta MI – optiSLang connector allows users to access records from any table in any database on their Granta MI server. Each record selected from Granta MI is imported as a material card into the optiSLang library, following the user selection of the desired record and material format. 
It is expected that these results would then be validated by creating an instance of the suggested material and testing it. Of course, this test data can then be used in future to further improve and refine the property prediction capabilities. 

Installation and deployment
---------------------------
1. If necessary, unzip the accompanying folder "Granta MI".
2. Place this unzipped folder and its contents in the optiSLang plm folder e.g.
`C:\Users\Public\Documents\Dynardo\ANSYS optiSLang\2021 R1\scripting\plm\`.
3. (pip) Install the Granta MI Python STK on the Python instance in your oSL installation. Typically, this can be found at `C:\Program Files\Dynardo\ANSYS optiSLang\2021 R1\`. From this location, try `>>>optislang-python -m pip install .....` with the latest version of the Granta MI Python STK.


Technical details
-----------------

Data is transferred from Granta MI to optiSLang in a two-stage process. The first step uses the optiSLang receive node and optiSLang's PLM integration tool to access Granta MI. This is achieved by launching a GUI, which the user can then use to log on to Granta MI, select a database, select a table and one or more records. After that user select exporter. 

Following the selection of records and exporter, the GUI finishes by creating a json file containing the necessary data to log on to MI and identify records and exporters of interest. optiSLang's data receive node can then use this to interrogate the MI database, collect the necessary data and export it to file in optiSLang working directory. With OOT optiSLang functionality user can then run multiple simulations to select the best material. Each record selected from Granta MI is imported as a material card into the optiSLang library, following the user selection of the desired record and material format. 

Limitations
-----------
* Currently supports Windows authentification correctly, but not OIDC,and requires password obfuscation before basic authentification should be offered to a customer.
* Currently only supports single record selection 
* Currently only supports a single MI table (i.e. no links are followed).

Potential future improvements
-----------------------------
The following improvements should be made before shipping to a customer:
* Ensure that passwords do not appear anywhere in plain-text if basic authentification is used.
* Allow a more intuitive multi-selection of records in the tree structure. 

The following functionality could be included into a future version, which would significantly enhance the power of the tool:
* Adding the ability to use discrete type attributes as well.
* Following links and using linked data.
* Including functional attributes in the responses.
