mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-12-05 14:09:28 -05:00
With short steps only around the torch, the processor is faster than the card at the quarter-inch cells full sheets use, and the card only gained at a cell size they do not use. Drop OpenNest.Gpu, the ILGPU dependency and the accelerator interface; the heat map runs the same on every computer. The measured card timings stay in docs/plate-heat-map.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
62 lines
1.8 KiB
C#
62 lines
1.8 KiB
C#
using OpenNest.CNC;
|
|
using OpenNest.CNC.Thermal;
|
|
using OpenNest.Desktop.Interaction;
|
|
using OpenNest.Geometry;
|
|
|
|
namespace OpenNest.Desktop.Tests.Interaction;
|
|
|
|
public class HeatEstimateTests
|
|
{
|
|
private static (Plate Plate, CutSimulation Simulation) Job(double x = 5)
|
|
{
|
|
var program = new OpenNest.CNC.Program();
|
|
program.Codes.Add(new RapidMove(0, 0));
|
|
program.Codes.Add(new LinearMove(20, 0));
|
|
var plate = new Plate(80, 80);
|
|
plate.Parts.Add(new Part(new Drawing("part", program), new Vector(x, 5)));
|
|
return (plate, CutSimulation.Build(plate,
|
|
new CutParameters { Feedrate = 100, RapidTravelRate = 600, Units = Units.Inches }));
|
|
}
|
|
|
|
private static readonly ThermalParameters Parameters = new()
|
|
{
|
|
Thickness = 0.25,
|
|
Units = Units.Inches,
|
|
CellSize = 0.25,
|
|
};
|
|
|
|
[Fact]
|
|
public void AnEstimateIsRunForItsScaleAndLeftAtTheStart()
|
|
{
|
|
var (plate, simulation) = Job();
|
|
|
|
var estimate = HeatEstimate.Run(plate, simulation, Parameters);
|
|
|
|
Assert.True(estimate.Scale > 1);
|
|
Assert.Equal(TimeSpan.Zero, estimate.Heat.Time);
|
|
}
|
|
|
|
[Fact]
|
|
public void ACancelledEstimateThrows()
|
|
{
|
|
var (plate, simulation) = Job();
|
|
using var cancel = new CancellationTokenSource();
|
|
cancel.Cancel();
|
|
|
|
Assert.Throws<OperationCanceledException>(
|
|
() => HeatEstimate.Run(plate, simulation, Parameters, cancel.Token));
|
|
}
|
|
|
|
[Fact]
|
|
public void ARebuiltTimelineWithTheSameMovesMatches()
|
|
{
|
|
var (_, first) = Job();
|
|
var (_, again) = Job();
|
|
var (_, moved) = Job(x: 6);
|
|
|
|
Assert.True(HeatEstimate.SameMoves(first, again));
|
|
Assert.False(HeatEstimate.SameMoves(first, moved));
|
|
Assert.False(HeatEstimate.SameMoves(first, null!));
|
|
}
|
|
}
|