Changeset 7d177c1 in OpenModelica
- Timestamp:
- 2013-08-26T12:04:59+02:00 (11 years ago)
- Branches:
- Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
- Children:
- 569c48d4
- Parents:
- 27a8a7db
- Location:
- SimulationRuntime/c/simulation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
SimulationRuntime/c/simulation/simulation_runtime.cpp
r96b7fe8 r7d177c1 86 86 #endif 87 87 88 89 88 using namespace std; 90 89 … … 92 91 93 92 /* This variable is used to get the step size value during the simulation. */ 94 static double stepSize = 0.0; 95 static double currentTime = 0.0; 96 static int initTime = 0; 97 98 double getSimulationStepSize(double time, int *takeStep) 99 { 100 /* if the function is called first time during the simulation. */ 101 if (!initTime) { 102 initTime = 1; 103 currentTime = time; 104 *takeStep = 1; 105 } 106 else { 107 if (currentTime != time) { 108 currentTime = time; 109 *takeStep = 1; 110 } 111 else { 112 *takeStep = 0; 113 } 114 } 93 double stepSize = 0.0; 94 95 double getSimulationStepSize() 96 { 115 97 return stepSize; 116 98 } 117 99 118 void printSimulationStepSize(double in_stepSize, double time , int takeStep)119 { 120 fprintf(stderr, "in_stepSize=%f, time=%f , takeStep=%d\n", in_stepSize, time, takeStep);100 void printSimulationStepSize(double in_stepSize, double time) 101 { 102 fprintf(stderr, "in_stepSize=%f, time=%f\n", in_stepSize, time); 121 103 } 122 104 … … 811 793 read_input_xml(&(data->modelData), &(data->simulationInfo)); 812 794 initializeOutputFilter(&(data->modelData), data->simulationInfo.variableFilter); 813 /* set the global stepsize , currentTime & initTimevariable */795 /* set the global stepsize variable */ 814 796 stepSize = data->simulationInfo.stepSize; 815 currentTime = 0.0;816 initTime = 0;817 797 818 798 /* allocate memory for mixed system solvers */ -
SimulationRuntime/c/simulation/simulation_runtime.h
r44afde4 r7d177c1 96 96 fortran_integer *ng, double *gout, double *rpar, fortran_integer* ipar); 97 97 98 extern double getSimulationStepSize( double time, int *takeStep);99 extern void printSimulationStepSize(double in_stepSize, double time , int takeStep);98 extern double getSimulationStepSize(); 99 extern void printSimulationStepSize(double in_stepSize, double time); 100 100 101 101 /* the main function of the simulation runtime!
Note: See TracChangeset
for help on using the changeset viewer.