Please wait...
×

Error

Posted Tue, 13 Sep 2011 02:54:34 GMT by mwtoews
Simple question. I'd like to get the current time step integer. I've tried [tt]IfmGetAbsoluteSimulationTime[/tt], however, this is not quite the same (it is a floating-point day, not an integer for the time step). Please help me fill in the blank, or prove me a way to determine the time step.

[code]
static void PostTimeStep (IfmDocument pDoc)
{
double abs_sim_time = IfmGetAbsoluteSimulationTime(pDoc);
        int ts_num = ??????;

IfmInfo(pDoc, "At timestep #%i, with absolute time %g days\n", ts_num, abs_sim_time);
}
[/code]

Thanks!
Posted Wed, 14 Sep 2011 21:55:46 GMT by mwtoews
My solution is to track this independently, using a module global:

[code]
int ts; // time step integer

static void OnEnterSimulator (IfmDocument pDoc)
{
    // Reset time step
    ts = 0;
...

static void PostTimeStep (IfmDocument pDoc)
{
    ts++;
    IfmInfo(pDoc, "Processing timestep %i\n", ts);
...
[/code]

You must be signed in to post in this forum.