generateDynamicSystem

The command for generating the code for a dynamic system is very close to generateOCProblem.

generateDynamicSystem := proc( name::string, options)

Dynamic system options

options

type

default

equations

{list({algebraic,algebraic=algebraic}),

Vector({algebraic,algebraic=algebraic})}

[]

controls

{list(function),Vector(function)}

[]

states

{list(function),Vector(function)}

[]

dependentStates

{list(function),Vector(function)}

[]

In this group of options you can add the equations, controls, state variables and dependent states.

Post processing options

options

type

default

post_processing

list([algebraic,string])

[]

In the list of post processing the user can specify the variables or the expression of his interest to be computed at the end of the simulation.

Steady state options


options

type

default

additional_steady_state_equations

{list({algebraic,algebraic=algebraic}), Vector({algebraic,algebraic=algebraic})}

[]

steady_state_equations

{list({algebraic,algebraic=algebraic}), Vector({algebraic,algebraic=algebraic})}

[]

steady_state_guess

list({symbol,function}=algebraic)

[]

steady_state_tolerance

algebraic

1e-8

With those options you specify the equations of steady state that you want to analyse, eventual additional equations, a guess for the steady state and the value of the tolerance.

Forward integrations options

options

type

default

initial_conditions

list({symbol,function}=algebraic)

[]

range

[algebraic,[algebraic,algebraic]]

[0.1,[0,1.0]]

closed_loop

list({symbol,function}=algebraic)

[]

tolerance

algebraic

1e-8

Scalature options (da implementare)

options

type

default

state_scaling

list(symbol=algebraic)

[]

equation_scaling

list(integer=algebraic)

[]

Parameters options

options

type

default

parameters

list(symbol=algebraic)

[]

With the option parameters it is possible to give the values of the constants and parameters used in XOptima and that will be used to initialise the variables and added to the data file of the Ruby script.

Parameters for code generations options

options

type

default

language

list(string)

[“C++”]

compiler_options

list(string={string,list(string)})

[]

external_libs

list(string)

[]

external_libs_paths

list(string)

[]

external_libs_include_paths

list(string)

[]

This group of options allow to set how to produce the code to be linked with the Mechatronix. The default is C++ but the option Matlab will soon be available too. The user can pass specific options to the compiler and link external libraries.

Code generation options

options

type

default

simplifyExpression

boolean

false

codegenOptions

list

[]

output_directory

string

“../”

excluded

list(string)

[]

show_graph_ordered_parameters

boolean

false

Sometimes it can worth to simplify the equations created by XOptima during the solution process, for example if there is the possibility to collect repeated expression or simplify some terms. This uses the symbolic algebra system of Maple to produce optimised expression for the equations. Because this is time consuming for large projects, by default is disabled. To manage the creation of files in XOptima, you can use the option output_directory and excluded, as done for the command generateOCProblem. To see the dependencies of the variables activate the flag show_graph_ordered_parameters, this will show a graph of the ordered parameters.