diff --git a/moorpy/Catenary.py b/moorpy/Catenary.py index b10e01d..61818f6 100644 --- a/moorpy/Catenary.py +++ b/moorpy/Catenary.py @@ -1428,7 +1428,8 @@ def step_func_cat(X, args, Y, info, Ytarget, err, tols, iter, maxIter): # Tricky case for sloped seabed (prone to overestimating LBot unless trapped corrected in the solve) - (fAH1, fAV1, fBH1, fBV1, info1) = catenary(121.5, 17.5, 138.5, 1232572089, 2456.8, CB=0.0, alpha=-2.6, HF0=428113, VF0=396408, Tol=0.0005, nNodes=41, plots=1) + #(fAH1, fAV1, fBH1, fBV1, info1) = catenary(121.5, 17.5, 138.5, 1232572089, 2456.8, CB=0.0, alpha=-2.6, HF0=428113, VF0=396408, Tol=0.0005, nNodes=41, plots=1) + (fAH1, fAV1, fBH1, fBV1, info1) = catenary(121.09772794232714, -1.8384100597014594, 101.50770310432262, 1232572089.6, 2456.820077481978, CB=0.0, alpha=-0.8659609923714943, HF0=20534.12538249187, VF0=53055.020668169294, Tol=0.0005, nNodes=41, plots=1) """ Tol =2e-05 diff --git a/moorpy/body.py b/moorpy/body.py index 84bcccc..4c2a2d3 100644 --- a/moorpy/body.py +++ b/moorpy/body.py @@ -105,11 +105,6 @@ def attachPoint(self, pointID, rAttach): The identifier ID number of a point rAttach : array The position of the point relative to the body's frame [m] - - Returns - ------- - None. - ''' self.attachedP.append(pointID) @@ -118,6 +113,23 @@ def attachPoint(self, pointID, rAttach): if self.sys.display > 1: print("attached Point "+str(pointID)+" to Body "+str(self.number)) + """ + def dettachPoint(self, pointID): + '''Removes a Point from the Body. + + Parameters + ---------- + pointID : int + The identifier ID number of a point + rAttach : array + The position of the point relative to the body's frame [m] + ''' + + find pointID index in self.attachedP + delete entry from self.attachedP and rPointRel + + set point type to free + """ def attachRod(self, rodID, endCoords): '''Adds a Point to the Body, at the specified relative position on the body. diff --git a/moorpy/point.py b/moorpy/point.py index 83a8750..e0a534b 100644 --- a/moorpy/point.py +++ b/moorpy/point.py @@ -88,11 +88,6 @@ def attachLine(self, lineID, endB): The identifier ID number of a line endB : boolean Determines which end of the line is attached to the point - - Returns - ------- - None. - ''' self.attached.append(lineID) @@ -108,15 +103,16 @@ def detachLine(self, lineID, endB): The identifier ID number of a line endB : boolean Determines which end of the line is to be detached from the point - - Returns - ------- - None. - ''' - self.attached.pop(self.attached.index(lineID)) - self.attachedEndB.pop(self.attachedEndB.index(endB)) + # get attachment index + i1 = self.attached.index(lineID) + i2 = self.attachedEndB.index(endB) + if not i1==i2: + raise Exception("issue with the right end of the line to detach...") + + self.attached.pop(i1) + self.attachedEndB.pop(i1) print("detached Line "+str(lineID)+" from Point "+str(self.number)) diff --git a/moorpy/system.py b/moorpy/system.py index 7fb4a00..3595293 100644 --- a/moorpy/system.py +++ b/moorpy/system.py @@ -339,7 +339,36 @@ def removeLine(self, lineID): raise Exception("Invalid line number") """ + + def disconnectLineEnd(self, lineID, endB): + '''Disconnects the specified end of a Line object from whatever point + it's attached to, and instead attaches it to a new free point. + ''' + + # for now assume the line is at the expected index + line = self.lineList[lineID-1] + + if not line.number == lineID: + raise Exception(f"Error lineID {lineID} isn't at the corresponding lineList index.") + # detach line from whatever point it's attached to + for point in self.pointList: + if lineID in point.attached: + if point.attachedEndB[point.attached.index(lineID)] == endB: + point.detachLine(lineID, endB) + break + + # create new free point to attach the line end to + if endB: + r = line.rB + else: + r = line.rA + + self.addPoint(0, r) + + self.pointList[-1].attachLine(lineID, endB) + + def addLineType(self, type_string, d, mass, EA, name=""): '''Convenience function to add a LineType to a mooring system or adjust the values of an existing line type if it has the same name/key.