Commit 9b5a1154 authored by Niina Helistö's avatar Niina Helistö
Browse files

Fixing bugs in unit aggregation and the selection of unit efficiency...

Fixing bugs in unit aggregation and the selection of unit efficiency approximations. It is now easier to skip some efficiency approximation levels.

Issue #135
parent 2a7ca1f7
...@@ -190,6 +190,7 @@ Parameter ...@@ -190,6 +190,7 @@ Parameter
* settings(mSetting) * settings(mSetting)
mSettings(mType, mSetting) "Model settings array" mSettings(mType, mSetting) "Model settings array"
mSettingsEff(mtype, effLevel) "Model efficiency approximation array" mSettingsEff(mtype, effLevel) "Model efficiency approximation array"
mSettingsEff_start(mtype, effLevel) "The first time step of the efficiency level - mSettingsEff is the last"
mInterval(mType, mSetting, counter) "Model interval array" mInterval(mType, mSetting, counter) "Model interval array"
t_skip_counter "Numerical counter for solve time steps" t_skip_counter "Numerical counter for solve time steps"
; ;
......
...@@ -190,7 +190,7 @@ loop(m, ...@@ -190,7 +190,7 @@ loop(m,
* --- Calculate 'lastStepNotAggregated' for aggregated units and aggregator units --- * --- Calculate 'lastStepNotAggregated' for aggregated units and aggregator units ---
loop(effLevel$mSettingsEff(m, effLevel), loop(effLevel$mSettingsEff(m, effLevel),
loop(effLevel_${mSettingsEff(m, effLevel_) and ord(effLevel_) <= ord(effLevel)}, loop(effLevel_${mSettingsEff(m, effLevel_) and ord(effLevel_) < ord(effLevel)},
p_unit(unit_aggregated(unit), 'lastStepNotAggregated')${ sum(unit_,unitUnitEffLevel(unit_, unit, effLevel)) } p_unit(unit_aggregated(unit), 'lastStepNotAggregated')${ sum(unit_,unitUnitEffLevel(unit_, unit, effLevel)) }
= mSettingsEff(m, effLevel_); = mSettingsEff(m, effLevel_);
p_unit(unit_aggregator(unit), 'lastStepNotAggregated')${ sum(unit_,unitUnitEffLevel(unit, unit_, effLevel)) } p_unit(unit_aggregator(unit), 'lastStepNotAggregated')${ sum(unit_,unitUnitEffLevel(unit, unit_, effLevel)) }
...@@ -237,6 +237,12 @@ loop(m, ...@@ -237,6 +237,12 @@ loop(m,
); );
); );
); );
// Store the first time step of the effLevel
loop(effLevel$mSettingsEff(m, effLevel),
loop(effLevel_${mSettingsEff(m, effLevel_) and ord(effLevel_) < ord(effLevel)},
mSettingsEff_start(m, effLevel) = mSettingsEff(m, effLevel_) + 1;
);
);
); );
* --- Units with online variables in the first active effLevel --------------- * --- Units with online variables in the first active effLevel ---------------
......
...@@ -612,7 +612,7 @@ Option clear = sufts; ...@@ -612,7 +612,7 @@ Option clear = sufts;
// Loop over the defined efficiency groups for units // Loop over the defined efficiency groups for units
loop(effLevelGroupUnit(effLevel, effGroup, unit)${ mSettingsEff(mSolve, effLevel) }, loop(effLevelGroupUnit(effLevel, effGroup, unit)${ mSettingsEff(mSolve, effLevel) },
// Determine the used effGroup for each uft // Determine the used effGroup for each uft
suft(effGroup, uft(unit, f, t))${ ord(t) >= tSolveFirst + mSettingsEff(mSolve, effLevel - 1) + 1 suft(effGroup, uft(unit, f, t))${ ord(t) >= tSolveFirst + mSettingsEff_start(mSolve, effLevel)
and ord(t) <= tSolveFirst + mSettingsEff(mSolve, effLevel) } and ord(t) <= tSolveFirst + mSettingsEff(mSolve, effLevel) }
= yes; = yes;
); // END loop(effLevelGroupUnit) ); // END loop(effLevelGroupUnit)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment