Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,12 @@ CM11_proj/tmp.obj

# Ignore Experiments folder under tests/Applications/Eco_Fixed_Timming
/tests/Applications/Eco_Fixed_Timming/Experiments/

# Ignore Claude Code configuration
.claude/

# Ignore large SUMO output files
fcd.xml

# Ignore large assets managed via download script
tests/Applications/SUMO_CARLA_EcoDriving/MLK_Carla_Scenario/CARLAFiles/MLK_noped1002_final_debug.fbx
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
path = ProprietaryFiles
url = https://github.com/Real-Sim-XIL/ProprietaryFiles.git

[submodule "tests/Applications/SUMO_CARLA_EcoDriving/mlk_xil"]
path = tests/Applications/SUMO_CARLA_EcoDriving/mlk_xil
url = https://code.ornl.gov/realsim_realtwin-deployment/mlk_xil.git
4 changes: 2 additions & 2 deletions CommonLib/RealSimPack.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function setupImpl(obj)
% % try

% initialize ByteData
ByteData = zeros(200, 1, 'uint8');
ByteData = zeros(1024, 1, 'uint8');

% parser ByteData
[ByteData, nMsgSize] = obj.packVehData(simState, t, ByteData, VehDataBus);
Expand All @@ -98,7 +98,7 @@ function validateInputsImpl(obj, simState, t, VehData)
function [sz1, sz2] = getOutputSizeImpl(obj)
% Maximum length of linear indices and element vector is the
% number of elements in the input
sz1 = [200 1]; sz2 = [1 1];
sz1 = [1024 1]; sz2 = [1 1];
end

function [fz1, fz2] = isOutputFixedSizeImpl(~)
Expand Down
2 changes: 1 addition & 1 deletion CommonLib/RealSimSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#pragma comment (lib, "AdvApi32.lib")

#define RECVBUFFERSIZE 1024
#define SENDBUFFERSIZE 200
#define SENDBUFFERSIZE 1024


// s-function parameters
Expand Down
Binary file modified CommonLib/RealSimSocket.mexw64
Binary file not shown.
4 changes: 2 additions & 2 deletions CommonLib/TrafficHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ int TrafficHelper::sendToSUMO(double simTime, MsgHelper Msg_c) {
}
else {
traci.vehicle.setSpeed(idStr, speed); // speed set at (k) essentially will be reflected at (k+1), not considered in the integration

std::cout << "Set SUMO id " << idStr << " to speed " << speed << std::endl;
/*
bit0: Regard safe speed
bit1 : Regard maximum acceleration
Expand All @@ -650,7 +650,7 @@ int TrafficHelper::sendToSUMO(double simTime, MsgHelper Msg_c) {
bit5 : Disregard right of way within intersections(only applies to foe vehicles that have entered the intersection).
*/

traci.vehicle.setSpeedMode(idStr, Config_c->SumoSetup.SpeedMode); // 000000 most checks off
//traci.vehicle.setSpeedMode(idStr, Config_c->SumoSetup.SpeedMode); // 000000 most checks off
//traci.vehicle.setSpeedMode(idStr, 0); // 000000 most checks off
//traci.vehicle.setSpeedMode(idStr, 24); // 011000
//traci.vehicle.setSpeedMode(idStr, 8); // 001000
Expand Down
2 changes: 1 addition & 1 deletion ProprietaryFiles
4 changes: 2 additions & 2 deletions TrafficLayer/TrafficLayer/mainTrafficLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ int main(int argc, char* argv[]) {
// RUN one-step simulation
///****************************************************

Traffic_c.runOneStepSimulation();


if (ENABLE_VEH_SIMULATOR && isVeryFirstStep) {
if (Sock_c.initConnection(TrafficLayerErrorFile) > 0) {
Expand Down Expand Up @@ -963,7 +963,7 @@ int main(int argc, char* argv[]) {
}

ii = ii + 1;

Traffic_c.runOneStepSimulation();
}

Traffic_c.close();
Expand Down
247 changes: 136 additions & 111 deletions VirCarlaEnv/VirCarlaEnv/mainVirCarla.cpp

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions scripts/download_large_assets.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env pwsh
# Download large simulation assets from OneDrive

$ASSETS = @{
"tests/Applications/SUMO_CARLA_EcoDriving/MLK_Carla_Scenario/CARLAFiles/MLK_noped1002_final_debug.fbx" = "https://outlookuga-my.sharepoint.com/:u:/g/personal/ys04893_uga_edu/EU8vuZV8DvtOlJ6HhpL7Z8MBkhCtVcloma0qxJXXMsPP7A?e=0KgETK&download=1"
}

$repoRoot = Split-Path -Parent $PSScriptRoot
Set-Location $repoRoot

foreach ($file in $ASSETS.Keys) {
$dest = Join-Path $repoRoot $file

if (Test-Path $dest) {
$sizeMB = [math]::Round((Get-Item $dest).Length / 1MB, 2)
Write-Host "File $file already exists ($sizeMB MB)" -ForegroundColor Yellow
$response = Read-Host "Redownload? (y/N)"
if ($response -notmatch '^[yY]') {
Write-Host "Skipped $file" -ForegroundColor Green
continue
}
}

Write-Host "Downloading $file..." -ForegroundColor Yellow
$destDir = Split-Path -Parent $dest
New-Item -ItemType Directory -Path $destDir -Force | Out-Null

try {
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $ASSETS[$file] -OutFile $dest
$ProgressPreference = 'Continue'

$sizeMB = [math]::Round((Get-Item $dest).Length / 1MB, 2)
Write-Host "OK Downloaded $file ($sizeMB MB)" -ForegroundColor Green
}
catch {
Write-Host "`nERROR Failed to download $file" -ForegroundColor Red
Write-Host $_.Exception.Message -ForegroundColor Red
Write-Host "`nTroubleshooting:" -ForegroundColor Yellow
Write-Host "1. Make sure you have access to the OneDrive link" -ForegroundColor Yellow
Write-Host "2. Check your internet connection" -ForegroundColor Yellow
Write-Host "3. Try downloading manually from: $($ASSETS[$file])" -ForegroundColor Yellow
Read-Host "`nPress Enter to exit"
exit 1
}
}

Write-Host "`nAll assets ready!" -ForegroundColor Green
Read-Host "`nPress Enter to exit"
3 changes: 3 additions & 0 deletions tests/Applications/Eco_Fixed_Timming/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SIMULATION_FOLDER=C:\Users\hg25079\Documents\GitHub\FIXS\tests\Applications\Eco_Fixed_Timming\Experiments_Sumo\Shallowford_after_calibration_banleftturn_AdjustedFixedTime_V3
CONFIG_PATH=C:\Users\hg25079\Documents\GitHub\FIXS\tests\Applications\Eco_Fixed_Timming\Experiments_Sumo\Shallowford_after_calibration_banleftturn_AdjustedFixedTime_V3\config_Sumo.yaml
SUMO_NET_PATH=C:\Users\hg25079\Documents\GitHub\FIXS\tests\Applications\Eco_Fixed_Timming\Experiments_Sumo\Shallowford_after_calibration_banleftturn_AdjustedFixedTime_V3\chatt.net.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<output>
<edgedata-output value="EdgeData.xml"/>
<fcd-output value="fcd.xml" samplingRate="1"/>
<precision value="6"/>
</output>
<time>
<begin value="28800"/>
Expand All @@ -26,5 +27,6 @@
<report>
<no-warnings value="true"/>
<no-step-log value="true"/>
<log value="simulation.log"/>
</report>
</configuration>
55 changes: 55 additions & 0 deletions tests/Applications/Eco_Fixed_Timming/SimulinkModelInit.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
% File: realsim_script.m


simModelName = 'CAVE_MachE_dSPACE_250912';%

% Clear workspace and console
disp(['Current folder: ', pwd]);
close all;
clearvars -except settingDir simModelName config_file_name; % Keep input variables
clc;
format compact;

% Different Vehicle Model, if different, need change!!!!!

addpath(genpath('.\\Vehicles_24a'))
configPath = 'C:\Users\hg25079\Documents\GitHub\FIXS\tests\Applications\SUMO_CARLA_EcoDriving\MLK_Sumo_Scenario\config_Sumo.yaml';



% Initializations
RealSimPath = 'C:\Users\hg25079\Documents\GitHub\FIXS\CommonLib';
% Add path of RealSim tools
addpath(genpath(RealSimPath));
% Initialize RealSim for Simulink, Read yaml file
disp(['configPath: ', configPath]);
%print configPath
fprintf('Configuration path: %s\n', configPath);

[VehicleMessageFieldDefInputVec, VehDataBus, TrafficLayerIP, TrafficLayerPort] = RealSimInitSimulink(configPath);

% Define RealSim parameters
RealSimPara = struct;
RealSimPara.warmupTime = 0;
RealSimPara.speedInit = 1; % Initial speed of the ego vehicle when entering SUMO network
RealSimPara.tLookahead = 0.1; % Use 0.1 for external control, recommend tLookahead >= 0.2 for SUMO driver
RealSimPara.smoothWindow = 1; % Number of moving average data points, 1 means no moving average
RealSimPara.speedSource = 3; % Use speedSource = 3 for dummy vehicle dynamics (simple transfer function)

% Start RealSim Procedure
fprintf('Starting RealSim procedure...\n');
%tic;

% Start Simulink model
% Specify the following:
% 1) Simulink model name
% 2) Stop time of the Simulink model
% Assign RealSimPara to the base workspace

assignin('base', 'RealSimPara', RealSimPara);
assignin('base', 'VehicleMessageFieldDefInputVec', VehicleMessageFieldDefInputVec);
assignin('base', 'VehDataBus', VehDataBus);
assignin('base', 'TrafficLayerIP', TrafficLayerIP);
assignin('base', 'TrafficLayerPort', TrafficLayerPort);


23 changes: 23 additions & 0 deletions tests/Applications/Eco_Fixed_Timming/SimulinkModelSaveResults.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
settingDir = 'C:\Users\hg25079\Documents\GitHub\FIXS\tests\Applications\Eco_Fixed_Timming\Experiments_Sumo\Shallowford_after_calibration_banleftturn_AdjustedFixedTime_V3\MPR\0%_10Hz_w_vehDyn_29119.31\';

VehicleOut = out;
Time = VehicleOut.desired_speed.Time;
DesiredSpeed = VehicleOut.desired_speed.Data;
DesiredSpeed = DesiredSpeed(:);
ActualSpeed = VehicleOut.actual_speed.Data;
ActualSpeed = ActualSpeed(:);
MPGe = VehicleOut.MPGe.Data;
BatteryCurrent = VehicleOut.battery_current.Data;
BatteryPower = VehicleOut.battery_power.Data;
BatterySOC = VehicleOut.battery_soc.Data;
MotorSpeed = VehicleOut.motor_speed.Data;
MotorTorque = VehicleOut.motor_torque.Data;
ActualAcc = VehicleOut.VehAcc.Data;


save('vehData', 'VehicleOut')
T = table(Time, DesiredSpeed, ActualSpeed, MPGe, BatteryCurrent, BatteryPower, BatterySOC, MotorSpeed, MotorTorque, ActualAcc,'VariableNames', {'Time', 'DesiredSpeed', 'ActualSpeed', 'MPGe', 'BatteryCurrent', 'BatteryPower','BatterySOC', 'MotorSpeed', 'MotorTorque', 'ActualAcc'});
% T = table(Time, DesiredSpeed, ActualSpeed, MPGe, BatteryCurrent, BatteryPower, BatterySOC, MotorSpeed, MotorTorque,'VariableNames', {'Time', 'DesiredSpeed', 'ActualSpeed', 'MPGe', 'BatteryCurrent', 'BatteryPower','BatterySOC', 'MotorSpeed', 'MotorTorque'});

writetable(T, [settingDir, '\ego_profile.csv']);

Binary file modified tests/Applications/Eco_Fixed_Timming/TrafficLayer.exe
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/Applications/Eco_Fixed_Timming/cav_casestudy
Submodule cav_casestudy updated from 294ee6 to af74ee
Loading