public static bool AddMachinery2StockToStock(Machinery2Stock totalsMach2Stock,
                                                     double multiplier, Machinery2Stock currentMach2Stock)
        {
            bool bHasCalculations = false;

            //this should only be done at tp stock analysis level when the opcomps were correctly
            //adjusted by output collection and by tp.amount (i.e. use opcomp.ReSetParentTimePeriodProperties)
            totalsMach2Stock.TotalAmount             += (currentMach2Stock.TotalAmount * multiplier);
            totalsMach2Stock.TotalLaborAvailable     += (currentMach2Stock.TotalLaborAvailable);
            totalsMach2Stock.TotalWorkdayProbability += (currentMach2Stock.TotalWorkdayProbability);
            totalsMach2Stock.TotalTimelinessPenalty1 += (currentMach2Stock.TotalTimelinessPenalty1);
            totalsMach2Stock.TotalTimelinessPenaltyDaysFromStart1 += (currentMach2Stock.TotalTimelinessPenaltyDaysFromStart1);
            totalsMach2Stock.TotalTimelinessPenalty2 += (currentMach2Stock.TotalTimelinessPenalty2 * multiplier);
            totalsMach2Stock.TotalTimelinessPenaltyDaysFromStart2 += (currentMach2Stock.TotalTimelinessPenaltyDaysFromStart2);
            totalsMach2Stock.TotalWorkdaysLimit                += (currentMach2Stock.TotalWorkdaysLimit * multiplier);
            totalsMach2Stock.TotalFieldCapacity                += (currentMach2Stock.TotalFieldCapacity);
            totalsMach2Stock.TotalAreaCovered                  += (currentMach2Stock.TotalAreaCovered * multiplier);
            totalsMach2Stock.TotalFieldDays                    += (currentMach2Stock.TotalFieldDays * multiplier);
            totalsMach2Stock.TotalOutputPrice                  += (currentMach2Stock.TotalOutputPrice);
            totalsMach2Stock.TotalOutputYield                  += (currentMach2Stock.TotalOutputYield);
            totalsMach2Stock.TotalProbableFieldDays            += (currentMach2Stock.TotalProbableFieldDays * multiplier);
            totalsMach2Stock.TotalTimelinessPenaltyCost        += (currentMach2Stock.TotalTimelinessPenaltyCost * multiplier);
            totalsMach2Stock.TotalTimelinessPenaltyCostPerHour += (currentMach2Stock.TotalTimelinessPenaltyCostPerHour);
            totalsMach2Stock.TotalR += (currentMach2Stock.TotalR);
            bHasCalculations         = true;
            return(bHasCalculations);
        }
Exemple #2
0
        //add a TimelinessOpComp1 to the baseStat.Machinery2Stocks dictionary
        public static bool AddMachinery2StocksToDictionary(
            this Machinery2Stock baseStat,
            int filePosition, int nodePosition, TimelinessOpComp1 calculator)
        {
            bool bIsAdded = false;

            if (filePosition < 0 || nodePosition < 0)
            {
                baseStat.ErrorMessage
                    = Errors.MakeStandardErrorMsg("ANALYSES_INDEX_OUTOFBOUNDS");
                return(false);
            }
            if (baseStat.Machinery2Stocks == null)
            {
                baseStat.Machinery2Stocks
                    = new Dictionary <int, List <TimelinessOpComp1> >();
            }
            if (baseStat.Machinery2Stocks.ContainsKey(filePosition))
            {
                if (baseStat.Machinery2Stocks[filePosition] != null)
                {
                    for (int i = 0; i <= nodePosition; i++)
                    {
                        if (baseStat.Machinery2Stocks[filePosition].Count <= i)
                        {
                            baseStat.Machinery2Stocks[filePosition]
                            .Add(new TimelinessOpComp1());
                        }
                    }
                    baseStat.Machinery2Stocks[filePosition][nodePosition]
                             = calculator;
                    bIsAdded = true;
                }
            }
            else
            {
                //add the missing dictionary entry
                List <TimelinessOpComp1> baseStats
                    = new List <TimelinessOpComp1>();
                KeyValuePair <int, List <TimelinessOpComp1> > newStat
                    = new KeyValuePair <int, List <TimelinessOpComp1> >(
                          filePosition, baseStats);
                baseStat.Machinery2Stocks.Add(newStat);
                bIsAdded = AddMachinery2StocksToDictionary(baseStat,
                                                           filePosition, nodePosition, calculator);
            }
            return(bIsAdded);
        }
Exemple #3
0
        public static int GetNodePositionCount(this Machinery2Stock baseStat,
                                               int filePosition, TimelinessOpComp1 calculator)
        {
            int iNodeCount = 0;

            if (baseStat.Machinery2Stocks == null)
            {
                return(iNodeCount);
            }
            if (baseStat.Machinery2Stocks.ContainsKey(filePosition))
            {
                if (baseStat.Machinery2Stocks[filePosition] != null)
                {
                    iNodeCount = baseStat.Machinery2Stocks[filePosition].Count;
                }
            }
            return(iNodeCount);
        }
Exemple #4
0
 public virtual void CopyTotalMachinery2StockProperties(
     Machinery2Stock calculator)
 {
     this.TotalAmount             = calculator.TotalAmount;
     this.TotalLaborAvailable     = calculator.TotalLaborAvailable;
     this.TotalWorkdayProbability = calculator.TotalWorkdayProbability;
     this.TotalTimelinessPenalty1 = calculator.TotalTimelinessPenalty1;
     this.TotalTimelinessPenaltyDaysFromStart1 = calculator.TotalTimelinessPenaltyDaysFromStart1;
     this.TotalTimelinessPenalty2 = calculator.TotalTimelinessPenalty2;
     this.TotalTimelinessPenaltyDaysFromStart2 = calculator.TotalTimelinessPenaltyDaysFromStart2;
     this.TotalWorkdaysLimit                = calculator.TotalWorkdaysLimit;
     this.TotalAreaCovered                  = calculator.TotalAreaCovered;
     this.TotalFieldCapacity                = calculator.TotalFieldCapacity;
     this.TotalFieldDays                    = calculator.TotalFieldDays;
     this.TotalOutputPrice                  = calculator.TotalOutputPrice;
     this.TotalOutputYield                  = calculator.TotalOutputYield;
     this.TotalCompositionAmount            = calculator.TotalCompositionAmount;
     this.TotalOutputTimes                  = calculator.TotalOutputTimes;
     this.TotalProbableFieldDays            = calculator.TotalProbableFieldDays;
     this.TotalTimelinessPenaltyCost        = calculator.TotalTimelinessPenaltyCost;
     this.TotalTimelinessPenaltyCostPerHour = calculator.TotalTimelinessPenaltyCostPerHour;
     this.TotalR = calculator.TotalR;
 }
Exemple #5
0
 //copy constructor
 public Machinery2Stock(Machinery2Stock calculator)
     : base(calculator)
 {
     CopyTotalMachinery2StockProperties(calculator);
 }