Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotstart save (aka "Bread Crumbs") #252

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ script:
# run unit tests
- cd tests
- ctest
- cat ./Testing/Temporary/*
- cd $SWMM_HOME
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
pip install --src build/packages -r tools/requirements.txt ;
Expand Down
6 changes: 4 additions & 2 deletions docs/modules_toolkit.dox
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

@addtogroup tkfuncs
@{
@fn int swmm_getCurrentDateTimeStr(char *dtimestr)
@fn int swmm_getCurrentDateTime(int *year, int *month, int *day,
int *hour, int *minute, int *second)
@fn int swmm_getNodeResult (int index, int type, double *result)
@fn int swmm_getLinkResult (int index, int type, double *result)
@fn int swmm_getSubcatchResult (int index, int type, double *result)
Expand All @@ -16,11 +17,12 @@
@fn int swmm_freeOutfallStats (SM_OutfallStats *outfallStats)
@fn int swmm_getLinkStats (int index, SM_LinkStats *linkStats)
@fn int swmm_getPumpStats (int index, SM_PumpStats *pumpStats)
@fn int swmm_getSubcatchStats (int index, SM_SubcatchStats *subcatchStats)
@fn int swmm_getSubcatchStats (int index, SM_SubcatchStats **subcatchStats)
@fn int swmm_getSystemRoutingStats (SM_RoutingTotals *routingTot)
@fn int swmm_getSystemRunoffStats (SM_RunoffTotals *runoffTot)
@fn int swmm_setLinkSetting (int index, double setting)
@fn int swmm_setNodeInflow (int index, double flowrate)
@fn int swmm_setOutfallStage (int index, double stage)
@fm int swmm_setGagePrecip(int index, double total_precip)
@}
*/
10 changes: 10 additions & 0 deletions include/toolkitAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ typedef struct
double pctError;
} SM_RunoffTotals;


/**
@brief Get the text of an error code.
@param errcode The error code
Expand Down Expand Up @@ -911,6 +912,9 @@ int DLLEXPORT swmm_setSimulationDateTime(int timetype, int year, int month,
int day, int hour, int minute,
int second);

//-------------------------------
// Active Simulation Results API
//-------------------------------
/**
@brief Get the current simulation datetime information.
@param[out] year The year
Expand Down Expand Up @@ -1093,6 +1097,12 @@ int DLLEXPORT swmm_setOutfallStage(int index, double stage);
*/
int DLLEXPORT swmm_setGagePrecip(int index, double total_precip);

/**
@brief Save hotstart file during simulation
@param hsfile The file name of the hotstart file that user would like to save
*/
int DLLEXPORT swmm_saveHotstart(char *hsfile);

/**
@brief Helper function to free memory array allocated in SWMM.
@param array The pointer to the array
Expand Down
21 changes: 12 additions & 9 deletions src/funcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void report_writeSysStats(TSysStats* sysStats);
void report_writeErrorMsg(int code, char* msg);
void report_writeErrorCode(void);
void report_writeInputErrorMsg(int k, int sect, char* line, long lineCount);
void report_writeWarningMsg(char* msg, char* id);
void report_writeWarningMsg(char* msg, char* id);
void report_writeTseriesErrorMsg(int code, TTable *tseries);

void inputrpt_writeInput(void);
Expand Down Expand Up @@ -273,7 +273,7 @@ void stats_report(void);
void stats_updateCriticalTimeCount(int node, int link);
void stats_updateFlowStats(double tStep, DateTime aDate, int stepCount,
int steadyState);
void stats_updateSubcatchStats(int subcatch, double rainVol,
void stats_updateSubcatchStats(int subcatch, double rainVol,
double runonVol, double evapVol, double infilVol,
double impervVol, double pervVol, double runoffVol, double runoff); //(5.1.013)
void stats_updateGwaterStats(int j, double infil, double evap,
Expand Down Expand Up @@ -357,12 +357,12 @@ void node_getResults(int node, double wt, float x[]);
int inflow_readExtInflow(char* tok[], int ntoks);
int inflow_readDwfInflow(char* tok[], int ntoks);
int inflow_readDwfPattern(char* tok[], int ntoks);
int inflow_setExtInflow(int j, int param, int type,
int tSeries, int basePat, double cf,
int inflow_setExtInflow(int j, int param, int type,
int tSeries, int basePat, double cf,
double baseline, double sf);
int inflow_validate(int param, int type, int tSeries,
int basePat, double *cf);
int inflow_validate(int param, int type, int tSeries,
int basePat, double *cf);

void inflow_initDwfInflow(TDwfInflow* inflow);
void inflow_initDwfPattern(int pattern);

Expand All @@ -389,7 +389,10 @@ void iface_saveOutletResults(DateTime reportDate, FILE* file);
// Hot Start File Methods
//-----------------------------------------------------------------------------
int hotstart_open(void);
void hotstart_close(void);
void hotstart_close(TFile hsfile);
int openHotstartFile2(TFile hsfile);
int saveRunoff(TFile hsfile);
int saveRouting(TFile hsfile);

//-----------------------------------------------------------------------------
// Conveyance System Link Methods
Expand Down Expand Up @@ -472,7 +475,7 @@ int shape_validate(TShape *shape, TTable *curve);
int controls_create(int n);
void controls_delete(void);
int controls_addRuleClause(int rule, int keyword, char* Tok[], int nTokens);
int controls_evaluate(DateTime currentTime, DateTime elapsedTime,
int controls_evaluate(DateTime currentTime, DateTime elapsedTime,
double tStep);

//-----------------------------------------------------------------------------
Expand Down
Loading