nikhilgupta10 / GridLAB-D

Other
1 stars 0 forks source link

#659 Suggested Matlab link upgrades, #1389

Open nikhilgupta10 opened 7 years ago

nikhilgupta10 commented 7 years ago

1) Add a alid_to\ ability to the model. Currently, it re-synchronizes with Matlab every time there is a new iteration or sync call...this can be a massive transfer of data that's not necessary and slows the simulation. Suggest a alid_to\ feature, maybe be making the Matlab link an \object\, that disconnects Matlab and GLD for a given amount of time.

2) A list / grouping function would be handy, i.e., I want the cooling setpoint for every house on groupid feeder1. This will be helpful for global optimization scenarios.

3) Convert the current GLM syntax to something more inline with other GLM syntax. Specifically, the Matlab link is looking for a single line of code up to 1024 characters long, without carriage returns. Suggest making it more flexible, maybe use object syntax {} to define start and finish of code.

4) Currently debug or display options in the Matlab code do not get displayed, i.e., passed from the Matlab code out to the command line. Makes it very difficult to debug. I imagine this is a setting in activating the Matlab command window, but unsure.

,

nikhilgupta10 commented 7 years ago

nikhilgupta10 imported these comments from Sourceforge: The user dchassin does not exist anymore. Therefore assigning this to afisher1.

  #define LF_SKIPSAFE 0x01
  int flags;
  TIMESTAMP valid_to;
  TIMESTAMP last_t;

Add the following declaration at the top of glxmatlab/matlab.cpp:

  int global_skipsafe = 0;

Add the following into the if-else-if sequence in '''matlab_settag''' in glxmatlab/matlab.cpp:

  else if ( strcmp(tag,\skipsafe\)==0 )
  {
    if ( strcmp(data,\yes\)==0 )
    {
      mod->flags |= LF_SKIPSAFE;
      char buf[1024];
      if ( gl_global_getvar(\skipsafe\,buffer,sizeof(buffer))
        global_skipsafe = atoi(buf);
    }
    else if ( strcmp(data,
o\)==0 ) // this is the default value
      mod->flags &= ~LF_SKIPSAFE;
    else
      gl_error(\skipsafe value '%s' is not valid\, data);
  }

Add the following to the end of '''glx_init''':

  mod->last_t = gl_globalclock;

Add the following to '''glx_sync''' in glxmatlab/matlab.cpp before matlab_exec() call:

    TIMESTAMP effective_valid_to = min(mod->last_t+global_skipsafe,mod->valid_to);
    if ( global_skipsafe>0 && (mod->flags&LF_SKIPSAFE) && t1<effective_valid_to )
      return effective_valid_to;
    else
      last_t - t1;

,

Diff: