Advertisement
MaxSMoke

HELP!

Jul 27th, 2023 (edited)
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.00 KB | Source Code | 0 0
  1. let firstPhaseTrigger = false;
  2. let isFirstPhaseTriggered = false;
  3.  
  4. outputsArray.forEach(out => {
  5.   out.setHighVoltage(311.127);
  6.   out.setLowVoltage(-311.127);
  7.   out.setState(false);
  8. });
  9.  
  10. if (in2.getVoltage() == 0) {
  11.   isFirstPhaseTriggered = false;
  12. }
  13.  
  14. if (in2.getVoltage() == -311.127) {
  15.   if (firstPhaseTrigger == true) {
  16.     firstPhaseTrigger = false;
  17.     isFirstPhaseTriggered = true;
  18.   } else if (firstPhaseTrigger == false) {
  19.     firstPhaseTrigger = true;
  20.     isFirstPhaseTriggered = true;
  21.   }
  22. }
  23.  
  24. if (firstPhaseTrigger == true) {
  25.   if (in2.getVoltage() <= in3.getVoltage()) {
  26.     out0.setState(false);
  27.     out3.setState(false);
  28.   } else if (in2.getVoltage() > in3.getVoltage()) {
  29.     out0.setState(true);
  30.     out3.setState(true);
  31.   }
  32. } else if (firstPhaseTrigger == false) {
  33.   if (in2.getVoltage() <= in3.getVoltage()) {
  34.     out1.setState(false);
  35.     out2.setState(false);
  36.   } else if (in2.getVoltage() > in3.getVoltage()) {
  37.     out1.setState(true);
  38.     out2.setState(true);
  39.   }
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement