-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVBVA.m
93 lines (70 loc) · 3.14 KB
/
VBVA.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
% ------------------------------------------------------------------------
% MATSimVA
% ------------------------------------------------------------------------
% Run Virtual WIM or Apercu traffic over a bridge to find maximum load effects
% This program should only be used with both the Output and Apercu/Virtual files
% Even though it can work for VirtualWIM, Apercu is probably the main use
% Initial commands
clear, clc, format long g, rng('shuffle'), close all;
% Input Information --------------------
InfCase = [4 12]; % User must know the InfCase number(s)
Folder = 'PlatoonApercu';
FDate = 'Jan29-21 100236';
%FDate = 'Sep03-20 113250';
FName = ['Apercu\' Folder '\AWIM_' FDate '.mat']; % Options
OutputFName = ['Output\' Folder '\' FDate '.mat'];
%FName = 'VirtualWIM\Congest\WIM_May08-20 165449.mat'; % Options
%FName = 'Apercu\PlatStud60m\AWIM_Jan24-20 1049.mat'; % Options
%OutputFName = 'Output\PlatStud60m\Jan24-20 1049.mat';
% AWIM: 'Apercu\AWIM_Mar25-20 1034.mat'
% VWIM: 'WIM_Jan14 1130.mat'
% Input Complete ---------------------
% % NOTE: Optional Input through File (see other MATSim_ files for details
% Initialize
OverMax = [];
% Load File
load(FName)
% Load Output File
load(OutputFName);
% If not already defined, we need to define things in terms of OutInfo
BaseData = OutInfo.BaseData;
BaseData.Save = 0;
BaseData.Folder = '/AGB2002A15';
BaseData.ApercuTitle = sprintf('%s','VAWIM');
[Num.Lanes,Lane,LaneData,~,~] = UpdateData(BaseData,[],1,1);
[Inf,Num.InfCases,Inf.x,Inf.v,ESIA] = GetInfLines(OutInfo.LaneData,BaseData,Num.Lanes);
% Classify
PDC = Classify(PD);
for i = 1:length(InfCase)
try
[a, SimNum] = max(OutInfo.OverMaxT.MaxLE(OutInfo.OverMaxT.InfCase == InfCase(i)));
catch % Cover the case of MAXT (old school) rather than MaxT
[a, SimNum] = max(OutInfo.OverMAXT.MaxLE(OutInfo.OverMAXT.InfCase == InfCase(i)));
end
% There is no InfCase with VWIM
try
PDCx = PDC(PDC.SimNum == SimNum & PDC.InfCase == InfCase(i),:);
catch
PDCx = PDC(PDC.SimNum == SimNum,:);
end
% Convert PDC to AllTrAx
[PDCx, AllTrAx, TrLineUp] = WIMtoAllTrAx(PDCx,round(Inf.x(end)),Lane.Dir,BaseData.ILRes);
% Round TrLineUp first row, move unrounded to fifth row
TrLineUp(:,5) = TrLineUp(:,1); TrLineUp(:,1) = round(TrLineUp(:,1)/BaseData.ILRes);
% Subject Influence Line to Truck Axle Stream
[MaxLE,SMaxLE,BrStInd,AxonBr] = GetMaxLE(AllTrAx,Inf,BaseData.RunDyn,InfCase(i));
%[MaxLE,SMaxMaxLE,BrStInd,AxonBr] = GetMaxLE(AllTrAx,Inf,BaseData.RunDyn,1);
% Record Maximums
OverMax = [OverMax; [InfCase(i), 1, MaxLE, SMaxLE, BrStInd]];
% Take only the influence lines that apply to the current InfCase
Infv = Inf.v(:,Inf.UniqInds == InfCase(i));
% Remove nans (added experimentally 12/02/2020.. fixed 05/03)
FirstNan = find(isnan(Infv));
if ~isempty(FirstNan)
Infv = Infv(1:FirstNan-1,:);
Infx = Inf.x(1:FirstNan-1,:);
end
T = Apercu(PDCx,BaseData.ApercuTitle,Infx,Infv,BrStInd,TrLineUp,MaxLE/ESIA.Total(InfCase(i)),MaxLE/SMaxLE,Lane.Dir,BaseData.ILRes);
end
% Convert Results to Table
OverMaxT = array2table(OverMax,'VariableNames',{'InfCase','Year','MaxLE','SMaxLE','MaxBrStInd'});