-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArgumentError in gearbox #18
Comments
To parse As a workaround i've renamed the variable There is now a different error, julia> file = "SX_Mesh_manual.xml";
julia> H = readsxmodel(file, ST=ConstrainedLinearControlContinuousSystem);
DimensionMismatch("tried to assign 6-element array to 1×1 destination")
Stacktrace:
[1] throw_setindex_mismatch(::Array{Float64,1}, ::Tuple{Int64,Int64}) at ./indices.jl:94
[2] setindex_shape_check(::Array{Float64,1}, ::Int64, ::Int64) at ./indices.jl:146
[3] macro expansion at ./multidimensional.jl:554 [inlined]
[4] _unsafe_setindex!(::IndexLinear, ::Array{Float64,2}, ::Array{Float64,1}, ::Int64, ::Base.Slice{Base.OneTo{Int64}}) at ./multidimensional.jl:549
[5] macro expansion at ./multidimensional.jl:541 [inlined]
[6] _setindex! at ./multidimensional.jl:537 [inlined]
[7] setindex!(::Array{Float64,2}, ::Array{Float64,1}, ::Int64, ::Colon) at ./abstractarray.jl:968
[8] #linearHS#25(::Type{T} where T, ::Type{T} where T, ::Type{T} where T, ::Array{Any,1}, ::Function, ::Dict{String,Any}) at /Users/forets/.julia/v0.6/SX/src/symbolic.jl:109
[9] (::SX.#kw##linearHS)(::Array{Any,1}, ::SX.#linearHS, ::Dict{String,Any}) at ./<missing>:0
[10] #readsxmodel#1(::Bool, ::Type{T} where T, ::Type{T} where T, ::Array{Any,1}, ::Function, ::String) at /Users/forets/.julia/v0.6/SX/src/io.jl:149
[11] (::SX.#kw##readsxmodel)(::Array{Any,1}, ::SX.#readsxmodel, ::String) at ./<missing>:0
[12] include_string(::String, ::String) at ./loading.jl:522 |
Further debugging shows that this error exposes a wrong assumption in #13. Although parameters are defined "globally" for all locations in a given component (via As it is the case in this model, we have: julia> file = "SX_Mesh_manual.xml";
julia> HDict = readsxmodel(file, raw_dict=true);
julia> HDict["flows"][1]
6-element Array{Expr,1}:
:(t' = 1)
:(vx' = 21.875)
:(vy' = -0.114285)
:(px' = vx)
:(py' = vy)
:(II' = 0)
julia> HDict["flows"][2]
1-element Array{Expr,1}:
:(t' = 0) You see, the set of equations of the second location affects only a subset of the variables defined in this component. Hence i think we need to pull in the loop ex = diff.(RHS, state_variables)
A[i, :] = convert.(N, ex) is going to crash, because the dimension on the right (in this case, 6) does not match the number of columns of |
Done in this commit, which fixes the problem. I doubted if the same fix applies to discrete transitions, and finally decided to add it. Basically, in an assignment you don't necessarily won't affect all state variables defined in the component. IIRC, SpaceEx automatically adds the missing variables in an assignment, we see this for example in <assignment>x' == x & v' == -0.75*v</assignment> compare to the original network <assignment>v := -c*v</assignment>
...
<bind component="ball_template" as="ball" x="238.0" y="106.0">
...
<map key="c">0.75</map>
...
</bind> |
great! you have been super-efficient :) :) |
The following error occurs when we parse the gearbox benchmark.
ArgumentError: Second argument must be of Symbol type
The text was updated successfully, but these errors were encountered: