Skip to main content
FluidEarth Portal Header version 3

FluidEarth Portal

Go Search
  
FluidEarth Portal > FluidEarth Discussions > Help with a C++ program  

FluidEarth Discussions

Modify settings and columns
Discussions board for FluidEarth Users
  
View: 
Post
Started: 03/06/2010 17:08
Attachment
Picture Placeholder: MMansour
MMansour
Help with a C++ program
Hi Gordon,
 
I am trying to make a C++ program OpenMI complient.
 
I produced a dll version of my program which i tested sucessfully. I followed the tutorial related to FORTRAN programs and updated the EngineProxy.cs to call my dll.
 
I have not updated any of the xml or omi files yet.
 
I tried to run the model in pipistrelle and got the list of errors (attached).  I would be grateful if you can help explaining what hapenning and to put me on the right track to proceed from here.
 
Regards,
 
Majdi 
Posted: 03/06/2010 19:18
Picture Placeholder: GGlasgow
GGlasgow
hi,
 
c++?  ...a rather brave decision, if you don't mind my saying! not got too much experieince with that type of wrapping, so as you get further i think Adrian Harper might prove more helpful than me.
 
as for this pipistrelle error, it's a little difficult to see from your screengrab but the very first system exception is telling you that the timestamps aren't moving forward - basically your model is stuck on one time, for one reason or another.
 
you should check that you have a dt that's properly initialised and with a sensible value (non zero) and is being added to the current time in 'compute'.
 
your message suggests one of these steps might have become lost somewhere - either in the initialisation phase (i.e. check the string for dt is consistent in both initialise and the omi file), in the assignment or in 'compute' if you're not returning a time that's moved forward.
 
if this doesn't help, it might be worth uploading the log file (with event monitoring 'all' and logging level 'debug2'), which i can help you go through to see what other information is available from the run.
 
hope this helps, but if not let me know,
 
gordon
Posted: 04/06/2010 14:15
Picture Placeholder: MMansour
MMansour
Gordon,
 
Thanks for your reply.  I think my problem is time inconsistency. My question is about the the time format.  This is clearly specified in the xml file but is it converted into Julian format somewhere later on?.  My model is using Julian Date and i think I have problem with the current time i return from it.  Can you help with this please?
 
Thanks
 
Majdi
Posted: 06/06/2010 21:12
Attachment
Picture Placeholder: GGlasgow
GGlasgow
hi,
 
no problem. keeping track of model time can be a fairly tricky thing to do. you're right - during initialisation the SDK converts the horizon into modified julian day format and passes it into the engine of the model during initialisation. the model then does need to keep returning the current time both at the end of initialisation and after every time-step. after each time-step, the model has to return a time further advanced than the one before.
 
if you are using modified julian date for your time-step, you shouldn't have to do any converting at all - you can just add dt after calcs in each compute() and it will keep moving forward through time. you will have to make sure your model horizon is long enough. all of the sample models step on a 1s or do time-step, so only cover an hour - you may have leapt over all of the horizon in a single dt. if you use long timesteps and haven't made this longer, it may be the first place to start.
 
i've put together some notes going through time in general in a little more detail.
 
i would suggest you run your composition in event = 'all', log level = 'debug2' and have a look at the initialisation and the timesteps. i've put extracts in the attached pdf from one of my runs, which shows the strings/values in the config file that get read into the model engine and current time at each time step the model is called. if you are having a problem with time, it should be most obvious here - more than happy to have a look through if you want to upload a copy.
 
hope this helps,
 
gordon
Posted: 07/06/2010 15:05
Picture Placeholder: MMansour
MMansour
Gordon,
 
It is working now. I had a bug in my model so the Julian Date format was not consistent with that of the SDK.  
I almost have a model wrapped now.
 
Thanks for the help.
 
Majdi
Posted: 07/06/2010 16:44
Picture Placeholder: GGlasgow
GGlasgow
sounds like you're making good progress.  let me know how you get on with the rest of the wrapping.
 
gordon