Exemple #1
0
        private Tst GetTstWithSmallestValue(TstCollection cellTst)
        {
            Tst Smallest = null;

            foreach (Tst tst in cellTst)
            {
                if (this.m_TSTGroupHint.ContainsKey(tst.TransitionGroupId) ||
                    this.m_TSTGroupHint.ContainsKey(AttributeValueReference.TST_GROUP_WILD))
                {
                    if (Smallest == null)
                    {
                        Smallest = tst;
                    }
                    else
                    {
                        if (tst.TstValue < Smallest.TstValue)
                        {
                            Smallest = tst;
                        }
                    }
                }
            }

            return(Smallest);
        }
        public double?GetAttributeValue(
            int stateAttributeTypeId, int stratumId, int?secondaryStratumId, int?tertiaryStratumId,
            int stateClassId, int iteration, int timestep, int age, TstCollection cellTst)
        {
            AttributeValueAgeBinCollection AgeBins = this.GetItem(
                stateAttributeTypeId, stratumId, secondaryStratumId, tertiaryStratumId,
                stateClassId, iteration, timestep);

            if (AgeBins == null)
            {
                return(null);
            }

            AttributeValueAgeBin Bin = AgeBins.GetAgeBin(age);

            if (Bin == null)
            {
                return(null);
            }

            AttributeValueReference AttrRef = Bin.GetReference(cellTst);

            if (AttrRef == null)
            {
                return(null);
            }

            STSimDistributionBase b = AttrRef.ClassRef;

            b.Sample(iteration, timestep, this.m_DistributionProvider, StochasticTime.DistributionFrequency.Always);

            return(b.CurrentValue.Value);
        }
Exemple #3
0
        public AttributeValueReference GetReference(TstCollection cellTst)
        {
            AttributeValueReference AttrRef = this.GetReferenceWithTST(cellTst);

            if (AttrRef == null)
            {
                AttrRef = this.GetReferenceWithoutTST();
            }

            return(AttrRef);
        }
Exemple #4
0
        private AttributeValueReference GetReferenceWithTST(TstCollection cellTst)
        {
            if (this.m_RefsWithTST.Count == 0 || cellTst.Count == 0)
            {
                return(null);
            }

            Tst tst = this.GetTstWithSmallestValue(cellTst);

            if (!this.m_TSTGroupHint.ContainsKey(tst.TransitionGroupId) &&
                !this.m_TSTGroupHint.ContainsKey(AttributeValueReference.TST_GROUP_WILD))
            {
                return(null);
            }

            AttributeValueReference FinalRef = null;

            foreach (AttributeValueReference attrRef in this.m_RefsWithTST)
            {
                if (attrRef.TSTGroupId != tst.TransitionGroupId &&
                    attrRef.TSTGroupId != AttributeValueReference.TST_GROUP_WILD)
                {
                    continue;
                }

                if (tst.TstValue >= attrRef.TSTMin && tst.TstValue <= attrRef.TSTMax)
                {
                    if (FinalRef == null)
                    {
                        FinalRef = attrRef;
                        continue;
                    }

                    if (attrRef.TSTMin > FinalRef.TSTMin)
                    {
                        FinalRef = attrRef;
                    }
                }
            }

            return(FinalRef);
        }