|
From your earlier message you implied that this statement
if (temp < upLinkRatio)
may be the problem. Are you sure the value of the temp variable is consistent in DEBUG and RELEASE modes? As I do not really understand how all of this code works I can't speculate as to any other places to look.
|
|
|
|
|
There is just one version of code and I just change Solution configuration from debug to release, so temp is consistent.
Whole program simulates WLAN with EDCA (802.11e). BEload:execute() function generates packets MSDU for one single station, which means it generates offered traffic = offered load. It decides (draws) whether just arrived packet will be sent in UPLINK or DOWNLINK. upLinkRatio variable states what % of all packets generated by BEload:execute() function will be sent in UPLINK. When the random double temp that varies from 0 to 1 is smaller than upLinkRatio (let's say smaller than 0.2 - let's assume upLinkRatio = 0.2), generated packet will be sent in UPLINK. It means address of source and transmitter will be set to address of station, and destination address to 0 (which is the address of access point - AP):
if (temp < upLinkRatio){
msdu->DA = 0;
msdu->TA = msdu->SA = staAddress;
}
Otherwise source and transmitter addresses will be set to address of AP (0) and destination adress to address of station.
else{
msdu->SA = msdu->TA = 0;
msdu->DA = staAddress;
}
So the problem is that proportion of offered traffic in UPLINK and DOWNLINK for RELEASE version are inverted. 80% of packets are offered in UPLINK, instead of 20%.
After changing statement you quoted to:
if (temp > upLinkRatio){
20% of packets are offered in UPLINK instead of 80% (of course just inthis case, when conditional statement is "inverted").
|
|
|
|
|
mass85 wrote: There is just one version of code and I just change Solution configuration from debug to release, so temp is consistent.
So you're saying that somehow the values of the '<' and '>' operators are being inverted by the compiler! I would suggest that it is much more likely that either the value of temp or upLinkRatio takes a different value depending on whether or not DEBUG is set. Try putting some extra code in there to see exactly what values are being used.
|
|
|
|
|
OK. I've changed conditional statement, so there's no upLinkRatio variable just constant value 0.2. And I also added cout<<temp;
the result="" is="" quite="" strange.="" most="" of="" the="" temp="" values="" are="" 0...="" which="" course="" incorrect.="" do="" you="" know,="" what="" might="" be="" reason="" for="" that?="" i="" will="" looking="" anything="" suspicious="" in="" generator,="" but="" it="" hard="" to="" find...="" example="" function="" gettimebe="" returns="" correct="" values.
here="" parts="" code="" that="" can="" affect="" beload="" from="" generator="" (this="" class="" used="" generate="" pseudo="" random="" numbers):
<pre="">
class Generator{
private:
int a, h, q, r, m;
int *coreCRC;
int **coreCW;
int *coreTimeBE;
int *coreTimeBK;
int *coreUpLinkRatio;
int *coreBurst;
int *corePacket;
int uniform(int X){
h = int ( double (X) / q );
X = a*(X - q*h) - r*h;
if (X < 0) X = X + m;
return X;
}
public:
double getTimeBE(int staAddress, double intensity){
int x = uniform(coreTimeBE[staAddress]);
coreTimeBE[staAddress] = x;
return (-1/intensity * log(double(x)/m));
}
double getUpLinkRandom(int staAddress){
int x = uniform(coreUpLinkRatio[staAddress]);
coreUpLinkRatio[staAddress] = x;
return double(x)/m;
}
void initialize(){
coreCW = new int*[staNr];
coreUpLinkRatio = new int[staNr];
coreBurst = new int[staNr];
coreTimeBE = new int[staNr];
coreTimeBK = new int[staNr];
corePacket = new int[staNr];
for(int i = 0; i < staNr; i++) coreCW[i] = new int[AC];
coreCRC = new int[staNr];
int x = 17;
int msgs = int (5*msgsToObserve*(1 + transientPhase/simTime));
for (int i = 0; i < staNr; i++){
for(int j = 0; j < AC; j++){
coreCW[i][j] = x;
for(int k = 0; k < (runsNr*(10*msgs + 3*shift + runShift)); k++)
x = uniform(x);
}
}
////////////////
// code omitted
///////////////
for(int i = 0; i < AC; i++){
coreUpLinkRatio[i] = x;
for(int j = 0; j < (runsNr*(2*beMsgsToObserve + shift + runShift)); j++)
x = uniform(x);
}
}
Generator() : a(69621), q(30845), r(23902), m(2147483647) {}
};
|
|
|
|
|
You know, it's very hard to find mistakes in snippet of code that may also be error-free (the mistake may be, for instance in the omitted code). Your best bet is a uninitialized variable (in the posted code, for instance m appears to be such).
BTW have a look the classical article "Surviving the Release Version".
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thx for the link.
a, q, r, m are initialized in constructor.
|
|
|
|
|
mass85 wrote: Most of the temp values are 0... which is of course incorrect. Do you know, what might be the reason for that?
No idea whatever, but obviously some part of your randomiser is incorrect.
mass85 wrote: int uniform(int X){
h = int ( double (X) / q );
X = a*(X - q*h) - r*h;
if (X < 0) X = X + m;
return X;
}
Try using more meaningful variable names as it can often aid in problem diagnosis.
|
|
|
|
|
This function is an implementation of a math formula...
I have finally found the bug!
And it was in the part of code pasted here. You couldn't find it, because you don't know whole design of this simulator In fact not whole coreUpLinkRatio array was initialized because of wrong for loop parameters after copying and pasting blocks of code without proper check of all details...
It should be this:
for(int i = 1 + repeaters; i < staNr; i++){
coreUpLinkRatio[i] = x;
for(int j = 0; j < (runsNr*(2*beMsgsToObserve + shift + runShift)); j++)
x = uniform(x);
}
...instead of this:
for(int i = 0; i < AC; i++){
coreUpLinkRatio[i] = x;
for(int j = 0; j < (runsNr*(2*beMsgsToObserve + shift + runShift)); j++)
x = uniform(x);
}
Thank you for your help!
|
|
|
|
|
mass85 wrote: I have finally found the bug!
Congratulations!
So when you wrote: There are no uninitialized variables in this block of code. I don't think there are any in whole program.
You did not realize that: In fact not whole coreUpLinkRatio array was initialized.
A good lesson to be learned here, methinks.
mass85 wrote: Thank you for your help!
My pleasure; I just wish my own bugs were as easy to find!
|
|
|
|
|
Developing this project learned me a lot, believe me. I found all the bugs I noticed (it hadn't been always like that before) and the more bugs I noticed and found the faster debugging was in the future. But this bug was a little bit different, that's why I wouldn't have found that without you insisting on uninitialized variable to be the problem.
But what was the problem in fact? Was the uninitialized part of array filled with zeros? It would explain why getUpLinkRatio returned zeros for most of the staAddresses. Core of the multiplicative generator can't be equal to 0, because it would return always 0.
Good luck in your debugging!
|
|
|
|
|
Hi, i am not familiar to win32 api so this may seen a easy question, i have a handle to a menu item, how can i action (virtual press that menu) and run it's method. I want to do this from other program ,from my programm i want to control menus from other apps(i already read the menus,i have handles to them).
Thx.
I found that it will work in most cases with WM_command
simion314
modified on Sunday, September 20, 2009 7:02 AM
|
|
|
|
|
Use FindWindow() to find the other program and use SendMessage()/PostMessage() (probably a WM_COMMAND message) to "press" the button.
|
|
|
|
|
How do you bind a Microsoft Forms TextBox in a Access 2002 Memo Field in VC++ 6? I am using this but just get a blank field
CWnd* pDSC = GetDlgItem(IDC_ADODC1);
pEdit = GetDlgItem(IDC_TEXTBOX1);
pEdit->BindDefaultProperty(0x16,VT_BSTR, _T("Synopsis"), pDSC);
|
|
|
|
|
|
Please must delete this post and re-post in the C# forum yourself.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Why didn't you post this question here[^] the first place?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
i want to compile the c/c++ programs using commands in cmd promt in windows
|
|
|
|
|
|
|
I have a problem. I make a program like this:
One Form, 2 ListBoxs, 1 grammar file and SAPI. ListBox1 have 3 items (Blue, Green, White). ListBox2 is empty. Grammar file have 'Blue', 'Green' and 'White'.
When i talk 'Blue', 'Green' or 'White' the program recognize the word and add to ListBox2.
In Windows XP (Sapi 5.1) the program works wonderful. In Windows Vista when i talk 'Blue', 'Green', 'White' the word in ListBox1 is selected and nothing happen to ListBox2 (Windows Vista recognize, not my program). How can i fix it?
modified on Saturday, September 19, 2009 12:03 PM
|
|
|
|
|
FredBrina wrote: SAPI
I'm not familiar with this API, what is its purpose?
Can you post the portion of code that has the problem? Everyone then has a better idea of what your program is trying to do.
|
|
|
|
|
SAPI = Speech Recognition API from Microsoft. Windows Vista (english version) have the version 5.3. Windows XP u can install version 5.1. I dont post the code because i am using Borland C++ and the code is bigger. My program recognize the words with no problems. The problem is: In Windows Vista the native recognize program seems to try to recognize first then my program.
|
|
|
|
|
FredBrina wrote: The problem is: In Windows Vista the native recognize program seems to try to recognize first then my program.
I don't quite understand what you are saying here, but rereading your original post it sounds as though the SAPI is recognising the word you speak, and selecting that item into one of the list boxes. You then expect some action in the other listbox which works in XP but not in Vista. Have you checked the differences between the two SAPI versions for any known errors? Have you checked the relationship between the two list boxes?
FredBrina wrote: I dont post the code because i am using Borland C++ and the code is bigger.
Without seeing the code where the problem is occurring it is impossible to make any further guesses as to what may be happening.
|
|
|
|
|
Yes, Sapi is recognising the word. The problem is: Windows XP -> my program recognize. Windows Vista -> Windows Vista recognize. See the problem:
The program now:
ListBox1 = "Blue", "White" ...
ListBox2 = Empty
Grammar file = "Blue", "White" ...
When i talk "Blue", Windows Vista recognize the word and select the item. My program not recognize!
The program fixed:
ListBox1 = "B.l.u.e", "W.h.i.t.e" ...
ListBox2 = Empty
Grammar file = "Blue", "White" ...
When i talk "Blue", Windows Vista didnt recognize (ListBox1 now have "B.l.u.e"). My program recognize!
|
|
|
|
|
Well I can't say that I understand your explanation, but I'm happy that your problem is resolved.
|
|
|
|