Skip to content

Commit

Permalink
feat: add support for external data variables with > 2 dimensions (#47)
Browse files Browse the repository at this point in the history
Fixes #45
  • Loading branch information
chrispcampbell authored Sep 17, 2020
1 parent 6c80c59 commit 6683e63
Show file tree
Hide file tree
Showing 5 changed files with 442 additions and 74 deletions.
238 changes: 238 additions & 0 deletions models/extdata/extdata.dat
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,42 @@ A Totals
8 218.571
9 240
10 270
B Selection[B1]
0 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
B Selection[B2]
0 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
B Selection[B3]
0 1
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
B1 Totals
0 10
1 30
Expand All @@ -22,6 +58,36 @@ B1 Totals
8 135.714
9 150
10 170
C Selection[C1]
0 1
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
C Selection[C2]
0 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
Chosen B
0 3
Chosen C
0 1
Chosen E
0 2
D Totals
0 11000
1 11200
Expand All @@ -34,6 +100,30 @@ D Totals
8 11571.4
9 11600
10 11800
E Selection[E1]
0 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
E Selection[E2]
0 1
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
E1 Values
0 7000
1 7100
Expand Down Expand Up @@ -88,6 +178,118 @@ Simple Totals
10 5500
TIME STEP
0 1
Total EBC
0 2000
1 2100
2 2200
3 2300
4 2400
5 2500
6 2600
7 2700
8 2800
9 2900
10 3000
Total EBC for Selected BC[E1]
0 1400
1 1500
2 1600
3 1700
4 1800
5 1900
6 2000
7 2100
8 2200
9 2300
10 2400
Total EBC for Selected BC[E2]
0 2000
1 2100
2 2200
3 2300
4 2400
5 2500
6 2600
7 2700
8 2800
9 2900
10 3000
Total EBC for Selected C[E1,B1]
0 1000
1 1100
2 1200
3 1300
4 1400
5 1500
6 1600
7 1700
8 1800
9 1900
10 2000
Total EBC for Selected C[E1,B2]
0 1200
1 1300
2 1400
3 1500
4 1600
5 1700
6 1800
7 1900
8 2000
9 2100
10 2200
Total EBC for Selected C[E1,B3]
0 1400
1 1500
2 1600
3 1700
4 1800
5 1900
6 2000
7 2100
8 2200
9 2300
10 2400
Total EBC for Selected C[E2,B1]
0 1600
1 1700
2 1800
3 1900
4 2000
5 2100
6 2200
7 2300
8 2400
9 2500
10 2600
Total EBC for Selected C[E2,B2]
0 1800
1 1900
2 2000
3 2100
4 2200
5 2300
6 2400
7 2500
8 2600
9 2700
10 2800
Total EBC for Selected C[E2,B3]
0 2000
1 2100
2 2200
3 2300
4 2400
5 2500
6 2600
7 2700
8 2800
9 2900
10 3000
VSERRATLEASTONE
0 1
VSSUM
0 0
A Values[A1]
0 0
1 10
Expand Down Expand Up @@ -166,6 +368,42 @@ E Values[E2]
2 8200
9 8300
10 8400
EBC Values[E1,B1,C1]
0 1000
10 2000
EBC Values[E1,B1,C2]
0 1100
10 2100
EBC Values[E1,B2,C1]
0 1200
10 2200
EBC Values[E1,B2,C2]
0 1300
10 2300
EBC Values[E1,B3,C1]
0 1400
10 2400
EBC Values[E1,B3,C2]
0 1500
10 2500
EBC Values[E2,B1,C1]
0 1600
10 2600
EBC Values[E2,B1,C2]
0 1700
10 2700
EBC Values[E2,B2,C1]
0 1800
10 2800
EBC Values[E2,B2,C2]
0 1900
10 2900
EBC Values[E2,B3,C1]
0 2000
10 3000
EBC Values[E2,B3,C2]
0 2100
10 3100
Simple 1
0 1000
1 2000
Expand Down
60 changes: 60 additions & 0 deletions models/extdata/extdata.mdl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ E Values[E1]
E Values[E2]
~~|

EBC Values[DimE,DimB,DimC]
~~|

Simple Totals =
Simple 1 + Simple 2
~~|
Expand All @@ -60,6 +63,63 @@ E2 Values =
E Values[E2]
~~|

Chosen E = 2
~~|

Chosen B = 3
~~|

Chosen C = 1
~~|

E Selection[DimE] =
IF THEN ELSE ( DimE = Chosen E , 1 , 0 )
~~|

B Selection[DimB] =
IF THEN ELSE ( DimB = Chosen B , 1 , 0 )
~~|

C Selection[DimC] =
IF THEN ELSE ( DimC = Chosen C , 1 , 0 )
~~|

Total EBC for Selected C[DimE,DimB] =
VECTOR SELECT (
C Selection[DimC!] ,
EBC Values[DimE,DimB,DimC!] ,
0,
VSSUM,
VSERRATLEASTONE
)
~~|

Total EBC for Selected BC[DimE] =
VECTOR SELECT (
B Selection[DimB!] ,
Total EBC for Selected C[DimE,DimB!] ,
0,
VSSUM,
VSERRATLEASTONE
)
~~|

Total EBC =
VECTOR SELECT (
E Selection[DimE!] ,
Total EBC for Selected BC[DimE!] ,
0,
VSSUM,
VSERRATLEASTONE
)
~~|

VSERRATLEASTONE = 1
~~|

VSSUM = 0
~~|

********************************************************
.Control
********************************************************~
Expand Down
36 changes: 36 additions & 0 deletions models/extdata/extdata_data.dat
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,39 @@ E Values[E2]
2 8200
9 8300
10 8400
EBC Values[E1,B1,C1]
0 1000
10 2000
EBC Values[E1,B1,C2]
0 1100
10 2100
EBC Values[E1,B2,C1]
0 1200
10 2200
EBC Values[E1,B2,C2]
0 1300
10 2300
EBC Values[E1,B3,C1]
0 1400
10 2400
EBC Values[E1,B3,C2]
0 1500
10 2500
EBC Values[E2,B1,C1]
0 1600
10 2600
EBC Values[E2,B1,C2]
0 1700
10 2700
EBC Values[E2,B2,C1]
0 1800
10 2800
EBC Values[E2,B2,C2]
0 1900
10 2900
EBC Values[E2,B3,C1]
0 2000
10 3000
EBC Values[E2,B3,C2]
0 2100
10 3100
Loading

0 comments on commit 6683e63

Please sign in to comment.