Project.LoadProfile#
Reads per-bucket load and capacity of resources on the solved baseline of a Project. Read-only. For the load of hypothetical dates, use Preview with a Profile query instead.
Signature#
public LoadProfile LoadProfile(LoadProfileOptions options)
Synchronous and CPU-only. Reads the project without changing it. Project isn't thread-safe, so don't call LoadProfile on one instance from several threads at once.
Parameters#
| Name | Type | Description |
|---|---|---|
options |
LoadProfileOptions |
Range, resources, basis, task lists and an optional baseline check. A ProfileQuery converts to it implicitly, so project.LoadProfile(query) works. |
Returns#
A LoadProfile.
Errors#
| Error | When |
|---|---|
ProjectException with Code == ProjectError.NoBaseline |
The project is unsolved, including after Apply |
ProjectException with Code == ProjectError.StaleBaseline |
options.BaselineId doesn't name the current baseline |
InputException |
To <= From, or more than 100 000 buckets per resource (path to); an unknown resource (path resources) |
ArgumentNullException |
options is null |
Example#
Print the overloaded days of a resource that works on two tasks at once.
using Plen;
static Moment Day(int day) =>
Moment.FromYmdHm(2026, 1, day, 0, 0) ?? throw new InvalidOperationException("invalid date");
static AssignmentData Assign(string task) =>
new() { Task = task, Resource = "dev", Value = 1.0 };
var data = new ProjectData
{
Tasks =
[
new TaskData("a") { StartDate = Day(1), Duration = 2.0 },
new TaskData("b") { StartDate = Day(2), Duration = 2.0 },
],
Resources = [new ResourceData { Id = "dev" }],
Assignments = [Assign("a"), Assign("b")],
};
data.Config.UseCalendars = false;
var project = new Project();
project.Solve(data, new SolveOptions());
var profile = project.LoadProfile(new ProfileQuery(Day(1), Day(5)));
foreach (var resource in profile.Resources)
foreach (var bucket in resource.Buckets.Where(b => b.Load > b.Capacity))
Console.WriteLine($"{resource.Resource} at {bucket.Start}: {bucket.Load} of {bucket.Capacity}");
// dev at 2026-01-02 00:00: 2 of 1
Related#
LoadProfileOptions- the optionsProfileQuery- a query that converts to the optionsLoadProfile- the returned profile- Resource load - reading load and capacity per bucket
- Split assignment work - checking load after splitting an assignment