Home » Community » Newbie corner » Assert failed in core/value.h line 464
Assert failed in core/value.h line 464 [message #28243] |
Wed, 25 August 2010 08:29  |
jerson
Messages: 202 Registered: June 2010 Location: Bombay, India
|
Experienced Member |

|
|
Quote: |
From JFsrtsystem.2010-08-25-11-38-20.buglog file
* C:\upp2625\out\MINGW.Debug.Debug_full.Gui\JFsrtsystem.exe 25.08.2010 11:38:20, user: Jerson
ASSERT FAILED: Assertion failed in C:\upp2625\uppsrc\Core\Value.h, line 464
Invalid value conversion: N3Upp12RichValueRepINS_6StringEEE -> d
|
This is the message I get when I try to access the ExciterVoltage.Range member from the Settings structure.
// Global Settings go here
struct T_RGOP {
Value Range,
Gain,
Offset,
Precision;
void Serialize(Stream& stream)
{
stream % Range % Gain % Offset % Precision;
};
};
// Speed/ Sensitivity enumerations
enum eSpeed {Zero=0, Low, Mid, High};
struct T_Settings {
// for system settings screen
T_RGOP ExciterVoltage, // settings for each type of parameter
ExciterCurrent,
OutputVoltage,
OutputCurrent,
InputVoltage,
InputCurrent,
RegulatorVoltage,
RegulatorCurrent;
Value ProtectFactor,
ProtectMaxVout,
ProtectMaxIout,
ProtectMaxIin,
RegV0, RegVmax, // values for regulator 0 and 100%
GapV0, GapVmax; // and gap 0 & 100%
int ArcSensitivity;
// Other settings
int iHV_Mins, iHV_Secs,
iHV_Output, iHV_Protect,
iRegRange, iRegSpeed,
iResGap, iResSpeed;
int biAlarmSound:1, // alarm sound on/off
biAlarmLight:1; // alarm light on/off
// default values for the settings
T_Settings()
{
ExciterVoltage.Range = 6000;
ExciterCurrent.Range = 2000;
OutputVoltage.Range = 400;
OutputCurrent.Range = 1000;
InputVoltage.Range = 430;
InputCurrent.Range = 500;
RegulatorVoltage.Range = 1000;
RegulatorCurrent.Range = 1000;
ProtectFactor = 1200;
ProtectMaxVout = 1000;
ProtectMaxIout = 1000;
ProtectMaxIin = 1000;
RegV0 = 0; RegVmax = 100;
GapV0 = 0; GapVmax = 100;
iHV_Mins = 1; iHV_Secs = 0;
}
// serialization function
void Serialize(Stream& stream)
{
stream
% ExciterVoltage % ExciterCurrent
% OutputVoltage % OutputCurrent
% InputVoltage % InputCurrent
% RegulatorVoltage % RegulatorCurrent
% ProtectFactor % ProtectMaxVout
% ProtectMaxIout % ProtectMaxIin
% RegV0 % RegVmax
% GapV0 % GapVmax
% ArcSensitivity
// Other settings
% iHV_Mins % iHV_Secs
% iHV_Output % iHV_Protect
% iRegRange % iRegSpeed
% iResGap % iResSpeed
/* ("biAlarmSound", biAlarmSound)
("biAlarmLight", biAlarmLight)
*/
;
}
};
T_Settings Settings;
This is the line of code that is driving me nuts. Maybe I am doing something wrong. Vexciter.meter.SetMax(Settings.ExciterVoltage.Range);
If I comment out this line and put in a
DUMP(Settings.ExciterVoltage.Range);
I get the above assertion in both cases. Another place I have problems is using the same thing like this
Vexciter.meter.SetStep(Settings.ExciterVoltage.Range / 4); which comes back with an ambiguous divide operator message.
I am relatively new to C++ and UPP and cannot figure this out for myself. Can anyone guide me please?
Thanks
Jerson
|
|
|
|
|
Re: Assert failed in core/value.h line 464 [message #28281 is a reply to message #28243] |
Wed, 25 August 2010 16:49   |
jerson
Messages: 202 Registered: June 2010 Location: Bombay, India
|
Experienced Member |

|
|
Ok, I found it
The Settings.Vexciter.Range parameter is of Value type.
The control that was being used to take in user input was of type EditString.
This was the assignment
Settings.Vexciter.Range = ~esExciterVoltage;
This is where things were going wrong. The String value was geting assigned to the variable.
Following this was a call to StoreToFile(Settings, cfgfile);
this was storing the value as a string in the cfgfile.
On reloading the file by using LoadFromFile(Settings, cfgfile), the string was being loaded to Value. On assigning this to Meter.SetMax(Settings.Vexciter.Range), I was getting the assertion since the Value does not seamlessly convert to a double(help file says so).
Doing this Meter.SetMax((double)Settings.Vexciter.Range) does not help either.
However, now, I am out of the block and hopefully can steam ahead. I have changed all the user input boxes to EditDouble type.
BTW: why does this work
double d = Settings.ExciterVoltage.Range;
Vexciter.meter.SetStep(d/4);
and why not this?
Vexciter.meter.SetStep(Settings.ExciterVoltage.Range/4);
this gives an ambiguous operator message and fails to compile
Thanks for your help
[Updated on: Wed, 25 August 2010 16:54] Report message to a moderator
|
|
|
Re: Assert failed in core/value.h line 464 [message #28283 is a reply to message #28281] |
Wed, 25 August 2010 17:46  |
 |
koldo
Messages: 3432 Registered: August 2008
|
Senior Veteran |
|
|
Hello Jerson
Good for finding it.
Remember my first post:
This code gives compiling errors because the compiler does not know in advance the type of val:
Value val = 35;
double res = val/2;
This one works:
Value val = 35;
double res = int(val)/2.;
Best regards
Iñaki
|
|
|
Goto Forum:
Current Time: Sun Apr 27 01:33:38 CEST 2025
Total time taken to generate the page: 0.00775 seconds
|