Skip to content

Commit 555b493

Browse files
authored
Merge pull request #775 from mimiframework/explore-mi
Add temporary Model constructor
2 parents b28f1c5 + 78a74cb commit 555b493

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/core/types/model.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ mutable struct Model <: AbstractModel
2424
function Model(m::Model)
2525
return new(deepcopy(m.md), nothing)
2626
end
27+
28+
# Create a model from a ModelInstance (temporary for explore call)
29+
function Model(mi::ModelInstance)
30+
return new(deepcopy(mi.md), deepcopy(mi))
31+
end
2732
end
2833

2934
"""

src/explorer/explore.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ function explore(m::Model; title = "Electron")
5252

5353
end
5454

55+
function explore(mi::ModelInstance; title = "Electron")
56+
m = Model(mi)
57+
m.md.dirty = false # we need this to get explorer working, but it's a hack and should be temporary!
58+
explore(m)
59+
end
60+
5561
"""
5662
explore(sim_inst::SimulationInstance; title="Electron", model_index::Int = 1, scen_name::Union{Nothing, String} = nothing, results_output_dir::Union{Nothing, String} = nothing)
5763

0 commit comments

Comments
 (0)