Capacc 1.10.0
Whats this?
Capacc is Capac with cache!
Terminology
- Product - An item which is individually handled during the process.
- Phase - Part of the project. Contains products.
- Department - A product creation step. For example: welding, surface treatment etc.
Date capacity input
The optimization relies on two information. The date capacity is one of them, it represents the human resource capacity date by date in hours and departments. The following example presents the input in json format:
{
"StartDate": "2022-02-01",
"DefaultDepartmentCapacities": [
[ 8, 8, 8 ], //Monday
[ 8, 8, 8 ],
[ 8, 8, 8 ],
[ 8, 8, 8 ],
[ 8, 8, 8 ],
[ 8, 8, 8 ],
[ 8, 8, 8 ]
]
"ExceptionalDepartmentCapacities" : {
"2022-02-11T00:00:00" : [ 7, 7, 7]
}
}
The JSON represents an array of CapacDateInformation object. The model is defined under Capac.Model namespace. Example of a date capacity calculator input:
CapacDateInformation capacities = ...;
Project input
The second necessary information for the calculation is the phase data. It contains the phase information for optimization. The following example shows the root phase (aka project) definition in JSON format containing only the required parameters for the calculation. Additional parameters can be added. The 0 value in HoursInDepartments list has a dedicated functionality. If 0 is set at a department index the product will be skipped. It means that the department not handles the product, instead it will be automatically transported to the next department.
{
"Name": "Project1",
"Id": "Project1",
"Description": "leiras",
"Priority": 1,
"Deadline": "2022.10.30 08:00",
"MaterialAvailability": "2022.10.24 08:34",
"DesignAvailability": "2022.10.24 08:34",
"Phases": {
"Project1-Fázis1": {
"Name": "Project1-Fázis1",
"Id": "Project1-Fázis1",
"Description": "leiras",
"Priority": 1,
"Deadline": "2022.10.30 08:00",
"MaterialAvailability": "2022.10.24 08:34",
"DesignAvailability": "2022.10.24 08:34",
"Products": {
"Project1-Fázis1-1": {
"Id": "Project1-Fázis1-1",
"Weight": 2.0,
"HoursPerTonInDepartments": [ 3.5, 0, 0.5 ]
},
"Project1-Fázis1-2": {
"Id": "Project1-Fázis1-2",
"Weight": 4.0,
"HoursPerTonInDepartments": [ 9.0, 4.05, 0.5 ]
},
"Project1-Fázis1-3": {
"Id": "Project1-Fázis1-3",
"Weight": 1.0,
"HoursPerTonInDepartments": [ 8.0, 4.5, 0.5 ]
},
"Project1-Fázis1-4": {
"Id": "Project1-Fázis1-4",
"Weight": 1.5,
"HoursPerTonInDepartments": [ 2.0, 4.5, 4.5 ]
}
}
},
"Project1-Fázis2": {
"Name": "Project1-Fázis2",
"Id": "Project1-Fázis2",
"Description": "leiras",
"Priority": 1,
"Deadline": "2022.11.26 08:00",
"MaterialAvailability": "2022.10.23 08:34",
"DesignAvailability": "2022.10.23 08:34",
"Weight": 5,
"FinishedWeights": [ 1, 0, 0 ],
"OutsourceDeadlines": [ "2022.12.10 08:00", null, null ],
"OutsourcedWeights": [ 1.0, 0.0, 0.0 ],
"Products": {
"Project1-Fázis2-1": {
"Id": "Project1-Fázis2-1",
"Weight": 1.0,
"HoursPerTonInDepartments": [ 0.5, 0, 0.5 ]
},
"Project1-Fázis2-2": {
"Id": "Project1-Fázis2-2",
"Weight": 1.0,
"HoursPerTonInDepartments": [ 0.5, 0.5, 1.5 ]
},
"Project1-Fázis2-3": {
"Id": "Project1-Fázis2-3",
"Weight": 1.0,
"HoursPerTonInDepartments": [ 2.5, 0.5, 2.0 ]
},
"Project1-Fázis2-4": {
"Id": "Project1-Fázis2-4",
"Weight": 1.0,
"HoursPerTonInDepartments": [ 0.5, 0.05, 2.0 ]
},
"Project1-Fázis2-5": {
"Id": "Project1-Fázis2-5",
"Weight": 1.0,
"HoursPerTonInDepartments": [ 0.5, 2.5, 2.0 ]
}
}
},
"Project1-Fázis3": {
"Name": "Project1-Fázis3",
"Id": "Project1-Fázis3",
"Weight": 5.0,
"Description": "leiras",
"Priority": 1,
"Deadline": "2022.11.26 08:00",
"MaterialAvailability": "2022.10.23 08:34",
"DesignAvailability": "2022.10.23 08:34"
},
}
}
The JSON represents the project as a root phase object. The model is defined under Capac.Model namespace. Example of a product group list calculator input:
Phase project = ...;
Creating a Capacc service
Add Capac service in Startup.cs
builder.Services.AddSingleton<ICapacc, Capacc>();
Calculation
To trigger calculation based on the given date capacity and product group information simply call the Calculate() funciton of ta Capacc instance. Optional calculation parameters are:
- transportDays - the minimum number of days between a department finish time and the next department start time. Default is 2
- ignoreMeterialAvailability - ignore the material availability date. Default is false.
- ignoreDesignAvailability - ignore the design availability date. Default is false. -- 0 if the output is structured by departments for each day -- 1 if the output is structured by phases for each day
Typical use case:
//Make your controller depend on Calcc service
public YourController(ICalcc _calculatorCache)
//1.
//On table data history create a CapacityDto instance.
CapacityDto tableData = new CapacityDto();
//... add historical table data
//2.
//By adding the CapacityDto object to the calculator cache the package will persist your table data.
//Returns a key string so you can refer to the tableData later.
string key = _calculatorCache.Add(tableData);
//3.
//If the phase information is available add phase information to the cached table data.
var Phases_1 = new List<Phase>();
//...
_calculatorCache.AddPhases(key, Phases_1);
//4.
//Add capacity date information
var DateCapacities_1 = new CapacDateInformation();
//...
_calculatorCache.AddDateInformation(key, DateCapacities_1);
//5.
//Start calculation process
_calculatorCache.Calculate(key, 0, true, true, true, 1.5, 1);
//6.
//Get the results any time
_calculatorCache.GetCapacity(key)
//7.
//Optionally add data to the table
DateTime dateTime = DateTime.Now;
CapacityItemDto capacityItem = new CapacityItemDto();
_calculatorCache.Update(key, dateTime, capacityItem);
Result example as JSON
{
"Error":null,
"Progress":1.0,
"PhaseSummary":{
"Project1":{
"OptimalDesignAvailability":"2022-09-08T08:00:00",
"OptimalMaterialAvailability":"2022-09-08T08:00:00",
"StartTime":"2022-12-09T20:00:00",
"EndTime":"2023-05-12T20:00:00"
},
"Project1-Fázis1":{
"OptimalDesignAvailability":"2022-12-09T08:00:00",
"OptimalMaterialAvailability":"2022-12-09T08:00:00",
"StartTime":"2022-12-09T20:00:00",
"EndTime":"2023-04-10T20:00:00"
}
},
"Capacities":{
"29/11/2022":{
"RemainingDepartmentHours":[
0.0,
20.0,
10.0
],
"PhaseStatus":{
"Project1-Fázis1":{
"Id":"Project1-Fázis1",
"ItemStatuses":[
{
"Id":"Project1-Fázis1-Fázis1.1",
"ProductionStart":"0001-01-01T00:00:00",
"ProductionEnd":"0001-01-01T00:00:00",
"ProductionCapacity":[
{
"UsedHour":10.0,
"UsedWeight":0.5
},
{
"UsedHour":0.0,
"UsedWeight":0.0
},
{
"UsedHour":0.0,
"UsedWeight":0.0
}
]
}
]
},
"Project1":{
"Id":"Project1",
"ItemStatuses":[
{
"Id":"Project1-Fázis1",
"ProductionStart":"0001-01-01T00:00:00",
"ProductionEnd":"0001-01-01T00:00:00",
"ProductionCapacity":[
{
"UsedHour":10.0,
"UsedWeight":0.5
},
{
"UsedHour":0.0,
"UsedWeight":0.0
},
{
"UsedHour":0.0,
"UsedWeight":0.0
}
]
}
]
}
}
}
}
}
No packages depend on Capacc.
Bug fixes and performance improvements
.NET 6.0
- Capac (>= 2.4.0)
- NLog (>= 5.0.4)
- Newtonsoft.Json (>= 13.0.1)
- NuGet.Packaging (>= 6.3.1)
| Version | Downloads | Last updated |
|---|---|---|
| 1.10.0 | 1 | 12/10/2025 |