Skip to content
Snippets Groups Projects
Verified Commit 1472ca27 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

qval should be positive

parent bc49bcb5
No related branches found
No related tags found
No related merge requests found
module InstantGradients module InstantGradients
import StaticArrays: SVector, SMatrix import StaticArrays: SVector, SMatrix
import JuMP: @constraint
import ...Variables: VariableType, duration, qval, bmat_gradient, get_free_variable, set_simple_constraints!, effective_time, make_generic import ...Variables: VariableType, duration, qval, bmat_gradient, get_free_variable, set_simple_constraints!, effective_time, make_generic
import ...BuildSequences: global_model
import ..AbstractTypes: EventComponent, GradientWaveform import ..AbstractTypes: EventComponent, GradientWaveform
""" """
...@@ -23,6 +25,9 @@ function (::Type{InstantGradient})(; orientation=nothing, group=nothing, qval=no ...@@ -23,6 +25,9 @@ function (::Type{InstantGradient})(; orientation=nothing, group=nothing, qval=no
res = InstantGradient3D(get_free_variable.(qval), group) res = InstantGradient3D(get_free_variable.(qval), group)
else else
res = InstantGradient1D(get_free_variable(qval), orientation, group) res = InstantGradient1D(get_free_variable(qval), orientation, group)
if res.qval isa Number
@constraint global_model() res.qval >= 0
end
end end
set_simple_constraints!(res, variables) set_simple_constraints!(res, variables)
return res return res
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment