Jump to content

Read trends


Recommended Posts

Yes and no....

Yes, if you are saving the trends into SD and then use the Communication driver to read the trends file... but you will then need to do something with the file (You need some program that will open that file, for example SD Card Suite that converts it to USD files and then shows it on the PC, or converts it to CSV or Excel).

No, if you don't want to use any software in order to understand the trend file.

No, if you want to read the currently running trend without saving it to an sd card (Remote Operator does it, but it has a lot of logic on understanding what it reads, and it also requires a trend HMI element).

Link to comment
Share on other sites

  • 1 year later...

Reading a file from the SD Card can be done using the .Net driver SD APIs. The SD Card explorer uses those same APIs


After reading the files, you hit a wall, because we don't give any API of showing a trend on a UI.

There is a small program that converts URT files into PDF. The sources are not published, but it can be stripped out to have a model that represents the trends and its curves. But you will still need some kind of User Control that will take that data and show it in the UI (WinForms or WPF)

Link to comment
Share on other sites

For reading files from the SD card, you will a PLC object. I believe you already know how to communicate with a PLC (using GetPLC etc).


Now that you have a PLC object, called plc, you can write:


plc.SD.ReadFile(SdFolder.DT_DT1, "Hello.utr", null);



The SdFolder Enum is:

        public enum SdFolder
            RootFolder = -1,
            ALARMS = 0,
            DT = 1,
            DT_DT1 = 100,
            DT_DT2 = 101,
            DT_DT3 = 102,
            DT_DT4 = 103,
            LOG = 3,
            SYSTEM = 4,
            USER_APP = 5,
            TRENDS =  6,
            TRENDS_TRENDS1 = 600,
            TRENDS_TRENDS2 = 601,
            TRENDS_TRENDS3 = 602,
            TRENDS_TRENDS4 = 603,
            SDBLOCKS = 9,
            EXCEL = 10,
            EXCEL_EXCEL1 = 1000,
            EXCEL_EXCEL2 = 1001,
            EXCEL_EXCEL3 = 1002,
            EXCEL_EXCEL4 = 1003,
            WEB = 11,
These are the folders that are used by unitroncis in the SD.
There are other overloads to this function that also gets the folder as string (for example @"DT\DT1")
You can also list the files on the SD, etc... just look at the set of APIs that the SD class exposes.
Bte, the last parameter in the example I gave is a progress delegate, so if you want to have a progress car showing the download percentage, then use this delegate
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...