Skip to content

Commit 09379b2

Browse files
authored
Merge pull request #846 from mimiframework/ConnectorCompDims
Connector comp dims
2 parents 69a8def + e231262 commit 09379b2

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/components/connector.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ using Mimi
2121
end
2222

2323
@defcomp ConnectorCompMatrix begin
24-
regions = Index()
24+
ConnectorCompMatrix_Dim2 = Index()
2525

26-
input1 = Parameter(index = [time, regions])
27-
input2 = Parameter(index = [time, regions])
28-
output = Variable(index = [time, regions])
26+
input1 = Parameter(index = [time, ConnectorCompMatrix_Dim2])
27+
input2 = Parameter(index = [time, ConnectorCompMatrix_Dim2])
28+
output = Variable(index = [time, ConnectorCompMatrix_Dim2])
2929

3030
first = Parameter() # first year to use the shorter data
3131
last = Parameter() # last year to use the shorter data
@@ -38,7 +38,7 @@ end
3838
input = p.input2
3939
end
4040

41-
for r in d.regions
41+
for r in d.ConnectorCompMatrix_Dim2
4242
v.output[t, r] = @allow_missing(input[t, r])
4343
end
4444
end

src/core/connections.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,9 @@ function add_connector_comps!(obj::AbstractCompositeComponentDef)
10821082
# required it, and for now let the first and last of the component
10831083
# be free and thus be set to the same as the model
10841084
conn_comp = add_comp!(obj, conn_comp_def, conn_comp_name, before=comp_name)
1085+
if num_dims == 2
1086+
set_dimension!(obj, :ConnectorCompMatrix_Dim2, 1:size(model_param(obj, conn.backup).values,2))
1087+
end
10851088
conn_path = conn_comp.comp_path
10861089

10871090
# remove the connections added in add_comp!

0 commit comments

Comments
 (0)