made changes in tank levels,start and stop

master
varun 3 years ago
parent 1b0e23a806
commit e65b2b757f

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

Loading…
Cancel
Save