diff --git a/index.html b/index.html
index 0ac68c83..4b0d8aec 100644
--- a/index.html
+++ b/index.html
@@ -339,9 +339,6 @@
-
-
-
-
diff --git a/js/pid_controller.js b/js/pid_controller.js
deleted file mode 100644
index b1df6870..00000000
--- a/js/pid_controller.js
+++ /dev/null
@@ -1,130 +0,0 @@
-'use strict';
-
-
-var PidController = function () {
-
- var self = {},
- privateScope = {};
-
- /**
- *
- * @type {number}
- */
- privateScope.target = null;
-
- /**
- *
- * @type {{P: null, I: null, D: null}}
- */
- privateScope.gains = {
- P: null,
- I: null,
- D: null
- };
-
- /**
- *
- * @type {number}
- */
- privateScope.Iterm = 0;
-
- /**
- *
- * @type {{min: number, max: number}}
- */
- privateScope.ItermLimit = {
- min: -1000,
- max: 1000
- };
-
- /**
- *
- * @type {number}
- */
- privateScope.previousError = 0;
-
- /**
- *
- * @type {{min: number, max: number, minThreshold: number}}
- */
- privateScope.output = {
- min: null,
- max: null,
- minThreshold: null
- };
-
- /**
- *
- * @param {number} value
- */
- self.setTarget = function (value) {
- privateScope.target = value;
- };
-
- /**
- * @param {number} Pgain
- * @param {number} Igain
- * @param {number} Dgain
- */
- self.setGains = function (Pgain, Igain, Dgain) {
- privateScope.gains.P = Pgain;
- privateScope.gains.I = Igain;
- privateScope.gains.D = Dgain;
- };
-
- /**
- * Sets min and max value for output
- * @param {number} min
- * @param {number} max
- * @param {number} minThreshold if output is below this value, [min] is returned
- */
- self.setOutput = function (min, max, minThreshold) {
- privateScope.output.min = min;
- privateScope.output.max = max;
- privateScope.output.minThreshold = minThreshold;
- };
-
- /**
- * Sets upper and lower limit for Iterm accumulator
- * @param {number} min
- * @param {number} max
- */
- self.setItermLimit = function (min, max) {
- privateScope.ItermLimit.min = min;
- privateScope.ItermLimit.max = max;
- };
-
- /**
- * Executes PID controller based on current value and target
- * @param {number} current
- * @returns {number}
- */
- self.run = function (current) {
- var error = current - privateScope.target,
- Pterm = error * privateScope.gains.P,
- Dterm = (error - privateScope.previousError) * privateScope.gains.D,
- output;
-
- privateScope.previousError = error;
-
- privateScope.Iterm += error * privateScope.gains.I;
- if (privateScope.Iterm > privateScope.ItermLimit.max) {
- privateScope.Iterm = privateScope.ItermLimit.max;
- } else if (privateScope.Iterm < privateScope.ItermLimit.min) {
- privateScope.Iterm = privateScope.ItermLimit.min;
- }
-
- output = Pterm + privateScope.Iterm + Dterm;
- if (output < privateScope.output.minThreshold) {
- output = privateScope.output.min;
- } else if (output > privateScope.output.max) {
- output = privateScope.output.max;
- }
-
- return output;
- };
-
- return self;
-};
-
-module.exports = PidController;
\ No newline at end of file
diff --git a/js/serial_backend.js b/js/serial_backend.js
index 2fb26e80..8f053ca9 100755
--- a/js/serial_backend.js
+++ b/js/serial_backend.js
@@ -477,7 +477,6 @@ var SerialBackend = (function () {
$('#msp-load').text("MSP load: " + mspQueue.getLoad().toFixed(1));
$('#msp-roundtrip').text("MSP round trip: " + mspQueue.getRoundtrip().toFixed(0));
$('#hardware-roundtrip').text("HW round trip: " + mspQueue.getHardwareRoundtrip().toFixed(0));
- $('#drop-rate').text("Drop ratio: " + mspQueue.getDropRatio().toFixed(0) + "%");
}, 100);
interval.add('global_data_refresh', periodicStatusUpdater.run, periodicStatusUpdater.getUpdateInterval(CONFIGURATOR.connection.bitrate), false);
diff --git a/js/serial_queue.js b/js/serial_queue.js
index f4cf1bc1..7dbf492b 100644
--- a/js/serial_queue.js
+++ b/js/serial_queue.js
@@ -3,7 +3,6 @@
const CONFIGURATOR = require('./data_storage');
const MSPCodes = require('./msp/MSPCodes');
const SimpleSmoothFilter = require('./simple_smooth_filter');
-const PidController = require('./pid_controller');
const eventFrequencyAnalyzer = require('./eventFrequencyAnalyzer');
const mspDeduplicationQueue = require('./msp/mspDeduplicationQueue');
@@ -28,29 +27,9 @@ var mspQueue = function () {
privateScope.currentLoad = 0;
- /**
- * PID controller used to perform throttling
- * @type {PidController}
- */
- privateScope.loadPidController = new PidController();
- privateScope.loadPidController.setTarget(privateScope.targetLoad);
- privateScope.loadPidController.setOutput(0, 99, 0);
- privateScope.loadPidController.setGains(5, 6, 3);
- privateScope.loadPidController.setItermLimit(0, 90);
-
- privateScope.dropRatio = 0;
-
privateScope.removeCallback = null;
privateScope.putCallback = null;
- publicScope.computeDropRatio = function () {
- privateScope.dropRatio = privateScope.loadPidController.run(publicScope.getLoad());
- };
-
- publicScope.getDropRatio = function () {
- return privateScope.dropRatio;
- };
-
privateScope.queue = [];
privateScope.softLock = false;
@@ -229,12 +208,10 @@ var mspQueue = function () {
*/
publicScope.put = function (mspRequest) {
- console.log('Received message ', mspRequest.code);
-
const isMessageInQueue = mspDeduplicationQueue.check(mspRequest.code);
if (isMessageInQueue) {
- console.log('Message already in queue: ' + mspRequest.code);
+ eventFrequencyAnalyzer.put('MSP Duplicate ' + mspRequest.code);
return false;
}
@@ -286,7 +263,6 @@ var mspQueue = function () {
publicScope.balancer = function () {
privateScope.currentLoad = privateScope.loadFilter.get();
- publicScope.computeDropRatio();
/*
* Also, check if port lock if hanging. Free is so