Loading…
Loading…
Method Name: Method_Read_Trend_All
Method ID: 0x4820
Method Label: Read trend curves
Method Help:
- {
- int nDataReadCount;
- int select;
- int count_retries;
- int tabnState[2];
- int nState;
- int x1;
- int nb_trend;
- int position;
- int nb_points;
- int sel_1;
- int sel_2;
- int sel_3;
- int sel_4;
- int MasterLength;
- int nTransaction;
- int reduce_points;
- long intput_tmp;
- long i;
- long varid[2];
- long nMaxBCT;
- long nBCT;
- unsigned int compareDW[29];
- unsigned int compareVal;
- long max_trend_entries;
- float max_y;
- float min_y;
- float max_y_2;
- float min_y_2;
- float max_y_3;
- float min_y_3;
- float max_y_4;
- float min_y_4;
- float flt_y;
- float max_1;
- float max_2;
- float max_3;
- float max_4;
- float min_1;
- float min_2;
- float min_3;
- float min_4;
- nb_trend = 0;
- position = 0;
- reduce_points = 0;
- x1 = 0;
- sel_1 = 0;
- sel_2 = 0;
- sel_3 = 0;
- sel_4 = 0;
- max_y = -1000000;
- min_y = 100000;
- max_y_2 = -1000000;
- min_y_2 = 100000;
- max_y_3 = -1000000;
- min_y_3 = 100000;
- max_y_4 = -1000000;
- min_y_4 = 100000;
- max_1 = 100000;
- max_2 = 100000;
- max_3 = 100000;
- max_4 = 100000;
- min_1 = 100000;
- min_2 = 100000;
- min_3 = 100000;
- min_4 = 100000;
- _set_comm_status(0x7F,1);
- _set_no_device(1);
- _set_all_resp_code(0);
- _set_device_status(0xFF,0);
- i = 0;
- send_command_trans(143,10);
- nBCT = _ivar_value(17781);
- nMaxBCT = _ivar_value(17782);
- if (nMaxBCT == 0 || nMaxBCT == 107 && nBCT == 0)
- {
- _add_abort_method(17877);
- compareDW[0] = 0x3a7d6d3d;
- compareDW[1] = 0x513e2d2d;
- compareDW[2] = 0x717a2f6a;
- compareDW[3] = 0x43755f46;
- compareDW[4] = 0x41247658;
- compareDW[5] = 0x6b3d3734;
- compareDW[6] = 0x76737076;
- compareDW[7] = 0x6137416f;
- compareDW[8] = 0x435b515d;
- compareDW[9] = 0x2b50534a;
- compareDW[10] = 0x26766a33;
- compareDW[11] = 0x626f235e;
- compareDW[12] = 0x61aa7347;
- compareDW[13] = 0x6e735477;
- compareDW[14] = 0x264c4c34;
- compareDW[15] = 0x3462787d;
- compareDW[16] = 0x3a7d6d3d;
- compareDW[17] = 0x513e2d2d;
- compareDW[18] = 0x717a2f6a;
- compareDW[19] = 0x43755f46;
- compareDW[20] = 0x41247658;
- compareDW[21] = 0x6b3d3734;
- compareDW[22] = 0x76737076;
- compareDW[23] = 0x6137416f;
- compareDW[24] = 0x435b515d;
- compareDW[25] = 0x2b50534a;
- compareDW[26] = 0x26766a33;
- _iassign(17781,110);
- send_command_trans(143,0);
- _iassign(17781,107);
- send_command_trans(143,0);
- for (i = 0; i < 25; i++)
- {
- compareVal = _ivar_value(resolve_array_ref(17878,i));
- if (compareDW[i] != compareVal)
- {
- break;
- }
- }
- remove_all_abort();
- }
- if (i == 0 && nMaxBCT != 110 || i == 25)
- {
- _iassign(17781,60);
- nTransaction = 70;
- MasterLength = 60;
- }
- else
- {
- _iassign(17781,16);
- nTransaction = 71;
- MasterLength = 16;
- }
- intput_tmp = _lvar_value(17566);
- if (intput_tmp != 33004)
- {
- nb_trend = nb_trend + 1;
- sel_1 = 1;
- save_values();
- }
- intput_tmp = _lvar_value(17567);
- if (intput_tmp != 33004)
- {
- nb_trend = nb_trend + 1;
- sel_2 = 1;
- save_values();
- }
- intput_tmp = _lvar_value(17568);
- if (intput_tmp != 33004)
- {
- nb_trend = nb_trend + 1;
- sel_3 = 1;
- save_values();
- }
- intput_tmp = _lvar_value(17569);
- if (intput_tmp != 33004)
- {
- nb_trend = nb_trend + 1;
- sel_4 = 1;
- save_values();
- }
- if (nb_trend != 0)
- {
- max_trend_entries = _ivar_value(17571);
- _iassign(17582,max_trend_entries);
- send_command_trans(178,1436);
- send_command_trans(173,285);
- _iassign(17897,0);
- _iassign(18974,nb_trend);
- _iassign(17879,132);
- _iassign(17895,1);
- i = _ivar_value(17583);
- _iassign(17565,5);
- send_command_trans(178,1435);
- send_command_trans(146,2);
- count_retries = 1;
- while (count_retries <= 15 && nState != 100)
- {
- DELAY(2,literal_string(2606));
- count_retries = count_retries + 1;
- send_command_trans(147,2);
- tabnState[0] = 17577;
- nState = _ivar_value(17577);
- }
- if (nState != 100)
- {
- ACKNOWLEDGE(literal_string(2510));
- abort();
- }
- nDataReadCount = 0;
- if (nb_trend == 1)
- {
- nb_points = max_trend_entries;
- reduce_points = max_trend_entries - nb_points * 1;
- }
- if (nb_trend == 2)
- {
- nb_points = max_trend_entries / 2;
- reduce_points = max_trend_entries - nb_points * 2;
- }
- if (nb_trend == 3)
- {
- nb_points = max_trend_entries / 3;
- reduce_points = max_trend_entries - nb_points * 3;
- }
- if (nb_trend == 4)
- {
- nb_points = max_trend_entries / 4;
- reduce_points = max_trend_entries - nb_points * 4;
- }
- _iassign(18975,-HB_TrendInterval_1 * nb_points);
- _iassign(17879,132);
- _iassign(17895,1);
- send_command_trans(211,0);
- while (nDataReadCount <= max_trend_entries - 1 - reduce_points)
- {
- if (MasterLength == 60)
- {
- if (max_trend_entries - nDataReadCount >= 15)
- {
- _iassign(17941,(nDataReadCount + MasterLength / 4) * 100 / max_trend_entries);
- }
- else
- {
- _iassign(17941,(nDataReadCount + 1) * 100 / max_trend_entries);
- }
- }
- else
- {
- _iassign(17941,(nDataReadCount + MasterLength / 4) * 100 / max_trend_entries);
- }
- varid[0] = 17941;
- if (progress < 100)
- {
- put_message(literal_string(2610),varid);
- }
- else
- {
- _iassign(17941,100);
- varid[0] = 17941;
- put_message(literal_string(2610),varid);
- }
- _iassign(17895,0);
- _iassign(17916,0);
- if (MasterLength == 60)
- {
- if (max_trend_entries - nDataReadCount >= 15)
- {
- send_command_trans(212,nTransaction);
- }
- else
- {
- send_command_trans(212,nTransaction + 2);
- }
- }
- else
- {
- send_command_trans(212,nTransaction);
- }
- if (MasterLength == 60)
- {
- if (max_trend_entries - nDataReadCount < 15)
- {
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points] = HelpFloat_1;
- }
- else
- {
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points] = HelpFloat_1;
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points - 1] = HelpFloat_2;
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points - 2] = HelpFloat_3;
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points - 3] = HelpFloat_4;
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points - 4] = HelpFloat_5;
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points - 5] = HelpFloat_6;
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points - 6] = HelpFloat_7;
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points - 7] = HelpFloat_8;
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points - 8] = HelpFloat_9;
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points - 9] = HelpFloat_10;
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points - 10] = HelpFloat_11;
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points - 11] = HelpFloat_12;
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points - 12] = HelpFloat_13;
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points - 13] = HelpFloat_14;
- array_Display_Trend_buffer[max_trend_entries - 1 - nDataReadCount - reduce_points - 14] = HelpFloat_15;
- }
Please login for more