Пример #1
0
        public static void ElectricityInput(VIRCurrent current,
                                            ElectricalOIinheritance sourceInstance,
                                            IntrinsicElectronicData comingFrom,
                                            IntrinsicElectronicData thiswire)
        {
            if (thiswire.Data.SupplyDependent.TryGetValue(sourceInstance, out ElectronicSupplyData supplyDep))
            {
                if (supplyDep.CurrentComingFrom.TryGetValue(comingFrom, out VIRCurrent currentComFrom))
                {
                    currentComFrom.addCurrent(current);
                }
                else
                {
                    supplyDep.CurrentComingFrom[comingFrom] = current;
                }

                if (!(supplyDep.ResistanceComingFrom.Count > 0))
                {
                    var sync = ElectricalManager.Instance.electricalSync;
                    sync.StructureChange = true;
                    sync.NUStructureChangeReact.Add(thiswire.ControllingDevice);
                    sync.NUResistanceChange.Add(thiswire.ControllingDevice);
                    sync.NUCurrentChange.Add(thiswire.ControllingDevice);
                    Logger.LogErrorFormat("Resistance isn't initialised on", Category.Electrical);
                    return;
                }

                supplyDep.SourceVoltage = (float)current.Current() * ElectricityFunctions.WorkOutResistance(supplyDep.ResistanceComingFrom);
            }

            //ELCurrent.CurrentWorkOnNextListADD(Thiswire);
            thiswire.ElectricityOutput(current, sourceInstance);
        }
Пример #2
0
        public static void ElectricityOutput(VIRCurrent Current,
                                             ElectricalOIinheritance SourceInstance,
                                             IntrinsicElectronicData Thiswire)
        {
            //Logger.Log("4 > " + Current);
            //Logger.Log("poke > " + SourceInstance.InData.Data.SupplyDependent[SourceInstance].ToString());
            var        OutputSupplyingUsingData = Thiswire.Data.SupplyDependent[SourceInstance];
            VIRCurrent SupplyingCurrent         = null;
            float      Divider = (ElectricityFunctions.WorkOutResistance(OutputSupplyingUsingData.ResistanceComingFrom));

            foreach (KeyValuePair <IntrinsicElectronicData, VIRResistances> JumpTo in OutputSupplyingUsingData
                     .ResistanceComingFrom)
            {
                if (OutputSupplyingUsingData.ResistanceComingFrom.Count > 1)
                {
                    SupplyingCurrent = Current.SplitCurrent(Divider / JumpTo.Value.Resistance());
                }
                else
                {
                    SupplyingCurrent = Current;
                }

                OutputSupplyingUsingData.CurrentGoingTo[JumpTo.Key] = SupplyingCurrent;
                if (JumpTo.Key != null && JumpTo.Key.Categorytype != PowerTypeCategory.DeadEndConnection)
                {
                    JumpTo.Key.ElectricityInput(SupplyingCurrent, SourceInstance, Thiswire);
                }
            }
        }
Пример #3
0
 public virtual void ShowDetails()
 {
     ElectricityFunctions.WorkOutActualNumbers(this);
     Logger.Log("connections " + (string.Join(",", Data.connections)), Category.Electrical);
     //Logger.Log("ID " + (this.GetInstanceID()), Category.Electrical);
     Logger.Log("Type " + (Categorytype.ToString()), Category.Electrical);
     Logger.Log("Can connect to " + (string.Join(",", CanConnectTo)), Category.Electrical);
     Logger.Log("WireEndA > " + WireEndA + " WireEndB > " + WireEndB, Category.Electrical);
     foreach (var Supply in Data.SupplyDependent)
     {
         string ToLog;
         ToLog  = "Supply > " + Supply.Key + "\n";
         ToLog += "Upstream > ";
         ToLog += string.Join(",", Supply.Value.Upstream) + "\n";
         ToLog += "Downstream > ";
         ToLog += string.Join(",", Supply.Value.Downstream) + "\n";
         ToLog += "ResistanceGoingTo > ";
         ToLog += string.Join(",", Supply.Value.ResistanceGoingTo) + "\n";
         ToLog += "ResistanceComingFrom > ";
         ToLog += string.Join(",", Supply.Value.ResistanceComingFrom) + "\n";
         ToLog += "CurrentComingFrom > ";
         ToLog += string.Join(",", Supply.Value.CurrentComingFrom) + "\n";
         ToLog += "CurrentGoingTo > ";
         ToLog += string.Join(",", Supply.Value.CurrentGoingTo) + "\n";
         ToLog += "SourceVoltages > ";
         ToLog += string.Join(",", Supply.Value.SourceVoltage) + "\n";
         Logger.Log(ToLog, Category.Electrical);
     }
     Logger.Log(" ActualVoltage > " + Data.ActualVoltage
                + " CurrentInWire > " + Data.CurrentInWire
                + " EstimatedResistance >  " + Data.EstimatedResistance, Category.Electrical);
 }
        public virtual string ShowDetails()
        {
            StringBuilder SB = new StringBuilder();

            ElectricityFunctions.WorkOutActualNumbers(this);
            SB.Append("connections " + (string.Join(",", Data.connections)));
            SB.Append("\n");
            SB.Append("Type " + (Categorytype.ToString()));
            SB.Append("\n");
            SB.Append("Can connect to " + (string.Join(",", CanConnectTo)));
            SB.Append("\n");
            SB.Append("WireEndA > " + WireEndA + " WireEndB > " + WireEndB);
            foreach (var Supply in Data.SupplyDependent)
            {
                SB.Append("Supply > " + Supply.Key + "\n");
                SB.Append("Upstream > ");
                SB.Append(string.Join(",", Supply.Value.Upstream) + "\n");
                SB.Append("Downstream > ");
                SB.Append(string.Join(",", Supply.Value.Downstream) + "\n");
                SB.Append("ResistanceGoingTo > ");
                SB.Append(string.Join(",", Supply.Value.ResistanceGoingTo) + "\n");
                SB.Append("ResistanceComingFrom > ");
                SB.Append(string.Join(",", Supply.Value.ResistanceComingFrom) + "\n");
                SB.Append("CurrentComingFrom > ");
                SB.Append(string.Join(",", Supply.Value.CurrentComingFrom) + "\n");
                SB.Append("CurrentGoingTo > ");
                SB.Append(string.Join(",", Supply.Value.CurrentGoingTo) + "\n");
                SB.Append("SourceVoltages > ");
                SB.Append(string.Join(",", Supply.Value.SourceVoltage) + "\n");
            }
            SB.Append(" ActualVoltage > " + Data.ActualVoltage
                      + " CurrentInWire > " + Data.CurrentInWire
                      + " EstimatedResistance >  " + Data.EstimatedResistance);
            return(SB.ToString());
        }
Пример #5
0
 public virtual void FindPossibleConnections()
 {
     InData.Data.connections.Clear();
     ElectricityFunctions.FindPossibleConnections(
         Locatedon,
         InData.CanConnectTo,
         InData.GetConnPoints(),
         InData,
         InData.Data.connections
         );
 }
Пример #6
0
 public virtual void FindPossibleConnections()
 {
     InData.Data.connections.Clear();
     if (registerTile != null)
     {
         ElectricityFunctions.FindPossibleConnections(
             Matrix,
             InData.CanConnectTo,
             GetConnPoints(),
             InData,
             InData.Data.connections
             );
     }
 }
Пример #7
0
 public string ShowInGameDetails()
 {
     ElectricityFunctions.WorkOutActualNumbers(this);
     return("Component : " + Categorytype + "\nVoltage > " + Data.ActualVoltage.ToEngineering("V") + " Current > " + Data.CurrentInWire.ToEngineering("A"));
 }
 public string ShowInGameDetails()
 {
     ElectricityFunctions.WorkOutActualNumbers(this);
     return($"{Categorytype}: {Data.ActualVoltage.ToEngineering("V")}, {Data.CurrentInWire.ToEngineering("A")}");
 }