@@ -115,7 +115,7 @@ void WashCrewOptimizer::ReadSolarDataFromFiles()
115115 m_solar_data.y_pos = y;
116116 m_solar_data.mirror_output = output;
117117 m_solar_data.num_mirrors_by_group = mirrors_by_group;
118- m_solar_data.num_mirror_groups = mirrors_by_group.size ();
118+ m_solar_data.num_mirror_groups = ( int ) mirrors_by_group.size ();
119119}
120120
121121void WashCrewOptimizer::ReadWeatherData ()
@@ -235,9 +235,10 @@ void WashCrewOptimizer::ReadInputsFile()
235235 m_settings.system_efficiency = inputs[" system_efficiency" ];
236236 m_settings.num_years = inputs[" num_years" ];
237237 m_settings.price_per_kwh = inputs[" price_per_kwh" ];
238- m_settings.max_num_crews = inputs[" max_num_crews" ];
238+ m_settings.max_num_crews = ( int ) inputs[" max_num_crews" ];
239239 m_settings.heliostat_size = inputs[" helio_size" ];
240- m_settings.soiling_rate = inputs[" soiling_rate" ];
240+ LinearSoilingFunc f (inputs[" soiling_rate" ] / 24 .);
241+ m_func = &f;
241242 m_settings.seasonal_cost_multiple = inputs[" seasonal_multiple" ];
242243
243244}
@@ -407,7 +408,7 @@ void WashCrewOptimizer::GroupSolutionMirrors(int hours)
407408 (provided as input) to wash once.
408409 */
409410 m_solution_data = solar_field_data ();
410- m_solution_data.scale = hours * (m_settings.wash_rate / m_settings.heliostat_size );
411+ m_solution_data.scale = ( int )( hours * (m_settings.wash_rate / m_settings.heliostat_size ) );
411412 m_solution_data.groupings .clear ();
412413 for (int t = 0 ; t < m_settings.periods .size (); t++)
413414 m_results.solution_assignments [t] = {};
@@ -456,7 +457,7 @@ void WashCrewOptimizer::GroupSolutionMirrors(int hours)
456457
457458 // Create a vector consisting of all the elemnents of the set
458459 // (which are unique and ordered).
459- m_solution_data.num_mirror_groups = assignment_breaks.size () - 1 ;
460+ m_solution_data.num_mirror_groups = ( int ) assignment_breaks.size () - 1 ;
460461 std::vector<double > x (m_solution_data.num_mirror_groups , 0 );
461462 std::vector<int > y (m_solution_data.num_mirror_groups , 0 );
462463 m_solution_data.num_mirrors_by_group .assign (y.begin (), y.end ());
@@ -465,7 +466,7 @@ void WashCrewOptimizer::GroupSolutionMirrors(int hours)
465466 m_solution_data.x_pos .assign (x.begin (), x.end ());
466467 m_solution_data.y_pos .assign (x.begin (), x.end ());
467468 int idx = 0 ;
468- int m;
469+ int m = 0 ;
469470 for (int c : assignment_breaks)
470471 {
471472 if (c != 0 )
@@ -501,11 +502,12 @@ void WashCrewOptimizer::GroupSolutionMirrors(int hours)
501502 cumulative_mirrors += solar_mirrors;
502503 solution_mirrors -= solar_mirrors;
503504 solar_data_idx++;
505+ if (solar_data_idx < m_solar_data.num_mirror_groups )
504506 solar_mirrors = m_solar_data.num_mirrors_by_group [solar_data_idx];
505507 }
506508 }
507509 m_solution_data.mirror_output [solution_idx] = sol_group_output;
508- for (size_t t = 0 ; t < m_settings.periods .size () - 1 ; t++)
510+ for (int t = 0 ; t < ( int ) m_settings.periods .size () - 1 ; t++)
509511 {
510512 if (
511513 std::find (
@@ -538,9 +540,7 @@ void WashCrewOptimizer::CalculateRevenueAndCosts()
538540 /*
539541 Calculates the NPV of the revenue generated per heliostat, as well as the
540542 NPV of the cost per crew, according to the settings and solar data
541- provided as input. Revenue per mirror and cost per crew are stored in
542- m_settings.revenuw_per_mirror and m_settings.total_cost_per_crew,
543- respectively.
543+ provided as input.
544544 */
545545 double annual_labor_cost = (
546546 m_settings.hourly_cost_per_crew * m_settings.crew_hours_per_week * (365 ./7 .)
@@ -574,6 +574,8 @@ void WashCrewOptimizer::CalculateRevenueAndCosts()
574574 * m_settings.operating_margin * revenue_multiplier
575575 );
576576
577+ m_settings.annual_rev_multiplier = revenue_multiplier; // used later in optical simulation
578+
577579}
578580
579581void WashCrewOptimizer::AssignSoilingFunction (SoilingFunction *func)
@@ -651,7 +653,7 @@ double WashCrewOptimizer::GetAssignmentCost(int i, int j)
651653 double mirrors_per_hour = (m_settings.wash_rate / m_settings.heliostat_size );
652654 double time = GetNumberOfMirrors (i, j) * (168 . / m_settings.crew_hours_per_week ) / mirrors_per_hour; // in hours between cleanings
653655
654- return m_settings.profit_per_kwh * total_output * m_func->Evaluate (time);// + m_settings.total_cost_per_crew;
656+ return m_settings.profit_per_kwh * total_output * m_func->Evaluate (time);
655657}
656658
657659double WashCrewOptimizer::EvaluatePath (std::vector<int > path)
@@ -743,7 +745,7 @@ std::vector<int> WashCrewOptimizer::GetEqualAssignmentPath(int num_crews)
743745 std::vector<int > path = {0 };
744746 for (int j = 1 ; j <= num_crews; j++)
745747 {
746- path.push_back (round (j * (float )(m_condensed_data.num_mirror_groups ) / num_crews));
748+ path.push_back (round (( float ) j * (float )(m_condensed_data.num_mirror_groups ) / ( float ) num_crews));
747749 }
748750 return path;
749751}
@@ -860,7 +862,7 @@ std::vector<int> WashCrewOptimizer::RetracePath(
860862 parent = parents[i*row_length + parent];
861863 }
862864
863- for (int i = path.size ()-1 ; i >= 0 ; i--)
865+ for (int i = ( int ) path.size ()-1 ; i >= 0 ; i--)
864866 rev_path.push_back (path.at (i));
865867
866868 return rev_path;
@@ -877,7 +879,7 @@ void WashCrewOptimizer::CalculateSolutionObjective(std::unordered_map<std::strin
877879 for (size_t t = 0 ; t < m_settings.periods .size ()-1 ; t++)
878880 {
879881 crews = m_results.num_crews_by_period [t];
880- cost += rev_losses[int_pair_to_string (crews, t+1 )];
882+ cost += rev_losses[int_pair_to_string (crews, ( int ) t+1 )];
881883 ft_crews = std::min (crews, ft_crews);
882884 vehicles = std::max (crews, vehicles);
883885 }
@@ -1006,7 +1008,7 @@ void WashCrewOptimizer::OptimizeWashCrews(int scale, bool output)
10061008 // use the equal-assignment path if specified; otherwise, use DP output.
10071009
10081010 m_results.assignments_by_crews [i] = {0 };
1009- for (int c = 0 ; c < path.size ()-1 ; c++)
1011+ for (int c = 0 ; c < ( int ) path.size ()-1 ; c++)
10101012 m_results.assignments_by_crews [i].push_back (
10111013 GetNumberOfMirrors (path[c], path[c + 1 ])
10121014 );
0 commit comments