Skip to content

Commit

Permalink
6.01.00128: added debug prints for BGA unload
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasGaertner committed Mar 12, 2019
1 parent e107857 commit cc249a0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions AIDriver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -867,14 +867,19 @@ function AIDriver:tipIntoBGASiloTipTrigger(dt)
local totalTipDuration = ((tipper.cp.totalFillLevel / dischargeNode.emptySpeed )/ 1000) + 2 --adding 2 sec for the time between setting tipstate and start of real unloading
local meterPrSeconds = totalLength / totalTipDuration;
self.unloadSpeed = meterPrSeconds*3.6
self:debug("%s in mode %s: entering BGASilo: \nemptySpeed: %sl/sek; fillLevel: %0.1fl\nSilo length: %sm/Total unload time: %ss *3.6 = unload speed: %.2fkmh", tostring(tipper.getName and tipper:getName() or 'no name'), tostring(self.vehicle.cp.mode), tostring(dischargeNode.emptySpeed*1000),tipper.cp.totalFillLevel,tostring(totalLength) ,tostring(totalTipDuration),self.unloadSpeed)
--print(string.format("totalTipDuration: %s; totalLength: %s",tostring(totalTipDuration),tostring(totalLength)))
end

local tipState = tipper:getTipState()
if tipState == Trailer.TIPSTATE_CLOSED or tipState == Trailer.TIPSTATE_CLOSING then
self:debug("start tipping")
tipper:setDischargeState(Dischargeable.DISCHARGE_STATE_GROUND)
end
else
if self.unloadSpeed then
self:debug("reset self.unloadSpeed")
end
self.unloadSpeed = nil
end
self.speed = self.unloadSpeed or self.speed
Expand Down
4 changes: 4 additions & 0 deletions drive.lua
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,10 @@ function courseplay:drive(self, dt)
if self.cp.currentTipTrigger ~= nil then
if self.cp.currentTipTrigger.bunkerSilo ~= nil then
refSpeed = Utils.getNoNil(self.cp.speeds.reverse, self.cp.speeds.crawl);
if courseplay.debugChannels[14] and g_updateLoopIndex % 100 == 0 then
courseplay:debug(string.format("%s: refSpeed: %.2f ", nameNum(self),refSpeed), 14);
end

--speedDebugLine = ("drive("..tostring(debug.getinfo(1).currentline-1).."): refSpeed = "..tostring(refSpeed))
else
refSpeed = self.cp.speeds.turn;
Expand Down
2 changes: 1 addition & 1 deletion modDesc.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<modDesc descVersion="40">
<version>6.01.00127</version>
<version>6.01.00128</version>
<author><![CDATA[Courseplay.devTeam]]></author>
<title>
<br>CoursePlay SIX</br>
Expand Down
4 changes: 3 additions & 1 deletion toolManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,9 @@ function courseplay:unload_tippers(vehicle, allowedToDrive,dt)
local refSpeed = meterPrSeconds * 3.6; -- * 0.90;
vehicle.cp.backupUnloadSpeed = vehicle.cp.speeds.reverse;
courseplay:changeReverseSpeed(vehicle, nil, refSpeed, true);
courseplay:debug(string.format("%s: BGA totalLength=%.2f, totalTipDuration%.2f, refSpeed=%.2f", nameNum(tipper), totalLength, totalTipDuration, refSpeed), 2);
--courseplay:debug(string.format("%s: BGA totalLength=%.2f, totalTipDuration%.2f, refSpeed=%.2f", nameNum(tipper), totalLength, totalTipDuration, refSpeed), 2);
courseplay:debug(string.format("%s in mode %s: entering BGASilo: \nemptySpeed: %sl/sek; fillLevel: %0.1fl\nSilo length: %sm/Total unload time: %ss *3.6 = unload speed: %.2fkmh", tostring(tipper.getName and tipper:getName() or 'no name'), tostring(vehicle.cp.mode), tostring(dischargeNode.emptySpeed*1000),tipper.cp.totalFillLevel,tostring(totalLength) ,tostring(totalTipDuration),refSpeed),14)
--print(string.format("totalTipDuration: %s; totalLength: %s",tostring(totalTipDuration),tostring(totalLength)))
--print(string.format("%s: BGA totalLength=%.2f, totalTipDuration%.2f, refSpeed=%.2f", nameNum(vehicle), totalLength, totalTipDuration, refSpeed));
end;
end;
Expand Down

0 comments on commit cc249a0

Please sign in to comment.