Esempio n. 1
0
        internal void AddTransitionMultiplierValue(TransitionMultiplierValue multiplier)
        {
            if (multiplier.TransitionMultiplierTypeId != this.m_TransitionMultiplierTypeId)
            {
                throw new ArgumentException("The transition multiplier type is not correct.");
            }

            this.m_TransitionMultiplierValues.Add(multiplier);
        }
        private double GetTransitionMultiplier(int transitionTypeId, int iteration, int timestep, Cell simulationCell)
        {
            if (this.m_TransitionMultiplierValues.Count == 0)
            {
#if DEBUG
                foreach (TransitionMultiplierType tmt in this.m_TransitionMultiplierTypes)
                {
                    Debug.Assert(tmt.TransitionMultiplierValueMap == null);
                }
#endif

                return(1.0);
            }

            Debug.Assert(this.m_TransitionMultiplierTypes.Count > 0);

            double         Product = 1.0;
            TransitionType tt      = this.m_TransitionTypes[transitionTypeId];

            foreach (TransitionMultiplierType tmt in this.m_TransitionMultiplierTypes)
            {
                if (tmt.TransitionMultiplierValueMap != null)
                {
                    foreach (TransitionGroup tg in tt.TransitionGroups)
                    {
                        List <TransitionMultiplierValue> Multipliers = tmt.TransitionMultiplierValueMap.GetTransitionMultipliers(
                            tg.TransitionGroupId,
                            simulationCell.StratumId,
                            simulationCell.SecondaryStratumId,
                            simulationCell.TertiaryStratumId,
                            simulationCell.StateClassId,
                            iteration,
                            timestep);

                        if (Multipliers != null)
                        {
                            TransitionMultiplierValue v = GetMultiplierCheckAgesAndTST(Multipliers, simulationCell);

                            if (v != null)
                            {
                                v.Sample(iteration, timestep, this.m_DistributionProvider, DistributionFrequency.Always);
                                Product *= v.CurrentValue.Value;
                            }
                        }
                    }
                }
            }

            return(Product);
        }