Click here to Skip to main content
15,897,704 members

Comments by The_Real_Chubaka (Top 37 by date)

The_Real_Chubaka 7-Feb-12 12:52pm View    
Yes but, the last line of code i wrote was a few years ago.
The_Real_Chubaka 7-Feb-12 12:46pm View    
Point 1)

Rangek.runge4(count, y, dist); // Method executed in real time [Is this the way to do this?]

y and dist are both is of type double.

This is Runge Kutta method to solve a set of first order differential equations.
“count” is the x-value, time in this case. “y[0]” is the y-value of the first differential equation, “y[1]” the y-value of the second differential equation …

So, this method is supposed to find y-values at every count+dist point.
I set “dist” to 0.1 but, it can be changed.

The problem I have is using it in real time. I am assuming that it is finding y-values in real time because count is real-time.

Point 2)

I changed that line to:

fprintf(output, "%l\t%f\n", count, y[0]);

I modified my code so many time that I forgot to modify that line. Thank you :)

Point 3)

Thank you very much.
It works like a charm.

Last point)

I think I need to go back to my Runge Kutta code and write my logic to implement it in real time with a pen and paper.
The_Real_Chubaka 7-Feb-12 10:59am View    
Since, it is always getting re-initialized, it will always be equal to -1 after the first iteration.
That mean lastCount will always be != from count after the first iteration.
That is also why it is only printing the first line.
The_Real_Chubaka 7-Feb-12 10:56am View    
Do you mean like this:

while(1)
{
time02 = time_now(); // Returns the time now
static long count = 0;
count = (time02-time01)/1000; // Number of seconds since “time01”
Rangek.runge4(count, y, dist); // Method executed in real time [Is this the way to do this?]

static long lastCount = -1; // 'static' so it does not get re-initialised
cout << "Counting: " << lastCount << " seconds\n";
//if((count%2) == 0)
if(lastCount == count)
{
fprintf(output, "%f\t%f\n", count, y[0]);
lastCount = count;
continue;
}

cout << "Counting: " << count << " seconds\n";

if( ((time02-time01)/1000) >= MAX) break;// Stop after 10 second

}

I have two problems:

I made "lastCount" static, but it is always getting re-initialized!!! Why is that?

The "countinue" statement will make this line "Rangek.runge4(count, y, dist);" not be executed in real-time.
The_Real_Chubaka 6-Dec-11 12:50pm View    
Main purpose of the server: just a repository for source code. However, i it would be a plus if i can run my applications on it :)

The kind of application we are working on: We are busy working on a web application. crawlers, parsers, extracting data from websites, putting extracted data in a database ...
However, in the future, we don't know what other projects we will work on. It can be desktop app, mobile app...

Thank you for your interest in my question.

Herve