diff --git a/src/Mod/Ship/tankGZ/TaskPanel.py b/src/Mod/Ship/tankGZ/TaskPanel.py index 5fefccafb..07b84abc9 100644 --- a/src/Mod/Ship/tankGZ/TaskPanel.py +++ b/src/Mod/Ship/tankGZ/TaskPanel.py @@ -54,7 +54,10 @@ class TaskPanel: dRoll = (roll1 - roll0) / (nRoll - 1) roll = [] GZ = [] + msg = Translator.translate("Computing GZ...\n") + App.Console.PrintMessage(msg) for i in range(0, nRoll): + App.Console.PrintMessage("\t%d/%d\n" % (i+1,nRoll)) roll.append(i*dRoll) GZ.append(self.computeGZ(draft[0], trim, roll[-1])) Plot(roll, GZ, disp[0]/1000.0, draft[0], trim) @@ -194,7 +197,7 @@ class TaskPanel: self.form.findChild(QtGui.QGroupBox, "AnglesGroup").setTitle(Translator.translate("Roll angles.")) self.form.findChild(QtGui.QLabel, "TrimLabel").setText(Translator.translate("Trim") + " [deg]") self.form.findChild(QtGui.QLabel, "StartAngleLabel").setText(Translator.translate("Start") + " [deg]") - self.form.findChild(QtGui.QLabel, "EndAngleLabel").setText(Translator.translate("Start") + " [deg]") + self.form.findChild(QtGui.QLabel, "EndAngleLabel").setText(Translator.translate("End") + " [deg]") self.form.findChild(QtGui.QLabel, "NAngleLabel").setText(Translator.translate("Number of points")) def onTanksSelection(self): @@ -224,10 +227,8 @@ class TaskPanel: disp = disp[0] # Get bouyancy center draft = self.computeDraft(disp) - xcb = draft[1] + B = [draft[1].x, draft[1].y, draft[1].z] draft = draft[0] - KBT = Hydrostatics.KBT(self.ship, draft, trim) - B = [xcb, KBT[0], KBT[1]] # Get stability initial condition BG = [G[0]-B[0], G[1]-B[1], G[2]-B[2]] x = BG[0]*math.cos(math.radians(trim)) - BG[2]*math.sin(math.radians(trim)) @@ -246,10 +247,8 @@ class TaskPanel: disp = disp[0] # Get bouyancy center draft = self.computeDraft(disp, trim) - xcb = draft[1] + B = [draft[1].x, draft[1].y, draft[1].z] draft = draft[0] - KBT = Hydrostatics.KBT(self.ship, draft, trim) - B = [xcb, KBT[0], KBT[1]] # Get stability initial condition BG = [G[0]-B[0], G[1]-B[1], G[2]-B[2]] x = BG[0]*math.cos(math.radians(trim)) - BG[2]*math.sin(math.radians(trim)) @@ -321,7 +320,7 @@ class TaskPanel: """ Computes ship draft. @param disp Ship displacement. @param trim Trim angle [degrees]. - @return Ship draft, and longitudinal bouyance center position. None if errors detected. + @return Ship draft, and bouyance center position. None if errors detected. """ if not self.ship: return None @@ -335,10 +334,10 @@ class TaskPanel: xcb = 0.0 while(abs(disp - w)/disp > 0.01): draft = draft + (disp - w) / (dens*dx*dy) - ww = Hydrostatics.Displacement(self.ship, draft, trim) - w = 1000.0*ww[1] - xcb = ww[2] - return [draft,xcb] + ww = Hydrostatics.displacement(self.ship, draft, 0.0, trim, 0.0) + w = 1000.0*ww[0] + B = ww[1] + return [draft,B] def computeGZ(self, draft, trim, roll): """ Compute GZ value. @@ -352,13 +351,13 @@ class TaskPanel: G = [disp[2], disp[3]] disp = disp[0] # Get bouyancy center (x coordinate not relevant) - KBT = Hydrostatics.KBT(self.ship, draft, trim, roll) - B = [KBT[0], KBT[1]] + disp = Hydrostatics.displacement(self.ship, draft, roll, trim, 0.0) + B = [disp[1].y, disp[1].z] # GZ computation BG = [G[0] - B[0], G[1] - B[1]] - y = BG[0]*math.cos(math.radians(-roll)) - BG[1]*math.sin(math.radians(-roll)) - z = BG[0]*math.sin(math.radians(-roll)) + BG[1]*math.cos(math.radians(-roll)) - return -y + y = BG[0]*math.cos(math.radians(roll)) - BG[1]*math.sin(math.radians(roll)) + z = BG[0]*math.sin(math.radians(roll)) + BG[1]*math.cos(math.radians(roll)) + return y def createTask(): panel = TaskPanel() diff --git a/src/Mod/Ship/tankGZ/TaskPanel.ui b/src/Mod/Ship/tankGZ/TaskPanel.ui index ce59e5d2b..80439d94d 100644 --- a/src/Mod/Ship/tankGZ/TaskPanel.ui +++ b/src/Mod/Ship/tankGZ/TaskPanel.ui @@ -182,7 +182,7 @@ - 89.000000000000000 + 180.000000000000000 45.000000000000000