Skip to content

Commit

Permalink
Gave each fish a unique integer ID which is now written to Move_Test_…
Browse files Browse the repository at this point in the history
…Report.csv, (addresses #28)
  • Loading branch information
colinsheppard committed Nov 4, 2011
1 parent 20666fd commit 6f78cb7
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 31 deletions.
4 changes: 3 additions & 1 deletion Trout.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Boston, MA 02111-1307, USA.
#include "DEBUGFLAGS.h"
#import "globals.h"

//#define MOVE_REPORT_ON
#define MOVE_REPORT_ON
//#define READY_TO_SPAWN_RPT
//#define SPAWN_CELL_RPT

Expand Down Expand Up @@ -147,6 +147,7 @@ double netEnergyForCell;

char *feedStrategy;
char *inShelter;
int fishID;

double maxMoveDistance;

Expand Down Expand Up @@ -203,6 +204,7 @@ id toggledFishForHabSurvUpdate;
- setSpawnDepthInterpolator: (id <InterpolationTable>) anInterpolator;
- setSpawnVelocityInterpolator: (id <InterpolationTable>) anInterpolator;
- setCaptureLogistic: (LogisticFunc *) aLogisticFunc;
- setFishID: (int) anIDNum;


//- setMovementRule: (char *) aRule;
Expand Down
70 changes: 41 additions & 29 deletions Trout.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ @implementation Trout
return self;
}

/////////////////////////////////////////////////////////////////////////////
//
// setFishID
//
////////////////////////////////////////////////////////////////////////////
- setFishID: (int) anIDNum
{
fishID = anIDNum;

return self;
}


///////////////////////////////////////////////
Expand Down Expand Up @@ -2786,9 +2797,9 @@ - (double) getHourlySearchConRate
fileMetaData = [BreakoutReporter reportFileMetaData: scratchZone];
fprintf(mvRptPtr,"\n%s\n\n",fileMetaData);
[scratchZone free: fileMetaData];
fprintf(mvRptPtr,"%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,\n",
fprintf(mvRptPtr,"%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,\n",
"DATE",
//"FISH-ID",
"FISH-ID",
"SPECIES",
"AGE",
"VELOCITY",
Expand Down Expand Up @@ -2831,34 +2842,35 @@ - (double) getHourlySearchConRate
exit(1);
}

strcpy(strDataFormat,"%s,%s,%d,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%s,%E,%E,%s,%E,%E,%E\n");
strcpy(strDataFormat,"%s,%d,%s,%d,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%s,%E,%E,%s,%E,%E,%E\n");
fprintf(mvRptPtr, strDataFormat,[timeManager getDateWithTimeT: [self getCurrentTimeT]],
mySpecies,
age,
velocity,
depth,
temp,
turbidity,
distToHide,
piscivDensity,
availableDrift,
availableSearch,
fishLength,
fishWeight,
feedTimeForCell,
captureSuccess,
potentialHourlyDriftIntake,
potentialHourlySearchIntake,
cMax,
standardResp,
activeResp,
inShelter,
dailyDriftNetEnergy,
dailySearchNetEnergy,
feedStrategy,
nonStarvSurvival,
netEnergyForBestCell,
expectedMaturity);
fishID,
mySpecies,
age,
velocity,
depth,
temp,
turbidity,
distToHide,
piscivDensity,
availableDrift,
availableSearch,
fishLength,
fishWeight,
feedTimeForCell,
captureSuccess,
potentialHourlyDriftIntake,
potentialHourlySearchIntake,
cMax,
standardResp,
activeResp,
inShelter,
dailyDriftNetEnergy,
dailySearchNetEnergy,
feedStrategy,
nonStarvSurvival,
netEnergyForBestCell,
expectedMaturity);


fflush(mvRptPtr);
Expand Down
2 changes: 1 addition & 1 deletion TroutModelSwarm.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ char* movementRule;

time_t popInitTime;


id fishColorMap;
int fishCounter;

id <List> speciesSymbolList; // List of symbols corresp to species studied

Expand Down
5 changes: 5 additions & 0 deletions TroutModelSwarm.m
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ @implementation TroutModelSwarm

reachSymbolList = [List create: modelZone];

fishCounter = 0;

fprintf(stdout, "TroutModelSwarm >>>> buildObjects >>> instantiateObjects >>>> BEFORE HabitatManager\n");
fflush(0);

Expand Down Expand Up @@ -1758,6 +1760,9 @@ - (Trout *) createNewFishWithSpeciesIndex: (int) speciesNdx
[newFish setSpawnVelocityInterpolator: aSpawnVelocityInterpolator];
[newFish setCaptureLogistic: aCaptureLogistic];

fishCounter++; // Give each fish a serial number ID
[newFish setFishID: fishCounter];

newFish = [newFish createEnd];

//fprintf(stdout, "TroutModelSwarm >>>> createNewFishWithSpeciesIndex >>>> END\n");
Expand Down

0 comments on commit 6f78cb7

Please sign in to comment.