linny-r 1.5.7 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linny-r",
3
- "version": "1.5.7",
3
+ "version": "1.5.8",
4
4
  "description": "Executable graphical language with WYSIWYG editor for MILP models",
5
5
  "main": "server.js",
6
6
  "scripts": {
@@ -477,9 +477,9 @@ class GUIChartManager extends ChartManager {
477
477
  y = e.pageY -
478
478
  this.svg_container.getBoundingClientRect().top + window.scrollY,
479
479
  yfract = (c.plot_oy - y / scale) / c.plot_height,
480
- yres = Math.round(
481
- Math.max(Math.abs(c.plot_min_y), Math.abs(c.plot_max_y)) / 500),
482
480
  yval = c.plot_min_y + yfract * (c.plot_max_y - c.plot_min_y),
481
+ yhigh = Math.max(Math.abs(c.plot_min_y), Math.abs(c.plot_max_y)),
482
+ yres = (yhigh > 1000 ? Math.round(yhigh / 500) : 1),
483
483
  ytrunc = Math.round(yval / yres) * yres,
484
484
  ylbl = (yfract < 0 || yfract > 1 || c.plot_min_y >= c.plot_max_y ?
485
485
  '' : 'y = ' + VM.sig2Dig(parseFloat(ytrunc.toPrecision(2))));
@@ -4743,8 +4743,12 @@ class VirtualMachine {
4743
4743
  // than the standard, as it should not go beyond the end time plus
4744
4744
  // look-ahead.
4745
4745
  if(this.block_count < this.nr_of_blocks) return this.chunk_length;
4746
- let rem = MODEL.runLength % MODEL.block_length;
4747
- if(rem === 0) rem = MODEL.block_length;
4746
+ // Last block length equals remainder of simulation period divided
4747
+ // by block length.
4748
+ let rem = (MODEL.runLength - MODEL.look_ahead) % MODEL.block_length;
4749
+ // If this remainder equals 0, the last block is a full chunk.
4750
+ if(rem === 0) return this.chunk_length;
4751
+ // Otherwise, the last block if remainder + look-ahead time steps.
4748
4752
  return rem + MODEL.look_ahead;
4749
4753
  }
4750
4754