Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test case for issue #124
Browse files Browse the repository at this point in the history
ToddFincannon committed Oct 6, 2021
1 parent dabda99 commit 5067a6b
Showing 4 changed files with 27 additions and 7 deletions.
3 changes: 3 additions & 0 deletions models/directconst/data/f.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
f,A2,A3
C1,12,13
C2,22,23
12 changes: 12 additions & 0 deletions models/directconst/directconst.dat
Original file line number Diff line number Diff line change
@@ -42,6 +42,18 @@ e[C2,B2]
0 4
e[C2,B3]
0 6
f[C1,A1]
0 0
f[C1,A2]
0 12
f[C1,A3]
0 13
f[C2,A1]
0 0
f[C2,A2]
0 22
f[C2,A3]
0 23
FINAL TIME
0 1
INITIAL TIME
12 changes: 12 additions & 0 deletions models/directconst/directconst.mdl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{UTF-8}
DimA: A1, A2, A3 ~~|
SubA: A2, A3 ~~|
DimB: B1, B2, B3 ~~|
DimC: C1, C2 ~~|
DimD: D1, D2 ~~|
@@ -38,6 +40,16 @@ e[DimC, DimB] =
'B2*'
) ~~~:SUPPLEMENTARY|

f[DimC, SubA] =
GET DIRECT CONSTANTS(
'data/f.csv',
',',
'B2'
) ~~~:SUPPLEMENTARY|

f[DimC, DimA] :EXCEPT: [DimC, SubA] = 0
~~~:SUPPLEMENTARY|

********************************************************
.Control
********************************************************~
7 changes: 0 additions & 7 deletions src/EquationGen.js
Original file line number Diff line number Diff line change
@@ -328,13 +328,6 @@ export default class EquationGen extends ModelReader {
// Emit the tmp var subscript just after emitting the tmp var elsewhere.
this.emit(`[${this.aaTmpDimName}[${i}]]`)
}
directConstSubscriptGen(subscripts) {
// Construct numeric constant variable subscripts in normal order.
let cSubscripts = subscripts.map(s => (isDimension(s) ? sub(s).value : [s]))
let indexSubscripts = cartesianProductOf(cSubscripts)
let numericSubscripts = indexSubscripts.map(idx => idx.map(s => sub(s).value))
return numericSubscripts.map(s => s.reduce((a, v) => a.concat(`[${v}]`), ''))
}
functionIsLookup() {
// See if the function name in the current call is actually a lookup.
// console.error(`isLookup ${this.lookupName()}`);

0 comments on commit 5067a6b

Please sign in to comment.