- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 233
 
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
Question: What has changed with MTK initialization?
I'm running a model to steady-state, picking out the steady state value, and try to use that in linearization. My code worked yesterday, but this morning I updated Julia packages (it's been a couple of weeks since last update), and now my code does not work.
So - either a bug has been introduced in MTK, or the method to initialize models has changed.
Here is what is going on:
- Run model to steady state:
 
tspan_ss = (0,1e3)   # "long" time to reach steady state
u_u_v(t) = u_v_const(t)   # u_u_v(t) is a register_symbolic function that provides input in the model
#
prob_ns_oL_ss = ODEProblem(hp_ns_oL, [], tspan_ss)
sol = solve(prob_ns_oL_ss,Rodas5())
x_ss = sol[end]   # Picks out the final value, interpreted as the steady state- Creating model for linearization:
 
@named hp_ns_LoL = HydroPower_ns(; case = :u_i)   # case is a structural_parameter, 
                                                                                     # used to remove input equation.
hp_ns_LoL = complete(hp_ns_LoL)- Specifying operational point for linearization:
 
op_x = Dict(unknowns(hp_ns_oL) .=> x_ss)  # specifying unknown values
op_u = Dict(hp_ns_LoL.u_v=>alpha_1_n/alpha_1_max) # "u" is the input
#
op_pt = merge(op_x, op_u)  # Operating point- Carrying out linearization -- this worked yesterday, but fails now:
 
mats, _ = linearize(hp_ns_LoL, [hp_ns_LoL.u_v], [hp_ns_LoL.f_e]; op=op_pt, allow_input_derivatives=true)
sys_2 = ss(mats...)This leads to the following error message:
Warning: Initialization system is overdetermined. 3 equations for 0 unknowns. Initialization will default to using least squares. `SCCNo...NOTE to "clarify" my model...
- In the model 
@variablessection, I give initial values to sufficient number of "states" to ensure that the initial unknowns can be computed. And normal simulation works fine. - I have had some problems using the 
remakefunction lately. If I doremake(model_name, u0 = x_ss), it seems like I get an error message related to overdetermined initialization problem. Is there a conflict with the default initial values I have given to the model in the@variablessection? - From the documentation of 
remake, there appears to have been made some changes??? There is also references tosetpandsetu, without examples of use (are these functions? keywords? or what?), as well as areplace(function?). - Has the above possible changes also led to setting the operational point by 
op = op_ptmalfunctioning? 
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested