Skip to content

Commit

Permalink
Simulated the model again after changing settings
Browse files Browse the repository at this point in the history
Intermediate files included now
  • Loading branch information
techy4shri committed Jan 30, 2025
1 parent bed91a8 commit 34d7ebc
Show file tree
Hide file tree
Showing 54 changed files with 1,530 additions and 3 deletions.
554 changes: 554 additions & 0 deletions NonInteractingTanks.TwoConnectedTanks/TwoConnectedTanks.c

Large diffs are not rendered by default.

Binary file modified NonInteractingTanks.TwoConnectedTanks/TwoConnectedTanks.exe
Binary file not shown.
47 changes: 47 additions & 0 deletions NonInteractingTanks.TwoConnectedTanks/TwoConnectedTanks.makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Makefile generated by OpenModelica
# Platform: win64

# Simulations use -O3 by default
CC=clang
CXX=clang++
LINK=clang++ -shared -Xlinker --export-all-symbols
EXEEXT=.exe
DLLEXT=.dll
CFLAGS_BASED_ON_INIT_FILE=
# define OMC_CFLAGS_OPTIMIZATION env variable to your desired optimization level to override this
OMC_CFLAGS_OPTIMIZATION=-Os
DEBUG_FLAGS=$(OMC_CFLAGS_OPTIMIZATION)
CFLAGS=-municode $(CFLAGS_BASED_ON_INIT_FILE) $(DEBUG_FLAGS) -DOM_HAVE_PTHREADS -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse ${MODELICAUSERCFLAGS}
CPPFLAGS= -I"C:/Program Files/OpenModelica1.24.3-64bit/include/omc/c" -I"C:/Program Files/OpenModelica1.24.3-64bit/include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=TwoConnectedTanks -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0
# define OMC_LDFLAGS_LINK_TYPE env variable to "static" to override this
OMC_LDFLAGS_LINK_TYPE=dynamic
RUNTIME_LIBS=-lSimulationRuntimeC -Wl,-Bdynamic -lomcgc -lryu -lopenblas -Wl,-B$(OMC_LDFLAGS_LINK_TYPE) -lstdc++ -Wl,-Bdynamic
LDFLAGS=-L"C:/Program Files/OpenModelica1.24.3-64bit/lib//omc" -L"C:/Program Files/OpenModelica1.24.3-64bit/lib" -Wl,--stack,16777216,-rpath,"C:/Program Files/OpenModelica1.24.3-64bit/lib//omc" -L"C:/Program Files/OpenModelica1.24.3-64bit/bin" -Wl,-rpath,"C:/Program Files/OpenModelica1.24.3-64bit/lib" -fopenmp -Wl,-Bstatic -lregex -ltre -lintl -liconv -lexpat -lpthread -loleaut32 -limagehlp -lhdf5 -lz -lsz -Wl,-Bdynamic $(RUNTIME_LIBS)
DIREXTRA=-L"D:/SHRI1/github/OpenModelica-GUI/NonInteractingTanks"
MAINFILE=TwoConnectedTanks.c
MAINOBJ=TwoConnectedTanks.o
CFILES=TwoConnectedTanks_functions.c TwoConnectedTanks_records.c \
TwoConnectedTanks_01exo.c TwoConnectedTanks_02nls.c TwoConnectedTanks_03lsy.c TwoConnectedTanks_04set.c TwoConnectedTanks_05evt.c TwoConnectedTanks_06inz.c TwoConnectedTanks_07dly.c \
TwoConnectedTanks_08bnd.c TwoConnectedTanks_09alg.c TwoConnectedTanks_10asr.c TwoConnectedTanks_11mix.c TwoConnectedTanks_12jac.c TwoConnectedTanks_13opt.c TwoConnectedTanks_14lnz.c \
TwoConnectedTanks_15syn.c TwoConnectedTanks_16dae.c TwoConnectedTanks_17inl.c TwoConnectedTanks_18spd.c

OFILES=$(CFILES:.c=.o)
GENERATEDFILES=$(MAINFILE) TwoConnectedTanks.makefile TwoConnectedTanks_literals.h TwoConnectedTanks_functions.h $(CFILES)

.PHONY: omc_main_target clean bundle

# This is to make sure that TwoConnectedTanks_*.c are always compiled.
.PHONY: $(CFILES)

omc_main_target: $(MAINOBJ) TwoConnectedTanks_functions.h TwoConnectedTanks_literals.h $(OFILES)
$(CC) -I. -o TwoConnectedTanks$(EXEEXT) $(MAINOBJ) $(OFILES) $(DIREXTRA) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)

omc_dll_target: $(MAINOBJ) TwoConnectedTanks_functions.h TwoConnectedTanks_literals.h $(OFILES)
$(CC) -DOMC_DLL_MAIN_DEFINE -o $(MAINOBJ) -c $(MAINFILE) $(DIREXTRA) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
$(CC) -shared -I. -o TwoConnectedTanks$(DLLEXT) $(MAINOBJ) $(OFILES) $(DIREXTRA) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)

clean:
@rm -f TwoConnectedTanks_records.o $(MAINOBJ)

bundle:
@tar -cvf TwoConnectedTanks_Files.tar $(GENERATEDFILES)
Binary file not shown.
18 changes: 18 additions & 0 deletions NonInteractingTanks.TwoConnectedTanks/TwoConnectedTanks_01exo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* External objects file */
#include "TwoConnectedTanks_model.h"
#if defined(__cplusplus)
extern "C" {
#endif

void TwoConnectedTanks_callExternalObjectDestructors(DATA *data, threadData_t *threadData)
{
if(data->simulationInfo->extObjs)
{
free(data->simulationInfo->extObjs);
data->simulationInfo->extObjs = 0;
}
}
#if defined(__cplusplus)
}
#endif

Binary file not shown.
13 changes: 13 additions & 0 deletions NonInteractingTanks.TwoConnectedTanks/TwoConnectedTanks_02nls.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* Non Linear Systems */
#include "TwoConnectedTanks_model.h"
#include "TwoConnectedTanks_12jac.h"
#include "simulation/jacobian_util.h"
#if defined(__cplusplus)
extern "C" {
#endif


#if defined(__cplusplus)
}
#endif

Binary file not shown.
14 changes: 14 additions & 0 deletions NonInteractingTanks.TwoConnectedTanks/TwoConnectedTanks_03lsy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* Linear Systems */
#include "TwoConnectedTanks_model.h"
#include "TwoConnectedTanks_12jac.h"
#if defined(__cplusplus)
extern "C" {
#endif

/* linear systems */


#if defined(__cplusplus)
}
#endif

Binary file not shown.
16 changes: 16 additions & 0 deletions NonInteractingTanks.TwoConnectedTanks/TwoConnectedTanks_04set.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* Initial State Set */
#include "TwoConnectedTanks_model.h"
#include "TwoConnectedTanks_11mix.h"
#include "TwoConnectedTanks_12jac.h"
#if defined(__cplusplus)
extern "C" {
#endif
/* funtion initialize state sets */
void TwoConnectedTanks_initializeStateSets(int nStateSets, STATE_SET_DATA* statesetData, DATA *data)
{
}

#if defined(__cplusplus)
}
#endif

Binary file not shown.
94 changes: 94 additions & 0 deletions NonInteractingTanks.TwoConnectedTanks/TwoConnectedTanks_05evt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/* Events: Sample, Zero Crossings, Relations, Discrete Changes */
#include "TwoConnectedTanks_model.h"
#if defined(__cplusplus)
extern "C" {
#endif

/* Initializes the raw time events of the simulation using the now
calcualted parameters. */
void TwoConnectedTanks_function_initSample(DATA *data, threadData_t *threadData)
{
long i=0;
}

const char *TwoConnectedTanks_zeroCrossingDescription(int i, int **out_EquationIndexes)
{
static const char *res[] = {"time <= 5.0"};
static const int occurEqs0[] = {1,5};
static const int *occurEqs[] = {occurEqs0};
*out_EquationIndexes = (int*) occurEqs[i];
return res[i];
}

/* forwarded equations */

int TwoConnectedTanks_function_ZeroCrossingsEquations(DATA *data, threadData_t *threadData)
{
TRACE_PUSH

data->simulationInfo->callStatistics.functionZeroCrossingsEquations++;


TRACE_POP
return 0;
}

int TwoConnectedTanks_function_ZeroCrossings(DATA *data, threadData_t *threadData, double *gout)
{
TRACE_PUSH
const int *equationIndexes = NULL;

modelica_boolean tmp0;
modelica_real tmp1;
modelica_real tmp2;

#if !defined(OMC_MINIMAL_RUNTIME)
if (measure_time_flag) rt_tick(SIM_TIMER_ZC);
#endif
data->simulationInfo->callStatistics.functionZeroCrossings++;

tmp1 = 1.0;
tmp2 = 5.0;
tmp0 = LessEqZC(data->localData[0]->timeValue, 5.0, tmp1, tmp2, data->simulationInfo->storedRelations[0]);
gout[0] = (tmp0) ? 1 : -1;

#if !defined(OMC_MINIMAL_RUNTIME)
if (measure_time_flag) rt_accumulate(SIM_TIMER_ZC);
#endif

TRACE_POP
return 0;
}

const char *TwoConnectedTanks_relationDescription(int i)
{
const char *res[] = {"time <= 5.0"};
return res[i];
}

int TwoConnectedTanks_function_updateRelations(DATA *data, threadData_t *threadData, int evalforZeroCross)
{
TRACE_PUSH
const int *equationIndexes = NULL;

modelica_boolean tmp3;
modelica_real tmp4;
modelica_real tmp5;

if(evalforZeroCross) {
tmp4 = 1.0;
tmp5 = 5.0;
tmp3 = LessEqZC(data->localData[0]->timeValue, 5.0, tmp4, tmp5, data->simulationInfo->storedRelations[0]);
data->simulationInfo->relations[0] = tmp3;
} else {
data->simulationInfo->relations[0] = (data->localData[0]->timeValue <= 5.0);
}

TRACE_POP
return 0;
}

#if defined(__cplusplus)
}
#endif

Binary file not shown.
80 changes: 80 additions & 0 deletions NonInteractingTanks.TwoConnectedTanks/TwoConnectedTanks_06inz.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/* Initialization */
#include "TwoConnectedTanks_model.h"
#include "TwoConnectedTanks_11mix.h"
#include "TwoConnectedTanks_12jac.h"
#if defined(__cplusplus)
extern "C" {
#endif

void TwoConnectedTanks_functionInitialEquations_0(DATA *data, threadData_t *threadData);

/*
equation index: 1
type: SIMPLE_ASSIGN
tank2.h = $START.tank2.h
*/
void TwoConnectedTanks_eqFunction_1(DATA *data, threadData_t *threadData)
{
TRACE_PUSH
const int equationIndexes[2] = {1,1};
(data->localData[0]->realVars[0] /* tank2.h STATE(1) */) = (data->modelData->realVarsData[0] /* tank2.h STATE(1) */).attribute .start;
TRACE_POP
}
extern void TwoConnectedTanks_eqFunction_5(DATA *data, threadData_t *threadData);

extern void TwoConnectedTanks_eqFunction_6(DATA *data, threadData_t *threadData);


/*
equation index: 4
type: SIMPLE_ASSIGN
tank2.Q1 = $DER.tank2.h * tank2.A
*/
void TwoConnectedTanks_eqFunction_4(DATA *data, threadData_t *threadData)
{
TRACE_PUSH
const int equationIndexes[2] = {1,4};
(data->localData[0]->realVars[3] /* tank2.Q1 variable */) = ((data->localData[0]->realVars[1] /* der(tank2.h) STATE_DER */)) * ((data->simulationInfo->realParameter[2] /* tank2.A PARAM */));
TRACE_POP
}
OMC_DISABLE_OPT
void TwoConnectedTanks_functionInitialEquations_0(DATA *data, threadData_t *threadData)
{
TRACE_PUSH
TwoConnectedTanks_eqFunction_1(data, threadData);
TwoConnectedTanks_eqFunction_5(data, threadData);
TwoConnectedTanks_eqFunction_6(data, threadData);
TwoConnectedTanks_eqFunction_4(data, threadData);
TRACE_POP
}

int TwoConnectedTanks_functionInitialEquations(DATA *data, threadData_t *threadData)
{
TRACE_PUSH

data->simulationInfo->discreteCall = 1;
TwoConnectedTanks_functionInitialEquations_0(data, threadData);
data->simulationInfo->discreteCall = 0;

TRACE_POP
return 0;
}

/* No TwoConnectedTanks_functionInitialEquations_lambda0 function */

int TwoConnectedTanks_functionRemovedInitialEquations(DATA *data, threadData_t *threadData)
{
TRACE_PUSH
const int *equationIndexes = NULL;
double res = 0.0;


TRACE_POP
return 0;
}


#if defined(__cplusplus)
}
#endif

Binary file not shown.
20 changes: 20 additions & 0 deletions NonInteractingTanks.TwoConnectedTanks/TwoConnectedTanks_07dly.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* Delay */
#include "TwoConnectedTanks_model.h"
#if defined(__cplusplus)
extern "C" {
#endif

int TwoConnectedTanks_function_storeDelayed(DATA *data, threadData_t *threadData)
{
TRACE_PUSH

int equationIndexes[2] = {1,-1};

TRACE_POP
return 0;
}

#if defined(__cplusplus)
}
#endif

Binary file not shown.
42 changes: 42 additions & 0 deletions NonInteractingTanks.TwoConnectedTanks/TwoConnectedTanks_08bnd.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* update bound parameters and variable attributes (start, nominal, min, max) */
#include "TwoConnectedTanks_model.h"
#if defined(__cplusplus)
extern "C" {
#endif

OMC_DISABLE_OPT
int TwoConnectedTanks_updateBoundVariableAttributes(DATA *data, threadData_t *threadData)
{
TRACE_PUSH
/* min ******************************************************** */
infoStreamPrint(LOG_INIT, 1, "updating min-values");
if (ACTIVE_STREAM(LOG_INIT)) messageClose(LOG_INIT);

/* max ******************************************************** */
infoStreamPrint(LOG_INIT, 1, "updating max-values");
if (ACTIVE_STREAM(LOG_INIT)) messageClose(LOG_INIT);

/* nominal **************************************************** */
infoStreamPrint(LOG_INIT, 1, "updating nominal-values");
if (ACTIVE_STREAM(LOG_INIT)) messageClose(LOG_INIT);

/* start ****************************************************** */
infoStreamPrint(LOG_INIT, 1, "updating primary start-values");
if (ACTIVE_STREAM(LOG_INIT)) messageClose(LOG_INIT);

TRACE_POP
return 0;
}

OMC_DISABLE_OPT
int TwoConnectedTanks_updateBoundParameters(DATA *data, threadData_t *threadData)
{
TRACE_PUSH
TRACE_POP
return 0;
}

#if defined(__cplusplus)
}
#endif

Binary file not shown.
43 changes: 43 additions & 0 deletions NonInteractingTanks.TwoConnectedTanks/TwoConnectedTanks_09alg.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* Algebraic */
#include "TwoConnectedTanks_model.h"

#ifdef __cplusplus
extern "C" {
#endif


/* forwarded equations */
extern void TwoConnectedTanks_eqFunction_7(DATA* data, threadData_t *threadData);

static void functionAlg_system0(DATA *data, threadData_t *threadData)
{
{
TwoConnectedTanks_eqFunction_7(data, threadData);
threadData->lastEquationSolved = 7;
}
}
/* for continuous time variables */
int TwoConnectedTanks_functionAlgebraics(DATA *data, threadData_t *threadData)
{
TRACE_PUSH

#if !defined(OMC_MINIMAL_RUNTIME)
if (measure_time_flag) rt_tick(SIM_TIMER_ALGEBRAICS);
#endif
data->simulationInfo->callStatistics.functionAlgebraics++;

TwoConnectedTanks_function_savePreSynchronous(data, threadData);

functionAlg_system0(data, threadData);

#if !defined(OMC_MINIMAL_RUNTIME)
if (measure_time_flag) rt_accumulate(SIM_TIMER_ALGEBRAICS);
#endif

TRACE_POP
return 0;
}

#ifdef __cplusplus
}
#endif
Binary file not shown.
Loading

0 comments on commit 34d7ebc

Please sign in to comment.