Skip to content

Question: Making twin-rig yacht ("Bug: Main Sail object has no attribute IG") #54

@G0rocks

Description

@G0rocks

When I ran my code then I got this error:

runVPP.py 73 <module>
vpp.run(verbose=False)

VPPMod.py 237 run
sol = root(

_root.py 255 root
sol = _root_leastsq(_wrapped_fun, x0, args=args, jac=jac, **options)

_root.py 323 _root_leastsq
x, cov_x, info, msg, ier = leastsq(_wrapped_fun, x0, args=args,

_minpack_py.py 425 leastsq
shape, dtype = _check_func('leastsq', 'func', func, x0, args, n)

_minpack_py.py 23 _check_func
res = atleast_1d(thefunc(*((x0[:numinputs],) + args)))

return fun(*fargs)

_root.py 215 _wrapped_fun
return fun(*fargs)

VPPMod.py 301 resid
Fxa, Fya, Mxa = self.aero.update(vb0, phi0, tws, twa, flat, 2.0)

AeroMod.py 91 update
self._compute_forces()

AeroMod.py 117 _compute_forces
self.Mx = self.Fy * self._vce()

AeroMod.py 205 _vce
deltaCH = 0 if self.sails[1].up!=True else (1-self.ftj)*0.05*self.sails[1].IG

AttributeError:
'Main' object has no attribute 'IG'
PS C:\Users\Huldar\Reykjavik University\Meistaraverkefni - Huldar - General\Model and calculators\VPPs\Python-VPP> python .\runVPP.py

Which comes from line 205 in AeroMod.py which is:
deltaCH = 0 if self.sails[1].up!=True else (1-self.ftj)*0.05*self.sails[1].IG

In the Vectical centre of effort lift/drag weigted function.

But looking at the Main Sail object it defined in line 58 in SailMod.py and is defined as:

class Main(Sail):
    def __init__(self, name, P, E, Roach, BAD):
        """
        Initialize mainsail
    
        This function initializes an object of class Main which inherits the class Sail. 
        It calculates the area, the Vertical Center of Effort (vce), 
        sets CE = 1 and calls the super class constructor. 
    
        Parameters
        ----------
        name : string
            Of the sail
            
        P : Float
            Height of the Mainsail  in meters
            
        E: Float
            Length (Foot) of the Mainsail  in meters
            
        Roach: Float
            Percentage by which the triangular area is increased in order to obtain the mainsail area. 
            This is area behind the line from clew to head. 
            To get this number you have to calculate  Mainsail_area / (P*E/2) -1
            
        BAD: Float
            Boom Above Deck: Distance between boom and Deck  in meters
        
        Returns
        -------
        Main
            Object of type Main( Sail )
    
        See Also
        --------
        Jib( Sail )
    
        Examples
        --------
        >>> Main("MN1", P=16.60, E=5.60, Roach=0.1, BAD=1.0)
        <src.SailMod.Main object at 0xFFFFFFFFF>
        """
        self.name = name
        self.type = "main"
        self.P = P
        self.E = E
        self.roach = Roach
        self.BAD = BAD
        self.area0 = 0.5 * P * E * (1 + self.roach)
        self.vce = P / 3.0 * (1 + self.roach) + self.BAD
        super().__init__(self.name, self.type, self.area0, self.vce)
        self.measure()
    
    def measure(self, rfm=1, ftj=1):
        self.P_r = self.P*rfm
        self.vce = self.P_r / 3.0 * (1 + self.roach) + self.BAD
        self.area = self.area0*rfm**2
        self.CE = 1.

Where there is no IG parameter. I've tried adding it anyway when I make the mainsail but it just crashed also and said it was not expecting the parameter. Understandable. Now I'm unsure what this IG parameter is supposed to be but this is resulting in zero polar plots for the vessel I've inputted. What can we do to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions