Advertisement
MaxSMoke

3 Phase Frequency Invertor

Jul 27th, 2023
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.25 KB | Source Code | 0 0
  1. var outputsArray = [out0, out1, out2, out3, out4, out5, out6, out7];
  2. global.declareBoolean("firstTrigger", false);
  3. global.declareBoolean("isFirstTriggered", false);
  4. function firstPhase() {
  5.   var firstTriggerState = firstTrigger.get();
  6.   outputsArray.forEach(out => {
  7.     out.setHighVoltage(in0.getVoltage());
  8.     out.setLowVoltage(in1.getVoltage());
  9.     out.setState(false);
  10.   });
  11.   if (in2.getVoltage() == 0) isFirstTriggered.set(false);
  12.  
  13.   if (in2.getVoltage() <= in1.getVoltage()) {
  14.     if (firstTriggerState == true) {
  15.       firstTrigger.set(false);
  16.       isFirstTriggered.set(true);
  17.     }
  18.     if (firstTriggerState == false) {
  19.       firstTrigger.set(true);
  20.       isFirstTriggered.set(true);
  21.     }
  22.   }
  23.  
  24.   if (firstTrigger.get() == 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 (firstTrigger.get() == 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. }
  42. firstPhase();
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement