You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add methods to support colons between Timesteps ie.
using Mimi
## Failing Case
@defcomp A begin
p = Parameter(index = [time, pools])
v1 = Variable(index = [time, pools])
v2 = Variable(index = [time])
function run_timestep(p, v, d, t)
v.v1[t,:] = p.p[t,:]
if is_first(t)
v.v2[t] = 0
else
v.v2[t] = sum(v.v1[(t-1):t,:])
end
end
end
m = Model()
set_dimension!(m, :time, 1:10)
set_dimension!(m, :pools, 1:3)
add_comp!(m, A)
set_param!(m, :A, :p, fill(1,10,3))
run(m)
## Smaller Case
@efcomp A begin
p = Parameter(index = [time])
v = Variable(index = [time])
function run_timestep(p, v, d, t)
if is_first(t)
v.v[t] = p.p[t]
else
v.v[t] = sum(p.p[t:t])
# or v.v[t] = sum(p, p[t-1:t])
end
end
end
m = Model()
set_dimension!(m, :time, 1:10)
add_comp!(m, A)
set_param!(m, :A, :p, 1:10)
run(m)
The text was updated successfully, but these errors were encountered:
julia> Mimi.FixedTimestep:Mimi.FixedTimestep
ERROR: MethodError: no method matching -(::Type{Mimi.FixedTimestep}, ::Type{Mimi.FixedTimestep})
Closest candidates are:
-(::Array{DoubleFloats.DoubleFloat{T}, 2}, ::T) where T at /Users/lisarennels/.julia/packages/DoubleFloats/KXG5r/src/extras/misc.jl:62
-(::Array{DoubleFloats.DoubleFloat{T}, 1}, ::T) where T at /Users/lisarennels/.julia/packages/DoubleFloats/KXG5r/src/extras/misc.jl:56
-(::Intervals.Interval, ::Any) at /Users/lisarennels/.julia/packages/Intervals/ua9cq/src/interval.jl:297
...
Stacktrace:
[1] (::Colon)(start::Type{Mimi.FixedTimestep}, stop::Type{Mimi.FixedTimestep})
@ Base ./range.jl:7
[2] top-level scope
@ REPL[147]:1
Add methods to support colons between Timesteps ie.
using Mimi
The text was updated successfully, but these errors were encountered: