Skip to content

Commit

Permalink
fix: handle subdimensions correctly for GET DIRECT CONSTANTS and fix …
Browse files Browse the repository at this point in the history
…EXCEPT handling (#125)

Fixes #124
Fixes #134

Co-authored-by: Chris Campbell <[email protected]>
  • Loading branch information
ToddFincannon and chrispcampbell authored Oct 14, 2021
1 parent bd0a724 commit 2fdfb34
Show file tree
Hide file tree
Showing 11 changed files with 442 additions and 68 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
Expand Up @@ -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
Expand Down
50 changes: 26 additions & 24 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 ~~|
Expand Down Expand Up @@ -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
********************************************************~
Expand All @@ -55,30 +67,20 @@ V300 Do not put anything below this section - it will be ignored
$0-0-0,0,|0||0-0-0|0-0-0|0-0-0|0-0-0|0-0-0|0,0,100,0
///---\\\
:L<%^E!@
1:
directconst.vdfx
4:Tim
e
5:a[DimA]

6
:A1
9:directconst
19:100,0
24:0
25:1
26:1
15:0,0,0,0,0,0
27:0,
19:100,0
27:2,
34:0,
42:0
72:0
3:0 95:0
96:0 77:0 78:0 93:0
94:0
92:0
91:0
90:0
87:0
75:
43:
5:FINAL TIME
35:Date
36:YYYY-MM-DD
37:2000
38:1
39:1
40:2
41:0
42:1
24:0
25:0
26:0
17 changes: 17 additions & 0 deletions models/except/except.dat
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ h[A1]
0 8
INITIAL TIME
0 0
input
0 0
j[D1]
0 10
j[D2]
Expand Down Expand Up @@ -195,3 +197,18 @@ y[A2,C3]
y[A3,C2]
0 3
1 3
z[A1]
0 10
z[A2]
0 125
1 125
z[A3]
0 125
1 125
z ref a
0 25
z ref b
0 5
z total
0 250
1 250
10 changes: 10 additions & 0 deletions models/except/except.mdl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ y[SubA, SubC] :EXCEPT: [A3, C3] = c[SubA, SubC] ~~|
except3[DimE, DimF, DimG] :EXCEPT: [E2, F2, G2] = 3 ~~|
except4[DimE, DimF, DimG, DimH] :EXCEPT: [E2, F2, G2, H2] = 4 ~~|

input = 0 ~~|

z ref a = 25 ~~|
z ref b = 5 ~~|

z[SubA] = z ref a * z ref b ~~|
z[DimA] :EXCEPT: [SubA] = 10 ~~|

z total = SUM ( z[SubA!] ) ~~|

INITIAL TIME = 0 ~~|
FINAL TIME = 1 ~~|
SAVEPER = 1 ~~|
Expand Down
214 changes: 214 additions & 0 deletions models/except2/except2.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
a[A1]
0 1
a[A2]
0 1
a[A3]
0 1
b[A2]
0 2
b[A3]
0 2
c[A1,C1]
0 3
c[A1,C2]
0 3
c[A1,C3]
0 3
c[A2,C1]
0 3
c[A2,C2]
0 3
c[A2,C3]
0 3
c[A3,C1]
0 3
c[A3,C2]
0 3
c[A3,C3]
0 3
d[A2,C1]
0 4
d[A3,C1]
0 4
e[A1,C2]
0 5
e[A1,C3]
0 5
e[A2,C2]
0 5
e[A2,C3]
0 5
e[A3,C2]
0 5
e[A3,C3]
0 5
except3[E1,F1,G1]
0 3
except3[E1,F1,G2]
0 3
except3[E1,F2,G1]
0 3
except3[E1,F2,G2]
0 3
except3[E2,F1,G1]
0 3
except3[E2,F1,G2]
0 3
except3[E2,F2,G1]
0 3
except4[E1,F1,G1,H1]
0 4
except4[E1,F1,G1,H2]
0 4
except4[E1,F1,G2,H1]
0 4
except4[E1,F1,G2,H2]
0 4
except4[E1,F2,G1,H1]
0 4
except4[E1,F2,G1,H2]
0 4
except4[E1,F2,G2,H1]
0 4
except4[E1,F2,G2,H2]
0 4
except4[E2,F1,G1,H1]
0 4
except4[E2,F1,G1,H2]
0 4
except4[E2,F1,G2,H1]
0 4
except4[E2,F1,G2,H2]
0 4
except4[E2,F2,G1,H1]
0 4
except4[E2,F2,G1,H2]
0 4
except4[E2,F2,G2,H1]
0 4
f[A1,C1]
0 6
FINAL TIME
0 1
g[A2]
0 7
g[A3]
0 7
h[A1]
0 8
INITIAL TIME
0 0
input
0 0
j[D1]
0 10
j[D2]
0 20
k[A2]
0 11
1 11
k[A3]
0 11
1 11
o[A3]
0 9
p[A1,C2]
0 10
p[A1,C3]
0 10
p[A2,C1]
0 10
p[A2,C2]
0 10
p[A2,C3]
0 10
p[A3,C1]
0 10
p[A3,C2]
0 10
p[A3,C3]
0 10
q[A1,C1]
0 11
q[A1,C2]
0 11
q[A1,C3]
0 11
q[A2,C1]
0 11
q[A2,C3]
0 11
q[A3,C1]
0 11
q[A3,C3]
0 11
r[A1,C2]
0 12
r[A1,C3]
0 12
r[A2,C2]
0 12
r[A2,C3]
0 12
r[A3,C2]
0 12
r[A3,C3]
0 12
s[A2]
0 14
s[A3]
0 13
SAVEPER
0 1
t[A2,C2]
0 15
t[A2,C3]
0 15
t[A3,C2]
0 15
t[A3,C3]
0 15
TIME STEP
0 1
u[A2]
0 1
1 1
u[A3]
0 1
1 1
v[A2]
0 1
1 1
v[A3]
0 1
1 1
w[A1]
0 1
1 1
x[A1]
0 3
1 3
y[A2,C2]
0 3
1 3
y[A2,C3]
0 3
1 3
y[A3,C2]
0 3
1 3
z[A1]
0 10
z[A2]
0 125
1 125
z[A3]
0 125
1 125
z ref a
0 25
z ref b
0 5
z total
0 250
1 250
Loading

0 comments on commit 2fdfb34

Please sign in to comment.