Skip to content

Commit

Permalink
Merge pull request #8 from ApexRMS/kb-stock-flow-multipliers
Browse files Browse the repository at this point in the history
Kb stock flow multipliers
  • Loading branch information
katieb1 authored Apr 28, 2023
2 parents 66a5de9 + 410215c commit 1366f9b
Show file tree
Hide file tree
Showing 55 changed files with 3,069 additions and 2,553 deletions.
10 changes: 5 additions & 5 deletions src/DataFeedViews/FlowPathwayDataFeedView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public FlowPathwayDataFeedView()
}

private bool m_IsEnabled;
private ToolTip m_TooltipZoomOut = new ToolTip();
private ToolTip m_TooltipZoomIn = new ToolTip();
private FlowPathwayTabStripItem m_DiagramTab = new FlowPathwayTabStripItem("Diagram");
private FlowPathwayTabStripItem m_StockTab = new FlowPathwayTabStripItem("Stocks");
private FlowPathwayTabStripItem m_FlowTab = new FlowPathwayTabStripItem("Flows");
private readonly ToolTip m_TooltipZoomOut = new ToolTip();
private readonly ToolTip m_TooltipZoomIn = new ToolTip();
private readonly FlowPathwayTabStripItem m_DiagramTab = new FlowPathwayTabStripItem("Diagram");
private readonly FlowPathwayTabStripItem m_StockTab = new FlowPathwayTabStripItem("Stocks");
private readonly FlowPathwayTabStripItem m_FlowTab = new FlowPathwayTabStripItem("Flows");
private DiagramFilterCriteria m_FilterCriteria = new DiagramFilterCriteria();

protected override void InitializeView()
Expand Down
2 changes: 1 addition & 1 deletion src/DataSheets/FlowTypeDataSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FlowTypeDataSheet : DataSheet
private DataTable m_FlowTypeDataTable;
private DataSheet m_FlowGroupDataSheet;
private DataTable m_FlowGroupDataTable;
private Dictionary<int, string> m_PrevNames = new Dictionary<int, string>();
private readonly Dictionary<int, string> m_PrevNames = new Dictionary<int, string>();

protected override void OnDataFeedsRefreshed()
{
Expand Down
2 changes: 1 addition & 1 deletion src/DataSheets/StockTypeDataSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class StockTypeDataSheet : DataSheet
private DataTable m_StockTypeDataTable;
private DataSheet m_StockGroupDataSheet;
private DataTable m_StockGroupDataTable;
private Dictionary<int, string> m_PrevNames = new Dictionary<int, string>();
private readonly Dictionary<int, string> m_PrevNames = new Dictionary<int, string>();

protected override void OnDataFeedsRefreshed()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Diagram/DiagramFilterCriteria.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace SyncroSim.STSimStockFlow
{
internal class DiagramFilterCriteria
{
private Dictionary<int, bool> m_FlowTypes = new Dictionary<int, bool>();
private readonly Dictionary<int, bool> m_FlowTypes = new Dictionary<int, bool>();

public Dictionary<int, bool> FlowTypes
{
Expand Down
2 changes: 1 addition & 1 deletion src/Diagram/FlowPathwayDiagram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal class FlowPathwayDiagram : BoxArrowDiagram
private DataTable m_FlowDiagramData;
private DataSheet m_FlowPathwaySheet;
private DataTable m_FlowPathwayData;
private Dictionary<int, StockTypeShape> m_ShapeLookup = new Dictionary<int, StockTypeShape>();
private readonly Dictionary<int, StockTypeShape> m_ShapeLookup = new Dictionary<int, StockTypeShape>();
private bool m_IsFilterApplied;

public FlowPathwayDiagram()
Expand Down
2 changes: 1 addition & 1 deletion src/Diagram/FlowPathwayLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace SyncroSim.STSimStockFlow
{
internal class FlowPathwayLine : ConnectorLine
{
private FlowPathway m_Pathway;
private readonly FlowPathway m_Pathway;

public FlowPathwayLine(Color lineColor, FlowPathway pathway) : base(lineColor)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Diagram/StockTypeShape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ namespace SyncroSim.STSimStockFlow
{
internal class StockTypeShape : BoxDiagramShape
{
private int m_StockTypeId;
private List<FlowPathway> m_OutgoingPathways = new List<FlowPathway>();
private List<FlowPathway> m_IncomingPathways = new List<FlowPathway>();
private readonly int m_StockTypeId;
private readonly List<FlowPathway> m_OutgoingPathways = new List<FlowPathway>();
private readonly List<FlowPathway> m_IncomingPathways = new List<FlowPathway>();
private bool m_IsReadOnly;

public StockTypeShape(int stockTypeId, string displayName) :
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/FlowGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace SyncroSim.STSimStockFlow
{
internal class FlowGroup : StockFlowType
{
private FlowTypeLinkageCollection m_FlowTypeLinkages = new FlowTypeLinkageCollection();
private readonly FlowTypeLinkageCollection m_FlowTypeLinkages = new FlowTypeLinkageCollection();

public FlowGroup(int id, string name) : base(id, name)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Runtime/FlowGroupLinkage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace SyncroSim.STSimStockFlow
{
class FlowGroupLinkage
{
private FlowGroup m_FlowGroup;
private double m_Value;
private readonly FlowGroup m_FlowGroup;
private readonly double m_Value;

public FlowGroupLinkage(FlowGroup flowGroup, double value)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Runtime/FlowLateralMultiplier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ namespace SyncroSim.STSimStockFlow
{
internal class FlowLateralMultiplier
{
private int m_FlowGroupId;
private int? m_FlowMultiplierTypeId;
private int? m_Iteration;
private int? m_Timestep;
private string m_Filename;
private readonly int m_FlowGroupId;
private readonly int? m_FlowMultiplierTypeId;
private readonly int? m_Iteration;
private readonly int? m_Timestep;
private readonly string m_Filename;

public FlowLateralMultiplier(
int flowGroupId,
Expand Down
118 changes: 59 additions & 59 deletions src/Runtime/FlowMultiplier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,49 @@

namespace SyncroSim.STSimStockFlow
{
internal class FlowMultiplier : STSimDistributionBase
internal class FlowMultiplier : STSimDistributionBase
{
private int? m_StateClassId;
private int m_AgeMin;
private int m_AgeMax = int.MaxValue;
private int? m_FlowMultiplierTypeId;
private int m_FlowGroupId;
private readonly int? m_StateClassId;
private readonly int m_AgeMin;
private readonly int m_AgeMax = int.MaxValue;
private readonly int? m_FlowMultiplierTypeId;
private readonly int m_FlowGroupId;

public FlowMultiplier(
int? iteration,
int? timestep,
int? stratumId,
int? secondaryStratumId,
int? tertiaryStratumId,
int? stateClassId,
int ageMin,
int ageMax,
int? flowMultiplierTypeId,
int flowGroupId,
double? multiplierValue,
int? distributionTypeId,
DistributionFrequency? distributionFrequency,
double? distributionSD,
double? distributionMin,
double? distributionMax) : base(
iteration, timestep, stratumId, secondaryStratumId,
tertiaryStratumId, multiplierValue, distributionTypeId,
distributionFrequency, distributionSD, distributionMin, distributionMax)
{
this.m_StateClassId = stateClassId;
public FlowMultiplier(
int? iteration,
int? timestep,
int? stratumId,
int? secondaryStratumId,
int? tertiaryStratumId,
int? stateClassId,
int ageMin,
int ageMax,
int? flowMultiplierTypeId,
int flowGroupId,
double? multiplierValue,
int? distributionTypeId,
DistributionFrequency? distributionFrequency,
double? distributionSD,
double? distributionMin,
double? distributionMax) : base(
iteration, timestep, stratumId, secondaryStratumId,
tertiaryStratumId, multiplierValue, distributionTypeId,
distributionFrequency, distributionSD, distributionMin, distributionMax)
{
this.m_StateClassId = stateClassId;
this.m_AgeMin = ageMin;
this.m_AgeMax = ageMax;
this.m_FlowMultiplierTypeId = flowMultiplierTypeId;
this.m_FlowGroupId = flowGroupId;
}
this.m_FlowGroupId = flowGroupId;
}

public int? StateClassId
{
get
{
return this.m_StateClassId;
}
}
public int? StateClassId
{
get
{
return this.m_StateClassId;
}
}

public int AgeMin
{
Expand All @@ -67,29 +67,29 @@ public int AgeMax
}

public int? FlowMultiplierTypeId
{
get
{
return this.m_FlowMultiplierTypeId;
}
}
{
get
{
return this.m_FlowMultiplierTypeId;
}
}

public int FlowGroupId
{
get
{
return this.m_FlowGroupId;
}
}
public int FlowGroupId
{
get
{
return this.m_FlowGroupId;
}
}

public override STSimDistributionBase Clone()
{
return new FlowMultiplier(
this.Iteration, this.Timestep,
this.StratumId, this.SecondaryStratumId, this.TertiaryStratumId,
this.StateClassId, this.AgeMin, this.AgeMax, this.FlowMultiplierTypeId, this.FlowGroupId,
this.DistributionValue, this.DistributionTypeId, this.DistributionFrequency,
this.DistributionSD, this.DistributionMin, this.DistributionMax);
}
}
{
return new FlowMultiplier(
this.Iteration, this.Timestep,
this.StratumId, this.SecondaryStratumId, this.TertiaryStratumId,
this.StateClassId, this.AgeMin, this.AgeMax, this.FlowMultiplierTypeId, this.FlowGroupId,
this.DistributionValue, this.DistributionTypeId, this.DistributionFrequency,
this.DistributionSD, this.DistributionMin, this.DistributionMax);
}
}
}
81 changes: 81 additions & 0 deletions src/Runtime/FlowMultiplierByStock.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// stsim-stockflow: SyncroSim Add-On Package (to stsim) for integrating stocks and flows into state-and-transition simulation models in ST-Sim.
// Copyright © 2007-2023 Apex Resource Management Solutions Ltd. (ApexRMS). All rights reserved.

using SyncroSim.STSim;
using SyncroSim.StochasticTime;

namespace SyncroSim.STSimStockFlow
{
internal class FlowMultiplierByStock : STSimDistributionBase
{
private readonly int? m_StateClassId;
private readonly int? m_FlowMultiplierTypeId;
private readonly int m_FlowGroupID;
private readonly int m_StockGroupId;
private readonly double m_StockValue;

public FlowMultiplierByStock(
int? iteration, int? timestep, int? stratumId, int? secondaryStratumId, int? tertiaryStratumId,
int? stateClassId, int? flowMultiplierTypeId, int flowGroupId, int stockGroupId, double stockValue, double? multiplier,
int? distributionTypeId, DistributionFrequency? distributionFrequency, double? distributionSD,
double? distributionMin, double? distributionMax) : base(iteration, timestep, stratumId, secondaryStratumId, tertiaryStratumId, multiplier, distributionTypeId, distributionFrequency, distributionSD, distributionMin, distributionMax)
{
this.m_StateClassId = stateClassId;
this.m_FlowMultiplierTypeId = flowMultiplierTypeId;
this.m_FlowGroupID = flowGroupId;
this.m_StockGroupId = stockGroupId;
this.m_StockValue = stockValue;

}

public int? StateClassId
{
get
{
return this.m_StateClassId;
}
}

public int? FlowMultiplierTypeId
{
get
{
return this.m_FlowMultiplierTypeId;
}
}

public int FlowGroupId
{
get
{
return this.m_FlowGroupID;
}
}

public int StockGroupId
{
get
{
return this.m_StockGroupId;
}
}

public double StockValue
{
get
{
return this.m_StockValue;
}
}

public override STSimDistributionBase Clone()
{
return new FlowMultiplierByStock(
this.Iteration, this.Timestep, this.StratumId, this.SecondaryStratumId, this.TertiaryStratumId,
this.StateClassId, this.FlowMultiplierTypeId, this.FlowGroupId, this.StockGroupId, this.StockValue,
this.DistributionValue, this.DistributionTypeId, this.DistributionFrequency, this.DistributionSD,
this.DistributionMin, this.DistributionMax);
}
}
}

11 changes: 11 additions & 0 deletions src/Runtime/FlowMultiplierByStockCollection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// stsim-stockflow: SyncroSim Add-On Package (to stsim) for integrating stocks and flows into state-and-transition simulation models in ST-Sim.
// Copyright © 2007-2023 Apex Resource Management Solutions Ltd. (ApexRMS). All rights reserved.

using System.Collections.ObjectModel;

namespace SyncroSim.STSimStockFlow
{
internal class FlowMultiplierByStockCollection : Collection<FlowMultiplierByStock>
{
}
}
Loading

0 comments on commit 1366f9b

Please sign in to comment.