bool move() //Сдвиг строки выполняемый в буффере { bool moved = false; for (int i = 1; i < 4; i++) { if (temp[i] != 0) { if (temp[i - 1] == 0) { moved = true; } slip(i); } } for (int i = 1; i < 4; i++) { if (temp[i] != 0 && temp[i] == temp[i - 1]) //Cуммирование стоящих рядом равных элементов { temp[i - 1] *= 2; score += temp[i - 1]; temp[i] = 0; for (int n = i; n < 3; n++) { slip(n + 1); } moved = true; } } return moved; }
void slip(int i) //Смещение элементов в пустые ячейки { if (temp[i - 1] == 0) { temp[i - 1] = temp[i]; temp[i] = 0; if (i > 1) slip(i - 1); } }
Vector2 WheelContact::computeFrictionForce(real_type normForce, const Vector2& vel, real_type omegaR, real_type friction, PortValueList&) const { // We just get the wheel slip directly here real_type wheelSlip = vel(0)+omegaR; // The slip angle is the angle between the 'velocity vector' and // the wheel forward direction. real_type slipAngle = rad2deg*atan2(vel(1), fabs(vel(0))); // slipAngle = saturate(slipAngle, 10*fabs(vel(1))); slipAngle = smoothSaturate(slipAngle, 10*fabs(vel(1))); // Vector2 slip(wheelSlip, slipAngle); // if (1 < norm(slip)) // slip = normalize(slip); Vector2 slip(smoothSaturate(wheelSlip, real_type(1)), smoothSaturate(slipAngle, real_type(1))); // The friction force for fast movement. return (-friction*mFrictionCoeficient*normForce)*slip; }
void MiniBeeV2::send(char type, char *p, int size) { Serial.print(ESC_CHAR, BYTE); Serial.print(type, BYTE); for(i = 0;i < size;i++) slip(p[i]); Serial.print(DEL_CHAR, BYTE); }
int ContactMaterial3D::setTrialStrain (const Vector &strain_from_element) { #ifdef _G3DEBUG opserr << "ContactMaterial3D::setTrialStrain (const Vector &strain_from_element)" << endln; #endif Vector t_s(2); // tangential contact force double t_n; // normal contact force double f_nplus1_trial; // trial slip condition double gap; // current gap Vector slip(2); // incremental slip double t_s_norm; // norm of tangential contact force strain_vec = strain_from_element; gap = strain_vec(0); slip(0) = strain_vec(1); slip(1) = strain_vec(2); t_n = strain_vec(3); Vector zeroVec = slip; zeroVec.Zero(); // update frictional status this->UpdateFrictionalState(); // trial state (elastic predictor step) -> assume sticking inSlip = false; s_e_nplus1 = (t_n > -tensileStrength) ? s_e_n + slip : zeroVec; // ctv t_s = stiffness * g * s_e_nplus1; // cov // Norm(s_e_nplus1) = sqrt( s_e_nplus1' * g * s_e_nplus1 ) s_e_nplus1_norm = sqrt( s_e_nplus1(0) * g(0,0) * s_e_nplus1(0) + s_e_nplus1(1) * g(1,0) * s_e_nplus1(0) * 2.0 + s_e_nplus1(1) * g(1,1) * s_e_nplus1(1) ); // Norm(t_s) = sqrt( t_s' * g * t_s ) //t_s_norm = sqrt( t_s(0) * G(0,0) * t_s(0) // + t_s(1) * G(1,0) * t_s(0) * 2.0 // + t_s(1) * G(1,1) * t_s(1) ); //Norm(t_s) = k*Norm(s_e_nplus1) -- yields same result as above t_s_norm = stiffness * s_e_nplus1_norm; // slip condition f_nplus1_trial = t_s_norm - frictionCoeff*t_n - cohesion; // if (f_nplus1_trial > 0.0) { // if ( (f_nplus1_trial > 0.0) && (t_n > -cohesion/frictionCoeff) && (slip.Norm() > 1e-12) ) { if ( (f_nplus1_trial > 0.0) && (t_n > -tensileStrength) && (s_e_nplus1_norm > 1e-12) ) { // plastic corrector step -> sliding inSlip = true; gamma = f_nplus1_trial / stiffness * 0.999999999999 ; r_nplus1 = s_e_nplus1 / s_e_nplus1_norm; // ctv // s_p_nplus1 = s_p_n + gamma * r_nplus1 // s_e_nplus1 = s_nplus1 - s_p_nplus1 // = (s_nplus1 - s_p_n) - gamma * r_nplus1 // = (s_n + slip - s_p_n) - gamma * r_nplus1 // = (s_e_n + slip) - gamma * r_nplus1 // = s_e_nplus1_trial - gamma * r_nplus1 double scale = (1.0 - gamma/s_e_nplus1_norm); s_e_nplus1 = scale * s_e_nplus1; // ctv t_s = scale * t_s; // cov } #ifdef _G3DEBUG if (DEBUG_LEVEL > 1) { if (inSlip) { opserr << " ** SLIDING (material)" << endln; } else { opserr << " ** STICKING (material)" << endln; } } #endif //update stress and strain values stress_vec(0) = t_n; stress_vec(1) = t_s(0); stress_vec(2) = t_s(1); stress_vec(3) = gap; return 0; }