Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions models/fhw/effectors/rcs_generic/include/rcs_jet.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ class RcsJet {
std::vector<double> component_consumption;/* (kg)
Work space for prop consumption during delta_time_on maximum for each
propellant component */
std::vector<double> sum_component_consumption;/* (kg)
Accumulated values of component_consumption, provides pre-component
consumption over the duration of the simulation.*/
double sum_consumption{0.0}; /* (kg)
accumulated values of component_consumption across all components.
Provides total consumption by the jet over the duration of the
simulation.*/

double force_hat[3]{}; /* (--)
Unit-vector force direction. */
Expand Down Expand Up @@ -227,6 +234,9 @@ class RcsJet {
void scale_self_impingement();
void set_isp( double isp_);
double get_isp() const {return isp;}

const double & get_sum_consumption() const {return sum_consumption;}

protected:
void compute_component_flow_rates();
void blow_down();
Expand Down
10 changes: 8 additions & 2 deletions models/fhw/effectors/rcs_generic/src/rcs_group.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ RcsJetGroup::initialize(

// buffer size is the number of full time-steps necessary before a command
// will be seen
buffer_on_size = static_cast<unsigned int>(total_on_delay / time_step);
buffer_off_size = static_cast<unsigned int>(total_off_delay / time_step);
buffer_on_size = static_cast<unsigned int>(
MathUtils::divide_protected( total_on_delay,
time_step,
0.0, true));
buffer_off_size = static_cast<unsigned int>(
MathUtils::divide_protected( total_off_delay,
time_step,
0.0, true));

/* delay time = remainder of last time_step before jet is turned on or off */
delay_time_on = total_on_delay - buffer_on_size * time_step;
Expand Down
10 changes: 9 additions & 1 deletion models/fhw/effectors/rcs_generic/src/rcs_jet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ RcsJet::RcsJet(
group(group_),
time_step( system.time_step),
component_flow_rate( prop_pod.components.size()),
component_consumption( prop_pod.components.size())
component_consumption( prop_pod.components.size()),
sum_component_consumption( prop_pod.components.size())

{
// Start the command list with an "Off":
commands.push_back(false);
Expand Down Expand Up @@ -853,6 +855,12 @@ RcsJet::compute_prop_consumption()
}
}
}

// Accumulate component consumption:
for (unsigned int ii = 0; ii < component_consumption.size(); ++ii) {
sum_component_consumption[ii] += component_consumption[ii];
sum_consumption += component_consumption[ii];
}

// Add this jet's prop consumption (per component) to the pod
prop_pod.increment_mass_consumption( component_consumption);
Expand Down
Loading