Skip to content

Main Loop to support timestep level integration of processes and #186

@rburghol

Description

@rburghol

@PaulDudaRESPEC @ptomasula @austinorr @timcera

Operation/Module/Section/Time Looping in HSPF vs HSP2:

  • Within HSPF is the concept of an INSPAN, a subset of the simulation time span, and the RUNWID, the run width or the number of timesteps to be simulated consecutively. In a more basic HSPF simulation, the RUNWID can be equal to the number of timesteps to be simulated in the entire model, but it can be a subset if conditional special actions or some other advanced features are used. The INSPAN and RUNWID are computed up front and then used throughout the simulation.
  • In other words, as a single operation like a PERLND is executed, sections ATEMP, SNOW, PWATER, etc. are executed consecutively for a single time step, then ATEMP, SNOW, PWATER, etc. are executed consecutively for the second time step, proceeding until all time steps of the RUNWID are completed. At that point execution proceeds to the next operation. In the case of a simulation with multiple INSPANs, that entire sequence might be executed multiple times.
  • In contrast, the looping in all versions of HSP2 to date is more limited in sophistication. There is no INSPAN/RUNWID concept. Instead, execution proceeds from first operation to last operation in order, within each section of each operation simulating from first time step to last time step consecutively.
  • While the time looping of HSP2 is adequate for many simpler model simulations, this design breaks down when more sophisticated features are used, such as where a later operation in the sequence influences what happens in an earlier operation in the sequence.
  • In order, HSPF would run PERLND, IMPLND, RCHRES, COPY... (see below "OSUPER Operations Loop")
  • Reference:

For each INSPAN (group of RUNWID model timesteps)


|	OSUPER Operations Loop (for each operation)
|		TSGET (get timeseries)
|		Operating Modules (PERLND/IMPLND/RCHRES/Utility modules)
|			SPECL
|			If PERLND:
|		----------	Section ATEMP
|		|		Section SNOW
|		|		Section PWATER
|		RUNWID	Section SEDMNT
|		|		Section PSTEMP
|		|		Section PWTGAS
|		----------	Section PQUAL (+ others)
|			If IMPLND:
|		----------	Section ATEMP
|		|		Section SNOW
|		|		Section IWATER
|		RUNWID	Section SOLIDS
|		|		Section IWTGAS
|		----------	Section IQUAL
|			If RCHRES:
|		----------	Section HYDR
|		|		Section ADCALC
|		|		Section CONS
|		RUNWID	Section HTRCH
|		|		Section SEDTRN
|		|		Section GQUAL
|		----------	Section RQUAL
|			If Utility Module:
|				COPY, PLTGEN, GENER, etc.
|		TSPUT (put timeseries)

Complete Timeseries for Each Operation in hsp2 (loosely coupled)

  • delt: comes from
Main Operations Loop (for each operation and delt)
	get_timeseries
	If PERLND:
		Section ATEMP 			from first to last timestep
		Section SNOW 			from first to last timestep
		Section PWATER 		from first to last timestep
		Section SEDMNT 		from first to last timestep
		Section PSTEMP 		from first to last timestep
		Section PWTGAS 		from first to last timestep
		Section PQUAL (+ others)	from first to last timestep
	If IMPLND:
		Section ATEMP 			from first to last timestep
		Section SNOW 			from first to last timestep
		Section IWATER 			from first to last timestep
		Section SOLIDS 			from first to last timestep
		Section IWTGAS 			from first to last timestep
Section IQUAL 			from first to last timestep
	If RCHRES:
		Section HYDR 			from first to last timestep
		Section ADCALC 		from first to last timestep
		Section CONS 			from first to last timestep
		Section HTRCH 			from first to last timestep
		Section SEDTRN 		from first to last timestep
		Section GQUAL 			from first to last timestep
		Section RQUAL 			from first to last timestep
	If Utility Module:
		COPY, PLTGEN, GENER, etc. 	from first to last timestep
(save_timeseries occurs after each section is simulated)


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions