Ejemplo n.º 1
0
        private bool FilterIncludesAvgSpatialDataForFlowType(int flowTypeId)
        {
            FlowType ft = this.m_FlowTypes[flowTypeId];

            foreach (FlowGroupLinkage l in ft.FlowGroupLinkages)
            {
                if (this.FilterIncludesAvgSpatialDataForFlowGroup(l.FlowGroup.Id))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        private FlowGroup GetAutoGeneratedFlowGroup(FlowType t)
        {
            string n = DataTableUtilities.GetAutoGeneratedGroupName(t.Name);

            foreach (FlowGroup g in this.m_FlowGroups)
            {
                if (g.Name == n)
                {
                    return(g);
                }
            }

            throw new ArgumentException("Auto-generated group not found for flow type: " + t.Name);
        }
        private double GetFlowLateralMultiplier(int flowTypeId, Cell cell, int iteration, int timestep)
        {
            double   Multiplier = 1.0;
            FlowType ft         = this.m_FlowTypes[flowTypeId];

            foreach (FlowMultiplierType mt in this.m_FlowMultiplierTypes)
            {
                foreach (FlowGroupLinkage fgl in ft.FlowGroupLinkages)
                {
                    if (this.m_IsSpatial && mt.FlowLateralMultiplierMap != null)
                    {
                        Multiplier *= this.GetFlowLateralMultiplier(
                            cell,
                            mt.FlowLateralMultiplierMap,
                            fgl.FlowGroup.Id,
                            iteration,
                            timestep);
                    }
                }
            }

            Debug.Assert(Multiplier >= 0.0);
            return(Multiplier);
        }
Ejemplo n.º 4
0
        private void RecordSummaryFlowOutputData(
            int timestep,
            Cell cell,
            DeterministicTransition deterministicPathway,
            Transition probabilisticPathway,
            FlowPathway flowPathway,
            double flowAmount)
        {
            int?TransitionTypeId = null;
            int StratumIdDest    = cell.StratumId;
            int StateClassIdDest = cell.StateClassId;

            if (probabilisticPathway != null)
            {
                TransitionTypeId = probabilisticPathway.TransitionTypeId;

                if (probabilisticPathway.StratumIdDestination.HasValue)
                {
                    StratumIdDest = probabilisticPathway.StratumIdDestination.Value;
                }

                if (probabilisticPathway.StateClassIdDestination.HasValue)
                {
                    StateClassIdDest = probabilisticPathway.StateClassIdDestination.Value;
                }
            }
            else
            {
                if (deterministicPathway != null)
                {
                    if (deterministicPathway.StratumIdDestination.HasValue)
                    {
                        StratumIdDest = deterministicPathway.StratumIdDestination.Value;
                    }

                    if (deterministicPathway.StateClassIdDestination.HasValue)
                    {
                        StateClassIdDest = deterministicPathway.StateClassIdDestination.Value;
                    }
                }
            }

            if (this.m_STSimTransformer.IsOutputTimestep(
                    timestep,
                    this.m_SummaryFlowOutputTimesteps,
                    this.m_CreateSummaryFlowOutput))
            {
                FlowType t = this.m_FlowTypes[flowPathway.FlowTypeId];

                foreach (FlowGroupLinkage l in t.FlowGroupLinkages)
                {
                    if (!l.FlowGroup.OutputFilter.HasFlag(Constants.OutputFilter.Tabular))
                    {
                        continue;
                    }

                    FifteenIntegerLookupKey k = new FifteenIntegerLookupKey(
                        cell.StratumId,
                        GetSecondaryStratumIdKey(cell),
                        GetTertiaryStratumIdKey(cell),
                        cell.StateClassId,
                        LookupKeyUtilities.GetOutputCollectionKey(flowPathway.FromStockTypeId),
                        LookupKeyUtilities.GetOutputCollectionKey(TransitionTypeId),
                        StratumIdDest,
                        StateClassIdDest,
                        LookupKeyUtilities.GetOutputCollectionKey(flowPathway.ToStockTypeId),
                        l.FlowGroup.Id,
                        LookupKeyUtilities.GetOutputCollectionKey(flowPathway.TransferToStratumId),
                        LookupKeyUtilities.GetOutputCollectionKey(flowPathway.TransferToSecondaryStratumId),
                        LookupKeyUtilities.GetOutputCollectionKey(flowPathway.TransferToTertiaryStratumId),
                        LookupKeyUtilities.GetOutputCollectionKey(flowPathway.TransferToStateClassId),
                        LookupKeyUtilities.GetOutputCollectionKey(flowPathway.TransferToMinimumAge));

                    if (this.m_SummaryOutputFlowRecords.Contains(k))
                    {
                        OutputFlow r = this.m_SummaryOutputFlowRecords[k];
                        r.Amount += (flowAmount * l.Value);
                    }
                    else
                    {
                        OutputFlow r = new OutputFlow(
                            cell.StratumId,
                            GetSecondaryStratumIdValue(cell),
                            GetTertiaryStratumIdValue(cell),
                            cell.StateClassId,
                            flowPathway.FromStockTypeId,
                            TransitionTypeId,
                            StratumIdDest,
                            StateClassIdDest,
                            flowPathway.ToStockTypeId,
                            l.FlowGroup.Id,
                            flowPathway.TransferToStratumId,
                            flowPathway.TransferToSecondaryStratumId,
                            flowPathway.TransferToTertiaryStratumId,
                            flowPathway.TransferToStateClassId,
                            flowPathway.TransferToMinimumAge,
                            flowAmount * l.Value);

                        this.m_SummaryOutputFlowRecords.Add(r);
                    }
                }
            }
        }