Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mhinsch committed Sep 12, 2024
1 parent 4f880b1 commit 6f69b7d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
6 changes: 6 additions & 0 deletions main.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""
Main program, non-gui version.
"""


# library
using Random

Expand All @@ -7,6 +12,7 @@ include("mainHelpers.jl")
# create parameters
const simPars, pars = loadParameters(ARGS)

# logging and analysis
include(simPars.analysisFile)

Random.seed!(simPars.seed)
Expand Down
11 changes: 10 additions & 1 deletion mainHelpers.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
"""
Some common infrastructure for setting up and running the model.
"""



include("lib/loadLibsPath.jl")

# add various directories to Julia's model search path
addToLoadPath!(String(@__DIR__) * "/.",
String(@__DIR__) * "/lib",
String(@__DIR__) * "/src",
Expand All @@ -14,14 +21,14 @@ using Utilities

using DemographyPars
using DemographyModel
#using DemographyModelEO


include("src/demography/data.jl")

include("src/handleParams.jl")


"Generate and return a usable model object."
function setupModel(pars)
datp = pars.datapars
dir = datp.datadir
Expand All @@ -44,6 +51,7 @@ function setupModel(pars)
end


"Prepare and return output file or nothing."
function setupLogging(simPars; FS = "\t")
if simPars.logfile == ""
return nothing
Expand All @@ -57,6 +65,7 @@ function setupLogging(simPars; FS = "\t")
end


"Run fully initialised model non-interactively from start to finish."
function runModel!(model, simPars, pars, logfile = nothing; FS = "\t")
curTime = pars.poppars.startTime

Expand Down
4 changes: 4 additions & 0 deletions src/simulate/Age.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ export selectAgeTransition, ageTransition!
export ChangeAge1Yr


# transition filter
selectAgeTransition(person, pars) = true


# event tag
struct ChangeAge1Yr end


"Change a person's age. Emits the `ChangeAge1Yr` signal if the new age is an integer."
function changeAge!(person, newAge, model, pars)
person.age = newAge

Expand Down Expand Up @@ -42,6 +45,7 @@ function ageTransition!(person, time, model, pars)

changeAge!(person, person.age + 1//12, model, pars)

# count relationship time
if !isSingle(person)
person.pTime += 1//12
end
Expand Down
6 changes: 5 additions & 1 deletion src/simulate/Benefits.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"Implements the UK benefits system."



module Benefits


Expand All @@ -9,7 +13,7 @@ using BasicInfoAM, KinshipAM, WorkAM, DependenciesAM, DemoPerson
export computeBenefits!


# Debugg benefit allocation process
# Debug benefit allocation process
function computeBenefits!(pop, pars)

# Reset counters
Expand Down
1 change: 1 addition & 0 deletions src/simulate/kinship.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ struct Link{T}
end


"Generate a kinship network for a household."
function kinshipNetwork(filter, house, model, pars)
LinkT = Link{typeof(house)}
conns = Vector{LinkT}()
Expand Down

0 comments on commit 6f69b7d

Please sign in to comment.