MCPcopy Create free account
hub / github.com/NatLabRockies/SAM / Prepare

Method Prepare

src/simulation.cpp:571–614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

569}
570
571bool Simulation::Prepare()
572{
573 ConfigInfo *cfg = m_case->GetConfiguration();
574 if ( !cfg )
575 {
576 m_errors.Add("no valid configuration for this case");
577 return false;
578 }
579
580 m_simlist = cfg->Simulations;
581
582 m_outputList.clear();
583 m_outputLabels.clear();
584 m_outputUnits.clear();
585 m_uiHints.clear();
586
587 size_t nHybrids = cfg->Technology.size();
588
589 for (size_t ndx_hybrid = 0; ndx_hybrid < nHybrids; ndx_hybrid++) {
590
591 // transfer all the values except for ones that have been 'overriden'
592 for (VarTableBase::const_iterator it = m_case->Values(ndx_hybrid).begin();
593 it != m_case->Values(ndx_hybrid).end();
594 ++it)
595 if (0 == m_inputs[ndx_hybrid].Get(it->first))
596 m_inputs[ndx_hybrid].Set(it->first, *(it->second));
597
598 // recalculate all the equations
599 CaseEvaluator eval(m_case, m_inputs[ndx_hybrid], m_case->Equations(ndx_hybrid));// update m_inputs for hybrids
600 int n = eval.CalculateAll(ndx_hybrid);
601
602 if (n < 0)
603 {
604 wxArrayString& errs = eval.GetErrors();
605 for (size_t i = 0; i < errs.size(); i++)
606 m_errors.Add(errs[i]);
607
608 return false;
609 }
610
611 //wxLogStatus("Simulation preparation time: %d copy, %d eval", (int)time_copy, (int)time_eval);
612 }
613 return true;
614}
615
616static void dump_variable( FILE *fp, ssc_data_t p_data, const char *name )
617{ // .17g to .17g for full double precision.

Callers 9

RunBaseCaseMethod · 0.45
OnSimulateMethod · 0.45
PrepareSimulationsMethod · 0.45
SimulateMethod · 0.45
fcall_simulateFunction · 0.45
fcall_simulate_ssc_testsFunction · 0.45
fcall_parsimFunction · 0.45
fcall_reopt_size_batteryFunction · 0.45
OnSimulateMethod · 0.45

Calls 8

sizeMethod · 0.80
GetConfigurationMethod · 0.45
AddMethod · 0.45
clearMethod · 0.45
GetMethod · 0.45
SetMethod · 0.45
CalculateAllMethod · 0.45
GetErrorsMethod · 0.45

Tested by

no test coverage detected