Ejemplo n.º 1
0
    public static void ElectricityInput(float Current, GameObject SourceInstance, ElectricalOIinheritance ComingFrom, ElectricalOIinheritance Thiswire)
    {
        //Logger.Log (tick.ToString () + " <tick " + Current.ToString () + " <Current " + SourceInstance.ToString () + " <SourceInstance " + ComingFrom.ToString () + " <ComingFrom " + Thiswire.ToString () + " <Thiswire ", Category.Electrical);
        int SourceInstanceID = SourceInstance.GetInstanceID();

        if (!(Thiswire.Data.SourceVoltages.ContainsKey(SourceInstanceID)))
        {
            Thiswire.Data.SourceVoltages[SourceInstanceID] = new float();
        }
        if (!(Thiswire.Data.CurrentComingFrom.ContainsKey(SourceInstanceID)))
        {
            Thiswire.Data.CurrentComingFrom[SourceInstanceID] = new Dictionary <ElectricalOIinheritance, float>();
        }
        Thiswire.Data.CurrentComingFrom[SourceInstanceID][ComingFrom] = Current;

        if (!(Thiswire.Data.ResistanceComingFrom.ContainsKey(SourceInstanceID)))
        {
            ElectricalSynchronisation.StructureChange = true;
            ElectricalSynchronisation.NUStructureChangeReact.Add(Thiswire.InData.ControllingUpdate);
            ElectricalSynchronisation.NUResistanceChange.Add(Thiswire.InData.ControllingUpdate);
            ElectricalSynchronisation.NUCurrentChange.Add(Thiswire.InData.ControllingUpdate);
            Logger.LogErrorFormat("Resistance isn't initialised on {1}", Category.Electrical, SourceInstance);
            return;
        }
        Thiswire.Data.SourceVoltages[SourceInstanceID] = Current * (ElectricityFunctions.WorkOutResistance(Thiswire.Data.ResistanceComingFrom[SourceInstanceID]));
        ELCurrent.CurrentWorkOnNextListADD(Thiswire);
        Thiswire.Data.CurrentStoreValue = ElectricityFunctions.WorkOutCurrent(Thiswire.Data.CurrentComingFrom[SourceInstanceID]);
    }
Ejemplo n.º 2
0
    public static void ElectricityInput(float Current, GameObject SourceInstance, ElectricalOIinheritance ComingFrom, ElectricalOIinheritance Thiswire)
    {
        //Logger.Log (tick.ToString () + " <tick " + Current.ToString () + " <Current " + SourceInstance.ToString () + " <SourceInstance " + ComingFrom.ToString () + " <ComingFrom " + Thiswire.ToString () + " <Thiswire ", Category.Electrical);
        int SourceInstanceID = SourceInstance.GetInstanceID();

        if (!(Thiswire.Data.SourceVoltages.ContainsKey(SourceInstanceID)))
        {
            Thiswire.Data.SourceVoltages[SourceInstanceID] = new float();
        }
        if (!(Thiswire.Data.CurrentComingFrom.ContainsKey(SourceInstanceID)))
        {
            Thiswire.Data.CurrentComingFrom[SourceInstanceID] = new Dictionary <ElectricalOIinheritance, float>();
        }
        Thiswire.Data.CurrentComingFrom[SourceInstanceID][ComingFrom] = Current;
        Thiswire.Data.SourceVoltages[SourceInstanceID] = Current * (ElectricityFunctions.WorkOutResistance(Thiswire.Data.ResistanceComingFrom[SourceInstanceID]));
        ELCurrent.CurrentWorkOnNextListADD(Thiswire);
        Thiswire.Data.CurrentStoreValue = ElectricityFunctions.WorkOutCurrent(Thiswire.Data.CurrentComingFrom[SourceInstanceID]);
    }
Ejemplo n.º 3
0
    public static void ElectricityInput(float Current, GameObject SourceInstance, ElectricalOIinheritance ComingFrom, ElectricalOIinheritance Thiswire)
    {
        //Logger.Log (" <Current " + SourceInstance.ToString () + " <SourceInstance " + ComingFrom.ToString () + " <ComingFrom " + Thiswire.ToString () + " <Thiswire ", Category.Electrical);
        int SourceInstanceID = SourceInstance.GetInstanceID();

        ElectricalSynchronisation.InputSupplyingUsingData = Thiswire.Data.SupplyDependent[SourceInstanceID];
        ElectricalSynchronisation.InputSupplyingUsingData.CurrentComingFrom[ComingFrom] = Current;
        if (!(ElectricalSynchronisation.InputSupplyingUsingData.ResistanceComingFrom.Count > 0))
        {
            ElectricalSynchronisation.StructureChange = true;
            ElectricalSynchronisation.NUStructureChangeReact.Add(Thiswire.InData.ControllingDevice);
            ElectricalSynchronisation.NUResistanceChange.Add(Thiswire.InData.ControllingDevice);
            ElectricalSynchronisation.NUCurrentChange.Add(Thiswire.InData.ControllingDevice);
            //Logger.LogErrorFormat("Resistance isn't initialised on {1}", Category.Electrical, SourceInstance);
            return;
        }
        ElectricalSynchronisation.InputSupplyingUsingData.SourceVoltages = Current * (ElectricityFunctions.WorkOutResistance(ElectricalSynchronisation.InputSupplyingUsingData.ResistanceComingFrom));
        ELCurrent.CurrentWorkOnNextListADD(Thiswire);
        Thiswire.Data.CurrentStoreValue = ElectricityFunctions.WorkOutCurrent(ElectricalSynchronisation.InputSupplyingUsingData.CurrentComingFrom);
    }