Conversion of CSV file from a P&ID diagram to DTDL file to make a digital twin

Sebastian, Joshua 21 Reputation points
2021-02-02T07:05:57.267+00:00

I have a csv file which is the output of a p&id diagram. Is there any document or method/links which i can use for converting the csv file to a dtdl file and create a twin accordingly using that?

Azure Digital Twins
Azure Digital Twins
An Azure platform that is used to create digital representations of real-world things, places, business processes, and people.
224 questions
{count} votes

Accepted answer
  1. AshokPeddakotla-MSFT 30,516 Reputation points
    2021-02-02T14:04:05.423+00:00

    @Sebastian, Joshua
    As per my understanding of the query, you need to create a digital twins graph out of CSV files extracted from P&ID diagram. Correct me if I'm wrong.

    One way to get this data into Azure Digital Twins is to write a code to interpret the CSV file into commands to create twins and relationships. The following code sample illustrates reading the data from the CSV file and creating a twin graph in Azure Digital Twins.

    Example:

    // Method to ingest data from the CSV file  
            public static List<List<string>> ReadData()  
            {  
                string path = "<path-to>/filename.csv";  
                string[] lines = System.IO.File.ReadAllLines(path);  
                List<List<string>> data = new List<List<string>>();  
                int count = 0;  
                foreach (string line in lines)  
                {  
                    if (count++ == 0)  
                        continue;  
                    List<string> cols = new List<string>();  
                    data.Add(cols);  
                    string[] columns = line.Split(',');  
                    foreach (string column in columns)  
                    {  
                        cols.Add(column);  
                    }  
                }  
                return data;  
            }  
    
    // Method to create the digital twins client  
            private static DigitalTwinsClient createDTClient()  
            {  
      
                string adtInstanceUrl = "https://<your-instance-hostname>";  
                var credentials = new DefaultAzureCredential();  
                DigitalTwinsClient client = new DigitalTwinsClient(new Uri(adtInstanceUrl), credentials);  
                return client;  
            }  
    

    I would suggest you, go through the Create graph from a CSV file documentation sample and see if it helps.

    Do let us know if you have any further queries.

    ----------------------------------------------------------------------------------------------------------------------------------------

    If an answer is helpful, please "Accept answer" or "Up-Vote" for the same which might be beneficial to other community members reading this thread.

    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful