MicroModelicaCCompiler  4.5.3
MicroModelica::IR::Model Class Reference

#include <class.hpp>

Inheritance diagram for MicroModelica::IR::Model:
Collaboration diagram for MicroModelica::IR::Model:

Public Member Functions

 Model ()
 
 Model (string name)
 
virtual ~Model ()=default
 
string name () const
 
void insert (string n)
 
void insert (VarName n, Util::Variable &vi, DEC_Type type)
 
void insert (VarName n, Util::Variable &vi)
 
void insert (AST_Equation eq)
 
void insert (AST_Statement stm, bool initial)
 
void insert (AST_Statement stm)
 
void setCalledFunctions (FunctionTable &fs)
 
void insert (AST_External_Function_Call efc)
 
void insert (AST_Argument_Modification x)
 
Util::VarSymbolTable symbols () const
 
Util::ImportTable imports () const
 
ModelAnnotation annotations () const
 
FunctionTable calledFunctions () const
 
int algebraicNbr () const
 
int stateNbr () const
 
int discreteNbr () const
 
int inputNbr () const
 
int outputNbr () const
 
int eventNbr () const
 
Util::SymbolTable linkLibraries () const
 
Util::SymbolTable includeDirectories () const
 
Util::SymbolTable libraryDirectories () const
 
EquationTable derivatives ()
 
EquationTable BDFDerivatives ()
 
EquationTable algebraics ()
 
Deps::ModelDependencies dependencies ()
 
EquationTable outputs ()
 
EventTable events ()
 
bool externalFunctions ()
 
InputTable inputs ()
 
void setEquations ()
 
void setEvents ()
 
void setOutputs ()
 
void setInputs ()
 
StatementTable initialCode ()
 
void computeDependencies ()
 
void setModelConfig ()
 
- Public Member Functions inherited from MicroModelica::IR::Class
virtual ~Class ()=default
 

Protected Member Functions

void addVariable (int id, Option< Range > range, EQUATION::Type type, unsigned int &offset)
 Adds a new variable for events and output equations that doesn't have associated variables in the model. More...
 
void setVariableOffset (Util::Variable var, unsigned int &offset, Util::Variable::RealType type, bool set_variable_count=true)
 
void setRealVariables (AST_Equation eq)
 
void addEquation (AST_Equation eq, Option< Range > range)
 
void reduceEquation (AST_Equation_Equality eq, list< AST_Equation > &new_eqs)
 
void addEvent (AST_Statement stm, Option< Range > range)
 
void reduceEvent (AST_Statement_When ev)
 
void addFunction (Util::SymbolTable symbols, FunctionTable &fs)
 
void addInput (Equation eq)
 
void orderEquations ()
 
EquationDefOrder getEquationDefOrder (Equation eq)
 
int computeEventOffsetShift (Option< Range > range)
 

Protected Attributes

std::string _name
 
Util::ImportTable _imports
 
ModelAnnotation _annotations
 
FunctionTable _called_functions
 
EquationTable _derivatives
 
EquationTable _ordered_derivatives
 
EquationTable _algebraics
 
EquationTable _outputs
 
EventTable _events
 
InputTable _inputs
 
Deps::ModelDependencies _dependencies
 
CompiledPackageTable _packages
 
StatementTable _initial_code
 
Util::SymbolTable _library_directories
 
Util::SymbolTable _link_libraries
 
Util::SymbolTable _include_directories
 
std::list< AST_Equation > _ast_equations
 
std::list< AST_Statement > _ast_statements
 
unsigned int _state_nbr
 
unsigned int _discrete_nbr
 
unsigned int _algebraic_nbr
 
unsigned int _event_nbr
 
unsigned int _output_nbr
 
unsigned int _input_nbr
 
int _derivative_id
 
int _algebraic_id
 
int _statement_id
 
int _event_id
 
int _output_id
 
int _input_id
 
bool _external_functions
 

Detailed Description

Definition at line 160 of file class.hpp.

Constructor & Destructor Documentation

◆ Model() [1/2]

MicroModelica::IR::Model::Model ( )

Definition at line 220 of file class.cpp.

◆ Model() [2/2]

MicroModelica::IR::Model::Model ( string  name)

Definition at line 252 of file class.cpp.

◆ ~Model()

virtual MicroModelica::IR::Model::~Model ( )
virtualdefault

Member Function Documentation

◆ addEquation()

void MicroModelica::IR::Model::addEquation ( AST_Equation  eq,
Option< Range range 
)
protected

Definition at line 451 of file class.cpp.

References _algebraic_id, _algebraics, MicroModelica::IR::EQUATION::Algebraic, and ModelTable< Key, Value >::insert().

Here is the call graph for this function:

◆ addEvent()

void MicroModelica::IR::Model::addEvent ( AST_Statement  stm,
Option< Range range 
)
protected

◆ addFunction()

void MicroModelica::IR::Model::addFunction ( Util::SymbolTable  symbols,
FunctionTable fs 
)
protected

Definition at line 373 of file class.cpp.

References _link_libraries, MicroModelica::IR::FunctionAnnotation::libraries(), and ModelTable< Key, Value >::merge().

Referenced by setCalledFunctions().

Here is the call graph for this function:

◆ addInput()

void MicroModelica::IR::Model::addInput ( Equation  eq)
protected

Definition at line 732 of file class.cpp.

◆ addVariable()

void MicroModelica::IR::Model::addVariable ( int  id,
Option< Range range,
EQUATION::Type  type,
unsigned int &  offset 
)
protected

Adds a new variable for events and output equations that doesn't have associated variables in the model.

Parameters
[in]idThe identifier
[in]sizeThe size
[in]typeThe type

Definition at line 579 of file class.cpp.

Referenced by addEvent().

◆ algebraicNbr()

int MicroModelica::IR::Model::algebraicNbr ( ) const
inline

Definition at line 179 of file class.hpp.

◆ algebraics()

EquationTable MicroModelica::IR::Model::algebraics ( )
inline

Definition at line 190 of file class.hpp.

◆ annotations()

◆ BDFDerivatives()

EquationTable MicroModelica::IR::Model::BDFDerivatives ( )

Definition at line 494 of file class.cpp.

◆ calledFunctions()

FunctionTable MicroModelica::IR::Model::calledFunctions ( ) const
inline

Definition at line 178 of file class.hpp.

Referenced by MicroModelica::Generator::Files::makefile().

◆ computeDependencies()

void MicroModelica::IR::Model::computeDependencies ( )

Definition at line 752 of file class.cpp.

◆ computeEventOffsetShift()

int MicroModelica::IR::Model::computeEventOffsetShift ( Option< Range range)
protected

Definition at line 601 of file class.cpp.

Referenced by addEvent().

◆ dependencies()

Deps::ModelDependencies MicroModelica::IR::Model::dependencies ( )
inline

◆ derivatives()

EquationTable MicroModelica::IR::Model::derivatives ( )
inline

Definition at line 188 of file class.hpp.

◆ discreteNbr()

int MicroModelica::IR::Model::discreteNbr ( ) const
inline

Definition at line 181 of file class.hpp.

◆ eventNbr()

int MicroModelica::IR::Model::eventNbr ( ) const
inline

Definition at line 184 of file class.hpp.

◆ events()

EventTable MicroModelica::IR::Model::events ( )
inline

Definition at line 193 of file class.hpp.

◆ externalFunctions()

bool MicroModelica::IR::Model::externalFunctions ( )
inline

Definition at line 194 of file class.hpp.

◆ getEquationDefOrder()

EquationDefOrder MicroModelica::IR::Model::getEquationDefOrder ( Equation  eq)
protected

Definition at line 506 of file class.cpp.

References MicroModelica::Util::ModelConfig::instance(), and MicroModelica::Util::ModelConfig::lookup().

Here is the call graph for this function:

◆ imports()

Util::ImportTable MicroModelica::IR::Model::imports ( ) const
inlinevirtual

Implements MicroModelica::IR::Class.

Definition at line 176 of file class.hpp.

◆ includeDirectories()

Util::SymbolTable MicroModelica::IR::Model::includeDirectories ( ) const
inline

Definition at line 186 of file class.hpp.

Referenced by MicroModelica::Generator::Files::makefile().

◆ initialCode()

StatementTable MicroModelica::IR::Model::initialCode ( )
inline

Definition at line 200 of file class.hpp.

◆ inputNbr()

int MicroModelica::IR::Model::inputNbr ( ) const
inline

Definition at line 182 of file class.hpp.

◆ inputs()

InputTable MicroModelica::IR::Model::inputs ( )
inline

Definition at line 195 of file class.hpp.

◆ insert() [1/8]

void MicroModelica::IR::Model::insert ( AST_Argument_Modification  x)
virtual

Implements MicroModelica::IR::Class.

Definition at line 429 of file class.cpp.

◆ insert() [2/8]

void MicroModelica::IR::Model::insert ( AST_Equation  eq)
virtual

Implements MicroModelica::IR::Class.

Definition at line 337 of file class.cpp.

◆ insert() [3/8]

void MicroModelica::IR::Model::insert ( AST_External_Function_Call  efc)
virtual

Implements MicroModelica::IR::Class.

Definition at line 361 of file class.cpp.

◆ insert() [4/8]

void MicroModelica::IR::Model::insert ( AST_Statement  stm)
virtual

Implements MicroModelica::IR::Class.

Definition at line 359 of file class.cpp.

◆ insert() [5/8]

void MicroModelica::IR::Model::insert ( AST_Statement  stm,
bool  initial 
)
virtual

Implements MicroModelica::IR::Class.

Definition at line 363 of file class.cpp.

References _include_directories, MicroModelica::IR::FunctionAnnotation::includeDirectory(), and ModelTable< Key, Value >::insert().

Here is the call graph for this function:

◆ insert() [6/8]

void MicroModelica::IR::Model::insert ( string  n)
virtual

Implements MicroModelica::IR::Class.

Definition at line 436 of file class.cpp.

Referenced by MicroModelica::IR::Settings::leave().

◆ insert() [7/8]

void MicroModelica::IR::Model::insert ( VarName  n,
Util::Variable vi 
)
virtual

Implements MicroModelica::IR::Class.

Definition at line 288 of file class.cpp.

References MicroModelica::Util::Variable::size().

Here is the call graph for this function:

◆ insert() [8/8]

void MicroModelica::IR::Model::insert ( VarName  n,
Util::Variable vi,
DEC_Type  type 
)
virtual

Implements MicroModelica::IR::Class.

Definition at line 286 of file class.cpp.

References MicroModelica::Util::Variable::hasOffset().

Here is the call graph for this function:

◆ libraryDirectories()

Util::SymbolTable MicroModelica::IR::Model::libraryDirectories ( ) const
inline

Definition at line 187 of file class.hpp.

Referenced by MicroModelica::Generator::Files::makefile().

◆ linkLibraries()

Util::SymbolTable MicroModelica::IR::Model::linkLibraries ( ) const
inline

Definition at line 185 of file class.hpp.

Referenced by MicroModelica::Generator::Files::makefile().

◆ name()

string MicroModelica::IR::Model::name ( ) const
inlinevirtual

Implements MicroModelica::IR::Class.

Definition at line 165 of file class.hpp.

◆ orderEquations()

void MicroModelica::IR::Model::orderEquations ( )
protected

Definition at line 515 of file class.cpp.

References _ordered_derivatives, and ModelTable< Key, Value >::insert().

Here is the call graph for this function:

◆ outputNbr()

int MicroModelica::IR::Model::outputNbr ( ) const
inline

Definition at line 183 of file class.hpp.

Referenced by MicroModelica::Generator::Files::run().

◆ outputs()

EquationTable MicroModelica::IR::Model::outputs ( )
inline

Definition at line 192 of file class.hpp.

◆ reduceEquation()

void MicroModelica::IR::Model::reduceEquation ( AST_Equation_Equality  eq,
list< AST_Equation > &  new_eqs 
)
protected

◆ reduceEvent()

void MicroModelica::IR::Model::reduceEvent ( AST_Statement_When  ev)
protected

Definition at line 662 of file class.cpp.

◆ setCalledFunctions()

void MicroModelica::IR::Model::setCalledFunctions ( FunctionTable fs)

Definition at line 401 of file class.cpp.

References addFunction().

Here is the call graph for this function:

◆ setEquations()

void MicroModelica::IR::Model::setEquations ( )

Definition at line 542 of file class.cpp.

◆ setEvents()

void MicroModelica::IR::Model::setEvents ( )

Definition at line 683 of file class.cpp.

References addEvent().

Here is the call graph for this function:

◆ setInputs()

◆ setModelConfig()

void MicroModelica::IR::Model::setModelConfig ( )

Definition at line 758 of file class.cpp.

◆ setOutputs()

◆ setRealVariables()

void MicroModelica::IR::Model::setRealVariables ( AST_Equation  eq)
protected

Definition at line 314 of file class.cpp.

◆ setVariableOffset()

void MicroModelica::IR::Model::setVariableOffset ( Util::Variable  var,
unsigned int &  offset,
Util::Variable::RealType  type,
bool  set_variable_count = true 
)
protected

Definition at line 302 of file class.cpp.

◆ stateNbr()

int MicroModelica::IR::Model::stateNbr ( ) const
inline

◆ symbols()

VarSymbolTable MicroModelica::IR::Model::symbols ( ) const
virtual

Implements MicroModelica::IR::Class.

Definition at line 284 of file class.cpp.

Referenced by MicroModelica::Generator::QSSModelInstance::generate().

Member Data Documentation

◆ _algebraic_id

int MicroModelica::IR::Model::_algebraic_id
protected

Definition at line 251 of file class.hpp.

Referenced by addEquation().

◆ _algebraic_nbr

unsigned int MicroModelica::IR::Model::_algebraic_nbr
protected

Definition at line 246 of file class.hpp.

Referenced by setInputs().

◆ _algebraics

EquationTable MicroModelica::IR::Model::_algebraics
protected

Definition at line 232 of file class.hpp.

Referenced by addEquation(), and setInputs().

◆ _annotations

ModelAnnotation MicroModelica::IR::Model::_annotations
protected

Definition at line 228 of file class.hpp.

Referenced by addEvent(), and setInputs().

◆ _ast_equations

std::list<AST_Equation> MicroModelica::IR::Model::_ast_equations
protected

Definition at line 242 of file class.hpp.

◆ _ast_statements

std::list<AST_Statement> MicroModelica::IR::Model::_ast_statements
protected

Definition at line 243 of file class.hpp.

◆ _called_functions

FunctionTable MicroModelica::IR::Model::_called_functions
protected

Definition at line 229 of file class.hpp.

◆ _dependencies

Deps::ModelDependencies MicroModelica::IR::Model::_dependencies
protected

Definition at line 236 of file class.hpp.

◆ _derivative_id

int MicroModelica::IR::Model::_derivative_id
protected

Definition at line 250 of file class.hpp.

◆ _derivatives

EquationTable MicroModelica::IR::Model::_derivatives
protected

Definition at line 230 of file class.hpp.

Referenced by setInputs().

◆ _discrete_nbr

unsigned int MicroModelica::IR::Model::_discrete_nbr
protected

Definition at line 245 of file class.hpp.

◆ _event_id

int MicroModelica::IR::Model::_event_id
protected

Definition at line 253 of file class.hpp.

Referenced by addEvent().

◆ _event_nbr

unsigned int MicroModelica::IR::Model::_event_nbr
protected

Definition at line 247 of file class.hpp.

Referenced by addEvent().

◆ _events

EventTable MicroModelica::IR::Model::_events
protected

Definition at line 234 of file class.hpp.

Referenced by addEvent(), and setInputs().

◆ _external_functions

bool MicroModelica::IR::Model::_external_functions
protected

Definition at line 256 of file class.hpp.

◆ _imports

Util::ImportTable MicroModelica::IR::Model::_imports
protected

Definition at line 227 of file class.hpp.

◆ _include_directories

Util::SymbolTable MicroModelica::IR::Model::_include_directories
protected

Definition at line 241 of file class.hpp.

Referenced by insert().

◆ _initial_code

StatementTable MicroModelica::IR::Model::_initial_code
protected

Definition at line 238 of file class.hpp.

◆ _input_id

int MicroModelica::IR::Model::_input_id
protected

Definition at line 255 of file class.hpp.

Referenced by setOutputs().

◆ _input_nbr

unsigned int MicroModelica::IR::Model::_input_nbr
protected

Definition at line 249 of file class.hpp.

Referenced by setOutputs().

◆ _inputs

InputTable MicroModelica::IR::Model::_inputs
protected

Definition at line 235 of file class.hpp.

Referenced by setOutputs().

◆ _library_directories

Util::SymbolTable MicroModelica::IR::Model::_library_directories
protected

Definition at line 239 of file class.hpp.

◆ _link_libraries

Util::SymbolTable MicroModelica::IR::Model::_link_libraries
protected

Definition at line 240 of file class.hpp.

Referenced by addFunction().

◆ _name

std::string MicroModelica::IR::Model::_name
protected

Definition at line 226 of file class.hpp.

◆ _ordered_derivatives

EquationTable MicroModelica::IR::Model::_ordered_derivatives
protected

Definition at line 231 of file class.hpp.

Referenced by orderEquations(), and setInputs().

◆ _output_id

int MicroModelica::IR::Model::_output_id
protected

Definition at line 254 of file class.hpp.

◆ _output_nbr

unsigned int MicroModelica::IR::Model::_output_nbr
protected

Definition at line 248 of file class.hpp.

◆ _outputs

EquationTable MicroModelica::IR::Model::_outputs
protected

Definition at line 233 of file class.hpp.

◆ _packages

CompiledPackageTable MicroModelica::IR::Model::_packages
protected

Definition at line 237 of file class.hpp.

◆ _state_nbr

unsigned int MicroModelica::IR::Model::_state_nbr
protected

Definition at line 244 of file class.hpp.

Referenced by setInputs().

◆ _statement_id

int MicroModelica::IR::Model::_statement_id
protected

Definition at line 252 of file class.hpp.


The documentation for this class was generated from the following files: