public void AppendToQueryParameters(Dictionary <string, string> queryParameters) { if (Phased) { queryParameters.Add(Parameters.Phased, Phased.ToString()); queryParameters.Add(Parameters.PhasingFinishHeight, FinishHeight.ToString()); queryParameters.Add(Parameters.PhasingVotingModel, ((int)VotingModel).ToString()); queryParameters.Add(Parameters.PhasingQuorum, Quorum.ToString()); if (MinBalance > 0) { queryParameters.Add(Parameters.PhasingMinBalance, MinBalance.ToString()); } if (HoldingId > 0) { queryParameters.Add(Parameters.PhasingHolding, HoldingId.ToString()); } if (MinBalanceModel != MinBalanceModel.None) { queryParameters.Add(Parameters.PhasingMinBalanceModel, ((int)MinBalanceModel).ToString()); } WhiteListed.ForEach(w => queryParameters.Add(Parameters.PhasingWhitelisted, w.AccountRs)); LinkedFullHash.ForEach(h => queryParameters.Add(Parameters.PhasingLinkedFullHash, h.ToHexString())); if (HashedSecret != null) { queryParameters.Add(Parameters.PhasingHashedSecret, HashedSecret.ToHexString()); } if (HashedSecretAlgorithm.HasValue) { queryParameters.Add(Parameters.PhasingHashedSecretAlgorithm, ((int)HashedSecretAlgorithm.Value).ToString()); } } }
/// <summary> /// Instantiates a new <see cref="CachedPhasedReadOnlyEvaluated{TFrom,T}"/> /// </summary> /// <param name="transform">The transform to apply to the elements of the backing <see cref="Phased{T}"/>.</param> /// <param name="theBase">The backing <see cref="Phased{T}"/>.</param> public CachedPhasedReadOnlyEvaluated(Func <TFrom, T> transform, Phased <TFrom> theBase) { this.basePhased = theBase; this.transform = transform; this.getTransform = CacheTransform; buffer = new Dictionary <TFrom, T>(); }
/// <summary> /// Instantiates a new <see cref="Bus"/>. This constructor supports /// arbitrarily-phased networks, including three-phase balanced and single-phase. /// </summary> /// <param name="ID">The ID of the bus. Should be unique among buses, but /// does not need to be unique amongst all network elements.</param> /// <param name="VoltagePhased">The absolute line-neutral voltage of each /// phase of the bus.</param> /// <param name="BaseVoltage">The single-phase base voltage of the bus /// (in Volts).</param> /// <param name="Location">The XY coordinates of the bus. Used for /// graphing the network.</param> public Bus(String ID, Phased <Complex> VoltagePhased, double BaseVoltage, Point?Location) { this.VoltagePhased = VoltagePhased; this.ID = ID; this.BaseVoltage = BaseVoltage; this.Location = Location; OnDeserialization(null); }
/// <summary> /// Instantiates a new <see cref="Bus"/>. This constructor supports /// arbitrarily-phased networks, including three-phase balanced and single-phase. /// </summary> /// <param name="ID">The ID of the bus. Should be unique among buses, but /// does not need to be unique amongst all network elements.</param> /// <param name="VoltagePhased">The absolute line-neutral voltage of each /// phase of the bus.</param> /// <param name="BaseVoltage">The single-phase base voltage of the bus /// (in Volts).</param> /// <param name="Location">The XY coordinates of the bus. Used for /// graphing the network.</param> public Bus(String ID, Phased<Complex> VoltagePhased, double BaseVoltage, Point? Location) { this.VoltagePhased = VoltagePhased; this.ID = ID; this.BaseVoltage = BaseVoltage; this.Location = Location; OnDeserialization(null); }
public Bus() // or OnDeserializationCallback, whatever { VoltagePUPhased = new PhasedEvaluated <Complex, Complex>( from => from / this.BaseVoltage, //get to => to * this.BaseVoltage, //set VoltagePhased ); }
/// <summary> /// Reconstructs the <see cref="Bus"/> when it has just been deserialised. /// </summary> /// <param name="sender">Not used.</param> public override void OnDeserialization(object sender) { base.OnDeserialization(sender); this._VoltagePUPhased = new PhasedEvaluated <Complex, Complex>( from => from / this.BaseVoltage, //get to => to * this.BaseVoltage, //set VoltagePhased ); }
/// <summary> /// Instantiates a new <see cref="Generator"/>. This constructor is /// for building balanced networks only. /// </summary> /// <param name="ID">The ID of the generator. Must be unique among /// generators, but not among network elements.</param> /// <param name="Generation">The total generation (in kVA) of /// the generator.</param> /// <param name="NumPhases">The number of phases to split the total generation between.</param> public Generator(String ID, Complex Generation, int NumPhases = 3) { this.ID = ID; this.GenerationPhased = new PhasedValues <Complex>(); foreach (int phase in Enumerable.Range(1, NumPhases)) { GenerationPhased[phase] = Generation / NumPhases; } }
/// <summary> /// Reconstructs the <see cref="NetworkElement"/> after deserialisation. /// </summary> /// <param name="sender">This value is unused.</param> public virtual void OnDeserialization(object sender) { _ConnectedToPhasedReadOnly = new CachedPhasedReadOnlyEvaluated <Collection <NetworkElementConnection>, ReadOnlyCollection <NetworkElementConnection> >(x => new ReadOnlyCollection <NetworkElementConnection>(x), _ConnectedToPhased ); }
/// <summary> /// Instantiates a new <see cref="Load"/>. This constructor is /// for building balanced networks only. /// </summary> /// <param name="ID">The ID of the load.</param> /// <param name="ActualKVA">The total kVA absorbed by the load.</param> /// <param name="NumPhases">The number of phases to split <paramref name="ActualKVA"/> between.</param> public Load(String ID, Complex ActualKVA, int NumPhases = 3) { this.ID = ID; this.ActualKVAPhased = new PhasedValues <Complex>(); foreach (int phase in Enumerable.Range(1, NumPhases)) { ActualKVAPhased[phase] = ActualKVA / NumPhases; } }
public override bool Unmutate(GameObject GO) { Phased Phased = ParentObject.GetEffect("Phased") as Phased; if (ParentObject.HasEffect("Phased")) { ParentObject.RemoveEffect(Phased); } return(base.Unmutate(GO)); }
public static void ApplyTileToEffects(GameObject target, string newTile) { //Sets the new tile to several effects that would otherwise override it. if (target.HasPart(typeof(HologramMaterial))) { HologramMaterial part = target.GetPart <HologramMaterial>(); part.Tile = newTile; } if (target.HasPart(typeof(HologramMaterialPrimary))) { HologramMaterialPrimary part = target.GetPart <HologramMaterialPrimary>(); part.Tile = newTile; } if (target.HasEffect <Phased>()) { Phased effect = target.GetEffect <Phased>(); effect.Tile = newTile; } }
/// <summary> /// Instantiates a new <see cref="PhasedEvaluated{TFrom, TTo}"/> with the specified transforms and base phased object. /// </summary> /// <param name="getTransform">A transform translating values from <paramref name="basePhased"/> to this <see cref="PhasedEvaluated{TFrom, TTo}"/>, for get operations.</param> /// <param name="setTransform">A transform translating values from this <see cref="PhasedEvaluated{TFrom, TTo}"/> to <paramref name="basePhased"/>, for set operations.</param> /// <param name="basePhased">The base phased object from which to get and set values from and to.</param> public PhasedEvaluated(Func <TFrom, TTo> getTransform, Func <TTo, TFrom> setTransform, Phased <TFrom> basePhased) { this.getTransform = getTransform; this.setTransform = setTransform; this.basePhased = basePhased; }
/// <summary> /// Instantiates a new <see cref="PhasedReadOnlyEvaluated{TFrom,T}"/>. /// </summary> /// <param name="getTransform">A function that converts from <typeparamref name="TFrom"/> to <typeparamref name="T"/>.</param> /// <param name="basePhased">The backing <see cref="Phased{TFrom}"/>.</param> public PhasedReadOnlyEvaluated(Func <TFrom, T> getTransform, Phased <TFrom> basePhased) { this.getTransform = getTransform; this.basePhased = basePhased; }
/// <summary> /// Instantiates a new <see cref="Load"/>. This constructor is /// for building arbitrarily-phased networks. /// </summary> /// <param name="ID">The ID of the load.</param> /// <param name="ActualKVAPhased">The phased kVA absorbed by the load.</param> public Load(String ID, Phased <Complex> ActualKVAPhased) { this.ID = ID; this.ActualKVAPhased = ActualKVAPhased; }
/// <summary> /// Instantiates a new <see cref="Generator"/>. This constructor is /// for building arbitrarily-phased networks. /// </summary> /// <param name="ID">The ID of the generator. Must be unique among /// generators, but not among network elements.</param> /// <param name="Generation">The phased generation (in kVA) of /// the generator.</param> public Generator(String ID, Phased <Complex> Generation) { this.ID = ID; this.GenerationPhased = Generation; }
/// <summary> /// Instantiate a new <see cref="NetworkElement"/>. Initialises the network element /// to be connected to nothing. /// </summary> public NetworkElement() { _ConnectedToPhased = new PhasedValues <Collection <NetworkElementConnection> >(); OnDeserialization(null); }
/// <summary> /// Reconstructs the <see cref="Bus"/> when it has just been deserialised. /// </summary> /// <param name="sender">Not used.</param> public override void OnDeserialization(object sender) { base.OnDeserialization(sender); this._VoltagePUPhased = new PhasedEvaluated<Complex,Complex>( from => from / this.BaseVoltage, //get to => to * this.BaseVoltage, //set VoltagePhased ); }
/// <summary> /// Instantiate a new <see cref="NetworkElement"/>. Initialises the network element /// to be connected to nothing. /// </summary> public NetworkElement() { _ConnectedToPhased = new PhasedValues<Collection<NetworkElementConnection>>(); OnDeserialization(null); }
/// <summary> /// Reconstructs the <see cref="NetworkElement"/> after deserialisation. /// </summary> /// <param name="sender">This value is unused.</param> public virtual void OnDeserialization(object sender) { _ConnectedToPhasedReadOnly = new CachedPhasedReadOnlyEvaluated<Collection<NetworkElementConnection>, ReadOnlyCollection<NetworkElementConnection> >(x => new ReadOnlyCollection<NetworkElementConnection>(x), _ConnectedToPhased ); }
/// <summary> /// Instantiates a new <see cref="Load"/>. This constructor is /// for building arbitrarily-phased networks. /// </summary> /// <param name="ID">The ID of the load.</param> /// <param name="ActualKVAPhased">The phased kVA absorbed by the load.</param> public Load(String ID, Phased<Complex> ActualKVAPhased) { this.ID = ID; this.ActualKVAPhased = ActualKVAPhased; }
/// <summary> /// Instantiates a new <see cref="Generator"/>. This constructor is /// for building arbitrarily-phased networks. /// </summary> /// <param name="ID">The ID of the generator. Must be unique among /// generators, but not among network elements.</param> /// <param name="Generation">The phased generation (in kVA) of /// the generator.</param> public Generator(String ID, Phased<Complex> Generation) { this.ID = ID; this.GenerationPhased = Generation; }