Skip to content

Commit cb80b9a

Browse files
committed
Write incomplete result-files, so it is possible to see the signals until the error was triggered
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@21398 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 83e92eb commit cb80b9a

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

SimulationRuntime/c/simulation/simulation_runtime.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,9 +645,13 @@ int callSolver(DATA* simData, string result_file_cstr, string init_initMethod,
645645
long i;
646646
long solverID = S_UNKNOWN;
647647
const char* outVars = (outputVariablesAtEnd.size() == 0) ? NULL : outputVariablesAtEnd.c_str();
648+
threadData_t *threadData = simData->threadData;
648649

649650
TRACE_PUSH
650651

652+
MMC_TRY_INTERNAL(mmc_jumper)
653+
MMC_TRY_INTERNAL(globalJumpBuffer)
654+
651655
if(initializeResultData(simData, result_file_cstr, cpuTime))
652656
{
653657
TRACE_POP
@@ -691,6 +695,9 @@ int callSolver(DATA* simData, string result_file_cstr, string init_initMethod,
691695
retVal = solver_main(simData, init_initMethod.c_str(), init_optiMethod.c_str(), init_file.c_str(), init_time, lambda_steps, solverID, outVars);
692696
}
693697

698+
MMC_CATCH_INTERNAL(mmc_jumper)
699+
MMC_CATCH_INTERNAL(globalJumpBuffer)
700+
694701
sim_result.free(&sim_result, simData);
695702

696703
TRACE_POP

SimulationRuntime/c/util/read_matlab4.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@
3535
#include <assert.h>
3636
#include "read_matlab4.h"
3737

38+
extern const char *omc_mat_Aclass;
39+
40+
typedef struct {
41+
uint32_t type;
42+
uint32_t mrows;
43+
uint32_t ncols;
44+
uint32_t imagf;
45+
uint32_t namelen;
46+
} MHeader_t;
47+
3848
/* Make Visual Studio not complain about deprecated items */
3949
#ifdef _MSC_VER
4050
#define strdup _strdup
@@ -364,7 +374,8 @@ const char* omc_new_matlab4_reader(const char *filename, ModelicaMatReader *read
364374
case 5: { /* "data_2" */
365375
if(binTrans==1) {
366376
reader->nrows = hdr.ncols;
367-
if(reader->nrows < 2) return "Too few rows in data_2 matrix";
377+
/* Allow empty matrix; it's not a complete file, but ok... */
378+
/* if(reader->nrows < 2) return "Too few rows in data_2 matrix"; */
368379
reader->nvar = hdr.mrows;
369380
reader->var_offset = ftell(reader->file);
370381
reader->vars = (double**) calloc(reader->nvar*2,sizeof(double*));
@@ -373,7 +384,8 @@ const char* omc_new_matlab4_reader(const char *filename, ModelicaMatReader *read
373384
if(binTrans==0) {
374385
unsigned int k,j;
375386
reader->nrows = hdr.mrows;
376-
if(reader->nrows < 2) return "Too few rows in data_2 matrix";
387+
/* Allow empty matrix; it's not a complete file, but ok... */
388+
/* if(reader->nrows < 2) return "Too few rows in data_2 matrix"; */
377389
reader->nvar = hdr.ncols;
378390
reader->var_offset = ftell(reader->file);
379391
reader->vars = (double**) calloc(reader->nvar*2,sizeof(double*));

SimulationRuntime/c/util/read_matlab4.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,6 @@
3434
#include <stdio.h>
3535
#include <stdint.h>
3636

37-
extern const char *omc_mat_Aclass;
38-
39-
typedef struct {
40-
uint32_t type;
41-
uint32_t mrows;
42-
uint32_t ncols;
43-
uint32_t imagf;
44-
uint32_t namelen;
45-
} MHeader_t;
46-
4737
typedef struct {
4838
char *name,*descr;
4939
int isParam;

0 commit comments

Comments
 (0)