132
Dependencies: DMSupport DMemWin
Fork of Motor_Embedded_3rd_emwin by
Revision 3:1823bfc913c1, committed 2017-07-12
- Comitter:
- Will_Lu
- Date:
- Wed Jul 12 08:20:05 2017 +0000
- Parent:
- 2:bfc676294e38
- Commit message:
- 123
Changed in this revision
--- a/Motor_Monitoring_Embedded.cpp Wed Jan 18 11:19:53 2017 +0000 +++ b/Motor_Monitoring_Embedded.cpp Wed Jul 12 08:20:05 2017 +0000 @@ -41,7 +41,7 @@ cIUR[10], cIUF[10], cTHDV[10], cVDFodd[10], cTHDI[10], cIDFodd[10], cPeakValue[10], cUBValue[10], cx_vel[10], cy_vel[10], cz_vel[10], cz_dis[10], cy_dis[10], cx_dis[10], cbk_PeakValue[10], cbk_UBValue[10], bkgPeakValue[10], bkgUBValue[10], cpCMS[10], cpH[10], cpS[10], cpR[10], cpB[10], cpE[10], - cVUR[10], cVUF[10], cVD[10], cCD[10], cBB[10]; + cVUR[10], cVUF[10], cVD[10], cCD[10], cBB[10], cVel[10], cDis[10]; double FIUR,FIUF,FTHDV,FVDFodd,FTHDI,FIDFodd,FBB,Fpeakvalue,health,stator,rotor,bearing,eccentric,FVUR,FVUF,FVD,FCD,FVel,FDis,pCMS; static int flagc = 0, flagf = 0, a0, a1; static unsigned aValues[]= {0, 0, 0, 0, 0, 0}; @@ -68,9 +68,9 @@ #define ID_WINDOW_0 (GUI_ID_USER + 0x54) #define ID_RADIO_0 (GUI_ID_USER + 0x55) -//Index_PAGE// +//Electric Index_PAGE// #define ID_FRAMEWIN_1 (GUI_ID_USER + 0x51) -#define ID_SCROLLBAR_0 (GUI_ID_USER + 0x52) + #define ID_TEXT_1 (GUI_ID_USER + 0x6A) #define ID_TEXT_22 (GUI_ID_USER + 0x6B) @@ -91,20 +91,17 @@ #define ID_TEXT_37 (GUI_ID_USER + 0x7A) #define ID_TEXT_38 (GUI_ID_USER + 0x7B) #define ID_TEXT_39 (GUI_ID_USER + 0x7C) +#define ID_TEXT_40 (GUI_ID_USER + 0x7D) //Select PAGE// #define ID_FRAMEWIN_2 (GUI_ID_USER + 0x53) -//FD PAGE// -#define ID_FRAMEWIN_7 (GUI_ID_USER + 0x5A) - -//CM PAGE// -#define ID_FRAMEWIN_8 (GUI_ID_USER + 0x5B) + //Further Analysis_PAGE// #define ID_FRAMEWIN_0 (GUI_ID_USER + 0x56) -//ISO-10816 PAGE// +//vibration index PAGE// #define ID_FRAMEWIN_3 (GUI_ID_USER + 0x57) //KeyBoard// #define ID_FRAMEWIN_4 (GUI_ID_USER + 0x58) @@ -120,6 +117,9 @@ //Further Select #define ID_FRAMEWIN_10 (GUI_ID_USER + 0x5D) + +//Electric Index_PAGE2 +#define ID_FRAMEWIN_11 (GUI_ID_USER + 0x5E) /********************************************************************* * * Static data @@ -181,33 +181,36 @@ }; static const GUI_WIDGET_CREATE_INFO _aISO10816[] = { - { FRAMEWIN_CreateIndirect, "ISO 10816-1 & NEMA MG-1", ID_FRAMEWIN_3, 0, 0, 800, 480, 0, 0x64, 0 }, - { TEXT_CreateIndirect, "Vrms (mm/s)", GUI_ID_USER + 110, 350, 20+40*1, 130 , 20}, - { TEXT_CreateIndirect, "0 ~ 0.71", GUI_ID_USER + 111, 350, 20+40*2, 130 , 20}, - { TEXT_CreateIndirect, "0.71 ~ 1.8", GUI_ID_USER + 112, 350, 20+40*3, 130 , 20}, - { TEXT_CreateIndirect, "1.8 ~ 4.5", GUI_ID_USER + 113, 350, 20+40*4, 130 , 20}, - { TEXT_CreateIndirect, "4.5 ~", GUI_ID_USER + 114, 350, 20+40*5, 130 , 20}, - { TEXT_CreateIndirect, "Good", GUI_ID_USER + 115, 560, 20+40*2, 130 , 20}, - { TEXT_CreateIndirect, "Acceptable", GUI_ID_USER + 116, 560, 20+40*3, 130 , 20}, - { TEXT_CreateIndirect, "Unsatisfactory", GUI_ID_USER + 117, 560, 20+40*4, 130 , 20}, - { TEXT_CreateIndirect, "Unacceptable", GUI_ID_USER + 118, 560, 20+40*5, 130 , 20}, - { TEXT_CreateIndirect, "Zone", GUI_ID_USER + 119, 560, 20+40*1, 130 , 20}, - { TEXT_CreateIndirect, "Class", GUI_ID_USER + 120, 420, 20+40*0, 200 , 20}, - { TEXT_CreateIndirect, "RPM", GUI_ID_USER + 121, 350, 320+40*0, 130 , 20}, - { TEXT_CreateIndirect, "1801 ~ 3600", GUI_ID_USER + 122, 350, 320+40*1, 130 , 20}, - { TEXT_CreateIndirect, "<= 1800", GUI_ID_USER + 123, 350, 320+40*2, 130 , 20}, - { TEXT_CreateIndirect, "Sp-p", GUI_ID_USER + 124, 560, 320+40*0, 130 , 20}, - { TEXT_CreateIndirect, "70 um", GUI_ID_USER + 125, 560, 320+40*1, 130 , 20}, - { TEXT_CreateIndirect, "90 um", GUI_ID_USER + 126, 560, 320+40*2, 130 , 20}, - -}; // 110 -- 126 + { FRAMEWIN_CreateIndirect, "Vibration Index", ID_FRAMEWIN_3, 0, 0, 800, 480, 0, 0x64, 0 }, + + { TEXT_CreateIndirect, "Status", ID_TEXT_1, 565, 15, 95, 40, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "Value", GUI_ID_USER + 108, 330, 15, 180, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "Threshold", GUI_ID_USER + 109, 410, 15, 180, 20, 0, 0x0, 0 }, + + { TEXT_CreateIndirect, "PeakValue_Acc", GUI_ID_USER + 110, 10, 70, 134, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "Max_Vel", GUI_ID_USER + 111, 10, 70+47*1, 270, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "Max_Dis", GUI_ID_USER + 112, 10, 70+47*2, 270, 20, 0, 0x0, 0 }, + + { TEXT_CreateIndirect, "% 5 %", GUI_ID_USER + 113, 400, 70, 90, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "mm/s 4.5 mm/s ", GUI_ID_USER + 114, 370,70+47*1, 150, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "um 90 um", GUI_ID_USER + 115, 390, 70+47*2, 110, 20, 0, 0x64, 0 }, + + { TEXT_CreateIndirect, "V_Peak", GUI_ID_USER + 116, 310, 70+47*0, 80, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "V_Vel", GUI_ID_USER + 117, 310, 70+47*1, 80, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "V_Dis", GUI_ID_USER + 118, 302, 70+47*2, 80, 20, 0, 0x64, 0 }, + + { TEXT_CreateIndirect, "A1", GUI_ID_USER + 119, 565, 70+47*0, 95, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "A2", GUI_ID_USER + 120, 565, 70+47*1, 95, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "A3", GUI_ID_USER + 121, 565, 70+47*2, 95, 20, 0, 0x64, 0 }, + +}; // 107 -- 121 static const GUI_WIDGET_CREATE_INFO _aFurtherSelect[] = { - { FRAMEWIN_CreateIndirect, "Further Select", ID_FRAMEWIN_10, 0, 0, 800, 480, 0, 0x64, 0 }, - { BUTTON_CreateIndirect, "Fuzzy", GUI_ID_USER + 82, 65 , 165, 300, 120}, + { FRAMEWIN_CreateIndirect, "Analysis", ID_FRAMEWIN_10, 0, 0, 800, 480, 0, 0x64, 0 }, + { BUTTON_CreateIndirect, "Local", GUI_ID_USER + 82, 65 , 165, 300, 120}, { BUTTON_CreateIndirect, "Remote", GUI_ID_USER + 83, 425 , 165, 300, 120}, }; static const GUI_WIDGET_CREATE_INFO _aRemoteAnalysis[] = { - { FRAMEWIN_CreateIndirect, "Further Analysis", ID_FRAMEWIN_0, 0, 0, 800, 480, 0, 0x64, 0 }, + { FRAMEWIN_CreateIndirect, "Analysis", ID_FRAMEWIN_0, 0, 0, 800, 480, 0, 0x64, 0 }, { TEXT_CreateIndirect, "Normal", GUI_ID_USER + 85, 120 , 125, 95 , 30}, { TEXT_CreateIndirect, "Caution", GUI_ID_USER + 86, 273 , 125, 95 , 30}, { TEXT_CreateIndirect, "Warning", GUI_ID_USER + 87, 425 , 125, 95 , 30}, @@ -221,7 +224,7 @@ }; static const GUI_WIDGET_CREATE_INFO _aFurtherFault[] = { - { FRAMEWIN_CreateIndirect, "Further Analysis", ID_FRAMEWIN_9, 0, 0, 800, 480, 0, 0x64, 0 }, + { FRAMEWIN_CreateIndirect, "Analysis", ID_FRAMEWIN_9, 0, 0, 800, 480, 0, 0x64, 0 }, { TEXT_CreateIndirect, "Fault Diagnosis", GUI_ID_USER + 98, 290 ,40, 300, 30}, { TEXT_CreateIndirect, "Health", GUI_ID_USER + 93, 290, 145, 100 , 30}, @@ -236,10 +239,10 @@ { BUTTON_CreateIndirect, "Get Background Value", GUI_ID_USER + 135, 0 , 105, 230, 120}, { BUTTON_CreateIndirect, "Data Acquisition", GUI_ID_USER + 136, 280, 105, 230, 120}, - { BUTTON_CreateIndirect, "Analysis (quickly)", GUI_ID_USER + 137, 560, 105, 230, 120}, + { BUTTON_CreateIndirect, "Index" , GUI_ID_USER + 137, 560, 105, 230, 120}, { BUTTON_CreateIndirect, "Send Data", GUI_ID_USER + 138, 0 , 330, 230, 120}, { BUTTON_CreateIndirect, "Get Result", GUI_ID_USER + 139, 280, 330, 230, 120}, - { BUTTON_CreateIndirect, "Analysis (further)", GUI_ID_USER + 140, 560, 330, 230, 120}, + { BUTTON_CreateIndirect, "Analysis" , GUI_ID_USER + 140, 560, 330, 230, 120}, }; // 135 -- 140 @@ -289,77 +292,85 @@ static const GUI_WIDGET_CREATE_INFO _aSelectPage[] = { - { FRAMEWIN_CreateIndirect, "Analysis Option", ID_FRAMEWIN_2, 0, 0, 800, 480, 0, 0x64, 0 }, - { BUTTON_CreateIndirect, "Condition Monitoring", GUI_ID_USER + 37, 425, 165, 300, 120}, - { BUTTON_CreateIndirect, "Fault Diagnosis", GUI_ID_USER + 36, 65, 165, 300, 120}, + { FRAMEWIN_CreateIndirect, "Index Option" , ID_FRAMEWIN_2, 0, 0, 800, 480, 0, 0x64, 0 }, + { BUTTON_CreateIndirect, "Vibration", GUI_ID_USER + 37, 425, 165, 300, 120}, + { BUTTON_CreateIndirect, "Electrical", GUI_ID_USER + 36, 65, 165, 300, 120}, }; ///// GUI_ID_USER 36,37 ////// -static const GUI_WIDGET_CREATE_INFO _aFDPage[] = { - { FRAMEWIN_CreateIndirect, "", ID_FRAMEWIN_2, 0, 0, 800, 480, 0, 0x64, 0 }, - { BUTTON_CreateIndirect, "Fault Diagnosis Index", GUI_ID_USER + 38, 490, 370, 290, 70}, - { TEXT_CreateIndirect, "Health", GUI_ID_USER + 39, 50 , 165, 95 , 20}, - { TEXT_CreateIndirect, "Stator", GUI_ID_USER + 40, 200, 165, 95 , 20}, - { TEXT_CreateIndirect, "Rotor", GUI_ID_USER + 41, 350, 165, 95 , 20}, - { TEXT_CreateIndirect, "Bearing", GUI_ID_USER + 42, 500, 165, 95 , 20}, - { TEXT_CreateIndirect, "Eccentric", GUI_ID_USER + 43, 650, 165, 100 , 20}, - { TEXT_CreateIndirect, "Fault Diagnosis", GUI_ID_USER + 44, 250, 40, 300, 30}, -}; ///// GUI_ID_USER 38 - 44 ////// - -static const GUI_WIDGET_CREATE_INFO _aCMPage[] = { - { FRAMEWIN_CreateIndirect, "", ID_FRAMEWIN_2, 0, 0, 800, 480, 0, 0x64, 0 }, - { BUTTON_CreateIndirect, "Condition Monitoring Index", GUI_ID_USER + 45, 490, 370, 290, 70}, - { TEXT_CreateIndirect, "Normal", GUI_ID_USER + 46, 45 , 135, 95 , 20}, - { TEXT_CreateIndirect, "Caution", GUI_ID_USER + 47, 245 , 135, 95 , 20}, - { TEXT_CreateIndirect, "Warning", GUI_ID_USER + 48, 445 , 135, 95 , 20}, - { TEXT_CreateIndirect, "Danger", GUI_ID_USER + 49, 645 , 135, 95 , 20}, - { TEXT_CreateIndirect, "Condition Monitoring", GUI_ID_USER + 50, 250 , 40, 300, 30}, -}; ///// GUI_ID_USER 45 - 50 ////// - + +static const GUI_WIDGET_CREATE_INFO _aIndexPage2[] = { + { FRAMEWIN_CreateIndirect, "Electrical Index", ID_FRAMEWIN_11, 0, 0, 800, 480, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "Status", ID_TEXT_1, 565, 15, 95, 40, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "Value", GUI_ID_USER + 35, 330, 15, 180, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "Threshold", GUI_ID_USER + 36, 410, 15, 180, 20, 0, 0x0, 0 }, + + { TEXT_CreateIndirect, "Current THD", GUI_ID_USER + 37, 10, 70, 134, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "Max Current Odd HD ( < 11th )", GUI_ID_USER + 38, 10, 70+47*1, 270, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "Side Band", GUI_ID_USER + 39, 10, 70+47*2, 270, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "Voltage Deviation", GUI_ID_USER + 49, 10, 70+47*3, 270, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "Current Deviation", GUI_ID_USER + 50, 10, 70+47*4, 270, 20, 0, 0x0, 0 }, + + { TEXT_CreateIndirect, "% 5 %", GUI_ID_USER + 40, 410, 70, 90, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "% 4 %", GUI_ID_USER + 41, 410, 70+47*1, 90, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "dB -40 dB", GUI_ID_USER + 42, 400, 70+47*2,100, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "% 10 %", GUI_ID_USER + 51, 410, 70+47*3, 90, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "% 10 %", GUI_ID_USER + 52, 410, 70+47*4,90, 20, 0, 0x64, 0 }, + + { TEXT_CreateIndirect, "V_THDI", GUI_ID_USER + 43, 330, 70+47*0, 80, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "V_IDFodd", GUI_ID_USER + 44, 330, 70+47*1, 80, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "V_BB", GUI_ID_USER + 45, 315, 70+47*2, 80, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "V_VD", GUI_ID_USER + 53, 330, 70+47*3, 80, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "V_CD", GUI_ID_USER + 54, 330, 70+47*4, 80, 20, 0, 0x0, 0 }, + + { TEXT_CreateIndirect, "S5", GUI_ID_USER + 46, 565, 70+47*0, 95, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "S6", GUI_ID_USER + 47, 565, 70+47*1, 95, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "S9", GUI_ID_USER + 48, 565, 70+47*2, 95, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "S10", GUI_ID_USER + 55, 565, 70+47*3, 95, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "S11", GUI_ID_USER + 56, 565, 70+47*4, 95, 20, 0, 0x64, 0 }, + +};///// GUI_ID_USER 34 -- 56 ////// static const GUI_WIDGET_CREATE_INFO _aIndexPage[] = { - { FRAMEWIN_CreateIndirect, "Index", ID_FRAMEWIN_1, 0, 0, 800, 480, 0, 0x64, 0 }, + { FRAMEWIN_CreateIndirect, "Electrical Index", ID_FRAMEWIN_1, 0, 0, 800, 480, 0, 0x64, 0 }, { TEXT_CreateIndirect, "Status", ID_TEXT_1, 565, 15, 95, 40, 0, 0x0, 0 }, - { TEXT_CreateIndirect, "Value", GUI_ID_USER + 59, 330, 15, 180, 20, 0, 0x0, 0 }, - { TEXT_CreateIndirect, "(Threshold)", GUI_ID_USER + 60, 410, 15, 180, 20, 0, 0x0, 0 }, - { TEXT_CreateIndirect, "Peak Value", GUI_ID_USER + 61, 10, 70+47*0, 180, 20, 0, 0x0, 0 }, -// { TEXT_CreateIndirect, "UB Value of Histogram", GUI_ID_USER + 62, 10, 70+47*1, 230, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "Threshold", GUI_ID_USER + 60, 410, 15, 180, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "Voltage Unbalance", GUI_ID_USER + 61, 10, 70+47*0, 180, 20, 0, 0x0, 0 }, + { TEXT_CreateIndirect, "Voltage Unbalance Factor", GUI_ID_USER + 62, 10, 70+47*1, 230, 20, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Voltage THD", GUI_ID_USER + 63, 10, 70+47*4, 134, 20, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Max Voltage Odd HD ( < 11th )", GUI_ID_USER + 64, 10, 70+47*5, 270, 20, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Current Unbalance", GUI_ID_USER + 65, 10, 70+47*2, 180, 20, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Current Unbalance Factor", GUI_ID_USER + 66, 10, 70+47*3, 230, 20, 0, 0x0, 0 }, - { TEXT_CreateIndirect, "Current THD", GUI_ID_USER + 67, 10, 70+47*6, 134, 20, 0, 0x0, 0 }, - { TEXT_CreateIndirect, "Max Current Odd HD ( < 11th )", GUI_ID_USER + 68, 10, 70+47*7, 270, 20, 0, 0x0, 0 }, - - { TEXT_CreateIndirect, "%\x20(10)", GUI_ID_USER + 69, 410, 70+47*2, 90, 20, 0, 0x64, 0 }, - { TEXT_CreateIndirect, "%\x20(2.5)", GUI_ID_USER + 70, 410, 70+47*3, 90, 20, 0, 0x64, 0 }, - { TEXT_CreateIndirect, "%\x20(5)", GUI_ID_USER + 71, 410, 70+47*4, 90, 20, 0, 0x64, 0 }, - { TEXT_CreateIndirect, "%\x20(3)", GUI_ID_USER + 72, 410, 70+47*5, 90, 20, 0, 0x64, 0 }, - { TEXT_CreateIndirect, "%\x20(5)", GUI_ID_USER + 73, 410, 70+47*6, 90, 20, 0, 0x64, 0 }, - { TEXT_CreateIndirect, "%\x20(4)", GUI_ID_USER + 74, 410, 70+47*7, 90, 20, 0, 0x64, 0 }, - { TEXT_CreateIndirect, cbk_PeakValue, GUI_ID_USER + 75, 427, 70+47*0, 90, 20, 0, 0x64, 0 }, -// { TEXT_CreateIndirect, cbk_UBValue, GUI_ID_USER + 76, 427, 70+47*1, 90, 20, 0, 0x64, 0 }, - + { BUTTON_CreateIndirect, "Next Page", GUI_ID_USER + 73, 550 , 350, 230, 80}, + + + + { TEXT_CreateIndirect, "% 10 %", GUI_ID_USER + 67, 410, 70+47*2, 90, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "% 2.5 %", GUI_ID_USER + 68, 410, 70+47*3, 90, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "% 5 %", GUI_ID_USER + 69, 410, 70+47*4, 90, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "% 3 %", GUI_ID_USER + 70, 410, 70+47*5, 90, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "% 5 %", GUI_ID_USER + 71, 410, 70+47*0, 90, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "% 1 %", GUI_ID_USER + 72, 410, 70+47*1, 90, 20, 0, 0x64, 0 }, + + { TEXT_CreateIndirect, "V_THDV", ID_TEXT_22, 330, 70+47*4, 80, 20, 0, 0x0, 0 }, /// 330 { TEXT_CreateIndirect, "V_VDFodd", ID_TEXT_23, 330, 70+47*5, 80, 20, 0, 0x0, 0 }, { TEXT_CreateIndirect, "V_IUR", ID_TEXT_24, 330, 70+47*2, 80, 20, 0, 0x0, 0 }, { TEXT_CreateIndirect, "V_IUF", ID_TEXT_25, 330, 70+47*3, 80, 20, 0, 0x0, 0 }, - { TEXT_CreateIndirect, "V_THDI", ID_TEXT_27, 330, 70+47*6, 80, 20, 0, 0x0, 0 }, - { TEXT_CreateIndirect, "V_IDFodd", ID_TEXT_28, 330, 70+47*7, 80, 20, 0, 0x0, 0 }, - { TEXT_CreateIndirect, "V_Peakvalue", ID_TEXT_29, 330, 70+47*0, 80, 20, 0, 0x64, 0 }, -// { TEXT_CreateIndirect, "V_UBvalue", ID_TEXT_30, 300, 70+47*1, 80, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "V_VUR", ID_TEXT_29, 330, 70+47*0, 80, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "V_VUF", ID_TEXT_30, 330, 70+47*1, 80, 20, 0, 0x64, 0 }, + { TEXT_CreateIndirect, "S1", ID_TEXT_32, 565, 70+47*4, 95, 20, 0, 0x64, 0 }, { TEXT_CreateIndirect, "S2", ID_TEXT_33, 565, 70+47*5, 95, 20, 0, 0x64, 0 }, { TEXT_CreateIndirect, "S3", ID_TEXT_34, 565, 70+47*2, 95, 20, 0, 0x64, 0 }, { TEXT_CreateIndirect, "S4", ID_TEXT_35, 565, 70+47*3, 95, 20, 0, 0x64, 0 }, - { TEXT_CreateIndirect, "S5", ID_TEXT_36, 565, 70+47*6, 95, 20, 0, 0x64, 0 }, - { TEXT_CreateIndirect, "S6", ID_TEXT_37, 565, 70+47*7, 95, 20, 0, 0x64, 0 }, { TEXT_CreateIndirect, "S7", ID_TEXT_38, 565, 70+47*0, 95, 20, 0, 0x64, 0 }, -// { TEXT_CreateIndirect, "S8", ID_TEXT_39, 565, 70+47*1, 95, 20, 0, 0x64, 0 }, - -};///// GUI_ID_USER 59 -- 76 ////// + { TEXT_CreateIndirect, "S8", ID_TEXT_39, 565, 70+47*1, 95, 20, 0, 0x64, 0 }, + + +};///// GUI_ID_USER 59 -- 73 ////// void fileName(time_t time, char* name, int type); void fileName(time_t time, char* name) @@ -1079,8 +1090,8 @@ } } -//------------------------------------------------- Index顯示頁面 ------------------------------------------------------------------------------------------------------------------------------// -static void _cbIndexPage(WM_MESSAGE * pMsg) +//------------------------------------------------- E_Index2顯示頁面 ------------------------------------------------------------------------------------------------------------------------------// +static void _cbIndexPage2(WM_MESSAGE * pMsg) { WM_HWIN hItem, hmate; int i; @@ -1093,15 +1104,162 @@ FRAMEWIN_SetClientColor(pMsg->hWin, 0xD5D5D5); hmate = WM_GetClientWindow(pMsg->hWin); - _hScroll = SCROLLBAR_CreateAttached(hmate, SCROLLBAR_CF_VERTICAL); - SCROLLBAR_SetNumItems(_hScroll, 640); - SCROLLBAR_SetPageSize(_hScroll, 500); - SCROLLBAR_SetValue (_hScroll, 0); - - for(i=59 ; i<77 ; i++) { + + + for(i=35 ; i<57 ; i++) { hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + i); TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); + } + + + // + // Initialization of 'Status' + // + hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); + TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_TOP); + + + // + // Initialization of 'V_THDI' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 43); + TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); + if( atof(cTHDI) > 5.0) { + TEXT_SetTextColor(hItem, 0x0000FF); + } + TEXT_SetText(hItem, cTHDI); + + // + // Initialization of 'V_IDFodd' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 44); + TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); + if( atof(cIDFodd) > 4.0) { + TEXT_SetTextColor(hItem, 0x0000FF); + } + TEXT_SetText(hItem, cIDFodd); + // + // Initialization of 'V_BB' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 45); + TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); + if( atof(cBB) > -40.0) { + TEXT_SetTextColor(hItem, 0x0000FF); + } + TEXT_SetText(hItem, cBB); + // + // Initialization of 'V_VD' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 53); + TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); + if( atof(cVD) > 10.0) { + TEXT_SetTextColor(hItem, 0x0000FF); + } + TEXT_SetText(hItem, cVD); + // + // Initialization of 'V_CD' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 54); + TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); + if( atof(cCD) > 10.0) { + TEXT_SetTextColor(hItem, 0x0000FF); + } + TEXT_SetText(hItem, cCD); + + // + // Initialization of 'Status of THDI' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 46); + TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); + if( atof(cTHDI) > 5.0) { + TEXT_SetTextColor(hItem, 0x0000FF); + TEXT_SetText(hItem, "Abnormal"); + } else { + TEXT_SetText(hItem, "Normal"); + } + // + // Initialization of 'Status of IDFodd' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 47); + TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); + if( atof(cIDFodd) > 4.0) { + TEXT_SetTextColor(hItem, 0x0000FF); + TEXT_SetText(hItem, "Abnormal"); + } else { + TEXT_SetText(hItem, "Normal"); + } + // + // Initialization of 'Status of BB' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 48); + TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); + if( atof(cBB) > -40.0) { + TEXT_SetTextColor(hItem, 0x0000FF); + TEXT_SetText(hItem, "Abnormal"); + } else { + TEXT_SetText(hItem, "Normal"); + } + // + // Initialization of 'Status of VD' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 55); + TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); + if( atof(cVD) > 10.0) { + TEXT_SetTextColor(hItem, 0x0000FF); + TEXT_SetText(hItem, "Abnormal"); + } else { + TEXT_SetText(hItem, "Normal"); + } + // + // Initialization of 'Status of CD' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 56); + TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); + if( atof(cCD) > 10.0) { + TEXT_SetTextColor(hItem, 0x0000FF); + TEXT_SetText(hItem, "Abnormal"); + } else { + TEXT_SetText(hItem, "Normal"); + } + + + default: + WM_DefaultProc(pMsg); + } +} + + + + +//------------------------------------------------- E_Index顯示頁面 ------------------------------------------------------------------------------------------------------------------------------// +static void _cbIndexPage(WM_MESSAGE * pMsg) +{ + WM_HWIN hItem, hmate; + int i,Id,NCode; + WM_HWIN hWin = pMsg->hWin; + + switch (pMsg->MsgId) { + case WM_INIT_DIALOG: + + FRAMEWIN_AddCloseButton(pMsg->hWin, FRAMEWIN_BUTTON_RIGHT, 0); + FRAMEWIN_SetActive(pMsg->hWin, 1); + FRAMEWIN_SetClientColor(pMsg->hWin, 0xD5D5D5); + + hmate = WM_GetClientWindow(pMsg->hWin); + + + for(i=59 ; i<74 ; i++) { + if(i==73){ + hItem = WM_GetDialogItem(hWin, GUI_ID_USER + i); + BUTTON_SetFocussable(hItem, 0); + } + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + i); + TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); + + } + + // // Initialization of 'Status' @@ -1167,24 +1325,34 @@ TEXT_SetText(hItem, cIDFodd); // - // Initialization of 'V_PeakValue' + // Initialization of 'V_VUR' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_29); TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); - if( atof(cPeakValue) > atof(bkgPeakValue)) { //// Threshold not sure + if( atof(cVUR) > 5) { //// Threshold not sure TEXT_SetTextColor(hItem, 0x0000FF); } - TEXT_SetText(hItem, cPeakValue); + TEXT_SetText(hItem, cVUR); // - // Initialization of 'V_UBValue' + // Initialization of 'V_VUF' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_30); TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); - if( atof(cUBValue) > atof(bkgUBValue)) { //// Threshold not sure + if( atof(cVUF) > 1) { //// Threshold not sure TEXT_SetTextColor(hItem, 0x0000FF); } - TEXT_SetText(hItem, cUBValue); + TEXT_SetText(hItem, cVUF); + + // + // Initialization of 'V_BB' + // + hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_31); + TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); + if( atof(cBB) > -40) { //// Threshold not sure + TEXT_SetTextColor(hItem, 0x0000FF); + } + TEXT_SetText(hItem, cBB); // // Initialization of 'Status of THDV' @@ -1261,13 +1429,11 @@ // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_38); TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); - if( atof(cPeakValue) > atof(bkgPeakValue)) { + if( atof(cVUR) > 5) { TEXT_SetTextColor(hItem, 0x0000FF); - TEXT_SetText(hItem, "Group 2"); - } else if(atof(cPeakValue) == 0.0) { - TEXT_SetText(hItem, ""); + TEXT_SetText(hItem, "Abnormal"); } else { - TEXT_SetText(hItem, "Group 1"); + TEXT_SetText(hItem, "Normal"); } // @@ -1275,15 +1441,41 @@ // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_39); TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); - if( atof(cUBValue) > atof(bkgUBValue)) { + if( atof(cVUF) > 1) { + TEXT_SetTextColor(hItem, 0x0000FF); + TEXT_SetText(hItem, "Abnormal"); + } else { + TEXT_SetText(hItem, "Normal"); + } + + // + // Initialization of 'Status of BB' + // + hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_40); + TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); + if( atof(cBB) > -40) { TEXT_SetTextColor(hItem, 0x0000FF); - TEXT_SetText(hItem, "Group 2"); - } else if(atof(cUBValue) == 0.0) { - TEXT_SetText(hItem, ""); + TEXT_SetText(hItem, "Abnormal"); } else { - TEXT_SetText(hItem, "Group 1"); + TEXT_SetText(hItem, "Normal"); } - + break; + + case WM_NOTIFY_PARENT: + Id = WM_GetId(pMsg->hWinSrc); + NCode = pMsg->Data.v; + switch(Id) { + + case GUI_ID_USER + 73: // button 'Next Page' // + switch(NCode) { + case WM_NOTIFICATION_RELEASED: + + hItem = GUI_CreateDialogBox(_aIndexPage2, GUI_COUNTOF(_aIndexPage2), _cbIndexPage2, WM_HBKWIN, 0, 0); + + break; + } + break; + } break; default: @@ -1294,139 +1486,104 @@ -//------------------------------------------------------------ISO 10816-1 & NEMA MG-1 PAGE----------------------------------------------------------------------------------------------------------// + +//------------------------------------------------------------V_Index PAGE----------------------------------------------------------------------------------------------------------// static void _cbISO10816(WM_MESSAGE * pMsg) { - WM_HWIN hItem; - - int i, xSize, ySize; - - - WM_HWIN hWin = pMsg->hWin; + WM_HWIN hItem, hmate; + int i; switch (pMsg->MsgId) { - case WM_INIT_DIALOG: - WM_Paint(hWin); - FRAMEWIN_SetActive(hWin, 1); - FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0); - - int hp = atoi(HP); - - switch(hp) { - case 0 ... 20: // ISO 10816 Class I - - for(i=110 ; i<127 ; i++) { - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + i); - TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); - } - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + 111); - TEXT_SetText(hItem, "0 ~ 0.71"); - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + 112); - TEXT_SetText(hItem, "0.71 ~ 1.8"); - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + 113); - TEXT_SetText(hItem, "1.8 ~ 4.5"); - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + 114); - TEXT_SetText(hItem, "4.5 ~"); - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + 119); - TEXT_SetText(hItem, "Zone"); - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + 120); - TEXT_SetText(hItem, "Class I : < 15 KW"); - - - - break; - - case 21 ... 100: // ISO 10816 Class II - - for(i=110 ; i<127 ; i++) { - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + i); - TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); - } - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + 111); - TEXT_SetText(hItem, "0 ~ 1.12"); - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + 112); - TEXT_SetText(hItem, "1.12 ~ 2.8"); - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + 113); - TEXT_SetText(hItem, "2.8 ~ 7.1"); - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + 114); - TEXT_SetText(hItem, "7.1 ~"); - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + 119); - TEXT_SetText(hItem, "Zone"); - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + 120); - TEXT_SetText(hItem, "Class II : 15 ~ 75 KW"); - - - break; + FRAMEWIN_AddCloseButton(pMsg->hWin, FRAMEWIN_BUTTON_RIGHT, 0); + FRAMEWIN_SetActive(pMsg->hWin, 1); + FRAMEWIN_SetClientColor(pMsg->hWin, 0xD5D5D5); + + hmate = WM_GetClientWindow(pMsg->hWin); + + + for(i=107 ; i<122 ; i++) { + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + i); + TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); + + } + + + // + // Initialization of 'Status' + // + hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); + TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_TOP); + + + // + // Initialization of 'V_Peak' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 116); + TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); + if( atof(cPeakValue) > 5.0) { + TEXT_SetTextColor(hItem, 0x0000FF); + } + TEXT_SetText(hItem, cPeakValue); + + // + // Initialization of 'Max_Vel' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 117); + TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); + if( atof(cVel) > 4.5) { + TEXT_SetTextColor(hItem, 0x0000FF); } - break; - - case WM_PAINT: - - xSize = LCD_GetXSize(); - ySize = LCD_GetYSize(); - GUI_DrawGradientV(0,0,xSize,ySize,0xE6E0B0,0x90EE90); - - GUI_SetColor(0x00D7FF); - GUI_FillRect(311,11,729,89); - - GUI_SetColor(0xFFBBFF); - GUI_FillRect(311,91,729,249); - - GUI_SetColor(0x4FA5FF); - GUI_FillRect(311,311,729,349); - - GUI_SetColor(0xB5B5B5); - GUI_FillRect(311,351,729,429); - - GUI_SetColor(GUI_BLACK); - - for(i=0 ; i<7 ; i++) { - GUI_DrawHLine( 10+40*i,310,730); - if(i<4) - GUI_DrawHLine(310+40*i,310,730); + TEXT_SetText(hItem, cVel); + // + // Initialization of 'Max_Dis' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 118); + TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); + if( atof(cDis) > 90.0) { + TEXT_SetTextColor(hItem, 0x0000FF); + } + TEXT_SetText(hItem, cDis); + + // + // Initialization of 'Status of V_peak' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 119); + TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); + if( atof(cPeakValue) > 5.0) { + TEXT_SetTextColor(hItem, 0x0000FF); + TEXT_SetText(hItem, "Abnormal"); + } else { + TEXT_SetText(hItem, "Normal"); } - for(i=0 ; i<3 ; i++) { - GUI_DrawVLine(310+210*i, 310, 430); - if(i<2) - GUI_DrawVLine(310+420*i, 10, 250); + // + // Initialization of 'Status of Max_Vel' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 120); + TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); + if( atof(cVel) > 4.5) { + TEXT_SetTextColor(hItem, 0x0000FF); + TEXT_SetText(hItem, "Abnormal"); + } else { + TEXT_SetText(hItem, "Normal"); } - GUI_DrawVLine(520, 50, 250); - - - - GUI_SetTextMode(GUI_TEXTMODE_TRANS); - GUI_SetFont(GUI_FONT_32B_ASCII); - GUI_DispStringAt("Vel. RMS (mm/s)", 0, 10); - GUI_DispStringAt("Dis. Peak to Peak (um)" , 0, 290); - - GUI_SetFont(GUI_FONT_20B_ASCII); - GUI_DispStringAt("X =", 30, 65); - GUI_DispStringAt(cx_vel, 70, 65); - - GUI_DispStringAt("Y =", 30, 90); - GUI_DispStringAt(cy_vel, 70, 90); - - GUI_DispStringAt("Z =", 30, 115); - GUI_DispStringAt(cz_vel, 70, 115); - - GUI_DispStringAt("X =", 30, 345); - GUI_DispStringAt(cx_dis, 70, 345); - - GUI_DispStringAt("Y =", 30, 370); - GUI_DispStringAt(cy_dis, 70, 370); - - GUI_DispStringAt("Z =", 30, 395); - GUI_DispStringAt(cz_dis, 70, 395); - - break; + // + // Initialization of 'Status of Max_Dis' + // + hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_USER + 121); + TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); + if( atof(cDis) > 90.0) { + TEXT_SetTextColor(hItem, 0x0000FF); + TEXT_SetText(hItem, "Abnormal"); + } else { + TEXT_SetText(hItem, "Normal"); + } default: WM_DefaultProc(pMsg); - } } //---------------------------------------------- Further Fault 頁面---------------------------------------------------------------// @@ -1543,7 +1700,7 @@ NCode = pMsg->Data.v; switch(Id) { - case GUI_ID_USER + 84: // button 'Further Fault' // + case GUI_ID_USER + 84: // button 'FurtherFault' // switch(NCode) { case WM_NOTIFICATION_RELEASED: @@ -1600,7 +1757,7 @@ math.Fuzzy_Fault(FIUR,FIUF,FTHDV,FVDFodd,FTHDI,FIDFodd,FBB,Fpeakvalue,&health,&stator,&rotor,&bearing,&eccentric); - math.Fuzzy_Condition(FVUR,FIUR,FVUF,FIUF,FTHDV,FVDFodd,FTHDI,FIDFodd,FVD,FCD,FVel,FDis,&pCMS); + math.Fuzzy_Condition(FVUR,FIUR,FVUF,FIUF,FVD,FCD,FVel,FDis,&pCMS); snprintf(cpH, 10, "%.2f", health); snprintf(cpS, 10, "%.2f", stator); snprintf(cpR, 10, "%.2f", rotor); @@ -1633,200 +1790,6 @@ //---------------------------------------------- Analysis 分析、亮燈頁面 ------------------------------------------------------------------------------------------------------------------------------// -static void _cbFDPage(WM_MESSAGE * pMsg) -{ - WM_HWIN hItem; - int NCode; - int Id, i; - - WM_HWIN hWin = pMsg->hWin; - - switch (pMsg->MsgId) { - case WM_INIT_DIALOG: - - WM_Paint(hWin); - FRAMEWIN_SetActive(hWin, 1); - FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0); - FRAMEWIN_SetClientColor(hWin, 0xD5D5D5); - - for(i=38 ; i<45 ; i++) { - if(i<39) { - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + i); - BUTTON_SetFocussable(hItem, 0);// Set all buttons non focussable // - } else { - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + i); - TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); - if(i>43) { - TEXT_SetFont(hItem, GUI_FONT_32B_ASCII); - } - } - } - break; - case WM_PAINT: - - GUI_SetColor(GUI_DARKGRAY); - GUI_SetPenSize(2); - GUI_DrawLine(5, 55, 285, 55); - GUI_DrawLine(515, 55, 785, 55); - GUI_DrawLine(5, 445, 785, 445); - GUI_DrawLine(5, 55, 5, 445); - GUI_DrawLine(785, 55, 785, 445); - - GUI_SetColor(GUI_BLACK); - for(i=0 ; i<5 ; i++) { - GUI_DrawCircle(95 + 150*i , 260, 50); /// Health /// Stator /// Rotor /// Bearing - } - - switch(flagf) { - case 1: - GUI_SetColor(GUI_GREEN); - GUI_FillCircle(95 , 260, 49); /// Health - break; - - case 2: - GUI_SetColor(GUI_RED); - GUI_FillCircle(245, 260, 49); /// Stator - break; - - case 3: - GUI_SetColor(GUI_RED); - GUI_FillCircle(395, 260, 49); /// Rotor - break; - - case 4: - GUI_SetColor(GUI_RED); - GUI_FillCircle(545, 260, 49); /// Bearing - break; - - case 5: - GUI_SetColor(GUI_RED); - GUI_FillCircle(695, 260, 49); /// Eccentric - break; - - case 6: - GUI_SetColor(GUI_YELLOW); - GUI_FillCircle(245, 260, 49); /// Stator - GUI_FillCircle(395, 260, 49); /// Rotor - break; - - case 7: - GUI_SetColor(GUI_YELLOW); - GUI_FillCircle(545, 260, 49); /// Bearing - GUI_FillCircle(695, 260, 49); /// Eccentric - break; - } - break; - - case WM_NOTIFY_PARENT: - Id = WM_GetId(pMsg->hWinSrc); - NCode = pMsg->Data.v; - switch(Id) { - - case GUI_ID_USER + 38: // button 'FD Index' // - switch(NCode) { - case WM_NOTIFICATION_RELEASED: - - hItem = GUI_CreateDialogBox(_aIndexPage, GUI_COUNTOF(_aIndexPage), _cbIndexPage, WM_HBKWIN, 0, 0); - - break; - } - break; - } - break; - default: - WM_DefaultProc(pMsg); - } -} - -static void _cbCMPage(WM_MESSAGE * pMsg) -{ - WM_HWIN hItem; - int NCode; - int Id, i; - - WM_HWIN hWin = pMsg->hWin; - - switch (pMsg->MsgId) { - case WM_INIT_DIALOG: - - WM_Paint(hWin); - FRAMEWIN_SetActive(hWin, 1); - FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0); - FRAMEWIN_SetClientColor(hWin, 0xD5D5D5); - - for(i=45 ; i<51 ; i++) { - if(i<46) { - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + i); - BUTTON_SetFocussable(hItem, 0);// Set all buttons non focussable // - } else { - hItem = WM_GetDialogItem(hWin, GUI_ID_USER + i); - TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); - if(i>49) { - TEXT_SetFont(hItem, GUI_FONT_32B_ASCII); - } - } - } - break; - case WM_PAINT: - - GUI_SetColor(GUI_DARKGRAY); - GUI_SetPenSize(2); - GUI_DrawLine(5, 55, 245, 55); - GUI_DrawLine(555, 55, 785, 55); - GUI_DrawLine(5, 445, 785, 445); - GUI_DrawLine(5, 55, 5, 445); - GUI_DrawLine(785, 55, 785, 445); - - - GUI_SetColor(GUI_BLACK); - for(i=0 ; i<4 ; i++) { - GUI_DrawCircle(95 + 200*i , 240, 60); /// Normal /// Caution /// Warning /// Danger - } - - switch(flagc) { - case 1: - GUI_SetColor(GUI_GREEN); - GUI_FillCircle(95, 240, 59); /// Normal - break; - - case 2: - GUI_SetColor(GUI_YELLOW); - GUI_FillCircle(295, 240, 59); /// Caution - break; - - case 3: - GUI_SetColor(0x0095ff); /// color of orange - GUI_FillCircle(495, 240, 59); /// Warning - break; - - case 4: - GUI_SetColor(GUI_RED); - GUI_FillCircle(695, 240, 59); /// Danger - break; - } - break; - - case WM_NOTIFY_PARENT: - Id = WM_GetId(pMsg->hWinSrc); - NCode = pMsg->Data.v; - switch(Id) { - - case GUI_ID_USER + 45: // button 'CMS Index' // - switch(NCode) { - case WM_NOTIFICATION_RELEASED: - - hItem = GUI_CreateDialogBox(_aISO10816, GUI_COUNTOF(_aISO10816), _cbISO10816, WM_HBKWIN, 0, 0); - - break; - } - break; - } - break; - default: - WM_DefaultProc(pMsg); - } -} - static void _cbSelectPage(WM_MESSAGE * pMsg) { @@ -1861,21 +1824,21 @@ NCode = pMsg->Data.v; switch(Id) { - case GUI_ID_USER + 36: // button 'FD Page' // + case GUI_ID_USER + 36: // button 'eletric index' // switch(NCode) { case WM_NOTIFICATION_RELEASED: - hItem = GUI_CreateDialogBox(_aFDPage, GUI_COUNTOF(_aFDPage), _cbFDPage, WM_HBKWIN, 0, 0); + hItem = GUI_CreateDialogBox(_aIndexPage, GUI_COUNTOF(_aIndexPage), _cbIndexPage, WM_HBKWIN, 0, 0); break; } break; - case GUI_ID_USER + 37: // button 'CM Page' // + case GUI_ID_USER + 37: // button 'vibration' // switch(NCode) { case WM_NOTIFICATION_RELEASED: - hItem = GUI_CreateDialogBox(_aCMPage, GUI_COUNTOF(_aCMPage), _cbCMPage, WM_HBKWIN, 0, 0); + hItem = GUI_CreateDialogBox(_aISO10816, GUI_COUNTOF(_aISO10816), _cbISO10816, WM_HBKWIN, 0, 0); break; } @@ -2091,129 +2054,14 @@ } Index_operation(e , v, file.timestamp, &IUR, &IUF, &THDV, &VDFodd, &THDI, &IDFodd, &PeakValue, &UBValue, &x_vel, &y_vel, &z_vel, &z_dis, &y_dis, &x_dis, &VUR, &VUF, &VD, &CD, &BB); + + // THDI = 3.5263 ; ///// 神奇海螺 // IDFodd = 3.2294 ; ///// 神奇海螺 FIUR=IUR;FIUF=IUF;FTHDV=THDV;FVDFodd=VDFodd;FTHDI=THDI;FIDFodd=IDFodd;FBB=BB;Fpeakvalue=PeakValue;FVUR=VUR;FVUF=VUF;FVD=VD;FCD=CD; - if(PeakValue > bkvvPeakValue || UBValue > bkvvUBValue ) { - group = 2 ; - } else { - group = 1 ; - } - - switch(group) { - - case 1 : //// group 1 ( H / S / R ) - if((IUF > 2.5 || IUR > 10)&&(IDFodd > 4 || THDI > 5 || VDFodd > 3 || THDV > 5)) { - - flagf = 6; //// flagf 6 ( S & R can't distinguish ) - } else if(IUF > 2.5 || IUR > 10) { - - flagf = 2; - } else if(IDFodd > 4 || THDI > 5 || VDFodd > 3 || THDV > 5) { - - flagf = 3; - } else { - - flagf = 1; - } - break; - - case 2 : //// group 2 ( B / E ) - if((IUF > 2.5 || IUR > 10)&&(IDFodd > 4 || THDI > 5 || VDFodd > 3 || THDV > 5)) { - - flagf = 7; //// flagf 7 ( S & R can't distinguish ) - } else if(IUF > 2.5 || IUR > 10) { - - flagf = 5; - } else if(IDFodd > 4 || THDI > 5 || VDFodd > 3 || THDV > 5) { - - flagf = 4; - } else { - - flagf = 7; //// flagf 7 ( S & R can't distinguish ) - } - - break; - } - - int hp = atoi(HP); - - switch(hp) { - case 0 ... 20: // ISO 10816 Class I - if((x_vel) > 4.5 || (y_vel) > 4.5 || (z_vel) > 4.5) { - flagiso = 4; - } else if((x_vel) > 1.8 || (y_vel) > 1.8 || (z_vel) > 1.8) { - flagiso = 3; - } else if((x_vel) > 0.71 || (y_vel) > 0.71 || (z_vel) > 0.71) { - flagiso = 2; - } else { - flagiso = 1; - } - break; - case 21 ... 100: // ISO 10816 Class II - if((x_vel) > 7.1 || (y_vel) > 7.1 || (z_vel) > 7.1) { - flagiso = 4; - } else if((x_vel) > 2.8 || (y_vel) > 2.8 || (z_vel) > 2.8) { - flagiso = 3; - } else if((x_vel) > 1.12 || (y_vel) > 1.12 || (z_vel) > 1.12) { - flagiso = 2; - } else { - flagiso = 1; - } - - break; - } - - - int rpm = atoi(RPM); - - switch(rpm) { - case 0 ... 1800: // NEMA MG-1 Case 1 - if(x_dis > 90.0 || y_dis > 90.0 || z_dis > 90.0) { - flagnema = 2; - } else { - flagnema = 1; - } - break; - case 1801 ... 3600: // NEMA MG-1 Case 2 // (x_dis) > 70 || (y_dis) > 70 || (z_dis) > 70 - if(x_dis > 70.0 || y_dis > 70.0 || z_dis > 70.0) { - flagnema = 2; - } else { - flagnema = 1; - } - break; - } - - - switch(flagiso) { - case 1 : - flagc = 1; - if(flagnema == 2) { - flagc = 4; - } - break; - case 2 : - flagc = 2; - if(flagnema == 2) { - flagc = 4; - } - break; - case 3 : - flagc = 3; - if(flagnema == 2) { - flagc = 4; - } - break; - case 4 : - flagc = 4; - if(flagnema == 2) { - flagc = 4; - } - break; - } - + snprintf(cIUR, 10, "%.4f", IUR); snprintf(cVUR, 10, "%.4f", VUR); @@ -2228,6 +2076,8 @@ snprintf(cIDFodd, 10, "%.4f", IDFodd); snprintf(cPeakValue, 10, "%.4f", PeakValue); snprintf(cUBValue, 10, "%.4f", UBValue); + snprintf(cVel, 10, "%.4f", FVel); + snprintf(cDis, 10, "%.4f", FDis); // snprintf(cPeakValue, 10, "%.4f", x_vel);//測試用 // snprintf(cUBValue, 10, "%.4f", y_vel);//測試用
--- a/embedded/MATH1.cpp Wed Jan 18 11:19:53 2017 +0000 +++ b/embedded/MATH1.cpp Wed Jul 12 08:20:05 2017 +0000 @@ -601,12 +601,12 @@ emax=emax/(bmax+emax);bmax=1-emax;*bearing=f1max*g2max*bmax*100;*eccentric=f1max*g2max*emax*100; } } -void MATH::Fuzzy_Condition(double VUR,double IUR,double VUF,double IUF,double THDV,double VDFodd,double THDI,double IDFodd,double VD,double CD,double Vel,double Dis,double *pCMS) +void MATH::Fuzzy_Condition(double VUR,double IUR,double VUF,double IUF,double VD,double CD,double Vel,double Dis,double *pCMS) { - double g1[2],g2[2],g3[2],g4[2],g5[2],g6[2],g7[2],g8[2],g9[2],c1[9]={0},c2[9]={0},p[2]; - int flag1,flag2,flag3,flag4,flag5,flag6,flag7,flag8,flag9,i; - if(VUR>=5||IUR>=10||THDV>=5||VDFodd>=3||THDI>=5||IDFodd>=4||VD>=10||CD>=10||Vel>=4.5||VUF>=1||IUF>=2.5||Dis>=90){*pCMS=1;} - else if(VUR<=1&&IUR<=2&&THDV<=1.5&&VDFodd<=1.5&&THDI<=2.5&&IDFodd<=2&&VD<=2.5&&CD==0&&Vel<=0.7){*pCMS=0;} + double g1[2],g2[2],g3[2],g4[2],g5[2],c1[9]={0},c2[9]={0},p[2]; + int flag1,flag2,flag3,flag4,flag5,i; + if(VUR>=5||IUR>=10||VD>=10||CD>=10||Vel>=4.5||VUF>=1||IUF>=2.5||Dis>=90){*pCMS=1;} + else if(VUR<=1&&IUR<=2&&VD<=2.5&&CD==0&&Vel<=0.7){*pCMS=0;} else{ if(VUR<=2){g1[1]=VUR-1.0;if(g1[1]<0){g1[1]=0;}g1[0]=1-g1[1];flag1=1;} if(VUR>2&&VUR<=3.5){g1[1]=VUR*2.0/3.0-4.0/3.0;g1[0]=1-g1[1];flag1=2;} @@ -614,57 +614,37 @@ if(IUR<=4){g2[1]=IUR*0.5-1;if(g2[1]<0){g2[1]=0;}g2[0]=1-g2[1];flag2=1;} if(IUR>4&&IUR<=6){g2[1]=IUR*0.5-2.0;g2[0]=1-g2[1];flag2=2;} if(IUR>6&&IUR<10){g2[1]=IUR*0.25-3.0*2.0;g2[0]=1-g2[1];flag2=3;} - if(THDV<=2){g3[1]=THDV*2-3;if(g3[1]<0){g3[1]=0;}g3[0]=1-g3[1];flag3=1;} - if(THDV>2&&THDV<=3.5){g3[1]=THDV*2.0/3.0-4.0/3.0;g3[0]=1-g3[1];flag3=2;} - if(THDV>3.5&&THDV<5){g3[1]=THDV*2.0/3.0-7.0/3.0;g3[0]=1-g3[1];flag3=3;} - if(VDFodd<=2){g3[1]=VDFodd*2.0-3.0;if(g4[1]<0){g4[1]=0;}g4[0]=1-g4[1];flag4=1;} - if(VDFodd>2&&VDFodd<=2.5){g4[1]=VDFodd*2.0-4.0;g4[0]=1-g4[1];flag4=2;} - if(VDFodd>2.5&&VDFodd<3){g4[1]=VDFodd*2.0-5.0;g4[0]=1-g4[1];flag4=3;} - if(THDI<=3){g5[1]=THDI*2.0-5.0;if(g5[1]<0){g5[1]=0;}g5[0]=1-g5[1];flag5=1;} - if(THDI>3&&THDI<=4){g5[1]=THDI-3.0;g5[0]=1-g5[1];flag5=2;} - if(THDI>4&&THDI<5){g5[1]=THDI-4.0;g5[0]=1-g5[1];flag5=3;} - if(IDFodd<=2.5){g6[1]=IDFodd*2.0-4.0;if(g6[1]<0){g6[1]=0;}g6[0]=1-g6[1];flag6=1;} - if(IDFodd>2.5&&IDFodd<=3){g6[1]=IDFodd*2.0-5.0;g6[0]=1-g6[1];flag6=2;} - if(IDFodd>3&&IDFodd<4){g6[1]=IDFodd-3.0;g6[0]=1-g6[1];flag6=3;} - if(VD<=3){g7[1]=VD*2.0-5.0;if(g7[1]<0){g7[1]=0;}g7[0]=1-g7[1];flag7=1;} - if(VD>3&&VD<=5){g7[1]=VD*0.5-3.0/2.0;g7[0]=1-g7[1];flag7=2;} - if(VD>5&&VD<10){g7[1]=VD*0.2-1.0;g7[0]=1-g7[1];flag7=3;} - if(CD<=2){g8[1]=CD*0.5;if(g8[1]<0){g8[1]=0;}g8[0]=1-g8[1];flag8=1;} - if(CD>2&&CD<=5){g8[1]=CD*1.0/3.0-2.0/3.0;g8[0]=1-g8[1];flag8=2;} - if(CD>5&&CD<10){g8[1]=CD*0.2-1.0;g8[0]=1-g8[1];flag8=3;} - if(Vel<=0.7){g9[1]=Vel*10.0/7.0;if(g9[1]<0){g9[1]=0;}g9[0]=1-g9[1];flag9=1;} - if(Vel>0.7&&Vel<=1.8){g9[1]=Vel*10.0/11.0-7.0/11.0;g9[0]=1-g9[1];flag9=2;} - if(Vel>1.8&&Vel<4.5){g9[1]=Vel*10.0/27.0-2.0/3.0;g9[0]=1-g9[1];flag9=3;} - if(flag1==3||flag2==3||flag3==3||flag4==3||flag5==3||flag6==3||flag7==3||flag8==3||flag9==3){ + if(VD<=3){g3[1]=VD*2.0-5.0;if(g3[1]<0){g3[1]=0;}g3[0]=1-g3[1];flag3=1;} + if(VD>3&&VD<=5){g3[1]=VD*0.5-3.0/2.0;g3[0]=1-g3[1];flag3=2;} + if(VD>5&&VD<10){g3[1]=VD*0.2-1.0;g3[0]=1-g3[1];flag3=3;} + if(CD<=2){g4[1]=CD*0.5;if(g4[1]<0){g4[1]=0;}g4[0]=1-g4[1];flag4=1;} + if(CD>2&&CD<=5){g4[1]=CD*1.0/3.0-2.0/3.0;g4[0]=1-g4[1];flag4=2;} + if(CD>5&&CD<10){g4[1]=CD*0.2-1.0;g4[0]=1-g4[1];flag4=3;} + if(Vel<=0.7){g5[1]=Vel*10.0/7.0;if(g5[1]<0){g5[1]=0;}g5[0]=1-g5[1];flag5=1;} + if(Vel>0.7&&Vel<=1.8){g5[1]=Vel*10.0/11.0-7.0/11.0;g5[0]=1-g5[1];flag5=2;} + if(Vel>1.8&&Vel<4.5){g5[1]=Vel*10.0/27.0-2.0/3.0;g5[0]=1-g5[1];flag5=3;} + if(flag1==3||flag2==3||flag3==3||flag4==3||flag5==3){ if(flag1==3){c1[0]=g1[0];c2[0]=g1[1];} if(flag2==3){c1[1]=g2[0];c2[1]=g2[1];} if(flag3==3){c1[2]=g3[0];c2[2]=g3[1];} if(flag4==3){c1[3]=g4[0];c2[3]=g4[1];} if(flag5==3){c1[4]=g5[0];c2[4]=g5[1];} - if(flag6==3){c1[5]=g6[0];c2[5]=g6[1];} - if(flag7==3){c1[6]=g7[0];c2[6]=g7[1];} - if(flag8==3){c1[7]=g8[0];c2[7]=g8[1];} - if(flag9==3){c1[8]=g9[0];c2[8]=g9[1];} p[0]=c1[0];p[1]=c2[0]; - for(i=1;i<9;i++){ - if(p[0]<c1[i]){p[0]=c1[i];} + for(i=1;i<5;i++){ + if(p[0]>c1[i]){p[0]=c1[i];} if(p[1]<c2[i]){p[1]=c2[i];} } *pCMS=(p[0]*0.6667+p[1])/(p[0]+p[1]); } - else if(flag1==2||flag2==2||flag3==2||flag4==2||flag5==2||flag6==2||flag7==2||flag8==2||flag9==2){ + else if(flag1==2||flag2==2||flag3==2||flag4==2||flag5==2){ if(flag1==2){c1[0]=g1[0];c2[0]=g1[1];} if(flag2==2){c1[1]=g2[0];c2[1]=g2[1];} if(flag3==2){c1[2]=g3[0];c2[2]=g3[1];} if(flag4==2){c1[3]=g4[0];c2[3]=g4[1];} if(flag5==2){c1[4]=g5[0];c2[4]=g5[1];} - if(flag6==2){c1[5]=g6[0];c2[5]=g6[1];} - if(flag7==2){c1[6]=g7[0];c2[6]=g7[1];} - if(flag8==2){c1[7]=g8[0];c2[7]=g8[1];} - if(flag9==2){c1[8]=g9[0];c2[8]=g9[1];} p[0]=c1[0];p[1]=c2[0]; - for(i=1;i<9;i++){ - if(p[0]<c1[i]){p[0]=c1[i];} + for(i=1;i<5;i++){ + if(p[0]>c1[i]){p[0]=c1[i];} if(p[1]<c2[i]){p[1]=c2[i];} } *pCMS=(p[0]*0.3333+p[1]*0.6667)/(p[0]+p[1]); @@ -675,16 +655,12 @@ if(flag3==1){c1[2]=g3[0];c2[2]=g3[1];} if(flag4==1){c1[3]=g4[0];c2[3]=g4[1];} if(flag5==1){c1[4]=g5[0];c2[4]=g5[1];} - if(flag6==1){c1[5]=g6[0];c2[5]=g6[1];} - if(flag7==1){c1[6]=g7[0];c2[6]=g7[1];} - if(flag8==1){c1[7]=g8[0];c2[7]=g8[1];} - if(flag9==1){c1[8]=g9[0];c2[8]=g9[1];} p[0]=c1[0];p[1]=c2[0]; - for(i=1;i<9;i++){ - if(p[0]<c1[i]){p[0]=c1[i];} + for(i=1;i<5;i++){ + if(p[0]>c1[i]){p[0]=c1[i];} if(p[1]<c2[i]){p[1]=c2[i];} } *pCMS=(p[1]*0.3333)/(p[0]+p[1]); } - } + } } \ No newline at end of file
--- a/embedded/MATH1.h Wed Jan 18 11:19:53 2017 +0000 +++ b/embedded/MATH1.h Wed Jul 12 08:20:05 2017 +0000 @@ -30,7 +30,7 @@ double HD(double *dick_1, double *dick_2, double *dick_3, int pu); double BB(double *d1, double *d2, double *d3, int pu); void Fuzzy_Fault(double IUR,double IUF,double THDV,double VDFodd,double THDI,double IDFodd,double BB,double peakvalue,double *health,double *stator,double *rotor,double *bearing, double *eccentric); - void Fuzzy_Condition(double VUR,double IUR,double VUF,double IUF,double THDV,double VDFodd,double THDI,double IDFodd,double VD,double CD,double Vel,double Dis,double *pCMS); + void Fuzzy_Condition(double VUR,double IUR,double VUF,double IUF,double VD,double CD,double Vel,double Dis,double *pCMS); private: