[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 3.20 on manjaro.testting


Le mercredi 15 janvier 2025 à 19:19 -0500, T Lee Davidson a écrit :
> On 1/15/25 1:46 PM, Philippe Valarcher wrote:
> > For fx = 20 To 100 Step 10 'to 50
> > v = CSingle((Log(fx) / Log(10) - xx1) * scaleX)
> > .Text(Format((fx / (fr / qt)), "0.0"), v, haut * 17 / 18)
> > Next
> 
> I tried your code in a VM with Manjaro Testing branch. I get a notice
> that "fr", in the above code, is an unknown symbol. I 
> don't see it or "qt" defined anywhere. What are they supposed to be?
> 
> 
As the mailing list desn't accept the test Isend you I add only the
text of my test project.
Regards
' Gambas class file

'Rem Constantes
Public Const C As Float = 344.00
Public Const Bta As Float = 1.61803398875
Public Const PO As Float = 1.1803398875
Public Const Pi As Float = 3.14159265359

Public Qb As Float
Public X1 As Float
Public q1 As Float
Public qap As Float
Public qab As Float
Public Mms As Float
Public SD As Float
Public FR As Float
Public QT As Float
Public QM As Float
Public Rcc As Float
Public Qts As Float
Public Z1 As Float

'Rem HP
Public Ds As Float
Public Led As Float
Public Ces As Float
Public Rms As Float
Public Ld As Float
Public das As Float
Public mad As Float
Public Cad As Float
Public QE As Float
Public BL As Float
Public Cms As Float
Public FA As Float
Public Ras As Float
Public Res As Float
Public Rat As Float
Public rz As Float
Public No1 As Float
Public Eff As Float
Public Var As Float
Public rs As Float

'Rem acoustiques
Public Mas As Float
Public Vas As Float
Public Las As Float
Public Sas As Float
Public Cas As Float
Public rad As Float
Public Vdd As Float
Public FD As Float
Public Qtd As Float

'Rem Enceintes
Public FB As Float
Public Lab As Float
Public Sab As Float
Public Dab As Float
Public Vab As Float
Public FP As Float
Public Lap As Float
Public Sap As Float
Public Vap As Float
Public Dap As Float
Public Fev As Float
Public Lev As Float
Public Sev As Float
Public Dev As Float
Public Vev As Float
Public Qev As Float
Public Fep As Float
Public Lep As Float
Public Sep As Float
Public Dep As Float
Public Vep As Float
Public Qep As Float
Public Fes As Float
Public Les As Float
Public Ses As Float
Public Ses1 As Float
Public Des As Float
Public Des1 As Float
Public alpha1 As Float
Public Ves As Float
Public Qes As Float
Public Mab As Float
Public Mep As Float
Public Mev As Float
Public Cab As Float
Public A As Float
Public S As Float
Public N As Float

Public couleur As Collection = New Collection
Public increment As Float
Public ro As Float
Public zmax As Float
Public k As Float
Public s1 As Float

Private Sub TrameFond()                                                          'tracé trame de fond

    Dim xx1 As Single
    Dim x2, y1, y2, fx, v As Single
    Dim scaleX, scaleY As Single
    Dim larg As Single
    Dim haut As Single

    '--------------- Zonage --------------------
    x2 = CSingle(Log10(300))
    xx1 = CSingle(Log10(10))
    y2 = CSingle(Log10(0.000000001))
    y1 = CSingle(Log10(1000000000))
    haut = CSingle(DrawingArea1.Height)
    larg = CSingle(DrawingArea1.Width)
    scaleX = CSingle((larg) / (x2 - xx1))
    scaleY = CSingle((haut) / (y2 - y1))
    '--------------------------------------------
    With Draw
        .Foreground = Color.Blue
        .Line(0, haut / 6, larg, haut / 6)
        .Line(0, haut / 3, larg, haut / 3)
        .Line(0, haut * 2 / 3, larg, haut * 2 / 3)
        .Line(0, haut * 5 / 6, larg, haut * 5 / 6)
        .Foreground = Color.Lighter(Color.DarkCyan)
        .Line(0, haut * 7 / 18, larg, haut * 7 / 18)
        .Line(0, haut * 8 / 18, larg, haut * 8 / 18)
        .Line(0, haut * 10 / 18, larg, haut * 10 / 18)
        .Line(0, haut * 11 / 18, larg, haut * 11 / 18)
        .Foreground = Color.DarkGreen
        .Text(" +6db", 0, haut / 6)
        .Text(" +3db", 0, haut / 3)
        .Text(" 0db", 0, haut / 2)
        .Text(" -3db", 0, haut * 2 / 3)
        .Text(" -6db", 0, haut * 5 / 6)
        For fx = 20 To 100 Step 10
            v = CSingle((Log(fx) / Log(10) - xx1) * scaleX)
            .Text(Format((fx), "0#"), v, haut * 16 / 18)
        Next
        .Foreground = Color.DarkGreen
        For fx = 20 To 200 Step 5 '
            v = CSingle((Log(fx) / Log(10) - xx1) * scaleX)
            .Line(v, y2, v, haut)
        Next
        For fx = 110 To 300 Step 10
            v = CSingle((Log(fx) / Log(10) - xx1) * scaleX)
            .Line(v, y2, v, haut)
        Next
        For fx = 150 To 250 Step 50
            v = CSingle((Log(fx) / Log(10) - xx1) * scaleX)
            .Text(Format((fx), "0#"), v, haut * 16 / 18)
        Next
        For fx = 25 To 35 Step 10
            v = CSingle((Log(fx) / Log(10) - xx1) * scaleX)
            .Text(Format((fx), "0#"), v, haut * 16 / 18)
        Next
        For fx = 20 To 100 Step 10 'to 50
            v = CSingle((Log(fx) / Log(10) - xx1) * scaleX)
            .Text(Format((fx / (fr / qt)), "0.0"), v, haut * 17 / 18)
        Next
        For fx = 150 To 250 Step 50
            v = CSingle((Log(fx) / Log(10) - xx1) * scaleX)
            .Text(Format((fx / (fr / qt)), "0.0"), v, haut * 17 / 18)
        Next
        v = CSingle((Log10(10.125) - xx1) * scaleX)
        .Text(("Fréquences :"), v, haut * 16 / 18)
        .Text(("Fréquences Normalisées"), v, haut * 17 / 18)
        '------- cadre rouge --------------------
        v = CSingle((Log(fr) / Log(10) - xx1) * scaleX)
        .Foreground = Color.Red
        .Line(v, haut / 6, v, haut * 5 / 6)                                     'ligne verticale
        .Line(0, haut / 2, larg, haut / 2)                                      'ligne horizontale
        .Rect(v - larg / 6, haut / 3.5, larg / 3, haut / 2.325)                 'rectangle centré en FR
        .Text("FR", v, haut / 20 * 1.25)
        .Text(Format((fr), "###"), v, haut / 20 * 1.75)
        '----------------------------------------
    End With

End

Private Sub Courbes(i As Integer)                                                'tracé des courbes enceintes

    '----------- pour la zone -------------------
    Dim xx1 As Single
    Dim x2, y1, y2, fx, v As Single
    Dim scaleX, scaleY As Single
    Dim larg As Single
    Dim haut As Single
    '------------ pour le dessin ----------------
    Dim Xcoord, Ycoord As Single
    Dim fz As Single
    Dim u2 As Single
    Dim v2 As Single
    Dim z2 As Single
    Dim r As Single
    Dim r1 As Single

    '--------- zonage de l'écran ----------------
    x2 = CSingle(Log10(300))
    xx1 = CSingle(Log10(10))
    y2 = CSingle(Log10(0.000000001))
    y1 = CSingle(Log10(1000000000))
    '--------------------------------------------
    haut = CSingle(DrawingArea1.Height)                                         'hauteur de la zone à dessin
    larg = CSingle(DrawingArea1.Width)                                          'largeur de la zone à dessin
    scaleX = CSingle(Round((larg) / (x2 - xx1)))                                'échelle X
    scaleY = CSingle(Round((haut) / (y2 - y1)))                                 'échelle Y

    With Draw
        v = CSingle((Log10(fep) - xx1) * scaleX)                                'mise à l'échelle
        .Foreground = Color.Blue
        .Line(v, haut / 6, v, haut * 5 / 6)
        v = CSingle((Log10(fev) - xx1) * scaleX)                                'mise à l'échelle
        .Foreground = Color.Blue
        .Line(v, haut / 6, v, haut * 5 / 6)
    End With

    Draw.Font.Name = "Default"
    '------ les courbes elles mêmes -------------
    For fx = 10 To 300 Step 0.05                                                'zone du graphique limitée à 300hz
        fz = fx
        u2 = CSingle(-fz ^ 3 * (fr / Qep + fb / qb) + fz * (fb * fr ^ 2 / qb + fb ^ 2 * fr / qep))
        v2 = CSingle((fb * fr) ^ 2 + fz ^ 4 - fz ^ 2 * (a * fr ^ 2 + fr ^ 2 + fb * fr / (qb * qep) + fb ^ 2))
        z2 = CSingle(Sqr(u2 ^ 2 + v2 ^ 2))
        r = CSingle(20 * Log(fz ^ 4 / z2))
        r1 = CSingle(r / Log(10))
        xcoord = CSingle((Log(fz) / Log(10) - xx1) * scaleX)                    'coordonnées X à dessiner
        ycoord = CSingle((r / Log(10) - y1) * scaleY)                           'coordonnées Y à dessiner
        If ycoord > haut Then
            Goto truc                                                           'pour éviter de sortir du cadre
        End If
        Draw.Foreground = couleur[i]
        Draw.Line(CInt(xcoord), CInt(ycoord), CInt(xcoord), CInt(ycoord))       'trace de chaque point pour former une ligne
    truc:                                                                       'l'étiquette pour ne pas dessiner de qui sort
    Next

Catch
    Message.info(Error.text & "  Courbes(i)")

End

Public Sub DrawingArea1_Draw()

    Dim i As Integer
    '------------ l'évènement dessin ------------
    i = 0
    Draw.Begin(DrawingArea1)
    TrameFond()
    courbes(i + 1)
    Draw.end
    '--------------------------------------------

End

Public Sub Form_Resize()

    '-- cette partie peut être réactivée pour tester --
    ' DrawingArea1.Clear
    ' Draw.Begin(DrawingArea1)
    ' TrameFond()
    ' Draw.end
    '--------- et la suivante commentée ---------------
    mnuVAB_Click()

End

Public Sub mnuVAB_Click()                                                       'pour un VAB donné

    Dim i, p As Integer

    DrawingArea1.Clear
    Draw.Begin(DrawingArea1)
    TrameFond()

    For p = 0 To 6
        qb = bta ^ 4
        qes = 1 / bta ^ (-4)
        Select Case p
            Case 0
                z1 = Bta ^ -2
            Case 1
                z1 = Bta ^ -1.5
            Case 2
                z1 = Bta ^ -1
            Case 3
                z1 = Bta ^ -0.5
            Case 4
                z1 = Bta ^ 0
            Case 5
                z1 = Bta ^ 0.5
            Case 6
                z1 = Bta ^ 1
        End Select
        qts = qtd * Sqr(z1 / (qb * qes))
        CalculsHP()
        CalculsEnc()
        increment = p + 1.25
        i += 1
        courbes(i)
    Next
    Draw.end

End

Public Sub DrawingArea1_MouseDown()

    If Mouse.Left Then
        mnuVAB_Click
    Endif
    If Mouse.Right Then
        DrawingArea1.Clear
        Draw.Begin(DrawingArea1)
        TrameFond()
        Draw.end
    Endif
    If Mouse.Middle Then

    Endif

End

Public Sub Form_Open()

    '------ Les Couleurs des courbes ------------
    couleur.Add(Color.Black, 0)
    couleur.Add(Color.Blue, 1)
    couleur.Add(Color.Red, 2)
    couleur.Add(Color.DarkYellow, 3)
    couleur.Add(Color.Magenta, 4)
    couleur.Add(Color.Orange, 5)
    couleur.Add(Color.DarkCyan, 6)
    couleur.Add(Color.Purple, 7)
    couleur.Add(Color.DarkGreen, 8)
    couleur.Add(Color.Gray, 9)
    '------ un hp arbitraire Pour la démo---------
    sd = 0.085
    fr = 50
    mms = 0.054085
    qt = 0.5203
    qm = 9.64
    rcc = 5.2
    qts = qt
    '---------------------------------------------

End

Private Sub CalculsHP()                                                         'Calculs hautparleur

    sd = sd / (1) ^ 0.5
    cms = 1 / ((2 * Pi * fr) ^ 2 * mms)
    qe = qm / ((qm / qt) - 1)
    bl = (2 * Pi * fr * mms * rcc / qe) ^ (1 / 2)
    fa = bl / mms
    mas = mms / sd ^ 2
    vas = po * c ^ 2 / ((2 * Pi * fr) ^ 2 * mas)
    vdd = mms / po
    cad = vdd / (po * c ^ 2)
    fd = po * c * sd / (2 * Pi * mms)
    ld = c / (2 * Pi * fd)
    mad = po * ld / sd
    qtd = (vdd / vas) ^ 0.5
    las = c / (2 * Pi * fr)
    sas = po * c / (2 * Pi * fr * mas)
    das = (4 * sas / Pi) ^ (1 / 2)
    cas = vas / (po * c ^ 2)
    ds = (4 * sd / Pi) ^ 0.5
    no1 = fr ^ 3 * vas * 0.0000009599999 / qe * 100
    eff = 10 * Log(no1 / 0.065) / Log(10) + 80
    rad = 1 / (2 * Pi * cas * fr * qt)
    var = ds ^ 4 / (po * mms)
    ro = qm / qt
    rs = 1 + bl ^ 2 * qt / qtd / rcc / po / c / sd
    zmax = ro * rcc
    led = bl ^ 2 / sd ^ 2 * cas
    ces = sd ^ 2 / bl ^ 2 * mas
    rms = 2 * Pi * fr * mms / qm
    ras = rms / sd ^ 2
    res = bl ^ 2 / rms
    rat = 1 / (2 * Pi * fr * cas * qt)
    rz = 1 / (2 * Pi * fr * cas * qt) - ras

End

Private Sub CalculsEnc()                                                         'cacluls enceintes

    qts = qt
    x1 = 1 / (qb) ^ 0.5
    fb = fr * x1 / qts
    lab = c / (2 * Pi * fb)
    mab = z1 * mas
    sab = po / mab * lab
    dab = (4 * sab / Pi) ^ 0.5
    vab = lab * sab
    cab = vab / (po * c ^ 2)
    s = qb / z1
    a = vas / vab
    alpha1 = bta ^ -2 / qtd ^ 2
    N = Logp(a * qb) / Logp(bta)
    fp = fr / qts
    lap = c / (2 * Pi * fp)
    sap = po / mab * lap
    dap = (4 * sap / Pi) ^ 0.5
    vap = lap * sap
    lep = lap
    lev = lab
    k = 2 * Pi / (po * c) * fr * mms
    ses = k / (a * qtd ^ 2)
    Ses1 = k / (alpha1 * qtd ^ 2)
    Des1 = (4 * ses1 / Pi) ^ 0.5
    vep = vdd
    sep = vep / lep
    mep = po * lep ^ 2 / vep
    dep = (4 * sep / Pi) ^ 0.5
    fep = c / (2 * Pi * lep)
    qep = fr / fep
    q1 = sap / sep
    qap = qep / q1
    qab = qtd * sd / sab
    vev = vap
    fev = c / (2 * Pi * lev)
    sev = vev / lev
    mev = po * lev ^ 2 / vev
    dev = (4 * sev / Pi) ^ 0.5
    qev = 2 * Pi * fr * mms / (po * 344 * sev)
    s1 = 1 / (2 * qts * a ^ 0.5)
    des = (4 * ses / Pi) ^ 0.5
    qes = qtd ^ 2 * a

End

Follow-Ups:
Re: 3.20 on manjaro.testtingT Lee Davidson <t.lee.davidson@xxxxxxxxx>
References:
3.20 on manjaro.testtingPhilippe Valarcher <philippe.valarcher@xxxxxxx>
Re: 3.20 on manjaro.testtingT Lee Davidson <t.lee.davidson@xxxxxxxxx>