public void sendCoordinates(object sender, SendCoordinateEvent e) { //if(e.y > maxMuscle) //Måske dette skal ændres til et gennemsnit af flere, så man tager højde for støj //{ // maxMuscle = e.y; //} //if(muscleForce.Count<11) //{ // muscleForce.Add(e.y); //} //else //{ // //Remove one from list and add a new one, then calculate slope // //expMuscle = slope //} ////Ovenstående bør måske overvejes at skulle gøres i en anden selvstændig tråd, snak med Michael if (zeroPointAdjusting == false) { muscleForce.Add(new XYDTO(e.x, e.y - zeroPointValue)); SendCoordinateEvent SCevent = new SendCoordinateEvent(e.x, e.y - zeroPointValue); sendCoordinate?.Invoke(this, SCevent); } else if (zeroPointAdjusting == true) { if (zeroPointValues.Count == 300) { getZeroPointAdjustment(); } else { zeroPointValues.Add(e.y); } } }
public void calculateForce(object sender, SendCoordinateEvent e) { //Moment modtaget fra Processor, sendes via Event, regnes om til kraft og kan regnes tilbage til moment i den samlede arm (altså hele patientens armlængde) double torque = e.y; double force = torque / (armLength - 0.05); double muscleTorque = force * armLength; //double muscleTorque = torque; //TEST, SKAL BRUGE DEN OVENFOR double timecount = e.x / 1000; SendCoordinateEvent coordinateEvent = new SendCoordinateEvent(timecount, muscleTorque); sendCoordinate?.Invoke(this, coordinateEvent); }
public void procesVoltage() { Stopwatch SW = new Stopwatch(); SW.Start(); while (!BC_.IsCompleted) { try { int bit = BC_.Take(); double voltage_ = (0.002 * bit); //double voltage_ = voltage; double torque = 0; switch (strengthLevel) { case "Reduced strength": torque = 15.32 * voltage_ + (Math.Pow(10, -12)); break; case "Medium strength": torque = 28.16 * voltage_ + (2 * Math.Pow(10, -12)); break; case "Full strength": torque = 41.68 * voltage_ + (Math.Pow(10, -12)); break; } SendCoordinateEvent CoordinateEvent = new SendCoordinateEvent(SW.ElapsedMilliseconds, torque); sendCoordinate?.Invoke(this, CoordinateEvent); } catch (InvalidOperationException e) { } } double timespan = SW.ElapsedMilliseconds; SW.Stop(); }