public override void PowerUpdateCurrentChange()
    {
        if (ControllingNode.Node.Data.SupplyDependent[ControllingNode.Node.gameObject.GetInstanceID()].ResistanceComingFrom.Count > 0)
        {
            if (!(SlowResponse && PullingWatts == 0))
            {
                ControllingNode.Node.FlushSupplyAndUp(ControllingNode.Node.gameObject);                                                                                                        //Room for optimisation
                CircuitResistance   = ElectricityFunctions.WorkOutResistance(ControllingNode.Node.Data.SupplyDependent[ControllingNode.Node.gameObject.GetInstanceID()].ResistanceComingFrom); // //!!
                VoltageAtChargePort = ElectricityFunctions.WorkOutVoltageFromConnector(ControllingNode.Node, ResistanceSourceModule.ReactionTo.ConnectingDevice);
                VoltageAtSupplyPort = ElectricityFunctions.WorkOutVoltageFromConnectors(ControllingNode.Node, ControllingNode.CanConnectTo);
                BatteryCalculation.PowerUpdateCurrentChange(this);

                if (current != Previouscurrent)
                {
                    if (Previouscurrent == 0 && !(current <= 0))
                    {
                    }
                    else if (current == 0 && !(Previouscurrent <= 0))
                    {
                        ControllingNode.Node.FlushSupplyAndUp(ControllingNode.Node.gameObject);
                    }
                    ControllingNode.Node.Data.SupplyingCurrent = current;
                    Previouscurrent = current;
                }
            }
        }
        else
        {
            CircuitResistance = 999999999999;
        }
        PowerSupplyFunction.PowerUpdateCurrentChange(this);
    }
Esempio n. 2
0
 public void PowerUpdateCurrentChange()
 {
     PowerSupplyFunction.PowerUpdateCurrentChange(this);
 }