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

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

Open
rburghol opened this issue Jan 28, 2025 · 0 comments
Open

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

rburghol opened this issue Jan 28, 2025 · 0 comments

Comments

@rburghol
Copy link
Contributor

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.

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)

Main Operations Loop (for each operation)
	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)


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant