DAESystem
Full API
Jusdl.Components.Systems.DynamicSystems.DAESystem
— TypeDAESystem(input, output, statefunc, outputfunc, state, stateder, t, modelargs=(), solverargs=();
alg=DAEAlg, modelkwargs=NamedTuple(), solverkwargs=NamedTuple())
Construsts a DAESystem
with input
and output
. statefunc
is the state function and outputfunc
is the output function. state
is the initial state, stateder
is the initial state derivative and t
is the time. modelargs
and modelkwargs
are passed into ODEProblem
and solverargs
and solverkwargs
are passed into solve
method of DifferentialEquations
. alg
is the algorithm to solve the differential equation of the system.
DAESystem
is represented by the following equations.
where $t$ is the time t
, $x$ is state
, $dx$ is the value of the derivative of the state stateder
, $u$ is the value of input
and $y$ is the value of output
at time $t$. solver
is used to solve the above differential equation.
The signature of statefunc
must be of the form
function statefunc(out, dx, x, u, t)
out .= ... # Update out
emd
and the signature of outputfunc
must be of the form
function outputfunc(x, u, t)
y = ... # Compute y
return y
end
Example
julia> function sfunc(out, dx, x, u, t)
out[1] = x[1] + 1 - dx[1]
out[2] = (x[1] + 1) * x[2] + 2
end;
julia> ofunc(x, u, t) = x;
julia> x0 = [1., -1];
julia> dx0 = [2., 0.];
julia> ds = DAESystem(nothing, Bus(1), sfunc, ofunc, x0, dx0, 0., modelkwargs=(differential_vars=[true, false],))
DAESystem(state:[1.0, -1.0], t:0.0, input:nothing, output:Bus(nlinks:1, eltype:Link{Float64}, isreadable:false, iswritable:false))
See DifferentialEquations for more information about modelargs
, modelkwargs
, solverargs
solverkwargs
and alg
.