Jump to content

Read trends


torstein

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.