26 #include "dae_builder_internal.hpp"
36 #include "casadi_misc.hpp"
37 #include "exception.hpp"
38 #include "code_generator.hpp"
39 #include "calculus.hpp"
40 #include "xml_file.hpp"
41 #include "external.hpp"
42 #include "integrator.hpp"
47 #define THROW_ERROR(FNAME, WHAT) \
48 throw CasadiException("Error in DaeBuilder::" FNAME " for '" + this->name() \
49 + "' at " + CASADI_WHERE + ":\n" + std::string(WHAT));
60 return (*this)->name_;
65 return (*this)->time();
66 }
catch (std::exception& e) {
67 THROW_ERROR(
"time", e.what());
75 return (*this)->inputs(to_enum<Category>(cat));
76 }
catch (std::exception& e) {
77 THROW_ERROR(
"inputs", e.what());
84 return (*this)->outputs(to_enum<Category>(cat));
85 }
catch (std::exception& e) {
86 THROW_ERROR(
"outputs", e.what());
93 return (*this)->cdef();
94 }
catch (std::exception& e) {
95 THROW_ERROR(
"cdef", e.what());
103 }
catch (std::exception& e) {
104 THROW_ERROR(
"ddef", e.what());
112 }
catch (std::exception& e) {
113 THROW_ERROR(
"wdef", e.what());
119 return (*this)->init_lhs();
123 return (*this)->init_rhs();
128 return (*this)->name((*this)->der_);
129 }
catch (std::exception& e) {
130 THROW_ERROR(
"der", e.what());
137 return (*this)->name((*this)->initial_unknowns_);
138 }
catch (std::exception& e) {
139 THROW_ERROR(
"initial_unknowns", e.what());
146 return (*this)->has_t();
147 }
catch (std::exception& e) {
148 THROW_ERROR(
"has_t", e.what());
195 (*this)->load_fmi_description(
filename);
196 }
catch (std::exception& e) {
197 THROW_ERROR(
"load_fmi_description", e.what());
203 casadi_assert(!
symbolic(),
"Functionality only applies to imported standard FMUs");
204 return (*this)->provides_directional_derivatives_;
205 }
catch (std::exception& e) {
206 THROW_ERROR(
"provides_directional_derivatives", e.what());
213 return (*this)->export_fmu(opts);
214 }
catch (std::exception& e) {
215 THROW_ERROR(
"export_fmu", e.what());
222 return (*this)->compile_fmu(files, opts);
223 }
catch (std::exception& e) {
224 THROW_ERROR(
"compile_fmu", e.what());
231 return (*this)->pack_fmu(files, opts);
232 }
catch (std::exception& e) {
233 THROW_ERROR(
"pack_fmu", e.what());
234 return std::string();
240 (*this)->prune(prune_p, prune_u);
241 }
catch (std::exception& e) {
242 THROW_ERROR(
"prune", e.what());
249 }
catch (std::exception& e) {
250 THROW_ERROR(
"tear", e.what());
256 return (*this)->has(
name);
257 }
catch (std::exception& e) {
258 THROW_ERROR(
"has", e.what());
265 return (*this)->all();
266 }
catch (std::exception& e) {
267 THROW_ERROR(
"all", e.what());
274 return (*this)->all(to_enum<Category>(cat));
275 }
catch (std::exception& e) {
276 THROW_ERROR(
"all", e.what());
284 auto cat = to_enum<Category>(v);
287 std::set<std::string> name_set(
name.begin(),
name.end());
288 casadi_assert(name_set.size() ==
name.size(),
"Duplicate names");
294 if (
ny() !=
name.size()) {
295 for (
auto&& n :
y()) {
296 if (name_set.find(n) == name_set.end())
set_causality(n,
"local");
300 casadi_error(
"Setting category '" + v +
"' not supported");
306 auto all_in_cat =
all(v);
307 if (all_in_cat.size() !=
name.size()) {
308 std::set<std::string> name_set(
name.begin(),
name.end());
309 for (
auto&& n : all_in_cat) {
310 if (name_set.find(n) == name_set.end()) {
311 if (v ==
"x" || v ==
"q") {
314 }
else if (v ==
"u" || v ==
"p") {
318 casadi_error(
"Cannot automatically remove '" + n +
"' from category '" + v +
"'");
324 casadi_error(
"Cannot set variables of category '" + v +
"'");
328 }
catch (std::exception& e) {
329 THROW_ERROR(
"set_all", e.what());
335 (*this)->reorder(to_enum<Category>(cat), (*this)->find(v));
336 }
catch (std::exception& e) {
337 THROW_ERROR(
"reorder", e.what());
342 const std::string& variability,
const Dict& opts) {
346 }
catch (std::exception& e) {
347 THROW_ERROR(
"add", e.what());
354 return (*this)->add(
name, to_enum<Causality>(
causality), opts).v;
355 }
catch (std::exception& e) {
356 THROW_ERROR(
"add", e.what());
363 return (*this)->add(
name, opts).v;
364 }
catch (std::exception& e) {
365 THROW_ERROR(
"add", e.what());
371 const std::string& variability,
const MX& expr,
const Dict& opts) {
374 casadi_assert(expr.
is_symbolic(),
"Expression must be symbolic");
376 casadi_assert(
name == expr.
name(),
"Name must match expression");
380 }
catch (std::exception& e) {
381 THROW_ERROR(
"add", e.what());
387 (*this)->eq(lhs, rhs, opts);
388 }
catch (std::exception& e) {
389 THROW_ERROR(
"eq", e.what());
395 (*this)->when(cond, eqs, opts);
396 }
catch (std::exception& e) {
397 THROW_ERROR(
"when", e.what());
403 return (*this)->assign(
name, val).name;
404 }
catch (std::exception& e) {
405 THROW_ERROR(
"assign", e.what());
406 return std::string();
412 return (*this)->reinit(
name, val).name;
413 }
catch (std::exception& e) {
414 THROW_ERROR(
"reinit", e.what());
415 return std::string();
422 }
catch (std::exception& e) {
423 THROW_ERROR(
"set_init", e.what());
429 (*this)->sanity_check();
430 }
catch (std::exception& e) {
431 THROW_ERROR(
"sanity_check", e.what());
437 return (*this)->variable(
name).v;
438 }
catch (std::exception& e) {
439 THROW_ERROR(
"var", e.what());
447 size_t ind = (*this)->find(
name);
449 ind = (*this)->variable(ind).der;
450 casadi_assert(ind !=
size_t(-1),
"No derivative expression for " +
name);
452 return (*this)->variable(ind).name;
453 }
catch (std::exception& e) {
454 THROW_ERROR(
"der", e.what());
455 return std::string();
462 static bool warned =
false;
464 casadi_warning(
"DaeBuilder::pre has not been implemented: Returning identity mapping");
468 }
catch (std::exception& e) {
469 THROW_ERROR(
"pre", e.what());
470 return std::string();
477 static bool warned =
false;
479 casadi_warning(
"DaeBuilder::pre has not been implemented: Returning identity mapping");
483 }
catch (std::exception& e) {
484 THROW_ERROR(
"pre", e.what());
489 std::vector<std::string>
DaeBuilder::der(
const std::vector<std::string>& name)
const {
491 std::vector<std::string> r(
name.size());
492 for (
size_t i = 0; i < r.size(); ++i) r[i] =
der(
name[i]);
494 }
catch (std::exception& e) {
495 THROW_ERROR(
"der", e.what());
500 std::vector<std::string>
DaeBuilder::pre(
const std::vector<std::string>& name)
const {
502 std::vector<std::string> r(
name.size());
503 for (
size_t i = 0; i < r.size(); ++i) r[i] =
pre(
name[i]);
505 }
catch (std::exception& e) {
506 THROW_ERROR(
"pre", e.what());
513 return !(*this)->variable(
name).has_beq();
514 }
catch (std::exception& e) {
515 THROW_ERROR(
"has_beq", e.what());
523 return (*this)->variable(v.
bind).
v;
524 }
catch (std::exception& e) {
525 THROW_ERROR(
"beq", e.what());
532 (*this)->eliminate(to_enum<Category>(cat));
533 }
catch (std::exception& e) {
534 THROW_ERROR(
"eliminate", e.what());
540 (*this)->sort(to_enum<Category>(cat));
541 }
catch (std::exception& e) {
542 THROW_ERROR(
"sort", e.what());
548 (*this)->lift(lift_shared, lift_calls);
549 }
catch (std::exception& e) {
550 THROW_ERROR(
"lift", e.what());
555 return (*this)->variable(
name).value_reference;
559 (*this)->variable(
name).value_reference = val;
563 return (*this)->variable(
name).description;
567 (*this)->variable(
name).description = val;
572 casadi_assert(fmi_version == 2 || fmi_version == 3,
"Only FMI version 2 or 3 supported");
574 if (fmi_version == 2) {
583 if (has_enum<TypeFmi2>(val) && !has_enum<Type>(val)) {
584 (*this)->variable(
name).type =
from_fmi2(to_enum<TypeFmi2>(val));
587 (*this)->variable(
name).type = to_enum<Type>(val);
593 }
catch (std::exception& e) {
594 THROW_ERROR(
"causality", e.what());
595 return std::string();
601 std::vector<std::string> ret;
602 for (
auto&& cat : (*this)->variable(
name).categories()) {
606 }
catch (std::exception& e) {
607 THROW_ERROR(
"categories", e.what());
614 (*this)->set_causality((*this)->find(
name), to_enum<Causality>(val));
615 }
catch (std::exception& e) {
616 THROW_ERROR(
"set_causality", e.what());
623 }
catch (std::exception& e) {
624 THROW_ERROR(
"variability", e.what());
625 return std::string();
631 (*this)->set_variability((*this)->find(
name), to_enum<Variability>(val));
632 }
catch (std::exception& e) {
633 THROW_ERROR(
"set_variability", e.what());
640 }
catch (std::exception& e) {
641 THROW_ERROR(
"category", e.what());
642 return std::string();
648 (*this)->set_category((*this)->find(
name),
650 }
catch (std::exception& e) {
651 THROW_ERROR(
"set_category", e.what());
660 (*this)->variable(
name).initial = to_enum<Initial>(val);
664 return (*this)->variable(
name).unit;
668 (*this)->variable(
name).unit = val;
672 return (*this)->variable(
name).display_unit;
676 (*this)->variable(
name).display_unit = val;
680 return (*this)->variable(
name).numel;
684 return (*this)->variable(
name).dimension;
689 return (*this)->start_time_;
690 }
catch (std::exception& e) {
691 THROW_ERROR(
"start_time", e.what());
698 (*this)->start_time_ = val;
699 }
catch (std::exception& e) {
700 THROW_ERROR(
"set_start_time", e.what());
706 return (*this)->stop_time_;
707 }
catch (std::exception& e) {
708 THROW_ERROR(
"stop_time", e.what());
715 (*this)->stop_time_ = val;
716 }
catch (std::exception& e) {
717 THROW_ERROR(
"set_stop_time", e.what());
723 return (*this)->tolerance_;
724 }
catch (std::exception& e) {
725 THROW_ERROR(
"tolerance", e.what());
732 (*this)->tolerance_ = val;
733 }
catch (std::exception& e) {
734 THROW_ERROR(
"set_tolerance", e.what());
740 return (*this)->step_size_;
741 }
catch (std::exception& e) {
742 THROW_ERROR(
"step_size", e.what());
749 (*this)->step_size_ = val;
750 }
catch (std::exception& e) {
751 THROW_ERROR(
"set_step_size", e.what());
756 const std::vector<std::string>& f_out) {
758 (*this)->add_lc(
name, f_out);
759 }
catch (std::exception& e) {
760 THROW_ERROR(
"add_lc", e.what());
765 const std::vector<std::string>& name_in,
766 const std::vector<std::string>& name_out,
bool sx,
bool lifted_calls)
const {
768 return (*this)->create(fname, name_in, name_out,
Dict(), sx, lifted_calls);
769 }
catch (std::exception& e) {
770 THROW_ERROR(
"create", e.what());
776 const std::vector<std::string>& name_in,
777 const std::vector<std::string>& name_out,
const Dict& opts)
const {
779 return (*this)->create(fname, name_in, name_out, opts,
false,
false);
780 }
catch (std::exception& e) {
781 THROW_ERROR(
"create", e.what());
789 }
catch (std::exception& e) {
790 THROW_ERROR(
"create", e.what());
797 return (*this)->add_fun(f);
798 }
catch (std::exception& e) {
799 THROW_ERROR(
"add_fun", e.what());
805 const std::vector<std::string>& res,
const Dict& opts) {
807 return (*this)->add_fun(
name, arg, res, opts);
808 }
catch (std::exception& e) {
809 THROW_ERROR(
"add_fun", e.what());
815 casadi_assert(!
has_fun(
name),
"Function '" +
name +
"' already exists");
821 return (*this)->has_fun(
name);
822 }
catch (std::exception& e) {
823 THROW_ERROR(
"has_fun", e.what());
830 return (*this)->fun(
name);
831 }
catch (std::exception& e) {
832 THROW_ERROR(
"fun", e.what());
840 Function all_eq = (*this)->gather_eq();
847 casadi_warning(
"Duplicate function: '" + f.name() +
"', ignored");
853 }
catch (std::exception& e) {
854 THROW_ERROR(
"gather_fun", e.what());
859 return (*this)->fun_;
864 return (*this)->
oracle(sx, elim_w, lifted_calls);
865 }
catch (std::exception& e) {
866 THROW_ERROR(
"oracle", e.what());
872 const std::vector<std::string>& s_in,
873 const std::vector<std::string>& s_out)
const {
875 return (*this)->dependent_fun(fname, s_in, s_out);
876 }
catch (std::exception& e) {
877 THROW_ERROR(
"dependent_fun", e.what());
884 return (*this)->transition(fname, index);
885 }
catch (std::exception& e) {
886 THROW_ERROR(
"transition", e.what());
893 return (*this)->transition(fname);
894 }
catch (std::exception& e) {
895 THROW_ERROR(
"transition", e.what());
914 return (*this)->der(v);
915 }
catch (std::exception& e) {
916 THROW_ERROR(
"der", e.what());
923 return (*this)->der(v);
924 }
catch (std::exception& e) {
925 THROW_ERROR(
"der", e.what());
932 return (*this)->attribute(to_enum<Attribute>(a),
name);
933 }
catch (std::exception& e) {
934 THROW_ERROR(
"attribute", e.what());
940 const std::vector<std::string>& name)
const {
942 return (*this)->attribute(to_enum<Attribute>(a),
name);
943 }
catch (std::exception& e) {
944 THROW_ERROR(
"attribute", e.what());
951 (*this)->set_attribute(to_enum<Attribute>(a),
name, val);
952 }
catch (std::exception& e) {
953 THROW_ERROR(
"set_attribute", e.what());
958 const std::vector<double>& val) {
960 (*this)->set_attribute(to_enum<Attribute>(a),
name, val);
961 }
catch (std::exception& e) {
962 THROW_ERROR(
"set_attribute", e.what());
968 return (*this)->variable(
name).min;
969 }
catch (std::exception& e) {
970 THROW_ERROR(
"min", e.what());
978 }
catch (std::exception& e) {
979 THROW_ERROR(
"min", e.what());
986 (*this)->variable(
name).min = val;
987 }
catch (std::exception& e) {
988 THROW_ERROR(
"set_min", e.what());
995 }
catch (std::exception& e) {
996 THROW_ERROR(
"set_min", e.what());
1002 return (*this)->variable(
name).max;
1003 }
catch (std::exception& e) {
1004 THROW_ERROR(
"max", e.what());
1012 }
catch (std::exception& e) {
1013 THROW_ERROR(
"max", e.what());
1020 (*this)->variable(
name).max = val;
1021 }
catch (std::exception& e) {
1022 THROW_ERROR(
"set_max", e.what());
1029 }
catch (std::exception& e) {
1030 THROW_ERROR(
"set_max", e.what());
1036 return (*this)->variable(
name).nominal;
1037 }
catch (std::exception& e) {
1038 THROW_ERROR(
"nominal", e.what());
1046 }
catch (std::exception& e) {
1047 THROW_ERROR(
"nominal", e.what());
1054 (*this)->variable(
name).nominal = val;
1055 }
catch (std::exception& e) {
1056 THROW_ERROR(
"set_nominal", e.what());
1063 }
catch (std::exception& e) {
1064 THROW_ERROR(
"set_mininal", e.what());
1070 return (*this)->attribute(
Attribute::START, std::vector<std::string>{name});
1071 }
catch (std::exception& e) {
1072 THROW_ERROR(
"start", e.what());
1080 }
catch (std::exception& e) {
1081 THROW_ERROR(
"start", e.what());
1089 }
catch (std::exception& e) {
1090 THROW_ERROR(
"set_start", e.what());
1097 }
catch (std::exception& e) {
1098 THROW_ERROR(
"set_start", e.what());
1105 }
catch (std::exception& e) {
1106 THROW_ERROR(
"set_start", e.what());
1113 }
catch (std::exception& e) {
1114 THROW_ERROR(
"reset", e.what());
1121 }
catch (std::exception& e) {
1122 THROW_ERROR(
"set", e.what());
1129 }
catch (std::exception& e) {
1130 THROW_ERROR(
"set", e.what());
1134 void DaeBuilder::set(
const std::vector<std::string>& name,
const std::vector<double>& val) {
1137 }
catch (std::exception& e) {
1138 THROW_ERROR(
"set", e.what());
1143 const std::vector<std::string>& val) {
1146 }
catch (std::exception& e) {
1147 THROW_ERROR(
"set", e.what());
1152 return get(std::vector<std::string>{
name}).front();
1158 std::vector<GenericType> ret;
1159 ret.reserve(
name.size());
1163 for (
const auto& n :
name) {
1165 const Variable& v = (*this)->variable(n);
1171 }
else if (v.
numel == 1) {
1178 std::vector<double> val;
1189 for (
const std::string& n :
name) ret.push_back(stats.at(n));
1192 }
catch (std::exception& e) {
1193 THROW_ERROR(
"get", e.what());
1200 return (*this)->symbolic_;
1201 }
catch (std::exception& e) {
1202 THROW_ERROR(
"symbolic", e.what());
1208 const std::vector<std::string>& inames)
const {
1210 return (*this)->jac_sparsity((*this)->find(onames), (*this)->find(inames));
1211 }
catch (std::exception& e) {
1212 THROW_ERROR(
"jac_sparsity", e.what());
double start_time() const
Get the start time.
void when(const MX &cond, const std::vector< std::string > &eqs, const Dict &opts=Dict())
Add when equations.
bool has_fun(const std::string &name) const
Does a particular function already exist?
std::vector< Function > fun() const
Get all functions.
void set_stop_time(double val)
Set the stop time.
casadi_int nu() const
Free controls.
double nominal(const std::string &name) const
Get the nominal value, single variable.
void sanity_check() const
Check if dimensions match.
Function add_fun(const std::string &name, const std::vector< std::string > &arg, const std::vector< std::string > &res, const Dict &opts=Dict())
Add a function from loaded expressions.
bool has(const std::string &name) const
Check if a particular variable exists.
const std::string & name() const
Name of instance.
std::string variability(const std::string &name) const
Get the variability.
void set_value_reference(const std::string &name, casadi_int val)
casadi_int nx() const
Differential states.
void set_start(const std::string &name, double val)
Set the start attribute, single variable.
static bool test_cast(const SharedObjectInternal *ptr)
Check if a particular cast is allowed.
double tolerance() const
Get the tolerance.
std::string initial(const std::string &name) const
std::vector< casadi_int > dimension(const std::string &name) const
Get the dimensions of a variable.
Function dependent_fun(const std::string &fname, const std::vector< std::string > &s_in, const std::vector< std::string > &s_out) const
Construct a function for evaluating dependent parameters.
std::vector< std::string > der() const
Model structure: All time derivatives.
double max(const std::string &name) const
Get the upper bound, single variable.
std::string unit(const std::string &name) const
std::vector< std::string > all() const
Get a list of all variables.
void set_max(const std::string &name, double val)
Set the upper bound, single variable.
Function oracle(bool sx=false, bool elim_w=false, bool lifted_calls=false) const
Get the (cached) oracle, SX or MX.
std::string category(const std::string &name) const
Get the variable category.
casadi_int nd() const
Dependent parameters.
void set_attribute(const std::string &a, const std::string &name, double val)
Set an attribute, single variable.
std::vector< MX > init_lhs() const
Initial conditions, left-hand-side.
void reorder(const std::string &cat, const std::vector< std::string > &v)
Reorder variables in a category.
double step_size() const
Get the step size.
void gather_fun(casadi_int max_depth=-1)
Collect embedded functions from the expression graph.
const MX & time() const
Expression for independent variable (usually time)
std::string causality(const std::string &name) const
Get the causality.
casadi_int nc() const
Named constants.
bool provides_directional_derivatives() const
Does the FMU provide support for analytic derivatives.
void set_tolerance(double val)
Set the tolerance.
void set_min(const std::string &name, double val)
Set the lower bound, single variable.
std::string assign(const std::string &name, const MX &val)
Assignment inside a when-equation or if-else equation.
void tear()
Identify iteration variables and residual equations using naming convention.
Function transition() const
Construct an event transition function, default naming.
std::vector< double > start(const std::string &name) const
Get the start attribute, single variable.
void set_type(const std::string &name, const std::string &val)
double attribute(const std::string &a, const std::string &name) const
Get an attribute, single variable.
void set_unit(const std::string &name, const std::string &val)
void sort(const std::string &cat)
Sort dependent parameters.
double stop_time() const
Get the stop time.
Function create() const
Create a function with standard integrator DAE signature, default naming.
double min(const std::string &name) const
Get the lower bound, single variable.
void set_display_unit(const std::string &name, const std::string &val)
std::string reinit(const std::string &name, const MX &val)
Reinitialize a state inside when-equations.
std::vector< std::string > categories(const std::string &name) const
Which categories are possible for a variable?
void set_init(const std::string &name, const MX &init_rhs)
Specify the initial equation for a variable.
void add_lc(const std::string &name, const std::vector< std::string > &f_out)
Add a named linear combination of output expressions.
void eq(const MX &lhs, const MX &rhs, const Dict &opts=Dict())
Add a simple equation.
void set_category(const std::string &name, const std::string &val)
Set the variable category, if permitted.
casadi_int nz() const
Algebraic variables.
std::vector< std::string > y() const
Outputs.
bool has_beq(const std::string &name) const
Does a variable have a binding equation?
std::string display_unit(const std::string &name) const
void set_nominal(const std::string &name, double val)
Set the nominal value, single variable.
void set_causality(const std::string &name, const std::string &val)
Set the causality, if permitted.
void prune(bool prune_p=true, bool prune_u=true)
Prune unused controls.
casadi_int nq() const
Quadrature states.
std::string pack_fmu(const Dict &files, const Dict &opts=Dict())
Pack files from export_fmu / compile_fmu into a single .fmu archive.
std::vector< std::string > pre(const std::vector< std::string > &name) const
Get the pre-variables of model variables.
std::vector< MX > init_rhs() const
Initial conditions, right-hand-side.
void set_variability(const std::string &name, const std::string &val)
Set the variability, if permitted.
MX add(const std::string &name, const std::string &causality, const std::string &variability, const Dict &opts=Dict())
Add a new model variable.
bool has_t() const
Is there a time variable?
void set_start_time(double val)
Set the start time.
DaeBuilder()
Default constructor.
void set(const std::string &name, double val)
void eliminate(const std::string &cat)
Eliminate all dependent parameters.
casadi_int value_reference(const std::string &name) const
Sparsity jac_sparsity(const std::vector< std::string > &onames, const std::vector< std::string > &inames) const
Get Jacobian sparsity.
casadi_int np() const
Parameters.
std::vector< MX > inputs(const std::string &cat) const
Input expressions for a specific category.
void lift(bool lift_shared=true, bool lift_calls=true)
Lift problem formulation by extracting shared subexpressions.
MX var(const std::string &name) const
casadi_int ny() const
Output variables.
const DaeBuilderInternal * operator->() const
Access a member function or object.
Dict compile_fmu(const Dict &files, const Dict &opts=Dict())
Compile the sources produced by export_fmu.
std::vector< MX > cdef() const
Definitions of named constants.
void set_all(const std::string &v, const std::vector< std::string > &name)
Set all variables within a a category.
std::vector< std::string > outputs() const
[DEPRECATED] Renamed "y"
void load_fmi_description(const std::string &filename)
Import problem description from FMI or XML.
casadi_int numel(const std::string &name) const
Get the number of elements of a variable.
Dict export_fmu(const Dict &opts=Dict())
Export instance into an FMU.
casadi_int nw() const
Dependent variables.
bool symbolic() const
Symbolic DAE instance?
void set_step_size(double val)
Set the step size.
std::vector< MX > ddef() const
Definitions of dependent parameters.
std::vector< std::string > initial_unknowns() const
Model structure: initial unknowns.
casadi_int nzero() const
Zero-crossing functions.
std::string description(const std::string &name) const
void set_initial(const std::string &name, const std::string &val)
MX beq(const std::string &name) const
Get the binding equation for a variable.
std::string type(const std::string &name, casadi_int fmi_version=3) const
std::vector< MX > wdef() const
Dependent variables and corresponding definitions.
void set_description(const std::string &name, const std::string &val)
virtual const Function & oracle() const
Get oracle.
std::vector< Function > find_functions(casadi_int max_depth=-1) const
Get all functions embedded in the expression graphs.
Dict stats(int mem=0) const
Get all statistics obtained at the end of the last evaluate call.
SharedObjectInternal * get() const
Get a const pointer to the node.
void own(SharedObjectInternal *node)
SharedObjectInternal * operator->() const
Access a member function or object.
Generic data type, can hold different types such as bool, casadi_int, std::string etc.
std::string name() const
Get the name.
bool is_symbolic() const
Check if symbolic.
std::vector< std::string > dyn_out()
Get output scheme of a DAE function.
std::vector< std::string > dyn_in()
Get input scheme of a DAE function.
bool is_input_category(Category cat)
Type from_fmi2(TypeFmi2 v)
bool is_output_category(Category cat)
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.
std::string to_string(TypeFmi2 v)
const double nan
Not a number.
std::vector< casadi_int > path(const std::vector< casadi_int > &map, casadi_int i_start)
Function external(const std::string &name, const Importer &li, const Dict &opts)
Load a just-in-time compiled external function.
std::string filename(const std::string &path)
Holds expressions and meta-data corresponding to a physical quantity evolving in time.
void get_attribute(Attribute a, double *val) const
casadi_int numel
Number of elements - product of all dimensions.
MX v
Variable expression (always a vector)