Skip to content

Commit 7dac89b

Browse files
authored
Merge pull request #269 from centreformicrosimulation/add_dcpst_idpartner
Output dcpst and idpartner to Person.csv
2 parents 6d10ff0 + 75772f2 commit 7dac89b

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/main/java/simpaths/model/Person.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class Person implements EventListener, IDoubleSource, IIntSource, Weight,
4949
private Long idOriginalHH;
5050
private Long idMother;
5151
private Long idFather;
52+
private Long idPartner;
5253
private Boolean clonedFlag;
5354
private Boolean bornInSimulation; //Flag to keep track of newborns
5455
private Long seed;
@@ -59,6 +60,7 @@ public class Person implements EventListener, IDoubleSource, IIntSource, Weight,
5960

6061
// person level variables
6162
private int dag; //Age
63+
private Dcpst dcpst;
6264
@Enumerated(EnumType.STRING) private Indicator adultchildflag;
6365
@Transient private boolean ioFlag; // true if a dummy person instantiated for IO decision solution
6466
@Enumerated(EnumType.STRING) private Gender dgn; // gender
@@ -712,6 +714,7 @@ public enum Processes {
712714
SocialCareProvision,
713715
Unemployment,
714716
Update,
717+
UpdateOutputVariables,
715718
UpdatePotentialHourlyEarnings, //Needed to union matching and labour supply
716719
}
717720

@@ -724,6 +727,9 @@ public void onEvent(Enum<?> type) {
724727
case Update -> {
725728
updateVariables(false);
726729
}
730+
case UpdateOutputVariables -> {
731+
updateOutputVariables();
732+
}
727733
case ProjectEquivConsumption -> {
728734
projectEquivConsumption();
729735
}
@@ -1896,6 +1902,11 @@ protected void updateVariables(boolean initialUpdate) {
18961902
}
18971903
}
18981904

1905+
private void updateOutputVariables() {
1906+
idPartner = getPartnerID();
1907+
dcpst = getDcpst();
1908+
}
1909+
18991910
private void updateLaggedVariables(boolean initialUpdate) {
19001911

19011912
les_c4_lag1 = les_c4;
@@ -4332,6 +4343,13 @@ public Person getPartner() {
43324343
return null;
43334344
}
43344345

4346+
public Long getPartnerID() {
4347+
Person partner = this.getPartner();
4348+
if (partner != null) {
4349+
return partner.getId();
4350+
} else return null;
4351+
}
4352+
43354353
private void nullPartnerVariables() {
43364354

43374355
careHoursFromPartnerWeekly = 0.0;

src/main/java/simpaths/model/SimPathsModel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ public void buildSchedule() {
594594
addCollectionEventToAllYears(persons, Person.Processes.HealthEQ5D);
595595
addEventToAllYears(Processes.CheckForImperfectTaxDBMatches);
596596
addEventToAllYears(tests, Tests.Processes.RunTests); //Run tests
597+
addCollectionEventToAllYears(persons, Person.Processes.UpdateOutputVariables); // Update idPartner, dhhtp_c4
597598
addEventToAllYears(Processes.EndYear);
598599

599600
// UPDATE YEAR

0 commit comments

Comments
 (0)