איך נוכל לעזור לך היום?

EAE26.0: How to Export Alarms in CSV format from EcoStruxure Automation Expert HMI Runtime

This knowledge base article explains User on How to Export Alarms in CSV format from EcoStruxure Automation Expert HMI Runtime.

EcoStruxure Automation Expert (EAE) HMI provides alarm management controls to view realtime and archived alarms.

The controls currently lack an ‘Export to file’ feature. This could be useful to the Users to capture a snapshot of the alarms related to the solution.

  1. Configure an EAE application with the CATs as per project requirement.
  2. Create a canvas with the realtime alarm Grid and archived alarm Grid. Provide the settings Alarm Type = Online for Real time alarms and Archive for Archive Alarms.

scr1

scr2

3. Add 2 buttons to the canvas, one for exporting the realtime alarms and the other for exporting the archived alarms.

scr3

scr4

4. Create event handlers for the buttons either by double clicking on the buttons, or by entering a function name for the ‘Click’ event in the Events tab of the properties pane.

5. Switch to the ‘Source’ tab of the canvas and Insert 3 additional statements in the directives section of the source code as shown below.

scr5

6. The functions from these namespaces will be used for the function shown below. Insert the following function in the source code after the arrow as shown in below screenshot.

scr9

void ExportAlarms(AlarmGrid alarmGrid)

{

var acw = (AlarmControlWrapper)alarmGrid.PlatformImpl;

foreach (var element in acw.Controls) {

if (element.ToString()=="NxtControl.GuiFramework.AlarmControl") {

var alarmControl=(AlarmControl)element;

//Include header (Column name) text

alarmControl.ClipboardCopyMode=DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;

//Select the entire table for export

alarmControl.SelectAll();

//Copy the table to clipboard

IDataObject iData = alarmControl.GetClipboardContent();

//Convert table data object to string for further manipulation

string sData = (String)iData.GetData(DataFormats.Text);

//Replace the default tab column separator with comma. Change this to the list separator defined in the OS's regional settings

sData=sData.Replace('\t',',');

//Create the SaveFileDialog object

var saveFileDialog1 = new SaveFileDialog();

//Set the filters for the SaveFileDialog. The file extension will be added if not typed in

saveFileDialog1.Filter = "CSV files (*.csv)|*.csv"  ;

//Remember the selected directory

saveFileDialog1.RestoreDirectory = true;

//Check if OK was pressed

if(saveFileDialog1.ShowDialog() == DialogResult.OK)

{

Stream almStream;

//Check if the file was successfully opened

if((almStream = saveFileDialog1.OpenFile()) != null)

{

//Convert the string to a stream of bytes to be written

byte[] dataBytes = Encoding.Unicode.GetBytes(sData);

//This writes the data to the file

almStream.Write(dataBytes,0,dataBytes.Length);

almStream.Close();

}

}

break;

}

}

}

7.  Insert the statement ExportAlarms (<alarmGrid Name>) in the newly created functions as shown below.

scr6

8. After completing the code, it will look like as shown below.

scr7

9. Ensure that the PC has the "List separator" as ",". Please refer the below screenshot of PC number format settings.

scr8

10. Now everything is ready. Just Build the project and then Run the HMI. Click on the export button. You will prompted to provide file path to be saved, after providing the file will be saved in CSV format.The Export function was tested for both the realtime and archived alarms.

שניידר אלקטריק ישראל

גלה עוד
טווח:
גלה עוד
טווח:
  • תיעוד מוצרים
  • בורר המוצר
  • מוצרים חלופיים והחלפה
  • מרכז עזרה ויצירת קשר
  • איתור סניפי שניידר אלקטריק
  • היכן לקנות
  • הקהילה של Schneider Electric
  • משרות
  • פרופיל חברה
  • דיווח על התנהגות בלתי הולמת
  • נגישות
  • חדר חדשות
  • משקיעים
  • EcoStruxure
  • חיפוש משימה
  • בלוג
  • מדיניות שמירה על פרטיות
  • הודעה על קובצי Cookie
  • תנאי שימוש
  • Change your cookie settings