Added in ability to manually adjust the gcode time multiplier

This commit is contained in:
Lars Brubaker 2018-02-02 09:47:06 -08:00
parent aa35fd268b
commit 010b57649e
10 changed files with 40 additions and 9 deletions

View file

@ -429,11 +429,13 @@ namespace MatterHackers.MatterControl
var maxAcceleration = settings.GetValue<double>(SettingsKey.max_acceleration);
var maxVelocity = settings.GetValue<double>(SettingsKey.max_velocity);
var jerkVelocity = settings.GetValue<double>(SettingsKey.jerk_velocity);
var multiplier = settings.GetValue<double>(SettingsKey.print_time_estimate_multiplier) / 100.0;
var loadedGCode = GCodeMemoryFile.Load(stream,
new Vector4(maxAcceleration, maxAcceleration, maxAcceleration, maxAcceleration),
new Vector4(maxVelocity, maxVelocity, maxVelocity, maxVelocity),
new Vector4(jerkVelocity, jerkVelocity, jerkVelocity, jerkVelocity),
new Vector4(multiplier, multiplier, multiplier, multiplier),
cancellationToken, progressReporter);
this.GCodeRenderer = new GCodeRenderer(loadedGCode);
this.RenderInfo = new GCodeRenderInfo(

View file

@ -154,6 +154,7 @@ namespace MatterHackers.MatterControl.Library.Export
new Vector4(),
new Vector4(),
new Vector4(),
Vector4.One,
CancellationToken.None));
var printerSettings = ActiveSliceSettings.Instance;

View file

@ -173,6 +173,7 @@ namespace MatterControl.Printing
Vector4 maxAccelerationMmPerS2,
Vector4 maxVelocityMmPerS,
Vector4 velocitySameAsStopMmPerS,
Vector4 speedMultiplier,
CancellationToken cancellationToken)
{
if (FileTooBigToLoad(fileName))
@ -184,7 +185,9 @@ namespace MatterControl.Printing
return new GCodeMemoryFile(fileName,
maxAccelerationMmPerS2,
maxVelocityMmPerS,
velocitySameAsStopMmPerS, cancellationToken);
velocitySameAsStopMmPerS,
speedMultiplier,
cancellationToken);
}
}
@ -218,13 +221,15 @@ namespace MatterControl.Printing
double feedRateMmPerMin,
Vector4 maxAccelerationMmPerS2,
Vector4 maxVelocityMmPerS,
Vector4 velocitySameAsStopMmPerS)
Vector4 velocitySameAsStopMmPerS,
Vector4 speedMultiplierV4)
{
double startingVelocityMmPerS = velocitySameAsStopMmPerS.X;
double endingVelocityMmPerS = velocitySameAsStopMmPerS.X;
double maxVelocityMmPerSx = Math.Min(feedRateMmPerMin / 60, maxVelocityMmPerS.X);
double acceleration = maxAccelerationMmPerS2.X;
double lengthOfThisMoveMm = Math.Max(deltaPositionThisLine.Length, deltaEPositionThisLine);
double speedMultiplier = speedMultiplierV4.X;
double distanceToMaxVelocity = GetDistanceToReachEndingVelocity(startingVelocityMmPerS, maxVelocityMmPerSx, acceleration);
if (distanceToMaxVelocity <= lengthOfThisMoveMm / 2)
@ -232,13 +237,13 @@ namespace MatterControl.Printing
// we will reach max velocity then run at it and then decelerate
double accelerationTime = GetTimeToAccelerateDistance(startingVelocityMmPerS, distanceToMaxVelocity, acceleration) * 2;
double runningTime = (lengthOfThisMoveMm - (distanceToMaxVelocity * 2)) / maxVelocityMmPerSx;
return accelerationTime + runningTime;
return (accelerationTime + runningTime) * speedMultiplier;
}
else
{
// we will accelerate to the center then decelerate
double accelerationTime = GetTimeToAccelerateDistance(startingVelocityMmPerS, lengthOfThisMoveMm / 2, acceleration) * 2;
return accelerationTime;
return (accelerationTime) * speedMultiplier;
}
}

View file

@ -64,6 +64,7 @@ namespace MatterControl.Printing
Vector4 maxAccelerationMmPerS2,
Vector4 maxVelocityMmPerS,
Vector4 velocitySameAsStopMmPerS,
Vector4 speedMultiplier,
CancellationToken cancellationToken, bool gcodeHasExplicitLayerChangeInfo = false)
{
this.gcodeHasExplicitLayerChangeInfo = gcodeHasExplicitLayerChangeInfo;
@ -72,6 +73,7 @@ namespace MatterControl.Printing
maxAccelerationMmPerS2,
maxVelocityMmPerS,
velocitySameAsStopMmPerS,
speedMultiplier,
cancellationToken, null);
if (loadedFile != null)
{
@ -119,16 +121,18 @@ namespace MatterControl.Printing
Vector4 maxAccelerationMmPerS2,
Vector4 maxVelocityMmPerS,
Vector4 velocitySameAsStopMmPerS,
Vector4 speedMultiplier,
CancellationToken cancellationToken)
{
return ParseFileContents(gcodeContents,
maxAccelerationMmPerS2, maxVelocityMmPerS, velocitySameAsStopMmPerS, cancellationToken, null);
maxAccelerationMmPerS2, maxVelocityMmPerS, velocitySameAsStopMmPerS, speedMultiplier, cancellationToken, null);
}
public static GCodeMemoryFile Load(Stream fileStream,
Vector4 maxAccelerationMmPerS2,
Vector4 maxVelocityMmPerS,
Vector4 velocitySameAsStopMmPerS,
Vector4 speedMultiplier,
CancellationToken cancellationToken,
Action<double, string> progressReporter = null)
{
@ -137,7 +141,7 @@ namespace MatterControl.Printing
using (var reader = new StreamReader(fileStream))
{
return ParseFileContents(reader.ReadToEnd(),
maxAccelerationMmPerS2, maxVelocityMmPerS, velocitySameAsStopMmPerS,
maxAccelerationMmPerS2, maxVelocityMmPerS, velocitySameAsStopMmPerS, speedMultiplier,
cancellationToken, progressReporter);
}
}
@ -153,6 +157,7 @@ namespace MatterControl.Printing
Vector4 maxAccelerationMmPerS2,
Vector4 maxVelocityMmPerS,
Vector4 velocitySameAsStopMmPerS,
Vector4 speedMultiplier,
CancellationToken cancellationToken, Action<double, string> progressReporter)
{
if (Path.GetExtension(filePath).ToUpper() == ".GCODE")
@ -165,6 +170,7 @@ namespace MatterControl.Printing
maxAccelerationMmPerS2,
maxVelocityMmPerS,
velocitySameAsStopMmPerS,
speedMultiplier,
cancellationToken, progressReporter);
}
}
@ -211,6 +217,7 @@ namespace MatterControl.Printing
Vector4 maxAccelerationMmPerS2,
Vector4 maxVelocityMmPerS,
Vector4 velocitySameAsStopMmPerS,
Vector4 speedMultiplier,
CancellationToken cancellationToken, Action<double, string> progressReporter)
{
if (gCodeString == null)
@ -306,7 +313,8 @@ namespace MatterControl.Printing
loadedGCodeFile.AnalyzeGCodeLines(cancellationToken, progressReporter,
maxAccelerationMmPerS2,
maxVelocityMmPerS,
velocitySameAsStopMmPerS);
velocitySameAsStopMmPerS,
speedMultiplier);
loadTime.Stop();
Console.WriteLine("Time To Load Seconds: {0:0.00}".FormatWith(loadTime.Elapsed.TotalSeconds));
@ -317,7 +325,8 @@ namespace MatterControl.Printing
private void AnalyzeGCodeLines(CancellationToken cancellationToken, Action<double, string> progressReporter,
Vector4 maxAccelerationMmPerS2,
Vector4 maxVelocityMmPerS,
Vector4 velocitySameAsStopMmPerS)
Vector4 velocitySameAsStopMmPerS,
Vector4 speedMultiplier)
{
double feedRateMmPerMin = 0;
Vector3 lastPrinterPosition = new Vector3();
@ -367,7 +376,7 @@ namespace MatterControl.Printing
if (feedRateMmPerMin > 0)
{
instruction.secondsThisLine = (float)GetSecondsThisLine(deltaPositionThisLine, deltaEPositionThisLine, feedRateMmPerMin,
maxAccelerationMmPerS2, maxVelocityMmPerS, velocitySameAsStopMmPerS);
maxAccelerationMmPerS2, maxVelocityMmPerS, velocitySameAsStopMmPerS, speedMultiplier);
}
if (progressReporter != null && maxProgressReport.ElapsedMilliseconds > 200)

View file

@ -2151,6 +2151,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
new Vector4(),
new Vector4(),
new Vector4(),
Vector4.One,
CancellationToken.None));
if (this.RecoveryIsEnabled

View file

@ -182,6 +182,7 @@ namespace MatterHackers.MatterControl.PrintQueue
new Vector4(),
new Vector4(),
new Vector4(),
Vector4.One,
CancellationToken.None);
for (int j = 0; j < unleveledGCode.LineCount; j++)

View file

@ -97,6 +97,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public const string ip_address = nameof(ip_address);
public const string ip_port = nameof(ip_port);
public const string jerk_velocity = nameof(jerk_velocity);
public const string print_time_estimate_multiplier = nameof(print_time_estimate_multiplier);
public const string laser_speed_025 = nameof(laser_speed_025);
public const string laser_speed_100 = nameof(laser_speed_100);
public const string layer_gcode = nameof(layer_gcode);

View file

@ -101,6 +101,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
SettingsKey.enable_sailfish_communication,
SettingsKey.max_velocity,
SettingsKey.jerk_velocity,
SettingsKey.print_time_estimate_multiplier,
SettingsKey.max_acceleration,
SettingsKey.ip_address,
SettingsKey.ip_port,

View file

@ -191,6 +191,7 @@ Printer
max_acceleration
max_velocity
jerk_velocity
print_time_estimate_multiplier
Slicing
Slicing Options
output_only_first_layer

View file

@ -1905,6 +1905,15 @@
"Units": "mm/s",
"RebuildGCodeOnChange": false
},
{
"SlicerConfigName": "print_time_estimate_multiplier",
"PresentationName": "Time Multiplier",
"HelpText": "Adjust this to correct differences between expected printing speeds and actual printing speeds.",
"DataEditType": "POSITIVE_DOUBLE",
"Units": "%",
"ShowIfSet": "!sla_printer",
"DefaultValue": "100"
},
{
"SlicerConfigName": "manual_movement_speeds",
"PresentationName": "Manual Movement Speeds",