linny-r 1.1.23 → 1.2.0

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.
@@ -747,6 +747,52 @@ img.inline-cancel-btn {
747
747
  cursor: pointer;
748
748
  }
749
749
 
750
+ /* styles for the NEW SCALAR dialog */
751
+ #new-scale-unit-modal {
752
+ z-index: 115; /* on top of the SCALARS modal */
753
+ }
754
+
755
+ #new-scale-unit-dlg {
756
+ width: min-content;
757
+ height: min-content;
758
+ max-height: 450px;
759
+ }
760
+
761
+ #new-scale-unit-name {
762
+ width: 70px;
763
+ }
764
+
765
+ #new-scale-unit-scalar {
766
+ width: 115px;
767
+ }
768
+
769
+ #new-scale-unit-base {
770
+ width: 70px;
771
+ }
772
+
773
+ /* styles for the SCALE UNITS dialog */
774
+ #scale-units-modal {
775
+ z-index: 110; /* on top of the SETTINGS dialog */
776
+ }
777
+
778
+ #scale-units-dlg {
779
+ width: 270px;
780
+ height: min-content;
781
+ max-height: 450px;
782
+ }
783
+
784
+ #scale-units-buttons > img.btn {
785
+ height: 20px;
786
+ width: 20px;
787
+ }
788
+
789
+ #scale-units-scroll-area {
790
+ margin: 2px;
791
+ width: calc(100% - 4px);
792
+ max-height: 250px;
793
+ overflow-y: auto;
794
+ border-top: 1px solid Silver;
795
+ }
750
796
 
751
797
  /* styles for the MODEL SETTINGS dialog */
752
798
  #settings-dlg {
@@ -754,6 +800,18 @@ img.inline-cancel-btn {
754
800
  height: min-content;
755
801
  }
756
802
 
803
+ #settings-scale-units-btn {
804
+ margin-left: 0px;
805
+ margin-right: 7px;
806
+ margin-top: -3px;
807
+ cursor: pointer;
808
+ filter: brightness(85%);
809
+ }
810
+
811
+ #settings-scale-units-btn:hover {
812
+ filter: brightness(200%);
813
+ }
814
+
757
815
  #password-dlg {
758
816
  width: min-content;
759
817
  height: min-content;
@@ -958,6 +1016,7 @@ td.a-box > div.abox {
958
1016
 
959
1017
  td.a-name {
960
1018
  width: 208px;
1019
+ max-width: 208px;
961
1020
  white-space: nowrap;
962
1021
  overflow: hidden;
963
1022
  text-overflow: ellipsis;
@@ -966,6 +1025,7 @@ td.a-name {
966
1025
 
967
1026
  td.a-weight {
968
1027
  width: 124px;
1028
+ max-width: 124px;
969
1029
  white-space: nowrap;
970
1030
  overflow: hidden;
971
1031
  text-overflow: ellipsis;
@@ -1546,7 +1606,7 @@ td.export {
1546
1606
  }
1547
1607
 
1548
1608
  #expression-dlg {
1549
- width: 545px;
1609
+ width: 550px;
1550
1610
  height: 325px;
1551
1611
  }
1552
1612
 
@@ -1864,6 +1924,10 @@ td.it {
1864
1924
  font-style: italic;
1865
1925
  }
1866
1926
 
1927
+ td.series {
1928
+
1929
+ }
1930
+
1867
1931
  td.io {
1868
1932
  width: 12px;
1869
1933
  }
@@ -1905,6 +1969,7 @@ div.io-box {
1905
1969
  border-top: 1px solid Silver;
1906
1970
  }
1907
1971
 
1972
+ #scale-units-table,
1908
1973
  #dataset-table,
1909
1974
  #dataset-modif-table,
1910
1975
  #equation-table,
@@ -2025,24 +2090,91 @@ tr.sel-set {
2025
2090
  background-color: #eff0ff;
2026
2091
  }
2027
2092
 
2028
- td.outcome:before {
2093
+ tr.def-sel {
2094
+ color: #400090;
2095
+ font-weight: bold;
2096
+ }
2097
+
2098
+ td.modif::before {
2099
+ content: ' \2045';
2100
+ color: #b00080;
2101
+ margin-right: 2px;
2102
+ }
2103
+
2104
+ td.outcome::before {
2029
2105
  content: ' \25C8';
2106
+ color: #b00080;
2107
+ margin-right: 1px;
2030
2108
  }
2031
2109
 
2032
- td.array:before {
2033
- content: ' \2637';
2110
+ td.array::before {
2111
+ content: ' \2263';
2112
+ color: #b00080;
2113
+ margin-right: 1px;
2034
2114
  }
2035
2115
 
2036
- td.blackbox:before {
2116
+ td.series::before {
2117
+ content: ' \28B8';
2118
+ color: #b00080;
2119
+ margin-left: -1px;
2120
+ }
2121
+
2122
+ td.outcome.modif::before {
2123
+ content: ' \25C8\2045';
2124
+ color: #b00080;
2125
+ margin-right: 2px;
2126
+ }
2127
+
2128
+ td.array.modif::before {
2129
+ content: ' \2263\2045';
2130
+ color: #b00080;
2131
+ margin-right: 1px;
2132
+ }
2133
+
2134
+ td.series.modif::before {
2135
+ content: ' \28B8\2045';
2136
+ color: #b00080;
2137
+ margin-left: -1px;
2138
+ }
2139
+
2140
+ td.blackbox::before {
2037
2141
  content: ' \25FC';
2142
+ color: #b00080;
2143
+ }
2144
+
2145
+ td.blackbox.series::before {
2146
+ content: ' \25FC\28B8';
2147
+ color: #b00080;
2038
2148
  }
2039
2149
 
2040
- td.blackbox.array:before {
2041
- content: ' \25FC\2637';
2150
+ td.blackbox.array::before {
2151
+ content: ' \25FC\2263';
2152
+ color: #b00080;
2042
2153
  }
2043
2154
 
2044
- td.blackbox.outcome:before {
2155
+ td.blackbox.outcome::before {
2045
2156
  content: ' \25FC\25C8';
2157
+ color: #b00080;
2158
+ }
2159
+
2160
+ td.blackbox.modif::before {
2161
+ content: ' \25FC\2045';
2162
+ color: #b00080;
2163
+ }
2164
+
2165
+ td.blackbox.series.modif::before {
2166
+ content: ' \25FC\28B8\2045';
2167
+ color: #b00080;
2168
+ }
2169
+
2170
+ td.blackbox.array.modif::before {
2171
+ content: ' \25FC\2263\2045';
2172
+ color: #b00080;
2173
+ }
2174
+
2175
+ td.blackbox.outcome.modif::before {
2176
+ content: ' \25FC\25C8\2045';
2177
+ color: #b00080;
2046
2178
  }
2047
2179
 
2048
2180
  td.dataset-selector {
@@ -2169,7 +2301,7 @@ td.equation-expression {
2169
2301
  /* SERIES modal dialog */
2170
2302
  #series-dlg {
2171
2303
  width: 165px;
2172
- height: 320px;
2304
+ height: 341px;
2173
2305
  }
2174
2306
 
2175
2307
  #series-default-lbl {
@@ -2184,36 +2316,49 @@ td.equation-expression {
2184
2316
  left: 79px;
2185
2317
  width: calc(100% - 83px);
2186
2318
  font-size: 12px;
2187
- margin-bottom: 2px;
2319
+ }
2320
+
2321
+ #series-unit-lbl {
2322
+ position: absolute;
2323
+ top: 47px;
2324
+ left: 2px;
2325
+ }
2326
+
2327
+ #series-unit {
2328
+ position: absolute;
2329
+ top: 46px;
2330
+ left: 32px;
2331
+ width: 70px;
2332
+ font-size: 12px;
2188
2333
  }
2189
2334
 
2190
2335
  #series-periodic {
2191
2336
  position: absolute;
2192
- top: 45px;
2337
+ top: 66px;
2193
2338
  left: 0px;
2194
2339
  }
2195
2340
 
2196
2341
  #series-periodic-lbl {
2197
2342
  position: absolute;
2198
- top: 47px;
2343
+ top: 68px;
2199
2344
  left: 22px;
2200
2345
  }
2201
2346
 
2202
2347
  #series-array {
2203
2348
  position: absolute;
2204
- top: 45px;
2349
+ top: 66px;
2205
2350
  left: 77px;
2206
2351
  }
2207
2352
 
2208
2353
  #series-array-lbl {
2209
2354
  position: absolute;
2210
- top: 47px;
2355
+ top: 68px;
2211
2356
  left: 99px;
2212
2357
  }
2213
2358
 
2214
2359
  #series-no-time-msg {
2215
2360
  position: absolute;
2216
- top: 66px;
2361
+ top: 87px;
2217
2362
  left: 1px;
2218
2363
  width: calc(100% - 2px);
2219
2364
  height: 30px;
@@ -2227,22 +2372,21 @@ td.equation-expression {
2227
2372
 
2228
2373
  #series-time-step-lbl {
2229
2374
  position: absolute;
2230
- top: 68px;
2375
+ top: 89px;
2231
2376
  left: 2px;
2232
2377
  }
2233
2378
 
2234
2379
  #series-time-scale {
2235
2380
  position: absolute;
2236
- top: 67px;
2381
+ top: 88px;
2237
2382
  left: 60px;
2238
2383
  width: 50px;
2239
2384
  font-size: 12px;
2240
- margin-bottom: 2px;
2241
2385
  }
2242
2386
 
2243
2387
  #series-time-unit {
2244
2388
  position: absolute;
2245
- top: 67px;
2389
+ top: 88px;
2246
2390
  left: 116px;
2247
2391
  height: 19px;
2248
2392
  width: 45px;
@@ -2251,13 +2395,13 @@ td.equation-expression {
2251
2395
 
2252
2396
  #series-method-lbl {
2253
2397
  position: absolute;
2254
- top: 91px;
2398
+ top: 112px;
2255
2399
  left: 2px;
2256
2400
  }
2257
2401
 
2258
2402
  #series-method {
2259
2403
  position: absolute;
2260
- top: 89px;
2404
+ top: 110px;
2261
2405
  left: 50px;
2262
2406
  height: 21px;
2263
2407
  width: 111px;
@@ -2266,7 +2410,7 @@ td.equation-expression {
2266
2410
 
2267
2411
  #series-remote {
2268
2412
  position: absolute;
2269
- top: 113px;
2413
+ top: 134px;
2270
2414
  left: 3px;
2271
2415
  width: calc(100% - 8px);
2272
2416
  }
@@ -2278,7 +2422,7 @@ td.equation-expression {
2278
2422
 
2279
2423
  #series-data-lbl {
2280
2424
  position: absolute;
2281
- top: 133px;
2425
+ top: 154px;
2282
2426
  left: 2px;
2283
2427
  }
2284
2428
 
@@ -2286,7 +2430,7 @@ td.equation-expression {
2286
2430
  position: absolute;
2287
2431
  bottom: 13px;
2288
2432
  width: calc(100% - 6px);
2289
- height: calc(100% - 165px);
2433
+ height: calc(100% - 186px);
2290
2434
  margin: 3px;
2291
2435
  }
2292
2436
 
@@ -2966,9 +3110,9 @@ td.sa-not-run {
2966
3110
  display: none;
2967
3111
  z-index: 20;
2968
3112
  margin: 0;
2969
- width: 425px;
3113
+ width: 450px;
2970
3114
  height: 275px;
2971
- min-width: 425px;
3115
+ min-width: 450px;
2972
3116
  min-height: 250px;
2973
3117
  max-height: 99vh;
2974
3118
  max-width: 99vw;
@@ -3050,7 +3194,7 @@ td.sa-not-run {
3050
3194
  position: absolute;
3051
3195
  top: -2px;
3052
3196
  left: 72px;
3053
- width: 140px;
3197
+ width: 170px;
3054
3198
  }
3055
3199
 
3056
3200
  /* enhance brightness for dark v-btn buttons */
@@ -3449,20 +3593,41 @@ div.no-colors {
3449
3593
  width: calc(100% - 6px);
3450
3594
  }
3451
3595
 
3596
+ #xp-iterator-dlg {
3597
+ width: 130px;
3598
+ height: min-content;
3599
+ }
3600
+
3601
+ #xp-iterator-table {
3602
+ margin: 2px;
3603
+ }
3604
+
3605
+ input.range-limit {
3606
+ height: 15px !important;
3607
+ width: 30px;
3608
+ text-align: center;
3609
+ }
3610
+
3452
3611
  /* the EDIT SETTINGS DIMENSIONS dialog allows editing these dimensions */
3453
- /* NOTE: many styles in common with the EDIT ACTOR DIMENSIONS dialog */
3454
- #xp-settings-dlg {
3612
+ /* NOTE: many styles in common with the EDIT COMBINATIONS dialog and */
3613
+ /* the EDIT ACTOR DIMENSIONS dialog */
3614
+ #xp-settings-dlg,
3615
+ #xp-combination-dlg {
3455
3616
  width: 270px;
3456
3617
  height: 236px;
3457
3618
  }
3458
3619
 
3459
- #xp-actor-s-header,
3620
+ #xp-actor-dimension-header,
3621
+ #xp-combination-s-header,
3622
+ #xp-combination-d-header,
3460
3623
  #xp-settings-s-header,
3461
3624
  #xp-settings-d-header {
3462
3625
  margin: 2px;
3463
3626
  }
3464
3627
 
3465
- #xp-actor-s-header > img,
3628
+ #xp-actor-dimension-header > img,
3629
+ #xp-combination-s-header > img,
3630
+ #xp-combination-d-header > img,
3466
3631
  #xp-settings-s-header > img,
3467
3632
  #xp-settings-d-header > img {
3468
3633
  margin-left: 5px;
@@ -3470,6 +3635,8 @@ div.no-colors {
3470
3635
  vertical-align: bottom;
3471
3636
  }
3472
3637
 
3638
+ #xp-combination-s-scroll-area,
3639
+ #xp-combination-d-scroll-area,
3473
3640
  #xp-settings-s-scroll-area,
3474
3641
  #xp-settings-d-scroll-area {
3475
3642
  width: 266px;
@@ -3479,6 +3646,8 @@ div.no-colors {
3479
3646
  }
3480
3647
 
3481
3648
  #xp-actor-dimension-table,
3649
+ #xp-combination-s-table,
3650
+ #xp-combination-d-table,
3482
3651
  #xp-settings-s-table,
3483
3652
  #xp-settings-d-table {
3484
3653
  background-color: white;
@@ -3488,6 +3657,8 @@ div.no-colors {
3488
3657
  }
3489
3658
 
3490
3659
  #xp-actor-dimension-table > tbody > tr:hover,
3660
+ #xp-combination-s-table > tbody > tr:hover,
3661
+ #xp-combination-d-table > tbody > tr:hover,
3491
3662
  #xp-settings-s-table > tbody > tr:hover,
3492
3663
  #xp-settings-d-table > tbody > tr:hover,
3493
3664
  #xp-clusters-table > tbody > tr:hover {
@@ -3495,33 +3666,43 @@ div.no-colors {
3495
3666
  }
3496
3667
 
3497
3668
  #xp-actor-dimension-table > tbody > tr > td,
3669
+ #xp-combination-s-table > tbody > tr > td,
3498
3670
  #xp-settings-s-table > tbody > tr > td,
3499
3671
  #xp-clusters-table > tbody > tr > td {
3500
3672
  border: 1px solid Silver;
3501
3673
  }
3502
3674
 
3675
+ #xp-combination-selector-dlg {
3676
+ width: 395px;
3677
+ height: 45px;
3678
+ }
3679
+
3503
3680
  #xp-settings-selector-dlg {
3504
3681
  width: 370px;
3505
3682
  height: 45px;
3506
3683
  }
3507
3684
 
3508
3685
  #xp-actor-selector-code,
3686
+ #xp-combination-selector-code,
3509
3687
  #xp-settings-selector-code {
3510
3688
  width: 80px;
3511
3689
  }
3512
3690
 
3691
+ #xp-combination-selector-string,
3513
3692
  #xp-settings-selector-string {
3514
3693
  width: 182px;
3515
3694
  font-family: monospace;
3516
3695
  }
3517
3696
 
3697
+ #xp-combination-dimension-dlg,
3518
3698
  #xp-settings-dimension-dlg {
3519
- width: 295px;
3699
+ width: 305px;
3520
3700
  height: 45px;
3521
3701
  }
3522
3702
 
3703
+ #xp-combination-dimension-string,
3523
3704
  #xp-settings-dimension-string {
3524
- width: 234px;
3705
+ width: 244px;
3525
3706
  }
3526
3707
 
3527
3708
  span.sd-clear {
@@ -45,6 +45,12 @@ const CONFIGURATION = {
45
45
  // Default properties for new models
46
46
  default_currency_unit: 'EUR',
47
47
  default_time_unit: 'hour',
48
+ // Standard scale units to be included in new models
49
+ scale_units: [
50
+ // Units can be defined as 3-tuples [name, scalar, base unit], e.g.,
51
+ // ['MJ', '1', '1'],
52
+ // ['kWh', '3.6', 'MJ']
53
+ ],
48
54
  default_scale_unit: '1', // 1 denotes "no unit" (abstract scale)
49
55
  // Font properties for SVG diagram
50
56
  // NOTE: When a font name comprises multiple words, it must be enclosed
@@ -130,8 +130,9 @@ class Controller {
130
130
  end_period: 'End at',
131
131
  look_ahead: 'Look-ahead'
132
132
  },
133
- ENTITY_PROPS: ['actors', 'clusters', 'processes', 'products', 'datasets',
134
- 'equations', 'links', 'constraints'],
133
+ ENTITY_PROPS: ['units', 'actors', 'clusters', 'processes', 'products',
134
+ 'datasets', 'equations', 'links', 'constraints'],
135
+ UNIT_PROPS: ['multiplier', 'base_unit'],
135
136
  ACTOR_PROPS: ['weight', 'comments'],
136
137
  CLUSTER_PROPS: ['comments', 'collapsed', 'ignore'],
137
138
  PROCESS_PROPS: ['comments', 'lower_bound', 'upper_bound', 'initial_level',
@@ -139,8 +140,8 @@ class Controller {
139
140
  PRODUCT_PROPS: ['comments', 'lower_bound', 'upper_bound', 'initial_level',
140
141
  'scale_unit', 'equal_bounds', 'price', 'is_source', 'is_sink', 'is_buffer',
141
142
  'is_data', 'integer_level', 'no_slack'],
142
- DATASET_PROPS: ['comments', 'default_value', 'time_scale', 'time_unit',
143
- 'method', 'periodic', 'array', 'url', 'default_selector'],
143
+ DATASET_PROPS: ['comments', 'default_value', 'scale_unit', 'time_scale',
144
+ 'time_unit', 'method', 'periodic', 'array', 'url', 'default_selector'],
144
145
  LINK_PROPS: ['comments', 'multiplier', 'relative_rate', 'share_of_cost',
145
146
  'flow_delay'],
146
147
  CONSTRAINT_PROPS: ['comments', 'no_slack', 'share_of_cost'],
@@ -152,7 +153,8 @@ class Controller {
152
153
  EXPERIMENT_PROPS: ['comments', 'configuration_dims',
153
154
  'column_scenario_dims', 'excluded_selectors'],
154
155
  };
155
- this.MC.ALL_PROPS = this.MC.ENTITY_PROPS + this.MC.ACTOR_PROPS +
156
+ this.MC.ALL_PROPS = this.MC.ENTITY_PROPS +
157
+ this.MC.UNIT_PROPS + this.MC.ACTOR_PROPS +
156
158
  this.MC.CLUSTER_PROPS + this.MC.PROCESS_PROPS +
157
159
  this.MC.PRODUCT_PROPS + this.MC.DATASET_PROPS + this.MC.LINK_PROPS +
158
160
  this.MC.CONSTRAINT_PROPS + this.MC.NOTE_PROPS + this.MC.CHART_PROPS +
@@ -277,9 +279,12 @@ class Controller {
277
279
  // Returns `name` without the object-attribute separator |, backslashes,
278
280
  // and leading and trailing whitespace, and with all internal whitespace
279
281
  // reduced to a single space.
280
- return name.replace(this.OA_SEPARATOR, ' ')
282
+ name = name.replace(this.OA_SEPARATOR, ' ')
281
283
  .replace(/\||\\/g, ' ').trim()
282
284
  .replace(/\s\s+/g, ' ');
285
+ // NOTE: this may still result in a single space, which is not a name
286
+ if(name === ' ') return '';
287
+ return name;
283
288
  }
284
289
 
285
290
  validName(name) {
@@ -311,6 +316,16 @@ class Controller {
311
316
  return n.replace(this.EQUATIONS_DATASET_NAME + '|',
312
317
  '<span class="eq">\u221Ax</span>');
313
318
  }
319
+
320
+ nameAsConstantString(n) {
321
+ // Returns name with single quotes if it equals an Linny-R constant
322
+ // or operator, or when it contains symbol separator characters or ']'
323
+ let quoted = CONSTANT_SYMBOLS.indexOf(n) >= 0 ||
324
+ MONADIC_OPERATORS.indexOf(n) >= 0 || n.indexOf(']') >= 0;
325
+ if(!quoted) SEPARATOR_CHARS.split('').forEach(
326
+ (c) => { if(n.indexOf(c) >= 0) quoted = true; });
327
+ return (quoted ? `'${n}'` : n);
328
+ }
314
329
 
315
330
  replaceEntity(str, en1, en2) {
316
331
  // Returns `en2` if `str` matches entity name `en1`; otherwise FALSE
@@ -329,7 +344,7 @@ class Controller {
329
344
  // Return FALSE to indicate "no replacement made"
330
345
  return false;
331
346
  }
332
-
347
+
333
348
  // Methods to notify modeler
334
349
 
335
350
  setMessage(msg, type, cause=null) {
@@ -437,6 +452,7 @@ class Controller {
437
452
  // while they can only be meaningfully performed by the GUI controller
438
453
  addListeners() {}
439
454
  readyToReset() {}
455
+ updateScaleUnitList() {}
440
456
  drawDiagram() {}
441
457
  drawSelection() {}
442
458
  drawObject() {}