use persistent runtime database table (no need to refresh if we pull the whole thing)
cache expiration per session data tables
Support setting of runoff file dynamically at wake(), load from matrix sub-comps
Eliminate redundant querying from shared table by storing in global or broadcast object
Support local munging of timestep?
Or, Could pass entire hourly simulation to model, and use:
var $intmethod = 6; // 6 - period sum, 3 - period mean inflow; but may be time-consuming
// period sum is what is returned for precip and suro/ifwo/agwo or any other ivld by remote/rss_cbp_land_data.php
Options
Create controller that can use old school method, or timeseries file method
ToDo:
Testing broadcast array
Test shared array (maybe the best way to go).
i.e.
Support CSV
use_remote_csv: Switch added to component to allow this instead of xml query
url_remote_csv: location of remote data file -- could we just override "final_feed_url"?
Test lookup to store data filename/url
first test that we can store file names in matrix components
this would require that the properties/components be initialized with run_mode before we look to load the data. Then, our lookup keyed with run_mode would return our file. Alternatively, during init() we could look for the "final_feed_url" property, and "run_mode" and then go from there
is run_mode initialized as property before other things?
it is if its part of the $input_props array sent at runtime. run_shakeTree.php does this, but run_model.php does NOT. This can be corrected in run_model.php quite easily.
global $cbp_seg_data;
// for landseg suro, ifwo and agwo
// current values at simulation timestep\
// Ex:
// $cbp_landseg_data['A51011'] = array(
// 'thistime' => 0, // set on update
// 'for_suro' => 0.011,
// 'for_ifwo' => 0.005,
// ...
// );
function step() {
$status = $this->checkSharedData($this->id2);
if (! ($status == 'error') ) {
if (!status) {
$this->putSharedData($this->id2, $this->state);
}
}
function checkSharedData($id) {
global $cbp_seg_data;
// check global variable
if (!isset($cbp_seg_data[$id])) {
return 'error'; // something is mis-configured that should have happened in init()
}
if ($cbp_seg_data[$this->id2]['thistime'] == $this->timer->thistime) {
// it is already updated, so return
return TRUE;
}
return FALSE;
function putSharedData($id, $data) {
global $cbp_seg_data, $global_hub;
// or a broadcast hub
// $global_hub->broadCast($dataClass, $dataName, $sourceID, $dataValue)
$global_hub->broadCast('cbp_landseg', $this->id2, 'for_suro', 0.001);
}
}
Fixed
Routine is hanging up during XML serialize operation. I feel like I've seen this effect before, often related to a nested object? See test basic.php
See also: https://github.com/HARPgroup/vahydro/issues/7
Options
ToDo:
Support CSV