protected override void UpdateModule()
    {
        bool hasPower = !inputPower.voltage.IsZero();

        if (hasPower)
        {
            if (!inputLocalRemote.value)
            {
                receivedSwitchPulseSignal = inputRemoteSwitch.value;
            }
            else
            {
                receivedSwitchPulseSignal = inputLocalSwitch.value;
            }

            float width = switchSignalReader.ReadWidth(receivedSwitchPulseSignal, Time.deltaTime);
            if (width > 0.1f && width < 0.3f)
            {
                isOn = true;
            }
            else if (width >= 0.3f)
            {
                isOn = false;
            }
        }

        ElectricalPort.Transfer(inputPower, outputPower, isOn);
        outputSwitchState.value = isOn;
        if (hasPower)
        {
            outputCloseIndicator.value = isOn;
            outputOpenIndicator.value  = !isOn;
        }
        else
        {
            outputCloseIndicator.value = false;
            outputOpenIndicator.value  = false;
        }

        if (hasPower)
        {
            //Update Meters
            if (meter != null)
            {
                meter.text = ReadingsFormatter.Format(outputPower.current.magnitude);
            }
        }
        else
        {
            //Update Meters
            if (meter != null)
            {
                meter.text = "";
            }
        }
    }
    protected override void UpdateModule()
    {
        bool p = !inputPower.voltage.IsZero();

        if (hasPower != p)
        {
            hasPower = p;
            if (hasPower)
            {
                OnPowerOn();
            }
            else
            {
                OnPowerOff();
            }
        }

        if (!hasPower)
        {
            compensateLevel           = 0;
            outputCap1Indicator.value = false;
            outputCap2Indicator.value = false;
            outputCap3Indicator.value = false;
            //Calculate input current
            inputPower.current = new Complex(0, compensateLevel * compensateValue) * inputPower.voltage;
            meter.text         = "";

            return;
        }

        //Calculate input current
        inputPower.current = new Complex(0, compensateLevel * compensateValue) * inputPower.voltage;

        //Calculate compensate factor
        if (targetPort.current.IsZero())
        {
            compensateFactor = 0.99f;
        }
        else
        {
            compensateFactor = Mathf.Cos((targetPort.voltage / targetPort.current).argument);
        }

        meter.text = ReadingsFormatter.Format(compensateFactor);

        //Lit Cap Indicator
        int n = compensateLevel;

        outputCap1Indicator.value = n % 2 == 1;
        n /= 2;
        outputCap2Indicator.value = n % 2 == 1;
        n /= 2;
        outputCap3Indicator.value = n % 2 == 1;
    }
    protected override void UpdateModule()
    {
        bool hasPower = !inputPower.voltage.IsZero();

        if (hasPower && !groundClosed)//Process switching only when powered on
        {
            if (!inputLocalRemote.value)
            {
                receivedSwitchPulseSignal = inputRemoteSwitch.value;
            }
            else
            {
                receivedSwitchPulseSignal = inputSwitch.value;
            }


            float width = switchSignalReader.ReadWidth(receivedSwitchPulseSignal, Time.deltaTime);
            if (width > 0.1f && width < 0.3f)
            {
                StartCoroutine("OpenRoutine");
            }
            else if (width >= 0.3f)
            {
                StartCoroutine("CloseRoutine");
            }
            safeScreen.SetActive(true);
        }
        else if (!hasPower)
        {
            safeScreen.SetActive(false);
        }

        ElectricalPort.Transfer(inputPower, outputPower, isOn);
        outputSwitchState.value = isOn;

        if (hasPower)
        {
            outputCloseIndicator.value = isOn;
            outputOpenIndicator.value  = !isOn;

            outputGroundCloseIndicator.value = groundClosed;
            outputGroundOpenIndicator.value  = !groundClosed;
        }
        else
        {
            outputCloseIndicator.value = false;
            outputOpenIndicator.value  = false;

            outputGroundCloseIndicator.value = false;
            outputGroundOpenIndicator.value  = false;
        }

        if (inputVoltageMeter != null)
        {
            float volDisplay = inputPower.voltage.magnitude * phaseToWire;
            if (volDisplay > 1000)
            {
                inputVoltageMeter.text = (volDisplay / 1000f).ToString("f1") + "kV";
            }
            else
            {
                inputVoltageMeter.text = volDisplay.ToString("f0") + "V";
            }
        }

        if (hasPower)
        {
            //Update Meters
            if (triphaseMeter1 != null)
            {
                triphaseMeter1.text = ReadingsFormatter.Format(outputPower.current.magnitude);
            }
            if (triphaseMeter2 != null)
            {
                triphaseMeter2.text = ReadingsFormatter.Format(outputPower.current.magnitude);
            }
            if (triphaseMeter3 != null)
            {
                triphaseMeter3.text = ReadingsFormatter.Format(outputPower.current.magnitude);
            }
        }
        else
        {
            //Update Meters
            if (triphaseMeter1 != null)
            {
                triphaseMeter1.text = "";
            }
            if (triphaseMeter2 != null)
            {
                triphaseMeter2.text = "";
            }
            if (triphaseMeter3 != null)
            {
                triphaseMeter3.text = "";
            }
        }
    }