Error with set_start_value_function and Parameter Function Call
#375
-
|
I encountered an error when trying to set the start value function for an infinite variable using a parameter function. The error message suggests an incorrect syntax when calling the parameter function within the anonymous function passed to Code Snippet (Illustrative): function spvSzg!(model::InfiniteModel, data::Dict, sets::modelSettingsRFO)
# ... (Parameter function definition) ...
pvData = data["pv"] # is an array
Dt = supports(t)
@parameter_function(model, PpvMPPT[w ∈ 1:Nw] == (t) -> pvData[zero_order_time_index(Dt,t), w])
# ... (Infinite variable definition) ...
@variable(model, Ppv[w ∈ 1:Nw] .≥ 0, Infinite(t))
# Attempt to set start value function (causes error)
[set_start_value_function(Ppv[w], t -> 5 * PpvMPPT[w](t)) for w ∈ 1:Nw]
# ... (Rest of the model definition) ...
endthe error occurs when Functional call `PpvMPPT[1](t)(1.0)` is unrecognized syntax.as if the transcription is not evaluating the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
When using for w ∈ 1:Nw
set_start_value_function(Ppv[w], t -> 5 * pvData[zero_order_time_index(Dt,t), w])
end |
Beta Was this translation helpful? Give feedback.
Hi @DarioSlaifsteinSk,
When using
set_start_value_function, you need to directly pass the Julia function in question, not a parameter function. So in this case you should write something like: