zekeriyasari / Causal.jl

Causal.jl - A modeling and simulation framework adopting causal modeling approach.
https://zekeriyasari.github.io/Causal.jl/dev/
Other
115 stars 7 forks source link

model_simulation.md tutorial, "A Larger Model Simulation" is broken, needs clock in simulate! call. #84

Open proudindiv opened 2 years ago

proudindiv commented 2 years ago

It may not of been updated from an earlier change to the interface.

# Simulation of the model 
simulate!(model, withbar=false)

gives:

MethodError: no method matching simulate!(::Model{LightGraphs.SimpleGraphs.SimpleDiGraph{Int64}, Vector{Any}, Vector{Any}, TaskManager{Any, Any, Inport{Inpin{Bool}}, Outport{Outpin{Float64}}, Nothing}, Nothing}; withbar=false)
Closest candidates are:
  simulate!(::Model, ::Clock; simdir, simprefix, simname, logtofile, loglevel, reportsim, withbar, breakpoints) at ~/.julia/packages/Causal/2C1k8/src/models/model.jl:638
  simulate!(::Model, ::Real, ::Real, ::Real; kwargs...) at ~/.julia/packages/Causal/2C1k8/src/models/model.jl:673

Stacktrace:
 [1] top-level scope
   @ In[4]:2
 [2] eval
   @ ./boot.jl:373 [inlined]
 [3] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1196

Using code similar to the earlier sections seems to work:

# Simulate the model
tinit, tsample, tfinal = 0., 0.01, 10. 
sim = simulate!(model, tinit, tsample, tfinal; withbar=false)

Similarly earlier section "Investigation of Simulation" fails on Clock:

clock = filecontent["model/clock"]
KeyError: key "model/clock" not found

Stacktrace:
 [1] getindex(h::Dict{String, Any}, key::String)
   @ Base ./dict.jl:481
 [2] top-level scope
   @ In[14]:1
 [3] eval
   @ ./boot.jl:373 [inlined]
 [4] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1196

I just discovered Causal.jl this evening and it looks like a great package!

I'm thinking of cloning Russell Standish and Steve Keen's "Minsky systems dynamics economics modeling software" to julia with it and combining them with my econometric time series modeling.