Skip to content

Add Get Joint Accelerations #468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions Etabs_Adapter/CRUD/Read/Results/NodeResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
using BH.oM.Structure.Requests;
using BH.oM.Adapter;
using BH.oM.Structure.Elements;
using System.Xml.Linq;

namespace BH.Adapter.ETABS
{
Expand Down Expand Up @@ -68,6 +69,7 @@ public IEnumerable<IResult> ReadResults(NodeResultRequest request, ActionConfig
return ReadNodeDisplacement(nodeIds);
case NodeResultType.NodeVelocity:
case NodeResultType.NodeAcceleration:
return ReadNodeAcceleration(nodeIds);
default:
Engine.Base.Compute.RecordError("Result extraction of type " + request.ResultType + " is not yet supported");
return new List<IResult>();
Expand All @@ -78,9 +80,42 @@ public IEnumerable<IResult> ReadResults(NodeResultRequest request, ActionConfig
/**** Private method - Extraction methods ****/
/***************************************************/

private List<NodeResult> ReadNodeAcceleration(IList ids = null, IList cases = null)
private List<NodeAcceleration> ReadNodeAcceleration(List<string> nodeIds)
{
throw new NotImplementedException("Node Acceleration results is not supported yet!");

List<NodeAcceleration> nodeAccelerations = new List<NodeAcceleration>();

int resultCount = 0;
string[] loadcaseNames = null;
string[] objects = null;
string[] elm = null;
string[] stepType = null;
double[] stepNum = null;
double[] ux = null;
double[] uy = null;
double[] uz = null;
double[] rx = null;
double[] ry = null;
double[] rz = null;

for (int i = 0; i < nodeIds.Count; i++)
{
int ret = m_model.Results.JointAccAbs(nodeIds[i].ToString(), eItemTypeElm.ObjectElm, ref resultCount, ref objects, ref elm, ref loadcaseNames,
ref stepType, ref stepNum, ref ux, ref uy, ref uz, ref rx, ref ry, ref rz);
if (ret == 0)
{
for (int j = 0; j < resultCount; j++)
{
int mode;
double timeStep;
GetStepAndMode(stepType[j], stepNum[j], out timeStep, out mode);
NodeAcceleration na = new NodeAcceleration(nodeIds[i], loadcaseNames[j], mode, timeStep, oM.Geometry.Basis.XY, ux[j], uy[j], uz[j], rx[j], ry[j], rz[j]);
nodeAccelerations.Add(na);
}
}
}

return nodeAccelerations;
}

/***************************************************/
Expand Down