Skip to content

Commit bba7170

Browse files
Roland Lichtersjenkins
authored andcommitted
fix
1 parent a166dbb commit bba7170

1 file changed

Lines changed: 84 additions & 4 deletions

File tree

OREAnalytics/orea/app/oreapp.cpp

Lines changed: 84 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -968,12 +968,14 @@ void OREAppInputParameters::loadParameters() {
968968
setOutputHistoricalScenarios(parseBool(tmp));
969969
}
970970

971-
/****************
972-
* SIMM
973-
****************/
971+
/**********************
972+
* SIMM and IM Schedule
973+
**********************/
974974

975+
LOG("SIMM and IMSCHEDULE");
975976
tmp = params_->get("simm", "active", false);
976-
if (!tmp.empty() && parseBool(tmp)) {
977+
bool doSimm = !tmp.empty() ? parseBool(tmp) : false;
978+
if (doSimm) {
977979
insertAnalytic("SIMM");
978980

979981
tmp = params_->get("simm", "version", false);
@@ -1034,6 +1036,80 @@ void OREAppInputParameters::loadParameters() {
10341036
setWriteSimmIntermediateReports(parseBool(tmp));
10351037
}
10361038

1039+
LOG("IM SCHEDULE");
1040+
//tmp = params_->get("imschedule", "active", false);
1041+
//bool doSchedule = !tmp.empty() ? parseBool(tmp) : false;
1042+
//if (doSchedule) {
1043+
tmp = params_->get("imschedule", "active", false);
1044+
if (!tmp.empty() && parseBool(tmp)) {
1045+
insertAnalytic("IM_SCHEDULE");
1046+
1047+
tmp = params_->get("imschedule", "version", false);
1048+
if (tmp != "") {
1049+
string tmpSimm = params_->get("simm", "version", false);
1050+
QL_REQUIRE(!doSimm || tmp == tmpSimm, "version for imschedule and simm should match");
1051+
setSimmVersion(tmp);
1052+
} else if (simmVersion() == "") {
1053+
LOG("set SIMM version for IM Schedule to 2.6, required to load CRIF")
1054+
setSimmVersion("2.6");
1055+
}
1056+
1057+
tmp = params_->get("imschedule", "crif", false);
1058+
if (tmp != "") {
1059+
string tmpSimm = params_->get("simm", "crif", false);
1060+
QL_REQUIRE(!doSimm || tmp == tmpSimm, "crif files for imschedule and simm should match");
1061+
string file = (inputPath / tmp).generic_string();
1062+
setCrifFromFile(file, csvEolChar(), csvSeparator(), '\"', csvEscapeChar());
1063+
}
1064+
1065+
tmp = params_->get("imschedule", "calculationCurrency", false);
1066+
if (tmp != "") {
1067+
string tmpSimm = params_->get("simm", "calculationCurrency", false);
1068+
QL_REQUIRE(!doSimm || tmp == tmpSimm, "calculation currency for for imschedule and simm should match");
1069+
setSimmCalculationCurrencyCall(tmp);
1070+
setSimmCalculationCurrencyPost(tmp);
1071+
} else {
1072+
QL_REQUIRE(baseCurrency() != "", "either base currency or calculation currency is required");
1073+
}
1074+
1075+
tmp = params_->get("imschedule", "calculationCurrencyCall", false);
1076+
if (tmp != "") {
1077+
string tmpSimm = params_->get("simm", "calculationCurrencyCall", false);
1078+
QL_REQUIRE(!doSimm || tmp == tmpSimm, "calculation currency for imschedule and simm should match");
1079+
setSimmCalculationCurrencyCall(tmp);
1080+
}
1081+
1082+
tmp = params_->get("imschedule", "calculationCurrencyPost", false);
1083+
if (tmp != "") {
1084+
string tmpSimm = params_->get("simm", "calculationCurrencyPost", false);
1085+
QL_REQUIRE(!doSimm || tmp == tmpSimm, "calculation currency for imschedule and simm should match");
1086+
setSimmCalculationCurrencyPost(tmp);
1087+
}
1088+
1089+
tmp = params_->get("imschedule", "resultCurrency", false);
1090+
if (tmp != "") {
1091+
string tmpSimm = params_->get("simm", "resultCurrency", false);
1092+
QL_REQUIRE(!doSimm || tmp == tmpSimm, "result currency for imschedule and simm should match");
1093+
setSimmResultCurrency(tmp);
1094+
}
1095+
else
1096+
setSimmResultCurrency(simmCalculationCurrencyCall());
1097+
1098+
tmp = params_->get("imschedule", "reportingCurrency", false);
1099+
if (tmp != "") {
1100+
string tmpSimm = params_->get("simm", "reportingCurrency", false);
1101+
QL_REQUIRE(!doSimm || tmp == tmpSimm, "reporting currency for imschedule and simm should match");
1102+
setSimmReportingCurrency(tmp);
1103+
}
1104+
1105+
tmp = params_->get("imschedule", "enforceIMRegulations", false);
1106+
if (tmp != "") {
1107+
string tmpSimm = params_->get("simm", "enforceIMRegulations", false);
1108+
QL_REQUIRE(!doSimm || tmp == tmpSimm, "enforceIMRegulations for imschedule and simm should match");
1109+
setEnforceIMRegulations(parseBool(tmp));
1110+
}
1111+
}
1112+
10371113
/************
10381114
* Simulation
10391115
************/
@@ -1571,6 +1647,10 @@ void OREAppInputParameters::loadParameters() {
15711647
setLazyMarketBuilding(false);
15721648
}
15731649

1650+
LOG("analytics: " << analytics().size());
1651+
for (auto a: analytics())
1652+
LOG("analytic: " << a);
1653+
15741654
LOG("buildInputParameters done");
15751655
}
15761656

0 commit comments

Comments
 (0)