mirror of
https://github.com/nasa/trick.git
synced 2024-12-20 21:53:10 +00:00
Fixes #44: Changed the MonteRun values that are used and that are recorded to be the same precision. Also increased the precision from 10 to 15 significant digits.
This commit is contained in:
parent
f4e0ce32b0
commit
f2ca099baf
@ -33,11 +33,17 @@ void Trick::MonteCarlo::dispatch_run_to_slave(MonteRun *in_run, MonteSlave *in_s
|
||||
message_publish(MSG_INFO, "Monte [Master] Dispatching run %d to %s:%d.\n",
|
||||
in_run->id, in_slave->machine_name.c_str(), in_slave->id) ;
|
||||
}
|
||||
|
||||
int command = htonl(MonteSlave::PROCESS_RUN);
|
||||
tc_write(&connection_device, (char *)&command, (int)sizeof(command));
|
||||
int num_bytes = htonl(buffer.length());
|
||||
tc_write(&connection_device, (char*)&num_bytes, (int)sizeof(num_bytes));
|
||||
tc_write(&connection_device, (char*)buffer.c_str(), (int)buffer.length());
|
||||
|
||||
if (verbosity >= INFORMATIONAL) {
|
||||
message_publish(MSG_INFO, "Parameterization of run %d :\n%s\n", in_run->id, buffer.c_str()) ;
|
||||
}
|
||||
|
||||
tc_disconnect(&connection_device);
|
||||
|
||||
++in_slave->num_dispatches;
|
||||
|
@ -42,15 +42,12 @@ std::string Trick::MonteVarCalculated::get_next_value() {
|
||||
value = buffer;
|
||||
break;
|
||||
case TRICK_FLOAT:
|
||||
sprintf(buffer, "%.10g", *(float *)ref2->address);
|
||||
sprintf(buffer, "%.15g", *(float *)ref2->address);
|
||||
value = buffer;
|
||||
sprintf(buffer, "trick.unhex_float(0x%lx)", *(long *)ref2->address);
|
||||
break;
|
||||
case TRICK_DOUBLE:
|
||||
sprintf(buffer, "%.10g", *(double *)ref2->address);
|
||||
sprintf(buffer, "%.15g", *(double *)ref2->address);
|
||||
value = buffer;
|
||||
sprintf(buffer, "struct.unpack(\"!d\", binascii.unhexlify(\"%016llx\"))[0]",
|
||||
*(long long *)ref2->address);
|
||||
break;
|
||||
default:
|
||||
sprintf(buffer, "#Unsupported value type %d", ref2->attr->type) ;
|
||||
@ -58,10 +55,9 @@ std::string Trick::MonteVarCalculated::get_next_value() {
|
||||
}
|
||||
|
||||
if (unit.empty()) {
|
||||
return name + std::string(" = ") + std::string(buffer) + std::string(" # ") + std::string(value);
|
||||
return name + std::string(" = ") + value;
|
||||
} else {
|
||||
return name + std::string(" = trick.attach_units(\"") + unit + std::string("\", ") + std::string(buffer) +
|
||||
std::string(") # ") + std::string(value);
|
||||
return name + std::string(" = trick.attach_units(\"") + unit + std::string("\", ") + value + std::string(")");
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
@ -181,17 +181,16 @@ std::string Trick::MonteVarRandom::get_next_value() {
|
||||
case TRICK_GSL_GAUSS:
|
||||
case TRICK_GSL_FLAT:
|
||||
default:
|
||||
sprintf(buffer, "%.10g", return_value.d);
|
||||
sprintf(buffer, "%.15g", return_value.d);
|
||||
value = buffer;
|
||||
sprintf(buffer, "struct.unpack(\"!d\", binascii.unhexlify(\"%llx\"))[0]", return_value.ll);
|
||||
break;
|
||||
}
|
||||
|
||||
if (unit.empty()) {
|
||||
return name + std::string(" = ") + std::string(buffer) + std::string(" # ") + std::string(value);
|
||||
return name + std::string(" = ") + value ;
|
||||
} else {
|
||||
return name + std::string(" = trick.attach_units(\"") + unit + std::string("\", ") + std::string(buffer) +
|
||||
std::string(") # ") + std::string(value);
|
||||
return name + std::string(" = trick.attach_units(\"") + unit + std::string("\", ") + value +
|
||||
std::string(")") ;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user