Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified MultiQueueSimulation/.vs/MultiQueueSimulation/v17/.suo
Binary file not shown.

Large diffs are not rendered by default.

491 changes: 77 additions & 414 deletions MultiQueueSimulation/.vs/MultiQueueSimulation/v17/DocumentLayout.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ShowEmptyProjects":false,"CustomColumnOrderings":{"name":0,"type":1,"neutral-value":2,"neutral-comment":3},"ShowValidationErrors":true,"SelectedResourceGroupsByProjectFilePath":{"D:\\Mazen\\college\\Modeling and Simulation\\Modelling-and-Simulation\\MultiQueueSimulation\\MultiQueueSimulation\\MultiQueueSimulation.csproj":["D:\\Mazen\\college\\Modeling and Simulation\\Modelling-and-Simulation\\MultiQueueSimulation\\MultiQueueSimulation\\Form1.resx"]},"VisibleColumnKeys":["name","neutral-value","neutral-comment"]}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions NewsPaperSellerSimulation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"**/.vs/"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ShowEmptyProjects":false,"CustomColumnOrderings":{"name":0,"type":1,"neutral-value":2,"neutral-comment":3},"ShowValidationErrors":true,"SelectedResourceGroupsByProjectFilePath":{"D:\\Projects\\Modelling-and-Simulation\\NewsPaperSellerSimulation\\NewspaperSellerSimulation\\NewspaperSellerSimulation.csproj":["D:\\Projects\\Modelling-and-Simulation\\NewsPaperSellerSimulation\\NewspaperSellerSimulation\\Form1.resx"]},"VisibleColumnKeys":["name","neutral-value","neutral-comment"]}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ public class SimulationEngine
SimulationSystem simulationSystem;
Random rand;
DistributionManager distributionManager;

public SimulationEngine(SimulationSystem ss)
{
rand = new Random();
simulationSystem = ss;
distributionManager = new DistributionManager();
simulationSystem.PerformanceMeasures = new PerformanceMeasures();
}
SimulationCase SimulateDay()
{
Expand All @@ -45,14 +47,28 @@ void CalculateProfits(SimulationCase simCase)
simCase.ScrapProfit = excess * simulationSystem.ScrapPrice;
simCase.DailyNetProfit = simCase.SalesProfit - simCase.DailyCost - simCase.LostProfit + simCase.ScrapProfit;
}
void CalculatePreformanceMeas(SimulationCase simCase)
{
simulationSystem.PerformanceMeasures.TotalScrapProfit += simCase.ScrapProfit;
simulationSystem.PerformanceMeasures.TotalLostProfit += simCase.LostProfit;
simulationSystem.PerformanceMeasures.TotalSalesProfit += simCase.SalesProfit;
simulationSystem.PerformanceMeasures.TotalNetProfit += simCase.DailyNetProfit;
if (simCase.LostProfit > 0)
simulationSystem.PerformanceMeasures.DaysWithMoreDemand++;
if(simCase.ScrapProfit > 0)
simulationSystem.PerformanceMeasures.DaysWithUnsoldPapers++;
}
public void RunSimulation()
{
simulationSystem.SimulationTable.Clear();
int NumOfRecords = simulationSystem.NumOfRecords;
simulationSystem.PerformanceMeasures.TotalCost = simulationSystem.PurchasePrice * simulationSystem.NumOfNewspapers * NumOfRecords;
for (int i = 1; i <= NumOfRecords; i++)
{
SimulationCase simCase = SimulateDay();
simCase.DayNo = i;

CalculatePreformanceMeas(simCase);
simulationSystem.SimulationTable.Add(simCase);
}
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
234 changes: 231 additions & 3 deletions NewsPaperSellerSimulation/NewspaperSellerSimulation/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading