void cthd_trip_point::thd_trip_point_add_cdev(cthd_cdev &cdev, int influence, int sampling_period) { trip_pt_cdev_t thd_cdev; thd_cdev.cdev = &cdev; thd_cdev.influence = influence; thd_cdev.sampling_priod = sampling_period; thd_cdev.last_op_time = 0; trip_cdev_add(thd_cdev); }
int cthd_trip_point::thd_trip_point_add_cdev_index(int _index, int influence) { cthd_cdev *cdev = thd_engine->thd_get_cdev_at_index(_index); if (cdev) { trip_pt_cdev_t thd_cdev; thd_cdev.cdev = cdev; thd_cdev.influence = influence; thd_cdev.sampling_priod = 0; thd_cdev.last_op_time = 0; trip_cdev_add(thd_cdev); return THD_SUCCESS; } else { thd_log_warn("thd_trip_point_add_cdev_index not present %d\n", _index); return THD_ERROR; } }
void cthd_trip_point::thd_trip_point_add_cdev(cthd_cdev &cdev, int influence, int sampling_period, int target_state_valid, int target_state, pid_param_t *pid_param) { trip_pt_cdev_t thd_cdev; thd_cdev.cdev = &cdev; thd_cdev.influence = influence; thd_cdev.sampling_priod = sampling_period; thd_cdev.last_op_time = 0; thd_cdev.target_state_valid = target_state_valid; thd_cdev.target_state = target_state; if (pid_param && pid_param->valid) { thd_log_info("pid valid %f:%f:%f\n", pid_param->kp, pid_param->ki, pid_param->kd); memcpy(&thd_cdev.pid_param, pid_param, sizeof(pid_param_t)); thd_cdev.pid.set_pid_param(pid_param->kp, pid_param->ki, pid_param->kd); } else { memset(&thd_cdev.pid_param, 0, sizeof(pid_param_t)); } trip_cdev_add(thd_cdev); }