forked from respec/HSPsquared
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Begin coding data model, object classes. #7
Comments
This was referenced Jul 18, 2022
This was referenced Jul 27, 2022
Spent some time locating the current php versions of these object classes
class modelObject {}
class modelSubObject extends modelObject {}
class broadCastObject extends modelSubObject {}
class dataMatrix extends modelSubObject {}
class modelContainer extends modelObject {} |
See example for setting up objects in python: https://github.com/HARPgroup/pydro-tools/tree/main/OOP |
Example:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overview
Note that the previous implementation was fully object oriented, though since hsp2 uses the
numba
compiler to create faster execution we will make a hybrid to leverage the speed benefits. will be instantiated to process model inputs from JSON (or from UCI if we support that).numba
code.pre-step
,step
, andpost-step
utilities_specl.py
aspre_step_model()
,step_model()
, andpost_step_model()
step_[class name]
function must be defined in the class code file, and added to the(pre_,post_)step_model()
functionstep_equation()
step()
function, certain things benefit from happening in thepreStep()
andpostStep()
phases.preStep()
Example: ModelRegister classes can act as accumulators of data from multiple senders in a single time-step. For a register, it is desirable to reset to zero at the beginning of each timestep, thus, the reset to zero happens inpre_step_register()
.opcode
) foropcodes
, i.e.,opcodes["/SPECL/Equations/RCHRES_001/Qlocal"] = "sin(step)"
step
will be stored ints[/path_to_object/property_name][step]
hsp2
these are often simply held as variable values that exist only within the context of the function that is being executed. Thets
dictionary also has state, but presumably that state is only for things that are being logged, and in the interest of data storage, we may not want every single item to be logged, especially as sub-components grow larger. Thus it is theoretically possible that something is important enouh to be stored instate
, but not important enough to be logged every time step?ts
.ts
can contain data paths copied from the hdf5/TIMESERIES/
and/RESULTS/
ui
(named thusly because they are an excerpt fromuci
)ts
essentially provides state for all objects referenceable via unique paths, the state function of what an object framework provides is satisfied.numba
does in fact have some object support, using@jitclass
@jitclass
might be useable.@jitclass
object cannot be passed as arguments, so we would need to instantiate the objects inside of thespecl
routine (or whatever operational entities base we use).specl/entities
so would need to test.Tasks
Priority objects/method/functions to develop:
preStep()
, set these registers to zero:ts["/BROADCASTS/RCHRES_0001/hydroObject/ps_mgd"][step]
ts["/BROADCASTS/RCHRES_0001/hydroObject/ps_mgd"][step] += ts["/OBJECTS/OBJECT0001/ps_local_mgd"][step]
The text was updated successfully, but these errors were encountered: