Open JaakkoArokoskiRF opened 1 year ago
Hi @JaakkoArokoskiRF,
please find attached examples which show how to specify and evaluate load-case combinations in Karamba3D 3. They will be part of the updated unit-tests-project. I hope this helps.
CantileverLoadCaseCombinationResults_tests.zip ShellLoadCaseCombinationResults_tests.zip WallLoadCaseCombinationResults_tests.zip
Thanks for attachments. I was enabled to construct Karamba.Loads.LoadCaseCombination with this code:
List<Karamba.Loads.Load> karambaLoads = new List<k3.Loads.Load>();
if (parameters.AddGravityLoad)
karambaLoads.Add(GetGravityLoad(analysisModel, parameters));
karambaLoads.AddRange(distributedForces);
karambaLoads.AddRange(forcePointLoads);
karambaLoads.AddRange(forceMomentLoads);
karambaLoads.AddRange(nodeLoads);
// Load combinations
List<Karamba.Loads.LoadCaseCombination> karambaCombinations = new List<LoadCaseCombination>();
foreach (var myLoadCombination in analysisModel.Loads.LoadCaseCombinations)
{
// Code shoudl generate something like this: "LCC = (LC0|LC1|LC2)"
List<string> rules = new List<string>();
string rule = $"{myLoadCombination.Value.Name} = (";
foreach (var loadCase in myLoadCombination.Value.Combinations)
{
// rule += loadCase.Factor + "*" + loadCase.Case.Name + "|";
rule += loadCase.Case.Name + "|";
}
rule = rule.Substring(0, rule.Length - 1) + ")";
rules.Add(rule);
Karamba.Loads.LoadCaseCombination karambaLoadCombination = new LoadCaseCombination(rules);
karambaLoadCombination.LcName = myLoadCombination.Value.Name;
if(karambaLoadCombination.IsValid)
karambaCombinations.Add(karambaLoadCombination);
}
karambaLoads.AddRange(karambaCombinations);
return karambaLoads;
I am using this method to run analyze:
Karamba.Algorithms.AnalyzeThI.solve(...)
In attachments there seems to be this method which I cannot find where you can give loadcombinations (list of strings) as a list
Analyze.solve(
model,
new List<string>() { "LCC" },
out IReadOnlyList<double> maxDisp,
out IReadOnlyList<Vector3> force,
out IReadOnlyList<double> energy,
out var outModel,
out var warningMessage);
return outModel;
but when I am trying to get reactions with this code its says: "no loadcase found...."
foreach (string loadcase in loadCases.LoadCombinationsIds)
{
Karamba.Models.Model model = karambaModel;
string lc_id = loadcase;
List<int> nodeIndexes = new List<int>() { support.node_ind };
List<Plane3> orientations;
List<List<Vector3>> forces_all;
List<List<Vector3>> moments_all;
List<Vector3> sum_forces_all;
List<Vector3> sum_moments_all;
Karamba.Results.Reaction.solve(
model,
lc_id,
nodeIndexes,
out orientations,
out forces_all,
out moments_all,
out sum_forces_all,
out sum_moments_all
);
Vector3 forceVector = forces_all[0][0];
Vector3 momentVector = moments_all[0][0];
reactions.Add(new SupportReaction(
loadcase,
forceVector.X,
forceVector.Y,
forceVector.Z,
momentVector.X,
momentVector.Y,
momentVector.Z
));
}
´´´
What I am doing wrong?
Do you use Karamba3D 3 (see here) or the corresponding nuget package? Use
Karamba.Algorithms.Analyze.solve(
model,
lCaseCombiNames,
out IReadOnlyList<double> lcMaxDisp,
out IReadOnlyList<Karamba.Geometry.Vector3> lcResultantForce,
out IReadOnlyList<double> lcElasticEnergy,
out var outModel,
out var warning);
to compute the results.
Hi!
I need help with or example code for how to use Karamba.Loads.LoadCaseCombination or how to add load case combinations to model.
Lets say I have this situation:
How I Can do this in Karamba models?