|
|
@ -284,8 +284,8 @@ exports.motorAction = async (req, reply) => {
|
|
|
|
intervalId = setInterval(async function () {
|
|
|
|
intervalId = setInterval(async function () {
|
|
|
|
// Calculate new water levels
|
|
|
|
// Calculate new water levels
|
|
|
|
const rcvr_info = await Tank.findOne({ customerId ,tankName:receiver_tank,tankLocation:receiver_type});
|
|
|
|
const rcvr_info = await Tank.findOne({ customerId ,tankName:receiver_tank,tankLocation:receiver_type});
|
|
|
|
const newWaterLevel = receiver_waterlevel + 200//Math.floor(supplier_waterlevel * 0.1);
|
|
|
|
const newWaterLevel = receiver_waterlevel + 350//Math.floor(supplier_waterlevel * 0.1);
|
|
|
|
const newSupplierWaterLevel = supplier_waterlevel - 200//Math.floor(supplier_waterlevel * 0.1);
|
|
|
|
const newSupplierWaterLevel = supplier_waterlevel - 350//Math.floor(supplier_waterlevel * 0.1);
|
|
|
|
const supplier_capacity = parseInt(supplier_tank_info.capacity.replace(/,/g, ''), 10)
|
|
|
|
const supplier_capacity = parseInt(supplier_tank_info.capacity.replace(/,/g, ''), 10)
|
|
|
|
|
|
|
|
|
|
|
|
// Check if updating should stop
|
|
|
|
// Check if updating should stop
|
|
|
@ -368,7 +368,7 @@ exports.motorAction = async (req, reply) => {
|
|
|
|
// Calculate new water levels
|
|
|
|
// Calculate new water levels
|
|
|
|
const rcvr_info = await Tank.findOne({ customerId ,tankName:receiver_tank,tankLocation:receiver_type});
|
|
|
|
const rcvr_info = await Tank.findOne({ customerId ,tankName:receiver_tank,tankLocation:receiver_type});
|
|
|
|
console.log(rcvr_info.motor_status)
|
|
|
|
console.log(rcvr_info.motor_status)
|
|
|
|
const newWaterLevel = receiver_waterlevel+200;
|
|
|
|
const newWaterLevel = receiver_waterlevel+450;
|
|
|
|
console.log(newWaterLevel,"2")
|
|
|
|
console.log(newWaterLevel,"2")
|
|
|
|
// Check if updating should stop
|
|
|
|
// Check if updating should stop
|
|
|
|
if ((newWaterLevel/receiver_capacity)*100 >= 97 || (newWaterLevel/receiver_capacity)*100 >= desired_water_percentage || rcvr_info.motor_status === "0" ) {
|
|
|
|
if ((newWaterLevel/receiver_capacity)*100 >= 97 || (newWaterLevel/receiver_capacity)*100 >= desired_water_percentage || rcvr_info.motor_status === "0" ) {
|
|
|
|