Skip to content

Commit

Permalink
Added selected_link_volumes option for SOLA Path Analysis (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesVaughan authored Sep 18, 2024
1 parent bb924de commit bf64179
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Code/TMG.Emme/NetworkAssignment/MultiClassRoadAssignment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,12 @@ public class Analysis : IModule
[RunParameter("Attribute ID", "", "The attribute to use for analysis.")]
public string AttributeId;

[RunParameter("Aggregation Matrix", 0, "The matrix number to store the results into.")]
[RunParameter("Aggregation Matrix", 0, "The matrix number to store the results into. Leave 0 to not apply.")]
public int AggregationMatrix;

[RunParameter("Selected Link Volumes", "", "The name of the link attribute to store the results into. Leave blank to not apply.")]
public string SelectedLinkVolumes;

[RunParameter("Operator", "+", "The operator to use to aggregate the matrix. Example:'+' for emissions, 'max' for select link analysis")]
public string AggregationOperator;

Expand Down Expand Up @@ -169,12 +172,6 @@ public bool RuntimeValidation(ref string error)
error = $"In {Name} the attribute ID was not valid!";
return false;
}
if (AggregationMatrix <= 0)
{
error = $"In {Name} the aggregation matrix number was invalid!";
return false;
}

return true;
}
}
Expand Down Expand Up @@ -222,6 +219,7 @@ private ModellerControllerParameter[] GetParameters()
new ModellerControllerParameter("ResultAttributes", string.Join(",", Classes.Select(c => c.VolumeAttribute))),
new ModellerControllerParameter("xtmf_AnalysisAttributes", GetAttributesFromClass()),
new ModellerControllerParameter("xtmf_AnalysisAttributesMatrixId", GetAttributeMatrixIds()),
new ModellerControllerParameter("xtmf_AnalysisSelectedLinkVolumes", GetelectedLinkVolumes()),
new ModellerControllerParameter("xtmf_AggregationOperator", GetAggregationOperator()),
new ModellerControllerParameter("xtmf_LowerBound", GetLowerBound()),
new ModellerControllerParameter("xtmf_UpperBound", GetUpperBound()),
Expand All @@ -247,6 +245,13 @@ select string.Join(",", from at in c.PathAnalyses
select "mf" + at.AggregationMatrix));
}

private string GetelectedLinkVolumes()
{
return string.Join("|", from c in Classes
select string.Join(",", from at in c.PathAnalyses
select at.SelectedLinkVolumes));
}

private string GetAggregationOperator()
{
return string.Join("|", from c in Classes
Expand Down
Binary file modified Code/TMG.Emme/TMG_Toolbox.mtbx
Binary file not shown.
Binary file modified Code/TMG.Emme/TMG_Toolbox_Python3.mtbx
Binary file not shown.

0 comments on commit bf64179

Please sign in to comment.