Loading...

Fire forest simulation Assignment

Open Posted By: highheaven1 Date: 26/04/2021 Graduate Case Study Writing

 Fire simulation can be modelled in software and is an important area of research in fire safetyi , fire drill managementii, fire investigationiii, and with applications in many computer game scenariosiv . One way to look at the world in software is to study a process as a group of smaller pieces (or cells or sites) that are somehow related. For example the world can be viewed as a rectangular grid of cells. Rules specify how a cell changes state over time based on the states of the cells around it. Each piece corresponds to an area (or volume) in the world and each piece can be associated with one of several possible states at any given time. A computer simulation involving such a system is called a cellular automaton. This assignment requires you to design and implement a program that models the spread of fire in a 2D forest environment. 

Category: Arts & Education Subjects: Art Deadline: 12 Hours Budget: $120 - $180 Pages: 2-3 Pages (Short Assignment)

Attachment 1

MOD003197 OBJECT ORIENTED C++ 2020-21 TRI2

MULTIPHASED COURSEWORK

PORTFOLIO OF IN-CLASS EXERCISES (15%)

During the trimester, weekly practical classes will re-enforce principles of the associated

lecture topic. Of these, there will be a number of programming exercises whose solutions

should be archived into a portfolio and submitted along with the main assignment essay at the

end of the trimester. These exercises should be worked on inside and outside of scheduled

practical class time, and students can support/help each other provided that no actual code is

exchanged between students, whether embedded in an email or attached as a separate file –

however verbal discussion and/or communication by free text grammatical social media is

encouraged.

MAIN COURSEWORK ASSIGNMENT (85%)

FIRE SIMULATION

Fire simulation can be modelled in software and is an important area of research in fire

safetyi, fire drill managementii, fire investigationiii, and with applications in many computer

game scenariosiv. One way to look at the world in software is to study a process as a group of smaller pieces (or cells or sites) that are somehow related. For example the world can be viewed as a

rectangular grid of cells. Rules specify how a cell changes state over time based on the states of the

cells around it. Each piece corresponds to an area (or volume) in the world and each piece can be associated with one of several possible states at any given time. A computer simulation involving such

a system is called a cellular automaton. This assignment requires you to design and implement a

program that models the spread of fire in a 2D forest environment.

Program requirements

Note that fire simulations are very well covered in textbooks, published journals and on the

internet. In fairness to all students to ensure equality as far as course background knowledge

is concerned your implementation must conform to the following two requirements:

1. Language must be C++ 2. Application must be console based

Code Development

1. The simulation requires you to create a simple 2D console-based world composed of a 21x21 grid of cells, where all cells contain a tree except for a 1-cell thick perimeter

boundary layer of empty cells. The boundary is similar to a firebreak or an area with

no trees; proximity to such a boundary cell cannot cause an internal tree to catch

fire. This insulating boundary is called an absorbing boundary condition. Draw the

forested world using ASCII characters such as an ampersand for a tree, an x for a

burning tree and a blank space for an empty cell.

i http://www.freefiresimulator.com/ ii http://www.flame-sim.com/ iii http://www.aeiengineers.com/application-of-fire-testing-and-modeling-in-a-forensic-investigation/ iv https://www.pcgamesn.com/firefighting-simulator/firefighting-simulator-announced-for-a-2017-release

2. Once the simulation is started the fire is initiated (in the first instance) with a burning tree at the central cell. No user-interaction is required other than to press a key to

indicate the end of one time-period and the start of the next, or to exit the simulation.

Each key press changes the state of the simulation and thus represents a time-step

(actual real units of time are irrelevant). Assume that the simulation continues until no

cell is on fire.

3. After each time step, re-draw the grid and prompt the user to press Enter to initiate the next time step, or another option to exit the simulation (if it helps you can think of the

simulation as being a kind of turn-based game).

4. During each time step each cell can be in one of three states, which could be represented numerically (eg 0, 1, 2)>

Empty – this represents either empty ground or the site of a burnt tree.

Tree – a tree that is not burning.

Burning – a tree that is burning.

5. During each time step the following rules should be applied to each cell to determine its’ state in the next time step;

i. If the site is empty it remains empty. ii. If a tree is present and none of the neighbours are burning it remains a tree.

iii. If a tree is present and at least one of the neighbours is burning it may or may not catch fire with a probability of 50% (use a random number generator to determine

this).

iv. If the site contains a burning tree then assume it will burn down in one time step leaving an empty site.

To simplify programming for this simulation, assume the state of a diagonal cell to the

northeast, southeast, southwest, or northwest does not have an impact on a current cell's

value at the next iteration. Therefore a cell's value at the next timestep depends on the

cell's current state and the values of its neighbours to the north, east, south, and west.

 Note that your solution must be object-oriented as far as possible. In very general terms the coding solution should firstly set up the forest environment and then

secondly implement the time steps and forest updates via a loop structure. Some

suggestions (not exhaustive or even necessarily a requirement) are;

 Develop a class Cell class whose objects fill a 2D array called forest, with appropriate private attributes and public methods.

 Develop a class Grid, with a static 2D char array of ascii symbols map reflecting the current visual state of the forest used for displaying to screen. A static method

spread() could process each Cell object in turn – by passing the state of the current

cell and the states of it’s neighbours, and return the new (ie next) state.

 Another static method could be applySpread() that takes at least one argument (the forest) and updates the forest grid and associated map. One approach is to

have an empty copy of the grid used every turn; that is, apply the update rules in

turn to each cell and then add the updated cell to the new location in the copy of

the grid not the original. When all the cells have been updated in the copy, that

copy becomes the new ‘original’ (which can be drawn to screen) and the old grid

is discarded.

 The most intuitive way to code a solution is to create a 2D array of Cell objects along with a 2D char array for display purposes. However there may be more

efficient ways of utilising an underlying data structure. For example instead of a

2D array of objects, all trees (whether in state ‘burning’ or ‘tree’) could be stored

in a linked list where each object contains a reference to the forest. Initially the

linked list would be long, but as the trees burn down the list will shorten and

memory can be de-allocated. The position of a tree in the list is irrelevant to its

location in the forest. This is a less intuitive approach but the advantage is that

only the tree/burning cells/objects need be processed and so each turn will be

faster in execution, although it is unlikely any obvious difference would be

observed in this small example.

Enhancements – you are encouraged to explore techniques (own ideas, literature research) to

further extend the simulation in order to maximise the marks you can achieve, but you should

aim for a basic implementation in the first instance. Some possibilities to consider are weather

(specify probability of catching fire at runtime), ground moisture (initialise a single connected

section of the forest that is damper and, hence, harder to burn), wind speed and direction

(direction=N,S,E,W and speed=none, low, high), neighbour probability (a tree catches fire

from neighbouring trees with a probability proportional to the number of neighbours on fire),

new tree growth (a new tree grows spontaneously in a previously empty cell according to a

given probability), use of an initial random grid (model initial density of forest cover and

number of initial burning locations).

ASSESSMENT

Assessment of Exercise Portfolio

Each class exercise solution is worth one mark. This will be awarded if the executable is

successful and also matches the associated source code (see Coursework submission below).

For example if only 6 exercises of 8 that are set are submitted and are successful you will be

awarded 6/8th’s of 15% i.e 11.3/15 towards the final mark.

Assessment of Fire Simulation Assignment

The work will be assessed according to:

a) program functionality

b) the extent to which the program follows good object-oriented practice including use of

appropriate user-written classes and methods

c) documentation report (incorporating quality of presentation – layout and readability) to

include:

i) a statement of what functionality you have been able to implement, and an evaluation

of the simulation development eg design of any classes and/or data structure, strengths

and limitations of the implementation (400 words). Include instructions for running the

program in an appendix.

ii) a class diagram (ensure your diagram matches the code implementation).

iii) a separate listing of the source code (in the document as an appendix).

Coursework submission

Structure your submission with a folder named after your sid e.g. ‘sid1234567’ Within this

folder there should be two further folders, one called ‘Portfolio’ and the other called ‘Fire

simulation’ or similar. The portfolio folder should itself contain one folder per assessed

exercise, each containing two files, the C++ source code (.cpp) and the C++ executable (.exe).

The fire simulation folder should contain the report (including class diagram and code listing

as described above), the C++ source code (.cpp) and the C++ executable (.exe). The

submission, ‘sid1234567’ should then be compressed into a single zip file e.g.

‘sid1234567.zip’ and submitted through TurnitIn by 2pm on Friday 23rd April 2021. Note

TurnitIn submissions have a file size limit of 100Mb; there should be no difficulty if you

avoid submitting VS project files.

REASSESSMENT DETAILS

If a re-assessment is required you should re-submit the main coursework assignment (the fire

simulation) by the standard due date for Trimester 2 2020-21 resubmissions. Your mark out

of 100% will be calculated on this main assignment submission only (usually the system will

cap this at 40%). Note there will be NO portfolio exercises taken into account irrespective of

how well they were undertaken at the first attempt. You are encouraged to explore a different

approach to writing the main assignment compared to the first attempt.

MOD003197 Object Oriented C++ Coursework feedback sheet 2020-21 Tri2

Portfolio exercises (not used in

reassessment)

Main Assignment

O v

e ra

ll

0 1

0 m

a rk

Overall module result

Student /15

F u

n ct

io n

a li

ty

g ra

d e

O b

je ct

o ri

e n

te d

a

p p

ro a

ch a

n d

d e

si g

n

D o

cu m

e n

ta ti

o n

a n

d p

re se

n ta

ti o

n

Comment %

G ra

d e

/85 %

Grade

Weighted 0.15. Eg if 5 exercises are successfully included out of 9 then the mark out of 15 is> 5/9 of 15 = 8.3

A: As C with many enhancements but maintaining a simple interface. B: As C with some enhancements. C: Program executes cleanly following timestep rules. D: Unclear interface, wrong output. F: Run time error or does not compile.

A: Uses appropriate classes and data structure(s). B: As C with accurate class diagram and restricted scope. C: Utilises user- written classes, scope not minimized. D: Procedural rather than OO approach. F: Non-OO approach, no methods.

A: Excellent evaluation. B: As C with class diagram of sufficient detail. C: Clearly written description and code layout. D: Insufficient detail, poorly written. F: Substantial elements missing.

Personalized comments specific

to student submission.

Each component is assigned a grade (F, D, C, B, A) and each maps to a mark (0- 100) from which the average is taken.

Main assignment grade

Weighted 0.85

Overall weighted mark

F (<40); D (40-49); C (50-59); B (60 - 69); A (70+)

Sid Number Mark Grade Grade Grade Comment Mark Grade Mark Final Mark

Final Grade