public Assemblies Remove(Assemblies assemblies)
        {
            var    j1  = (int)Math.Ceiling(assemblies.E1 / DeltaE);
            var    j2  = (int)Math.Ceiling(assemblies.E2 / DeltaE);
            double sum = 0;

            for (int j = j1; j <= j2; j++)
            {
                sum += NArray[j] * DeltaE;
            }
            var alpha = assemblies.Count / sum; //TODO; а что если там нет ТВС и сумма = 0?

            if (alpha > 1)
            {
                alpha = 1;
            }
            for (int j = j1; j <= j2; j++)
            {
                NArray[j] -= alpha * NArray[j];
            }
            Protocol.Add(NArray);
            OnPropertyChanged("AssembliesCount");
            // Fuel();
            return(new Assemblies {
                Count = alpha * sum, E1 = assemblies.E1, E2 = assemblies.E2
            });
        }
Esempio n. 2
0
 protected override void Context()
 {
     base.Context();
     _targetProtocol = new SimpleProtocol {
         DomainHelperForSpecs.ConstantParameterWithValue(1).WithName <IParameter>("SimpleParameter")
     };
     _sourceProtocol = new AdvancedProtocol {
         Id = "Id", Name = "Advanced Protocol", Description = "tralala"
     };
     _sourceProtocol.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName <IParameter>("AdvancedParameter"));
 }
        public void Insert(Assemblies assemblies)
        {
            var j1 = (int)Math.Ceiling(assemblies.E1 / DeltaE);
            var j2 = (int)Math.Ceiling(assemblies.E2 / DeltaE);

            {
                for (int j = j1; j <= j2; j++)
                {
                    NArray[j] += assemblies.Count / (assemblies.E2 - assemblies.E1);
                }
            }
            Protocol.Add(NArray);
            // Fuel();
            OnPropertyChanged("AssembliesCount");
        }