@@ -230,30 +230,56 @@ dso::IntegrationParameters::from_config(const char *fn,
230230 }
231231 params.mdealias = dap;
232232
233+ /* get the satellite (mandatory) */
234+ dso::SATELLITE sat (dso::SATELLITE::UNKNOWN);
235+ if (is_nonempty_string (config[" satellite-attitude" ][" satellite" ])) {
236+ const auto s = config[" satellite-attitude" ][" satellite" ].as <std::string>();
237+ try {
238+ sat = dso::translate_satid (s.c_str ());
239+ } catch (std::exception &e) {
240+ fprintf (stderr, e.what ());
241+ std::string err_msg = " [ERROR] Failed to translate satellite name "
242+ " from "
243+ " config parameters " +
244+ s + " (traceback:" + std::string (__func__) + " )\n " ;
245+ throw std::runtime_error (err_msg);
246+ }
247+ }
248+
233249 /* Satellite attitude (if model satellite-attitude::data_file is non-empty) */
234250 dso::SatelliteAttitude *satat = nullptr ;
235- dso::SatelliteMacromodel *satmm = nullptr ;
236251 dso::attitude_details::MeasuredAttitudeData *mad = nullptr ;
237252 if (is_nonempty_string (config[" satellite-attitude" ][" data_file" ])) {
238253 const auto d = config[" satellite-attitude" ][" data_file" ].as <std::string>();
239- const auto s = config[" satellite-attitude" ][" satellite" ].as <std::string>();
240254 try {
241- const dso::SATELLITE sat = dso::translate_satid (s.c_str ());
242255 satat = new dso::MeasuredAttitude (sat, d.c_str ());
243256 mad = new dso::attitude_details::MeasuredAttitudeData (
244257 dso::measured_attitude_data_factory (sat));
245- satmm = new dso::SatelliteMacromodel (
246- dso::SatelliteMacromodel::createSatelliteMacromodel (sat));
247258 } catch (std::exception &e) {
248259 fprintf (stderr, e.what ());
249260 std::string err_msg = " [ERROR] Failed to construct a SatelliteAttitude "
250- " and/or SatelliteMacromodel instance from "
261+ " and/or MeasuredAttitudeData instance from "
251262 " config parameters " +
252- s + " , " + d +
263+ d +
253264 " (traceback:" + std::string (__func__) + " )\n " ;
254265 throw std::runtime_error (err_msg);
255266 }
267+ }
268+ params.matt = satat; // attitude
269+ params.mattdata = mad; // attitude data (for retrieving attitude from stream)
256270
271+ /* create the macromodel (independent of attitude) */
272+ dso::SatelliteMacromodel *satmm = nullptr ;
273+ {
274+ try {
275+ satmm = new dso::SatelliteMacromodel (
276+ dso::SatelliteMacromodel::createSatelliteMacromodel (sat));
277+ } catch (std::exception &e) {
278+ fprintf (stderr, e.what ());
279+ std::string err_msg = " [ERROR] Failed to construct a SatelliteMacromodel"
280+ " instance from config parameters (traceback:" + std::string (__func__) + " )\n " ;
281+ throw std::runtime_error (err_msg);
282+ }
257283 if (is_nonempty_string (config[" satellite-attitude" ][" cnes_sat_file" ])) {
258284 const auto c =
259285 config[" satellite-attitude" ][" cnes_sat_file" ].as <std::string>();
@@ -265,9 +291,12 @@ dso::IntegrationParameters::from_config(const char *fn,
265291 }
266292 }
267293 }
268- params.matt = satat;
269- params.mattdata = mad;
270- params.msatmm = satmm;
294+ params.msatmm = satmm; // macromodel (maybe used or not depending on attitude)
295+
296+ /* Dynamic parameters */
297+ {
298+ params.mCr = config[" dynamic-parameters" ][" Cr" ].as <double >();
299+ }
271300
272301 /* return */
273302 return params;
0 commit comments