Opened 15 years ago
Last modified 15 years ago
#1225 closed defect (fixed)
derivative annotation in function casuses the function to not be added to the DAE functiontree
Reported by: | Per Östlund | Owned by: | Per Östlund |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | Instantiation | Version: | 1.6.0 |
Keywords: | Cc: | Per Östlund, Per Östlund |
Description
If a function has a derivative annotation, then only it's derivative is added to the function tree of the DAE, and not the function itself. Example:
function g input Real x; output Real z; algorithm z := x+1; end g; function f input Real x; input Real y; output Real z; annotation(derivative(noDerivative(y=g(x)))=f_der); algorithm z_der := x_der*cos(x); end f; function f_der input Real x; input Real y; input Real x_der; output Real z_der; algorithm z_der := x+y+x_der; end f_der; model Derivative3 Real x[3]; Real u[3](each fixed=false); type IC=Real(start=0,fixed=true); IC ic[2]=x[1:2]-u[1:2]; equation x[1]=f(exp(time),g(exp(time))); der(x[1:2])=x[2:3]; x[3]=u[3]; der(u[1:2])=u[2:3]; end Derivative3;
Output from omc:
function f_der input Real x; input Real y; input Real x_der; output Real z_der; algorithm z_der := x + y + x_der; end f_der; function g input Real x; output Real z; algorithm z := 1.0 + x; end g; fclass Derivative3 Real x[1]; Real x[2]; Real x[3]; Real u[1](fixed = false); Real u[2](fixed = false); Real u[3](fixed = false); Real ic[1](start = 0.0, fixed = true) = x[1] - u[1]; Real ic[2](start = 0.0, fixed = true) = x[2] - u[2]; equation x[1] = f(exp(time),g(exp(time))); der(x[1]) = x[2]; der(x[2]) = x[3]; x[3] = u[3]; der(u[1]) = u[2]; der(u[2]) = u[3]; end Derivative3;
Note:
See TracTickets
for help on using tickets.
Fixed in revision 5498.