Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. // Значения ключей по умолчанию
  2. #define STAB_STABLE_THRESH 20.0
  3. #define STAB_ALARM_THRESH 35.0
  4. #define STAB_TIME 2.0
  5. #define STAB_THRESH 35
  6.  
  7. void CStabilityDetector::Update(Msg &msg)
  8. {
  9. IDetector::Update(msg);
  10.  
  11. level = msg.GetParamInt("param0");
  12. bound = (int)(pow((double)(level / 15.0), 2) * 50.0 + 1.0); // 0-50
  13. gain = pow(((double)msg.GetParamInt("param2") / 30.0), 2) + 0.0001;
  14.  
  15. RegIni reg(STAB_DETECTOR_KEY);
  16.  
  17. double gain = reg.ReadDouble(_T("gain"), STAB_GAIN);
  18. reg.WriteDouble(_T("gain"), gain);
  19.  
  20. double stability_thresh = reg.ReadDouble(_T("stable_thresh"), STAB_STABLE_THRESH);
  21. reg.WriteDouble(_T("stable_thresh"), stability_thresh);
  22.  
  23. double alarm_thresh = reg.ReadDouble(_T("alarm_thresh"), STAB_ALARM_THRESH);
  24. reg.WriteDouble(_T("alarm_thresh"), alarm_thresh);
  25.  
  26. double alarm_time_thresh = reg.ReadDouble(_T("time"), STAB_TIME_FOR_ALARM);
  27. reg.WriteDouble(_T("time"), alarm_time_thresh);
  28.  
  29. int thresh = reg.ReadInt(_T("thresh"), STAB_THRESH);
  30. reg.WriteDouble(_T("thresh"), thresh);
  31.  
  32. m_pShiftDetector_Wrapper.reset(new ShiftDetector_Wrapper(gain, stability_thresh, alarm_thresh, alarm_time_thresh, thresh));
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement