linny-r 2.1.5 → 2.1.7

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.
@@ -1364,7 +1364,10 @@ class ExpressionParser {
1364
1364
  const
1365
1365
  parts = name.split(UI.PREFIXER),
1366
1366
  tail = parts.pop();
1367
- if(parts.length > 0) {
1367
+ if(!tail && parts.length) {
1368
+ // Prefix without its trailing colon+space could identify an entity.
1369
+ obj = MODEL.objectByID(UI.nameToID(parts.join(UI.PREFIXER)));
1370
+ } else if(parts.length > 0) {
1368
1371
  // Name contains at least one prefix => last part *could* be a
1369
1372
  // method name, so look it up after adding a leading colon.
1370
1373
  const method = MODEL.equationByID(UI.nameToID(':' + tail));
@@ -3391,13 +3394,19 @@ class VirtualMachine {
3391
3394
  // Infer cycle basis for combined power grids for which Kirchhoff's
3392
3395
  // voltage law must be enforced.
3393
3396
  if(MODEL.with_power_flow) {
3394
- MONITOR.logMessage(1, 'POWER FLOW: ' +
3397
+ this.logMessage(1, 'POWER FLOW: ' +
3395
3398
  pluralS(Object.keys(MODEL.power_grids).length, 'grid'));
3399
+ if(MODEL.ignore_grid_capacity) this.logMessage(1,
3400
+ 'NOTE: Assuming infinite grid line cacity');
3401
+ if(MODEL.ignore_KVL) this.logMessage(1,
3402
+ 'NOTE: Disregarding Kirchhoff\'s Voltage Law');
3403
+ if(MODEL.ignore_power_losses) this.logMessage(1,
3404
+ 'NOTE: Disregarding transmission losses');
3396
3405
  POWER_GRID_MANAGER.inferCycleBasis();
3397
3406
  if(POWER_GRID_MANAGER.messages.length > 1) {
3398
3407
  UI.warn('Check monitor for power grid warnings');
3399
3408
  }
3400
- MONITOR.logMessage(1, POWER_GRID_MANAGER.messages.join('\n'));
3409
+ this.logMessage(1, POWER_GRID_MANAGER.messages.join('\n'));
3401
3410
  if(POWER_GRID_MANAGER.cycle_basis.length) this.logMessage(1,
3402
3411
  'Enforcing Kirchhoff\'s voltage law for ' +
3403
3412
  POWER_GRID_MANAGER.cycleBasisAsString);
@@ -6204,7 +6213,7 @@ Solver status = ${json.status}`);
6204
6213
  } catch(err) {
6205
6214
  const msg = `ERROR while processing solver data for block ${bnr}: ${err}`;
6206
6215
  console.log(msg);
6207
- MONITOR.logMessage(bnr, msg);
6216
+ this.logMessage(bnr, msg);
6208
6217
  UI.alert(msg);
6209
6218
  this.stopSolving();
6210
6219
  this.halted = true;
@@ -7240,14 +7249,14 @@ function VMI_push_run_result(x, args) {
7240
7249
  if(Array.isArray(rn)) {
7241
7250
  // Let the running experiment infer run number from selector list `rn`
7242
7251
  // and its own "active combination" of selectors.
7243
- rn = xp.matchingCombinationIndex(rn);
7252
+ rn = xp.matchingCombinationIndex(rn);
7244
7253
  } else if(rn < 0) {
7245
7254
  // Relative run number: use current run # + r (first run has number 0).
7246
7255
  if(xp === MODEL.running_experiment) {
7247
7256
  rn += xp.active_combination_index;
7248
7257
  } else if(xp.chart_combinations.length) {
7249
7258
  // Modeler has selected one or more runs in the viewer table.
7250
- // FInd the highest number of a selected run that has been performed.
7259
+ // Find the highest number of a selected run that has been performed.
7251
7260
  let last = -1;
7252
7261
  for(const ccn of xp.chart_combinations) {
7253
7262
  if(ccn > last && ccn < xp.runs.length) last = ccn;
@@ -7340,7 +7349,10 @@ function VMI_push_run_result(x, args) {
7340
7349
  }
7341
7350
  }
7342
7351
  // Truncate near-zero values.
7343
- if(Math.abs(v) < VM.SIG_DIF_FROM_ZERO) v = 0;
7352
+ if(v && Math.abs(v) < VM.SIG_DIF_FROM_ZERO) {
7353
+ console.log('NOTE: Truncated experiment run result', v, 'to zero');
7354
+ v = 0;
7355
+ }
7344
7356
  x.push(v);
7345
7357
  }
7346
7358
 
@@ -8432,6 +8444,8 @@ function VMI_set_bounds(args) {
8432
8444
  // Check the difference, as this may be negligible.
8433
8445
  if(u - l < VM.SIG_DIF_FROM_ZERO) {
8434
8446
  u = Math.round(u * 1e5) / 1e5;
8447
+ // NOTE: This may result in -0 (minus zero) => then set to 0.
8448
+ if(u < 0 && u > -VM.NEAR_ZERO) u = 0;
8435
8449
  } else {
8436
8450
  // If substantial, warn that "impossible" bounds would have been set.
8437
8451
  const vk = vbl.displayName;