public virtual void PowerUpdateCurrentChange() { //Logger.Log("PowerUpdateCurrentChange()"+ this); if (powerSupply.Data.ResistanceComingFrom.Count > 0) { powerSupply.FlushSupplyAndUp(powerSupply.gameObject); //Room for optimisation CircuitResistance = ElectricityFunctions.WorkOutResistance(powerSupply.Data.ResistanceComingFrom[powerSupply.gameObject.GetInstanceID()]); // //!! ActualVoltage = powerSupply.Data.ActualVoltage; BatteryCalculation.PowerUpdateCurrentChange(this); if (current != Previouscurrent) { if (Previouscurrent == 0 && !(current <= 0)) { } else if (current == 0 && !(Previouscurrent <= 0)) { powerSupply.FlushSupplyAndUp(powerSupply.gameObject); } powerSupply.Data.SupplyingCurrent = current; Previouscurrent = current; } } powerSupply.PowerUpdateCurrentChange(); _PowerUpdateCurrentChange(); }
public void PowerUpdateCurrentChange() { RelatedDevice.FlushSupplyAndUp(RelatedDevice.gameObject); //Room for optimisation CircuitResistance = ElectricityFunctions.WorkOutResistance(RelatedDevice.ResistanceComingFrom [RelatedDevice.gameObject.GetInstanceID()]); // //!! ActualVoltage = RelatedDevice.ActualVoltage; BatteryCalculation.PowerUpdateCurrentChange(this); if (current != Previouscurrent) { if (Previouscurrent == 0 && !(current <= 0)) { // } else if (current == 0 && !(Previouscurrent <= 0)) { RelatedDevice.FlushSupplyAndUp(RelatedDevice.gameObject); //powerSupply.TurnOffSupply(); } RelatedDevice.SupplyingCurrent = current; Previouscurrent = current; } //if (current > 0) { RelatedDevice.PowerUpdateCurrentChange(); //} }