Circles

General FreeBASIC programming questions.
Locked
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Post by albert »

"Perpetual motion motor"

Code: Select all

dim as integer xres,yres
screen 19
screeninfo xres,yres
screenres xres,yres

dim as double rad=atn(1)/45
dim as ulongint radius =yres/4

dim as ulongint radius1=yres/4
dim as ulongint radius2=yres/4
dim as ulongint radius3=yres/4
dim as ulongint radius4=yres/4
dim as ulongint radius5=yres/4
dim as ulongint radius6=yres/4

dim as integer ball_radius=yres/20

dim as double x1,x2,x3,cx1,cx2,cx3,cx4,cx5,cx6
dim as double y1,y2,y3,cy1,cy2,cy3,cy4,cy5,cy6
dim as double atn1,atn2,atn3

dim as double c1,c2,c3,c4,c5,c6
dim as double s1,s2,s3,s4,s5,s6

dim as ulongint xctr=xres/2
dim as ulongint yctr=yres/2

circle(xctr,yctr),10,10
do
    for deg1 as integer = 0 to 120*3 step 1
        
        cls
            circle(xctr,yctr),xres/4,15
            c1=cos((0+deg1)*rad)
            s1=sin((0+deg1)*rad)
            
            x1=radius*c1
            y1=radius*s1
            
            atn1=atan2(y1,x1)/rad
            if atn1>=-95 and atn1<=-85 then radius1=yres/2:radius4=yres/4
            if atn1>=85 and atn1<=95  then radius1=yres/4:radius4=0
            cx1=radius1*c1
            cy1=radius1*s1
            cx4=radius4*cos(380+deg1*rad)
            cy4=radius4*sin(380+deg1*rad)
            line(xctr,yctr)-(xctr+x1*2,yctr+y1*2),15
            circle(xctr+cx1,yctr+cy1),ball_radius,10
            circle(xctr+cx4,yctr+cy4),ball_radius,12
            line-(xctr,yctr),15
            
            c2=cos((120+deg1)*rad)
            s2=sin((120+deg1)*rad)
            
            x2=radius*c2
            y2=radius*s2
            
            atn2=atan2(y2,x2)/rad
            if atn2>=-95 and atn2<=-85 then radius2=yres/2:radius5=yres/4
            if atn2>=85 and atn2<=95  then radius2=yres/4:radius5=0
            cx2=radius2*c2
            cy2=radius2*s2
            cx5=radius5*cos(200+deg1*rad)
            cy5=radius5*sin(200+deg1*rad)
            line(xctr,yctr)-(xctr+x2*2,yctr+y2*2),15
            circle(xctr+cx2,yctr+cy2),ball_radius,10
            circle(xctr+cx5,yctr+cy5),ball_radius,12
            line-(xctr,yctr),15
            
            c3=cos((240+deg1)*rad)
            s3=sin((240+deg1)*rad)
            
            x3=radius*c3
            y3=radius*s3
            
            atn3=atan2(y3,x3)/rad
            if atn3>=-95 and atn3<=-85 then radius3=yres/2:radius6=yres/4
            if atn3>=85 and atn3<=95  then radius3=yres/4:radius6=0
            cx3=radius3*c3
            cy3=radius3*s3
            cx6=radius6*cos(45+deg1*rad)
            cy6=radius6*sin(45+deg1*rad)
            line(xctr,yctr)-(xctr+x3*2,yctr+y3*2),15
            circle(xctr+cx3,yctr+cy3),ball_radius,10
            circle(xctr+cx6,yctr+cy6),ball_radius,12
            line-(xctr,yctr),15
        sleep 30
        
    if inkey<>"" then end
    next

loop

it doesn't work !!!
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Post by dodicat »

On earth, here, position is effortless, velocity requires effort.
We live in a place where friction prevails totally.
Above Earth, a bit, velocity is effortless, acceleration requires effort.
So we have a sort of perpetual motion not very far away from us.
That place of perpetual motion is less far away from me than Albert's home.
Hardly surprising that us humans are always trying to achieve it a bit closer to home.
The laws of thermodynamics I suppose are the epitomy of common sense.
However, entropy they say prevails in the universe (a bold statement).
On Earth, the biomass on it's surface beats entropy, it builds, from chaos, complicated molecular structures by a knowledge built into minute structures we would call DNA, or maybe molecules on a strand.
The creatures that this knowledge makes themself beat entropy by building structures (homes and the like).
So the creatures who invented the laws of thermodynamics are themselves breaking those laws.
When the solar system collapses, will the strands of molecules (the knowledge) be destroyed, or will they be able to find a safer temporary home again, before that event?
So, in general, all is NOT clear as to what can and cannot be done, and for this reason some of us are unbounded in thought.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Post by dodicat »

Hi Albert
OK I've altered the round for a positive string number.
You can test it to see if it's any use, I'm going for a walk down the to shore now with Louis the beagle.


Code: Select all


declare Function round(s1 As String) As String
declare Function plus(NUM1 As String,NUM2 As String) As String


dim s as string="99.999999999999999995"'"6.9996999999999999995"
print s
print round(s)
sleep
Function plus(NUM1 As String,NUM2 As String) As String
        Dim As Long lenf,lens
        Dim As Byte flag
        'Dim As String part1,part2
         'set up tables
            Dim As Ubyte Qmod(0 To 19)
            Dim bool(0 To 19) As Ubyte
For z As Integer=0 To 19
    Qmod(z)=cubyte(z Mod 10+48)
    bool(z)=cubyte(-(10<=z))
Next z


 
 #macro finish(three)
  three=Ltrim(three,"0")
        If three="" Then Return "0"
       If flag=1 Then Swap NUM2,NUM1
       Return three
       Exit Function
 #endmacro
 lenf=Len(NUM1)
 lens=Len(NUM2)
 If lens>lenf Then 
 Swap NUM2,NUM1
 Swap lens,lenf
 flag=1
 Endif

        Dim diff As Long=lenf-lens-Sgn(lenf-lens)
        Dim As String two,three',one
        three="0"+NUM1
        two=String(lenf-lens,"0")+NUM2
        Dim As Long n2
        Dim As Ubyte addup,addcarry
        Dim As Ubyte ten=10
        Dim As Ubyte ninetysix=96
        Dim As Ubyte fortyeight=48
        Dim As Ubyte zero=0
        addcarry=zero
           
         For n2=lenf-1 To diff Step -1 
          addup=two[n2]+NUM1[n2]-ninetysix
            three[n2+1]=Qmod(addup+addcarry)
            addcarry=bool(addup+addcarry)
        Next n2 
       
        If addcarry=zero Then 
        finish(three)
        Endif
        If n2=-1 Then 
        three[0]=addcarry+fortyeight
         finish(three)
        Endif

        For n2=n2 To 0 Step -1 
             addup=two[n2]+NUM1[n2]-ninetysix
               three[n2+1]=Qmod(addup+addcarry)
            addcarry=bool(addup+addcarry)
        Next n2
        three[0]=addcarry+fortyeight
    finish(three)
End Function
Function round(s1 As String) As String
    If valint(Right(s1,1))>=5 Then
        Dim to_add As Integer
    to_add=10-Valint(Right$(s1,1))
Dim As String var1,var2,char
Dim As Long pst
  #macro splice(stri,char)
    pst=Instr(stri,char)
    var1="":var2=""
    If pst<>0 Then
    var1=Mid(stri,1,pst-1)
    var2=Mid(stri,pst+1)
Else
    var1=stri
    Endif
    #endmacro
    Dim As String rou,ans
    Dim As Long l
    splice(s1,".")
    If var2="" Then Return s1
    rou=Rtrim(plus(var2,str(to_add)),"0")
    l=Len(rou)-1
    If l Then
        var2=rou
        ans=var1+"."+var2
    Else
        ans=plus(var1,rou)
        End If
    Return ans
Else
    Return s1
    End If
End Function
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Post by albert »

@Dodicat and Richard

I found a way to doo something like orbit where the momentum is downward like gravity, once you get the motor up to escape velocity it should remain in that velocity like a spaceship in orbit.

Code: Select all

dim as integer xres,yres
screen 19
screeninfo xres,yres
screenres xres,yres

dim as double rad=atn(1)/45
dim as ulongint radius =yres/4

dim as ulongint radius1=yres/2
dim as ulongint radius2=yres/2
dim as ulongint radius3=yres/2

dim as integer ball_radius=yres/20

dim as double x1,x2,x3,cx1,cx2,cx3
dim as double y1,y2,y3,cy1,cy2,cy3

dim as double c1,c2,c3
dim as double s1,s2,s3

dim as ulongint xctr=xres/2
dim as ulongint yctr=yres/2

circle(xctr,yctr),10,10
do
    for deg1 as integer = 0 to 360 step 1
        
        cls
            circle(xctr,yctr),10,15
            circle(xctr,yctr),xres/3.1,12
            circle(xctr,yctr),xres/3.8,12
            circle(xctr,yctr),xres/2.5,10
            circle(xctr,yctr),xres/2.9,10
            
            
            c1=cos((0+deg1)*rad)
            s1=sin((0+deg1)*rad)
            x1=radius*c1
            y1=radius*s1
            cx1=radius1*c1
            cy1=radius1*s1
            line(xctr,yctr)-(xctr+x1*2,yctr+y1*2),15
            circle(xctr+cx1,yctr+cy1),ball_radius,10
            
            c2=cos((120+deg1)*rad)
            s2=sin((120+deg1)*rad)
            x2=radius*c2
            y2=radius*s2
            cx2=radius2*c2
            cy2=radius2*s2
            line(xctr,yctr)-(xctr+x2*2,yctr+y2*2),15
            circle(xctr+cx2,yctr+cy2),ball_radius,10
            

            c3=cos((240+deg1)*rad)
            s3=sin((240+deg1)*rad)
            x3=radius*c3
            y3=radius*s3
            cx3=radius3*c3
            cy3=radius3*s3
            line(xctr,yctr)-(xctr+x3*2,yctr+y3*2),15
            circle(xctr+cx3,yctr+cy3),ball_radius,10
            
            sleep 30
        
    if inkey<>"" then end
    next

loop

the center pole is south (RED) the outer pole is green(NORTH) the magnets on the axles are north down and south up.

I ordered a magnet catalog off the internet and an Edmund Scientific catalog, and i can get magnet wire at Radio Shack. i'm gonna piddle around with it to see if i can get it up to speeds necessary to reach orbit velocity.
Last edited by albert on Jul 21, 2010 18:18, edited 1 time in total.
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Post by vdecampo »

albert wrote:I found a way to doo something like orbit where the momentum is downward like gravity, once you get the motor up to escape velocity it should remain in that velocity like a spaceship in orbit.
@albert

Energy in a system will always be lost through various means...

Friction
Drag
Electrical Resistance
Heat
Sound
(All of which are variations of the loss of energy)

Even an orbit will decay over time due to the drag of solar wind, atmospheric contact, and gravity waves.

-Vince
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Perpetual Motion Magnet Motor

Post by albert »

Here it is in its completion.

"Perpetual Motion Magnet Motor"

Code: Select all

Dim As Integer xres,yres
Screen 19
screeninfo xres,yres
screenres xres,yres

Dim As Double rad=Atn(1)/45
Dim As Ulongint iradius =yres/50
dim as ulongint oradius =yres/4

Dim As Ulongint radius1=yres/2
Dim As Ulongint radius2=yres/2
Dim As Ulongint radius3=yres/2

Dim As Integer ball_radius=yres/20

Dim As Double itx1,itx2,itx3,otx1,otx2,otx3,  cx1,cx2,cx3
Dim As Double ibx1,ibx2,ibx3,obx1,obx2,obx3
Dim As Double ity1,ity2,ity3,oty1,oty2,oty3,  cy1,cy2,cy3
Dim As Double iby1,iby2,iby3,oby1,oby2,oby3

Dim As Double itc1,itc2,itc3 , ibc1,ibc2,ibc3
Dim As Double its1,its2,its3 , ibs1,ibs2,ibs3

Dim As Double otc1,otc2,otc3 , obc1,obc2,obc3
Dim As Double ots1,ots2,ots3 , obs1,obs2,obs3

Dim As Ulongint xctr=xres/2
Dim As Ulongint yctr=yres/2

Circle(xctr,yctr),10,10
Do
    For deg1 As Integer = 0 To 360 Step 1
        
        Cls
            'center axle
            Circle(xctr,yctr),10,15
            'magnet rings
            Circle(xctr,yctr),xres/3.1,12
            Circle(xctr,yctr),xres/3.8,12
            Circle(xctr,yctr),xres/2.5,10
            Circle(xctr,yctr),xres/2.9,10
            
            'sub window
            line(xres/3.1,yres/1.7)-(xres/2.4,yres/1.35),7,b
            circle(xres/2.75,yres/1.6),5,15
            'top south
            line(xres/3,yres/1.53)-(xres/2.5,yres/1.63),12
            line(xres/3,yres/1.51)-(xres/2.5,yres/1.61),12
            'bottom north
            line(xres/3,yres/1.5)-(xres/2.5,yres/1.6),10
            line(xres/3,yres/1.48)-(xres/2.5,yres/1.58),10
            'floor
            line(xres/3,yres/1.4)-(xres/2.5,yres/1.4),10
            'direction arrow
            line(xres/2.6,yres/1.51)-(xres/2.5,yres/1.48),7
            line(xres/2.8,yres/1.48)-(xres/2.5,yres/1.48),7
            line(xres/2.6,yres/1.45)-(xres/2.5,yres/1.48),7
            
            'arm one
            itc1=Cos((0+deg1-20)*rad)
            its1=Sin((0+deg1-20)*rad)
            itx1=iradius*itc1
            ity1=iradius*its1
            
            ibc1=Cos((0+deg1+20)*rad)
            ibs1=Sin((0+deg1+20)*rad)
            ibx1=iradius*ibc1
            iby1=iradius*ibs1
            
            otc1=cos((0+deg1-1)*rad)
            ots1=sin((0+deg1-1)*rad)
            otx1=oradius*otc1
            oty1=oradius*ots1
            
            obc1=cos((0+deg1+1)*rad)
            obs1=sin((0+deg1+1)*rad)
            obx1=oradius*obc1
            oby1=oradius*obs1
            
            cx1=radius1*otc1
            cy1=radius1*ots1

            Line(xctr+itx1,yctr+ity1)-(xctr+otx1*2,yctr+oty1*2),15
            Line(xctr+ibx1,yctr+iby1)-(xctr+obx1*2,yctr+oby1*2),15
            line(xctr+otx1*2,yctr+oty1*2)-(xctr+obx1*2,yctr+oby1*2),15
            Circle(xctr+cx1,yctr+cy1),ball_radius,10
            
            
            'arm two
            itc2=Cos((120+deg1-20)*rad)
            its2=Sin((120+deg1-20)*rad)
            itx2=iradius*itc2
            ity2=iradius*its2
            
            ibc2=Cos((120+deg1+20)*rad)
            ibs2=Sin((120+deg1+20)*rad)
            ibx2=iradius*ibc2
            iby2=iradius*ibs2
            
            otc2=cos((120+deg1-1)*rad)
            ots2=sin((120+deg1-1)*rad)
            otx2=oradius*otc2
            oty2=oradius*ots2
            
            obc2=cos((120+deg1+1)*rad)
            obs2=sin((120+deg1+1)*rad)
            obx2=oradius*obc2
            oby2=oradius*obs2
            
            cx2=radius1*otc2
            cy2=radius1*ots2

            Line(xctr+itx2,yctr+ity2)-(xctr+otx2*2,yctr+oty2*2),15
            Line(xctr+ibx2,yctr+iby2)-(xctr+obx2*2,yctr+oby2*2),15
            line(xctr+otx2*2,yctr+oty2*2)-(xctr+obx2*2,yctr+oby2*2),15
            Circle(xctr+cx2,yctr+cy2),ball_radius,10

            'arm three
            itc3=Cos((240+deg1-20)*rad)
            its3=Sin((240+deg1-20)*rad)
            itx3=iradius*itc3
            ity3=iradius*its3
            
            ibc3=Cos((240+deg1+20)*rad)
            ibs3=Sin((240+deg1+20)*rad)
            ibx3=iradius*ibc3
            iby3=iradius*ibs3
            
            otc3=cos((240+deg1-1)*rad)
            ots3=sin((240+deg1-1)*rad)
            otx3=oradius*otc3
            oty3=oradius*ots3
            
            obc3=cos((240+deg1+1)*rad)
            obs3=sin((240+deg1+1)*rad)
            obx3=oradius*obc3
            oby3=oradius*obs3
            
            cx3=radius1*otc3
            cy3=radius1*ots3

            Line(xctr+itx3,yctr+ity3)-(xctr+otx3*2,yctr+oty3*2),15
            Line(xctr+ibx3,yctr+iby3)-(xctr+obx3*2,yctr+oby3*2),15
            line(xctr+otx3*2,yctr+oty3*2)-(xctr+obx3*2,yctr+oby3*2),15
            Circle(xctr+cx3,yctr+cy3),ball_radius,10
Sleep 30
        
    If inkey<>"" Then End
    Next

Loop

dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Perpetual Motion Magnet Motor

Post by dodicat »

Hi Albert
Nice little line rotate you got there.
Got a bit of a fright earlier, I was messing around in here, and I can only hear the T.V. in the living room, I heard in the background something about a major space event had been dicovered, I thought it was betelgeuse, I thought it had been blown to smithereens.
Nah, it was only another star discovered, as if there weren't enough of them already.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Post by albert »

My perpetual motion magnet motor in a vacum would reach the speed of the propagation of flux.

I think when i build it i'll have to put thick metal side walls around it to keep the magnets from flying out at the speed of light maybe a counter field to counter the centrifuge force. it could be a very dangerous experiment.

I have a little concern about the possible speeds that could develop. ilke working with megavolt tesla coils in the house.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Post by dodicat »

albert wrote:
I have a little concern about the possible speeds that could develop. ilke working with megavolt tesla coils in the house.
I wouldn't worry about it Albert, Enerst Rutherford made an atom bomb for the Manhattan project in his little workshop beside his house in Manchester.
Richard
Posts: 3096
Joined: Jan 15, 2007 20:44
Location: Australia

Post by Richard »

The speed that EM waves penetrate a conductive and magnetic material is less than one metre per second. This may seem counter intuitive at first, but it is due to the back EMF or skin effect. So if you use solid metal or magnets in your perpetual motion machine they are more likely to stop it than to make it go faster.

Code: Select all

'=======================================================================
' Skin effect and speed of propagation through material
'=======================================================================
Const As Double Pi = Atan2(0, -3.14)  ' Pi = 4 * Atn(1)
Const As Double TwoPi = 2 * Pi
Const As Double C = 299792458.        ' speed of light, metre/second
Const As Double Uo = 4.e-7 * Pi       ' absolute permeability, henry/metre
Const As Double Eo = 1/(Uo * C * C)   ' absolute permittivity, farad/metre

'-----------------------------------------------------------------------
Dim As Double w     ' angular frequency
Dim As Double f     ' frequency in Hz
Dim As Double r     ' resistivity in ohm metres
Dim As Double u     ' relative permeability
Dim As Double ur    ' relative permitivity
Dim As Double d     ' depth to 1/e in metres
Dim As Double t     ' transition time in seconds
Dim As Double v     ' velocity

'-----------------------------------------------------------------------
' f = 50        ' mains frequency
 f = 60        ' USA mains frequency
' f = 400       ' aircraft power
' f = 1000      ' midband audio
' f = 1e6       ' MW radio

'-----------------------------------------------------------------------
' ur = 1        ' nonmagnetic
' ur = 150      ' silicon steel initial
' ur = 500      ' silicon steel typical
 ur = 2200     ' silicon steel maximum

'-----------------------------------------------------------------------
' r = 1.72e-8   ' Cu
r = 1.72e-8 * 7  ' silicon steel for laminations
' r = 1.00e-7   ' Fe
' r = 2.00e-1   ' Sea water
' r = 2.50e+5   ' Pure water

'-----------------------------------------------------------------------
w = TwoPi * f
u = uo * ur
d = Sqr(2*r/(w*u))
Print Using "skin depth ######.###### mm"; d * 1000
Print Using "skin depth #########.# thou"; d * 1e6 / 25.4
t = 1/(2*f)
v = d/t
Print Using " velocity  ######.###### m/sec"; v

'=======================================================================
Sleep
'=======================================================================
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Post by dodicat »

Richard wrote:The speed that EM waves penetrate a conductive and magnetic material is less than one metre per second. This may seem counter intuitive at first, but it is due to the back EMF or skin effect. So if you use solid metal or magnets in your perpetual motion machine they are more likely to stop it than to make it go faster.
Hi Richard
You havn't divulged any information on a possible magnetic field insulation yet.
Maybe you have decided to work on this independently and keep us in the dark.
But that is OK.
If you decide to use bar magnets then, as so many have pointed out so far, that you get nothing for nothing in this world, don't you think that the bar magnets might loose tesla with prolonged turning, and if they do, what do you suggest could re-magnetize them on the fly.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Post by albert »

Thanks Richard!

But i think it would travel backward of what i've shown and the repulsion magnets need to be magnetized thru thier length instead of thru their thickness.
With the south end elevated at probably at a 45 deg angle.

what if it breaks the speed of light, the axle would melt at that speed and the leading edge might start fissioning.
Richard
Posts: 3096
Joined: Jan 15, 2007 20:44
Location: Australia

Post by Richard »

@ dodicat.
You havn't divulged any information on a possible magnetic field insulation yet.
Magnetic insulators should have a zero skin depth. Put the numbers in my last program. Mu metal works OK. There are even better metal magnetic screens now, but the ultimate is a superconductive sheet. http://en.wikipedia.org/wiki/Mumetal
kinem
Posts: 87
Joined: Sep 24, 2008 15:55

Post by kinem »

albert wrote:"Perpetual motion motor" it doesn't work !!!
That was my point. I guess you'll have to continue trying for a while before you learn that though. That's OK, as long as you do learn it eventually :)
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Post by albert »

@Richard

The "perpetual motion magnetic motor" uses permanent magnets and has no skin effect.

The only consideration is the force of repulsion versus the force of attraction.

I think i'll use lower power 1-3lb pull alnico rings and bingo wand magnets for the spoke magnets at a 22.5 to 45 degree angle. I think the angle and height of the repulsion side will determine the maximum speed.
i'll make it so it only goes a few thousand RPM by adjusting the spoke magnets angles and height.
Locked