Loading…

Method Name: perform_tuner_method

Method ID: 0x4318

Method Label: Performance Tuner

Method Help:


  • {
  • float qa, qb, qc, qd, qe; int q, q0, q1, q2, q3; char S[3];
  • int packet_byte_0, packet_byte_num, num_pts_to_collect;
  • int diag_byte, num_tvl_reversals, num_drv_reversals;
  • int start_byte, packet_index;
  • int TvP, iDvP, flag, num_of_steps, system_state, tuning_state, old_tuning_state;
  • int b8, i, bFlag;
  • int iTime;
  • int iSec;
  • float fTravel;
  • int iWait;
  • int iColVar;
  • float fCurrPos1, fCurrPos2;
  • float fPosDiff;
  • long ids[7], Stp;
  • float temp;
  • int iTempRamp;
  • float fRoundingFactor;
  • float fsecPerTick, frampRate;
  • float fRemTvl;
  • float Tv[150], fDriveSig[150], fTv0, fDriveSig0;
  • float Mx, Mn;
  • int t;
  • float g, v, m, sign;
  • float g_bak, v_bak, m_bak;
  • float step_size, MaxOvershoot, t80_minus_t10, write_implied_valve_position, local_travel_value;
  • float x, y, z, t10, t80, Gs, Ts, fDeadZone;
  • char st[3];
  • _set_device_status(0xFF,0);
  • _set_xmtr_device_status(0xFF,0);
  • _set_all_resp_code(1);
  • _set_resp_code((8),0);
  • _set_no_device(2);
  • send(151,S); if(_ivar_value(16804) > 1) { ACKNOWLEDGE("|en|The DD revision is not compatible with the firmware in the device.\nContact your Fisher sales office for an upgrade to your Device Description."); return; };
  • if(!((_ivar_value(16465) & 0x0008) == 0x0008))
  • {
  • ACKNOWLEDGE("|en|This Instrument Level does not support this procedure.");
  • }
  • else
  • {
  • send_trans(129,34,S); if(0x02 == _ivar_value(16509)) { ACKNOWLEDGE("|en|This action cannot be performed in Pressure Control."); return; } send(138,S); if((_ivar_value(16789) & 0x01) > 0) { ACKNOWLEDGE("|en|The instrument is reporting a Travel Sensor failure."); return; };
  • send_trans(129,0,S); _vassign(16452,16427); save_values(); if(1==_ivar_value(167)) { ACKNOWLEDGE("|en|Protection must be disabled to perform this operation."); process_abort(); } if((_ivar_value(16427))) { if(((_ivar_value(16465) & 0x01C0) == 0x0100)) { _get_dev_var_value(("|en|WARNING! Output will not track input and the SIS safety function will be disabled when Instrument Mode is Out of Service."),0,16452); } else { _get_dev_var_value(("|en|WARNING! Output will not track input when Instrument Mode is Out of Service."),0,16452); } save_values(); if(_ivar_value(16452)>0) { ACKNOWLEDGE("|en|Instrument Mode is still In Service."); process_abort(); } else { send_trans(130,6,S); } } send_trans(129,0,S); if((1==_ivar_value(16472)) || (5==_ivar_value(16472))) { if(1==_ivar_value(16472)) { ACKNOWLEDGE("|en|Access restricted\n\nInstrument was set to 'Out of Service' by a secondary master."); } else { ACKNOWLEDGE("|en|Access restricted\n\nInstrument was set to 'Out of Service' by a primary master."); } process_abort(); } _add_abort_method(17167); DELAY(1,"|en|Please wait...");
  • if(1 - SELECT_FROM_LIST("|en|WARNING! Performance Tuner will move the valve. Continue?","|en|Yes;No"))
  • {
  • i = 0; send(138,S); if((_ivar_value(16789) & 0x02) > 0) { send_trans(142,0,S); send_trans(129,29,S); send_trans(142,1,S); if(0x7FA00000==_lvar_value(16940)) i=0x01; if(0x7FA00000==_lvar_value(16938)) i=i | 0x02; if(0x7FA00000==_lvar_value(16939)) i=i | 0x04; if(((i & 0x01)>0) && ((_ivar_value(16465) & 0x0200) == 0x0200)) { ACKNOWLEDGE("|en|Supply Pressure Sensor Failure occurred"); } if((i & 0x02)>0) { ACKNOWLEDGE("|en|Pressure A Sensor Failure occurred"); } if((i & 0x04)>0) { ACKNOWLEDGE("|en|Pressure B Sensor Failure occurred"); } } switch(_ivar_value(16434)) { case 7: qb=0.689; qd=0.1; break; case 12: qb=68.9; qd=10.0; break; case 10: qb=0.703; qd=0.1; break; default: qb=10.0; qd=5.0; break; } if(!(i & 0x01)) { qa = _fvar_value(16947); _fassign(16947,((qb * 15.0))); send_trans(130,88,S); send(42,S); send_trans(142,0,S); send_trans(129,28,S); q=0; while ((_fvar_value(16439)send_trans(129,28,S); q=SELECT_FROM_LIST("|en|The Supply Pressure is not sufficient to move the valve.","|en|Adjust Supply and retry;Abort;Continue with Current Pressure"); } send_trans(142,1,S); qc=_fvar_value(16439); if (qc>qa) { qa=qc + qb / 2.0; q0=qa / qd; qa=q0 * qd; } _fassign(16947,(qa)); send_trans(130, 88,S); send_command(42); if (1==q) process_abort(); if(_fvar_value(16439)| 0x08; } };
  • send(138,S); q0 = 0; q1 = 1; while((_ivar_value(16792) & 0x08) > 0) { if(1 == q1) { send_trans(129,34,S); if((1 == _ivar_value(16464)) && ((_ivar_value(16794)) & 0x08)) { q0 = SELECT_FROM_LIST("|en|The Auxiliary Terminal Action is configured for a connected local control panel, but no local control panel is detected. You will need to correct the Auxiliary Terminal Action configuration or exit and fix the connected local control panel.","|en|Change Configuration;Exit"); if(0 == q0) { q == SELECT_FROM_LIST("|en|Aux Terminal Action","|en|Disabled;PST Diagnostic"); _iassign(16464,((2 * q))); send_trans(130,86,S); } } } if(0 == q0) { q0 = SELECT_FROM_LIST("|en|Instrument is locked in safety and must be unlocked before proceeding.\nWARNING! Unlocking the device may cause the valve to move.","|en|Unlock;Exit"); } if(1 == q0) { remove_all_abort(); _add_abort_method(17167); process_abort(); } if(1 == q1) { q2 = _ivar_value(16529); if(2 == q2) q2 = -1; q2 = q2 * ((-2 * _ivar_value(16508)) + 1); if(0 == 0) { if((_ivar_value(171) == 0)) { if(2 == _ivar_value(16529)) { qa = 0.0; } else { qa = 1.0; } _fassign(16640,(qa)); send_trans(130,78,S); } _iassign(16452,(1)); save_values(); send_trans(130,6,S); } } if((_ivar_value(171) == 0)) { if(1 == q1) { q1 = 2; _fassign(16405,((qa * 100.0))); save_values(); send_trans(130,4,S); } if(1 == _ivar_value(16464)) { ACKNOWLEDGE("|en|To unlock the device, press the button next to GREEN light on Local Control Panel for more than 1/2 second."); } else { ACKNOWLEDGE("|en|To unlock the device, short the Aux. terminals between 3 and 5 seconds."); } } else { if(1 == _ivar_value(16464)) { if(q2 < 0) { ACKNOWLEDGE("|en|To unlock the device\n1. Set the input current to 8 mA if the Local Control Panel is loop powered or 4 mA if the LCP has a seperate power supply.\n2. Press the button next to GREEN light on Local Control Panel for more than 1/2 second."); } else { ACKNOWLEDGE("|en|To unlock the device\n1. Set the input current to 20 mA.\n2. Press the button next to GREEN light on Local Control Panel for more than 1/2 second."); } } else { if(q2 < 0) { ACKNOWLEDGE("|en|To unlock the device\n1. Set the input current to 4 mA.\n2. Short the Aux. terminals between 3 and 5 seconds."); } else { ACKNOWLEDGE("|en|To unlock the device\n1. Set the input current to 20 mA.\n2. Press the button next to GREEN light on Local Control Panel for more than 1/2 second."); } } } send(138,S); } if(0 == 0) { _iassign(16452,(0)); save_values(); send_trans(130,6,S); send_trans(129,0,S); };
  • if(((_ivar_value(16496) & 0x01) > 0)) { if((_ivar_value(171) == 0)) { ACKNOWLEDGE("|en|The Hardware Shutdown DIP switch on the main electronics board must be Disabled to operate in multidrop mode."); process_abort(); } else { send(3,S); if((3 == _ivar_value(16496))) { while (_fvar_value(16418) > 9.0) { if(select_from_list("|en|Adjust the Analog Input current to move the valve to its normal (not tripped) position.", ids,"|en|Adjust Analog Input and continue;Exit")) { process_abort(); } send(3,S); } } if((1 == _ivar_value(16496))) { while (_fvar_value(16418) < 15.0) { if(select_from_list("|en|Adjust the Analog Input current to move the valve to its normal (not tripped) position.", ids,"|en|Adjust Analog Input and continue;Exit")) { process_abort(); } send(3,S); } } } } else { send(138,S); if((_ivar_value(171) > 0)) { send(3,S); while (_fvar_value(16418) < 3.8) { if(select_from_list("|en|Input must exceed 3.8 mA (7.8 mA if loop powered local control panel is attached.)", ids,"|en|Adjust Analog Input and continue;Exit")) { process_abort(); } send(3,S); } }; };
  • send(138,S); send_trans(129,0,S); if(((_ivar_value(16790) & 0x31) > 0) || (_ivar_value(10098) == 0)) { send_trans(142,6,S); send_trans(142,1,S); send_trans(157,0,S); if(1 != _ivar_value(167)) { _iassign(16622,(0)); save_values(); send_trans(130,74,S); } if((_ivar_value(171) == 0)) _iassign(16453,(2)); else _iassign(16453,(3)); save_values(); send_trans(130,7,S); send_trans(129,0,S); DELAY(1,"|en|Please wait..."); };
  • send_trans(129,51,S);
  • send_trans(136,2,S); save_values(); if(0==(_ivar_value(16784))) { send_trans(136,0,S); } else if(_ivar_value(16784)!=16) { if(SELECT_FROM_LIST("|en|ATTENTION! There is new firmware in the instrument that has not been activated.\n\n If you continue, the new firmware will be overwritten.","|en|Continue;Exit")) { DELAY(2,"|en|Aborting... Firmware will be left intact."); process_abort(); } send_trans(136,1,S); send_trans(136,0,S); } send(138,S); if(((_ivar_value(16465) & 0x0002) == 0x0002) && ((_ivar_value(16792) & 0x80)>0)) { if(SELECT_FROM_LIST("|en|There is diagnostic data in the instrument that has not been extracted by ValveLink.\n\n If you continue, this data will be overwritten.","|en|Continue;Exit")) { DELAY(2,"|en|Exiting"); process_abort(); } };
  • send_trans(129,38,S);
  • if(((_ivar_value(16465) & 0x01C0) == 0x0100))
  • {
  • _get_dev_var_value(("|en|Is a Volume Booster Present?"),0,16534);
  • }
  • else
  • {
  • _get_dev_var_value(("|en|Is a Volume Booster or Quick Release Present?"),0,16534);
  • }
  • save_values();
  • _get_dev_var_value(("|en|Does the valve have Graphite Packing?"),0,16535);
  • send_trans(130,90,S);
  • if (1 == _ivar_value(16534))
  • {
  • ACKNOWLEDGE("|en|REMINDER:\nOpen bypass screw at least 1 turn");
  • }
  • DELAY(1,"|en|Initializing Performance Tuner. Please wait...");
  • send_trans(129,34,S);
  • _vassign(16957,16527);
  • _iassign(16500,(_ivar_value(16499)));
  • send_trans(129,31,S);
  • send_trans(129,14,S);
  • send(132,S);
  • _vassign(16973,16673);
  • _vassign(16954,16522);
  • _vassign(16955,16523);
  • _vassign(16956,16524);
  • save_values();
  • remove_all_abort();
  • _add_abort_method(17177);
  • _vassign(16942,10098);
  • _iassign(16453,(0));
  • save_values();
  • send_trans(130,7,S);
  • _iassign(16499,(0));
  • send_trans(130,104,S);
  • send_trans(129,34,S);
  • _iassign(16527,(0));
  • send_trans(130,98,S);
  • num_pts_to_collect = 58;
  • if (1 == _ivar_value(16534))
  • {
  • g = 6.2;
  • if (1 == _ivar_value(16535))
  • {
  • v = 0.0;
  • m = 55.0;
  • }
  • else
  • {
  • v = 8.0;
  • m = 55.0;
  • }
  • }
  • else
  • {
  • if (1 == _ivar_value(16535))
  • {
  • num_pts_to_collect = 123;
  • g = 4.0;
  • v = 0.0;
  • m = 35.0;
  • }
  • else
  • {
  • g = 6.0;
  • v = 2.75;
  • m = 30.0;
  • }
  • }
  • _iassign(16819,((num_pts_to_collect + 20)));
  • save_values();
  • ids[0] = 16522;
  • ids[1] = 16523;
  • ids[2] = 16524;
  • t = 0;
  • _fassign(16522,(g)); save_values(); if(m >= _fvar_value(16524)) { _fassign(16524,(m)); send_trans(130,28,S); send_trans(130,30,S); } else { _fassign(16524,(m)); send_trans(130,30,S); send_trans(130,28,S); } _fassign(16523,(v)); send_trans(130,29,S); send(132,S);
  • send_trans(129,30,S);
  • fCurrPos1 = _fvar_value(16441);
  • if(fCurrPos1 >= 90)
  • {
  • fTravel = fCurrPos1 - 10.0;
  • }
  • else
  • {
  • fTravel = fCurrPos1 + 10.0;
  • }
  • _iassign(16816,(((81.92 * fTravel) + 2048.0)));
  • save_values();
  • send_command_trans(155, 2);
  • DELAY(15,"|en|Initializing Performance Tuner. Please wait...");
  • send_trans(129,30,S);
  • fCurrPos2 = _fvar_value(16441);
  • if(fCurrPos1 <= fCurrPos2)
  • {
  • fPosDiff = fCurrPos2 - fCurrPos1;
  • }
  • else
  • {
  • fPosDiff = fCurrPos1 - fCurrPos2;
  • }
  • if (fPosDiff <= 2)
  • {
  • remove_all_abort();
  • _add_abort_method(17178);
  • process_abort();
  • }
  • _iassign(16816,(((81.92 * 49.0) + 2048.0)));
  • save_values();
  • send_command_trans(155, 3);
  • iTime = 5;
  • iWait = 0;
  • for (iSec = 0; iSec < iTime; iSec++)
  • {
  • send_trans(129,30,S);
  • DELAY(5,"|en|Initializing Performance Tuner. Please wait...");
  • fRemTvl = fTravel - _fvar_value(16441);
  • if (((fRemTvl > -2.0) && (fRemTvl < 2.0)) && (iWait == 0))
  • {
  • iSec = iTime - 2;
  • iWait = 1;
  • }
  • }
  • send_trans(129,30,S);
  • Tv[0] = _fvar_value(16441);
  • fDriveSig[0] = _fvar_value(16435);
  • DELAY(2,"|en|Checking Steady-State Conditions.");


Please login for more