Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Rohit Mukherjee and Sharath Kumar Garlapati

REPORT ON CELLULAR AUTOMATON SIR


PURPOSE:
Creating a C# project which simulates the model of epidemic using two dimensional cellular
automaton and create some type of visualization of the epidemic.

APPROACH:
Step1: Create two 2-Dimensional Arrays which are in our case Array1 and UpdatedArray. We
initializing the Infectious count to some integer value and a method to count the infectious in the process
of this simulation.

Step2: Step 2 is more specific about Start button which is the main part to start the graph
simulation. This start button had initialized three Labels which shows the counts on the form whenever
we click the start button. we start with the Array Array1 by initializing the susceptible as 0 in the grid
of 50 X 50, next we will place the infectious agents in different places of the 50 X 50 using random i and j
locations.

Step3: Here the basic task is to declare another 2-Dimensional array called UpdatedArray and
here comes the most crucial part of our program which is tells if infectious count greater than zero then
enter the while loop and change the surrounding 8 neighbors of the infectious agent to infectious ones, so
we here used the [i , j] coordinates to represent the neighbors. The most confusion part is when we
declare 50 X 50 Grid so i and j travels from 0 to 49 positions if they exceed 49 we will get Array index
out of bound exception. Basically the implementation goes as Susceptible represented by 0, Infected
represented by 1 and Recovered represented by 2.

Step4: Last part is to copy the UpdatedArray values to Array1 (which is initial array) and passing
the values to the graph content in the form which are dragged from the tool box. These inputs are
transferred to the graph whenever start button is clicked and it shows the infectious count graph which is
bell shapes which clearly shows that the infectious count starts increasing up to a certain point and starts
decreasing.
We together worked on the project where we analyzed the problem dealing with exceptions Array
out of bound and Graph implementation.

Figure1: Shows the infectious Graph of SIR simulation.


This Graph contains eight labels and four of them are static and remaining are dynamic shows the Initial
Susceptible and Infectious count. It also shows the infectious days and Infectious agent count at the end.
Blue curve shows that the effected or infected Agents increase initially but from a certain point they tend
to decrease which means they get recovered or dies out and at last they become zero.

Hurdles or Got to know:


Problem1:

Array Index out Of Bound Exception in detail as we are dealing with 2-Dimentional
50X50 Grid. [Known fact but if we miss it, it has a great impact].

Solution:

By restricting i and j values from 0 to 49, frequently placing printing statements to keep
tract of indexes.

Problem2:

How to plot a graph in C# with values taken from .cs file and inputting variable into the
form to draw graph.

Solution:

Learnt from YouTube C# classes and implemented in our project. So whenever we need
to write a logic to button double click it and this code is related to Graph
this.chart1.Series["DiseaseSpread"].Points.AddXY(DAYCOUNT,TotalInfectious());

which tells that the series name is DiseaseSpread and add DAYCOUNT as x and
TotalInfectious as y axis.
Resources used:

1. YouTube: https://www.youtube.com/watch?v=82jnryBxsnI
2. C# tutorial: http://www.tutorialspoint.com/csharp/

You might also like