Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ARRAY declaration in GOSUB routines.
#7
(02-04-2024, 06:13 PM)bplus Wrote:
(02-04-2024, 04:52 PM)bartok Wrote:
(02-04-2024, 03:40 PM)bplus Wrote: A Gosub is part of the main or subroutine as they share variables with the main or subroutine depending where they reside but they are put off into their own little private corner to run a repetitious bit of code over and over without interferring with the main or subroutine.

That is one main difference between a Gosub and "real" sub or function, the GoSub uses or shares variables with the main or subroutine it resides in. A "real"  sub or function uses it's own set of variables different from the Main code set of variables. The other difference is that a "real" sub or function can have variables shared with main through the call eg, mySub var1, var2, ... whereas you only call a Gosub: myGosub the name alone.

A variables or array declaration section in a GOSUB can be moved to the top of Main or Subroutine and should be so you don't redeclare the variables and arrays each time the gosub is used by the main or subroutine, that's redundant and inefficient.

And another difference between a GoSub and a "Real" sub or function: The "real" subs or functions can be called by either another sub or function, the main program or even by a gosub part of main or subroutine. "Real" subs or functions are like completely independent little programs, you can even copy then and use them in other programs! That's the beauty of a really good Sub or Function and thus you can build Libraries of Subs and Functions, say for advanced array handling or file stuff or even GUI's or little interpreters.
I dont' have understood you answer, compared to my question. I try to be clearer. I know the difference between the real SUB, that is generally CALLed by mean of CALL (even if in QB64 is not compulsory, but I use CALL) and the "sub" called by GOSUB. And I think to have clear the way in which the values are passed in a SUB, as I know that a "sub" in a kind of extention of the code, with which it shares all.
What I thought was that in a SUB, a "sub" called by means of GOSUB works - into the SUB - in exactly the same way in which works a "sub" called by means of GOSUB, into the main code of the program . As to say, I thought that - into a SUB - a "sub" caled by means of GOSUB shares automatically all that was declared into the main code of the SUB.

Returning to the example, let's take a look at this:

Case A)<------------------------------------------

OPTION _EXPLICIT
'[variables declaration]
'[arrays declaration]
[main code of the program in which variables and arrays declared are not used]
GOSUB test:
END
test:
[variable declaration]
[arrays declaration]
[code of the "sub" in which variables and arrays declared are used]
RETURN

In this case (A), the program works in both ways: declaration at the beginning, or declaration into the "sub"


Case B)<------------------------------------------

OPTION _EXPLICIT
[main code]
CALL subroutine
END

SUB subroutine
[variable declaration of the SUB]
'[arrays declaration of the SUB]
[main code of the SUB in which variables and arrays declared are not used]
GOSUB test:
test:
'[variable declaration of the SUB]
[arrays declaration of the SUB]
[code of the "sub" in which variables and arrays declared are used]
RETURN
END SUB

In this case (B), it doesn't work in both ways:
[variable declaration of the SUB]: it can be at the beginning of the SUB, or at the beginning of the "sub", it's the same.
[arrays declaration of the SUB]: it works only if it is at the beginning of the "sub". If I put it at the beginning of the SUB, I get an OUT OF RANGE error. Not error about OPTION _EXPLICIT.

I'd like to see the code you are saying you can't declare the array right at the beginning and MUST declare it in the GoSub. I strongly suspect something else is going on that you might be misinterpreting that the array MUST be declared after the GOSUB line label ??? You got me really curious Smile Don't get me wrong if you don't use the array elsewhere in the sub or main code that the GoSub is in, it would likely work. But really let's see a real example.

I could make one up but it would either be irrelevant to you, not understandable or completely trivial. So let's see what specific example you are seeing this, please.

Ok. The code you will see is quite long. But you have to focus on SUBroutine "CalcolaIdrogramma".
More precisely, look at the lines 1754 to 1756, of the "sub" "interpola:" of the SUB:

Code: (Select All)
DIM costruisci(50, 2) AS idrogramma
DIM k(2) AS idrogramma
DIM x%(2)

If I comment (') them and I copy them at the line 1670 (where there is the declaration of variables and arrays of the SUB), then I get an OUT OF RANGE error, while OPTION _EXPLICIT STILL gives no errors.

In order to see the error, you must activate this part of the code.
In order to do that, you can do the following:
1. at the first request of INPUT, type 123, then press return: this activates the hidden default inputs I use for debug;
2. then press 2;
3. the press right arrow;
4. then press 2 (for example) at the input "ore:" then press return;
5. then press return at the input "minuti:".

Then you see an animation. Finished the amination, you have the error.

That's the code:
Code: (Select All)
'**************************************************************************************************************************************************
'*                                    Calcolo dell'idrogramma di piena di progetto tramite il metodo SCS-CN                                      *
'*                                                            - ing. Carlo BARTOLINI -                                                          *
'**************************************************************************************************************************************************
'*                                                        Inizio sezione principale codice                                                      *
'**************************************************************************************************************************************************

OPTION BASE 1
OPTION _EXPLICIT
_SCREENMOVE -3, 0
_ALLOWFULLSCREEN _STRETCH , _SMOOTH
_FULLSCREEN _STRETCH , _SMOOTH
_TITLE "Calcolo dell'idrogramma di piena di progetto tramite il metodo SCS-CN - ing. Carlo BARTOLINI"

TempiRitorno:
DATA 0,2,5,10,20,50,100,200,500,1000
DATA 1,0.82,1.24,1.46,1.69,2.04,2.34,2.70,3.22,3.64
CoefficientiIdrogrammaUnitarioMockus:
DATA 0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3,3.1,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4,4.1,4.2,4.3,4.4,4.5,4.6,4.7,4.8,4.9,5
DATA 0.03,0.1,0.19,0.31,0.47,0.66,0.82,0.93,0.99,1,0.99,0.93,0.86,0.78,0.68,0.56,0.46,0.39,0.33,0.28,0.244,0.207,0.177,0.147,0.127,0.107,0.092,0.077,0.066,0.055,0.048,0.04,0.035,0.029,0.025,0.021,0.018,0.015,0.013,0.011,0.009,0.008,0.007,0.006,0.006,0.005,0.004,0.003,0.001,0
CoefficientiDiscretizzazioneTemporale:
DATA 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32
DATA 0.1,0.2,0.3,0.2,0.3,0.3,0.3,0.3,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,1,1,1,1,1,1,1,1

TYPE mockus
    tSUta AS SINGLE
    qSUqp AS SINGLE
END TYPE
TYPE CoefficientiDiscretizzazioneTemporale
    N AS INTEGER
    tSUta AS SINGLE
END TYPE
TYPE TempiRitorno
    T AS INTEGER
    k AS SINGLE
END TYPE
TYPE matrice1
    mdt AS SINGLE
    h1 AS SINGLE
    i1 AS SINGLE
    i2 AS SINGLE
    DH AS SINGLE
    H2 AS SINGLE
    he AS SINGLE
    Dhe AS SINGLE
    tSUta AS SINGLE
    qSUqp AS SINGLE
    tmSUta AS SINGLE
    qmSUqp AS SINGLE
    qm AS SINGLE
END TYPE
TYPE idrogramma
    i AS _BYTE
    ore AS SINGLE
    portata AS SINGLE
END TYPE
TYPE composizione
    grafico AS LONG
    composizione AS LONG
END TYPE

CONST R& = _RGB32(255, 0, 0)
CONST G& = _RGB32(0, 255, 0)
CONST B& = _RGB32(0, 0, 255)
CONST bianco& = _RGB32(255, 255, 255)
CONST giallo& = _RGB32(255, 255, 0)
CONST grigio& = _RGB32(127, 127, 127)
CONST azzurro& = _RGB32(0, 255, 255)
CONST pastello& = _RGB32(183, 150, 139)
CONST viola& = _RGB32(255, 0, 255)
CONST trasparente& = _RGB32(0, 0)
CONST LarghezzaColonna%% = 8

DIM SHARED i%, n%%, z%%
DIM SHARED dx!, dy!
DIM SHARED dx%, dy%

REDIM _PRESERVE FineColonna%(1)
REDIM _PRESERVE IdroPixel1(1) AS idrogramma
REDIM _PRESERVE IdroPixel2(1) AS idrogramma
REDIM _PRESERVE idrogramma1(1) AS idrogramma
REDIM _PRESERVE idrogramma2(1) AS idrogramma

DIM mockus(50) AS mockus
DIM CoefficientiDiscretizzazioneTemporale(24) AS CoefficientiDiscretizzazioneTemporale
DIM TempiRitorno(10) AS TempiRitorno
DIM matrice1(2, 24, 50, 1) AS matrice1
DIM idrogrammi1a24(2, 24, 50, 1) AS idrogramma
DIM MassimiIdrogrammi1a24(2, 24, 1) AS idrogramma
DIM MassimiAssolutiIeto(2) AS idrogramma
DIM FinePioggiaIdrogrammi1a24(2, 24, 1) AS idrogramma
DIM FinePioggiaIdrogrammi1e2(2) AS idrogramma
DIM MinimiMatriciQuadrante1(2, 24, 1) AS idrogramma
DIM MinimiMatriciQuadrante2(2, 24, 1) AS idrogramma
DIM MassimiQuadrante2(2, 24, 1) AS idrogramma
DIM ComplessivoIeto1e2(2) AS composizione
DIM idrogramma1e2(2) AS composizione
DIM MatriciIeto1e2&(2, 24)
DIM matrice2!(2, 24, 50, 50)
DIM ore!(3), portata!(3)
DIM PassiFinePioggia1a24%%(24)
DIM interrompi~`(2)
DIM IdroMaxieto%%(2)
DIM inputs$(8)
DIM OriginaleGrafico&
DIM schermo&
DIM unitari&
DIM quadro&
DIM colore&
DIM istoX!
DIM DESKTOPWIDTH%, DESKTOPHEIGHT%
DIM L%, H%
DIM posizione%
DIM y%
DIM ieto%%
DIM VisualizzaIeto%%
DIM soglia%%
DIM tipo%%
DIM PosizioneCursore%%
DIM p%%
DIM test~`
DIM esc~`, riavvio~`, menu~`, TornaAlGrafico~`
DIM T$
DIM testo$
DIM KeyPress$
DIM TerminaSalvataggio$

DIM k! '[-] coeff. della curva di possibilità climatica del Centro Funzionale della Regione.        ¿
DIM a1! '[mm/d^n] coeff. della curva di possibilità climatica.                                      ³
DIM n1! '[-] coeff. della curva di possibilità climatica.                                            ³
DIM A2& '[mq] superficie bacino idrografico.                                                        ³ input iniziali chiesti dal programma all'utente.
DIM L~% '[m] lunghezza asta p                                                                        ³
DIM s1! '[%] pendenza media del bacino.                                                              ³
DIM CNII%% '[-] Curve Number.                                                                        ³
DIM CoeffPerditeIniziali! '                                                                          Ù
DIM CNIII! '[-] 'terreno umido.                                                                      ¿
DIM tl! '[ore] tempo di ritardo.                                                                    ³
DIM S2! '[mm] contenuto idrico massimodel terreno.                                                  ³
DIM Ia! '[mm] perdite iniziali.                                                                      ³
DIM tc! '[ore] tempo di corrivazione                                                                ³ dati immediatamente discendenti dagli input iniziali, che fungono da input interni al programma per le elaborazioni.
DIM ta! '[ore] tempo di picco.                                                                      ³
DIM qp! '[mc/s] portata al colmo dell'idrogramma unitario.                                          ³
DIM dt!(24) 'guardare ***. memorizza il passo temporale utilizzato in ciascuno dei 24+24 idrogrammi. ³
'            è costituito da un unico vettore perché dt!rimane invariato nel caso di ietogramma      ³
'            Chicago o costante.                                                                    Ù

DO
    CLEAR
    DESKTOPWIDTH% = _DESKTOPWIDTH
    DESKTOPHEIGHT% = _DESKTOPHEIGHT
    'DESKTOPWIDTH% = 1920 'risoluzione dello schermo su cui è stato creato il programma (ALPHA).
    'DESKTOPHEIGHT% = 1080
    'DESKTOPWIDTH% = 3840 'valore molto superiore ad ALPHA.
    'DESKTOPHEIGHT% = 2160
    'DESKTOPWIDTH% = 2650 'valore superiore ad ALPHA.
    'DESKTOPHEIGHT% = 1440
    'DESKTOPWIDTH% = 1366 'valore intermedio tra ALPHA e il limite inferiore della risoluzione dello schermo in pixel per il funzionamento del programma.
    'DESKTOPHEIGHT% = 768
    'DESKTOPWIDTH% = 1280 'limite inferiore della risoluzione dello schermo in pixel per il funzionamento del programma.
    'DESKTOPHEIGHT% = 720
    'DESKTOPWIDTH% = 1024 'valore sotto il limite inferiore della risoluzione dello schermo in pixel per il funzionamento del programma.
    'DESKTOPHEIGHT% = 768
    IF DESKTOPWIDTH% <= 2650 THEN
        IF DESKTOPWIDTH% < 1280 THEN
            esc~` = 1
            PRINT "Il programma Š incompatibile con schermi larghi meno di 1280 pixel."
            PRINT "Questo schermo Š largo"; DESKTOPWIDTH%; "pixel."
            PRINT "Premere un tasto per uscire."
            BEEP
            SLEEP
            EXIT DO
        END IF
    ELSE
        DESKTOPWIDTH% = 2650
        DESKTOPHEIGHT% = 1440
    END IF
    L% = DESKTOPWIDTH%: H% = L% \ 1.62
    RESTORE TempiRitorno
    FOR i% = 1 TO 20
        IF i% <= 10 THEN READ TempiRitorno(i%).T
        IF i% > 10 THEN READ TempiRitorno(i% - 10).k
    NEXT i%
    RESTORE CoefficientiIdrogrammaUnitarioMockus
    FOR i% = 1 TO 100
        IF i% <= 50 THEN READ mockus(i%).tSUta
        IF i% > 50 THEN READ mockus(i% - 50).qSUqp
    NEXT i%
    RESTORE CoefficientiDiscretizzazioneTemporale
    FOR i% = 1 TO 48
        IF i% <= 24 THEN READ CoefficientiDiscretizzazioneTemporale(i%).N
        IF i% > 24 THEN READ CoefficientiDiscretizzazioneTemporale(i% - 24).tSUta
    NEXT i%
    DO
        menu~` = 0
        VisualizzaIeto%% = 0
        inizio:
        IF _DIREXISTS(".\RisultatiQB64") THEN
            ON ERROR GOTO cancel1
            KILL (".\RisultatiQB64\*.*")
            ON ERROR GOTO cancel2
            RMDIR (".\RisultatiQB64")
        END IF
        ON ERROR GOTO 0
        ERASE idrogrammi1a24, MassimiIdrogrammi1a24, FinePioggiaIdrogrammi1a24, MassimiAssolutiIeto, IdroMaxieto%%, FinePioggiaIdrogrammi1e2, PassiFinePioggia1a24%%, IdroPixel1, IdroPixel2, idrogramma1, idrogramma2, dt!,_
        matrice1, matrice2!, MinimiMatriciQuadrante1, MinimiMatriciQuadrante2, MassimiQuadrante2
        FOR ieto%% = 1 TO 2
            ComplessivoIeto1e2(ieto%%).grafico = _NEWIMAGE(L% - 48 * 8, H%, 32)
            ComplessivoIeto1e2(ieto%%).composizione = _NEWIMAGE(L%, H%, 32)
            idrogramma1e2(ieto%%).grafico = _NEWIMAGE(L% - 59 * 8, H%, 32)
            idrogramma1e2(ieto%%).composizione = _NEWIMAGE(L%, H%, 32)
            FOR z%% = 1 TO 24
                MatriciIeto1e2&(ieto%%, z%%) = _NEWIMAGE(L%, H%, 32)
            NEXT z%%
        NEXT ieto%%
        schermo& = _NEWIMAGE(DESKTOPWIDTH%, DESKTOPHEIGHT%, 32)
        unitari& = _NEWIMAGE(L%, H%, 32)
        quadro& = _NEWIMAGE(L% - 97 * 8, H% \ 2, 32)
        SCREEN schermo&
        CLS
        COLOR giallo&: PRINT "        C A L C O L O  D E L L ' I D R O G R A M M A  D I  P I E N A  D I  P R O G E T T O  T R A M I T E  I L  M E T O D O  S C S - C N"
        COLOR grigio&: PRINT "                                                      -  I N G .  C A R L O  B A R T O L I N I  -"
        COLOR bianco&
        PRINT "Questo programma permette di calcolare:"
        PRINT "- l'idrogramma di piena di progetto (e relativa portata di picco);"
        PRINT "- se voluto, l'idrogramma di piena corrispondente ad un'ora di picco a scelta,"
        PRINT "per un dato tempo di ritorno tramite l'idrogramma unitario adimensionale di Mockus,il metodo afflussi-deflussi SCS-CN, ietogrammi "; CHR$(34); "Chicago"; CHR$(34); " e "; CHR$(34); "costanti"; CHR$(34); "."
        PRINT "Sar… possibile scegliere se visualizzare i risultati in base a l'uno o all'altro tipo di ietogrammi, ma saranno calcolati entrambi i casi e il programma,"
        PRINT "dopo l'elaborazione e premendo ESC o al suo termine, chieder… se si desidera salvare tutto nella seguente directory:"
        PRINT
        COLOR G&: PRINT _CWD$; "\RisultatiQB64";: COLOR bianco&: PRINT "."
        PRINT
        PRINT "Nel caso si vogliano salvare i risultati,Š consigliato che il programma si trovi sul computer locale,nel qual caso l'operazione di salvataggio richieder…"
        PRINT "pochi  secondi o 1-2 minuti, a  seconda che  si salvino  solo i tabulati o anche le immagini. Da rete, invece, possono  occorrere molti minuti solo per i"
        PRINT "tabulati."
        PRINT "I file salvati saranno di 3 tipi:"
        PRINT "- immagini dei grafici, con estensione "; CHR$(34); "BMP"; CHR$(34); ";"
        PRINT "- tabulati, con estensione "; CHR$(34); "CSV"; CHR$(34); ". Possono essere aperti con  Excel, ma per essere visualizzati correttamente, nelle impostazioni di Windows il separatore"
        PRINT "  dell'elenco dev'essere la virgola. Le celle dei fogli di lavoro dei file relativi al calcolo di ogni idrogramma contengono le formule,per cui in essi Š"
        PRINT "  esemplificata la procedura di calcolo del programma stesso;"
        PRINT "- un file con estensione "; CHR$(34); "TXT"; CHR$(34); " in cui Š riportato il codice del programma commentato, comprese le procedure di calcolo."
        PRINT
        PRINT "Rieseguendo o riavviando il programma [TAB], o tornando al menu degli input qui  di seguito [F1], la directory "; CHR$(34); "RisultatiQB64"; CHR$(34); " sar… cancellata, quindi se"
        PRINT "s'intende preservarne il contenuto, sar… prima necessario o rinominarla o spostarla."
        PRINT "---------------------------------------------------------------------------------------------------------------------------------------------------------"
        PRINT "Di seguito,si dovranno inserire i valori della curva di possibilit… climatica "; CHR$(34); "h = Ktúaúd^n"; CHR$(34); ". Se si dispone dei valori del Centro Funzionale, digitare il"
        PRINT "valore "; CHR$(34); "Kt"; CHR$(34); " relativo al  tempo di ritorno "; CHR$(34); "T"; CHR$(34); " d'interesse, con i relativi valori "; CHR$(34); "a"; CHR$(34); " e "; CHR$(34); "n"; CHR$(34); ". Se invece si ha una propria curva di possibilit… climatica,in"
        PRINT "corrispondenza di "; CHR$(34); "Kt"; CHR$(34); ", digitare "; CHR$(34); "INVIO"; CHR$(34); ", o "; CHR$(34); "1"; CHR$(34); ".In tal caso "; CHR$(34); "Kt"; CHR$(34); " sar… considerato pari a "; CHR$(34); "1"; CHR$(34); " e "; CHR$(34); "T"; CHR$(34); " come "; CHR$(34); "definito dall'utente"; CHR$(34); "."
        PRINT
        PRINT "- Kt [-] (INVIO per 1)                                            = "
        PRINT "- a [mm/d^n]                                                      = "
        PRINT "- n [-] (0ö1)                                                    = "
        PRINT "- Area in pianta del bacino idrografico [mý] (>=1)                = "
        PRINT "- Lunghezza dell'asta principale del bacino idrografico [m] (>=1) = "
        PRINT "- Pendenza media del bacino idrografico [%] (>=1)                = "
        PRINT "- CN(II) [-] (1ö100)                                              = "
        PRINT "- Coefficiente delle perdite inziali [-] (0ö0.2 - INVIO per 0.1)  = "
        LOCATE CSRLIN + 2,
        COLOR giallo&: PRINT "  [ESC]: esci; [TAB]: riavvia.": COLOR bianco&
        CALL InserimentoDati(k!, a1!, n1, A2&, L~%, s1!, CNII%%, CoeffPerditeIniziali!)
        IF esc~` = 1 OR riavvio~` = 1 THEN EXIT DO
        LOCATE PosizioneCursore%% + 9, 1
        COLOR giallo&
        PRINT "  [1]: visualizza i risultati basati sugli ietogrammi Chicago; [2]: visualizza i risultati basati sugli ietogrammi costanti;"
        PRINT "  [ESC]: esci; [TAB]: riavvia; [F1]: torna agli input iniziali."
        COLOR bianco&
        DO
            _LIMIT 30
            KeyPress$ = INKEY$
        LOOP UNTIL KeyPress$ = "1" OR KeyPress$ = "2" OR KeyPress$ = CHR$(27) OR KeyPress$ = CHR$(9) OR KeyPress$ = CHR$(0) + CHR$(59)
        SELECT CASE KeyPress$
            CASE "1", "2"
                VisualizzaIeto%% = VAL(KeyPress$)
                CNIII! = (23 * CNII%%) / (10 + 0.13 * CNII%%) '                                                  ¿
                tl! = 0.342 * ((L~% / 1000) ^ 0.8 / s1! ^ 0.5) * (1000 / CNIII! - 9) ^ 0.7 '* formula di Mockus. ³ dati immediatamente discendenti dagli input iniziali, che fungono da input interni al programma per le elaborazioni.
                S2! = 25.4 * (1000 / CNIII! - 10) '*                                                            ³
                Ia! = CoeffPerditeIniziali! * S2! '* coeff.=0.03-0.2. 'perdite iniziali                          ³ *  La sistemazione dei bacini montani - Vito Ferro - Seconda edizione - cap. 3.4.7. "Il metodo SCS" - pp. 195-205.
                tc! = tl! / 0.6 '**                                                                              ³
                ta! = tl! / 0.9 '*                                                                              ³ ** ibid. cap. 3.4.4. "Il tempo di corrivazione di un bacino" - p. 188.
                qp! = 0.208 * ((A2& / 1000000) / ta!) '*                                                        Ù
                FOR ieto%% = 1 TO 2
                    interrompi~`(ieto%%) = 0
                    continua1:
                    IF interrompi~`(1) = 1 THEN IF ieto%% = 1 THEN _CONTINUE
                    continua2:
                    IF interrompi~`(2) = 1 THEN EXIT FOR
                    ON ERROR GOTO salta
                    FOR z%% = 1 TO 24
                        GOSUB CalcolaMatriciIeto1e2
                        GOSUB DisegnaMatriciIeto1e2
                    NEXT z%%
                    IF interrompi~`(ieto%%) = 0 THEN GOSUB DisegnaComplessivoIeto1e2
                NEXT ieto%%
                ON ERROR GOTO 0
                GOSUB TerminaSeErrore
                IF esc~` = 1 OR riavvio~` = 1 THEN EXIT SELECT
                GOSUB DisegnaUnitari
                _DEST schermo&
                PRINT
                PRINT "-------------------------------------";: COLOR G&: PRINT " E' STATO SCELTO DI VISUALIZZARE I RISULTATI RELATIVI AGLI IETOGRAMMI ";
                IF VisualizzaIeto%% = 1 THEN
                    PRINT "CHICAGO  ";
                ELSE
                    PRINT "COSTANTI ";
                END IF
                COLOR bianco&: PRINT "-------------------------------------"
                PRINT
                PRINT "Nella pagina successiva  sar… possibile visualizzare 24 idrogrammi di piena con  relative portate di picco, per durate  della pioggia  fino a 32 volte il"
                PRINT "tempo di corrivazione, insieme alla spezzata (in";: COLOR giallo&: PRINT " giallo";: COLOR bianco&: PRINT ") congiungente le portate di picco."
                PRINT "Per determinare l'idrogramma di progetto e relativa portata di picco, sar… possibile avvalersi dei suddetti risultati (per esempio tramite Excel), oppure"
                PRINT "proseguire su questo programma."
                PRINT
                SELECT CASE VisualizzaIeto%%
                    CASE IS = 1
                        PRINT "In tal caso, il programma chieder… 2 input:"
                        PRINT "- una soglia percentuale S, per il calcolo dell'idrogramma di progetto."
                        PRINT "  Per esempio, scrivendo 10%, viene verificato se, sulla spezzata gialla, la portata di picco corrispondente all'ora 1 aumentata del 10%, Š minore  della"
                        PRINT "  portata di picco corrispondente all'ora 2. Se Š minore, l'algoritmo prosegue finch‚ non trova la portata di picco di un'ora "; CHR$(34); "i"; CHR$(34); " che, aumentata del 10%,"
                        PRINT "  risulta maggiore della portata di picco dell'ora "; CHR$(34); "i+1"; CHR$(34); ". Sar… considerato come idrogramma di progetto quello  relativo all'ultima ora la cui  portata di"
                        PRINT "  picco risulta essere superiore alla portata di picco dell'ora precedente aumentata del 10%."
                        PRINT "  Qualora la soglia percentuale  digitata sia troppo bassa per determinare, nel corso  delle iterazioni, un superamento  della  portata di picco dell'ora"
                        PRINT "  successiva, viene computato, come idrogramma di progetto, quello che presenta la massima portata di picco tra i 24 calcolati;"
                        PRINT "- un'ora di picco a scelta, di cui viene calcolata la corrispondente portata di picco e relativo idrogramma."
                    CASE IS = 2
                        PRINT "In tal caso, il programma chieder… 1 input:"
                        PRINT "- un'ora di picco a scelta, di cui viene calcolata la corrispondente portata di picco e relativo idrogramma."
                        PRINT "Come idrogramma di progetto, Š computato quello che presenta la massima portata di picco tra i 24 calcolati."
                END SELECT
                PRINT
                COLOR giallo&: PRINT "  [ESC]: salva; [TAB]: riavvia; [F1]: torna agli input iniziali; []: prosegui.": COLOR bianco&
                LOCATE CSRLIN + 1,
                DO
                    _LIMIT 30
                    KeyPress$ = INKEY$
                LOOP UNTIL KeyPress$ = CHR$(27) OR KeyPress$ = CHR$(9) OR KeyPress$ = CHR$(0) + CHR$(59) OR KeyPress$ = CHR$(0) + CHR$(77)
                SELECT CASE KeyPress$
                    CASE CHR$(27)
                        esc~` = 1
                        IF VisualizzaIeto%% = 2 THEN
                            CALL CalcolaIdrogramma(MassimiIdrogrammi1a24(VisualizzaIeto%%, 24, 1).ore, idrogrammi1a24(VisualizzaIeto%%, 24, 50, 1).ore, MassimiAssolutiIeto(VisualizzaIeto%%).ore,_
                            MassimiAssolutiIeto(VisualizzaIeto%%).portata, ComplessivoIeto1e2(VisualizzaIeto%%).grafico, ComplessivoIeto1e2(VisualizzaIeto%%).composizione)
                            GOSUB DisegnaIdrogramma
                        END IF
                    CASE CHR$(9)
                        riavvio~` = 1
                    CASE CHR$(0) + CHR$(59)
                        menu~` = 1
                    CASE CHR$(0) + CHR$(77)
                        CLS
                        VIEW PRINT 1 TO 4
                        DO
                            TornaAlGrafico~` = 0
                            ERASE IdroPixel1, IdroPixel2, idrogramma1, idrogramma2
                            FOR ieto%% = 1 TO 2
                                _DEST idrogramma1e2(ieto%%).grafico: CLS
                                _DEST idrogramma1e2(ieto%%).composizione: CLS
                            NEXT ieto%%
                            GOSUB VisualizzaComplessivo
                            CALL CalcolaIdrogramma(MassimiIdrogrammi1a24(VisualizzaIeto%%, 24, 1).ore, idrogrammi1a24(VisualizzaIeto%%, 24, 50, 1).ore, MassimiAssolutiIeto(VisualizzaIeto%%).ore,_
                            MassimiAssolutiIeto(VisualizzaIeto%%).portata, ComplessivoIeto1e2(VisualizzaIeto%%).grafico, ComplessivoIeto1e2(VisualizzaIeto%%).composizione)
                            GOSUB DisegnaIdrogramma
                            GOSUB VisualizzaIdrogramma
                            IF TornaAlGrafico~` = 1 THEN _CONTINUE
                            IF esc~` = 1 OR riavvio~` = 1 OR menu~` = 1 THEN EXIT DO
                            GOSUB VisualizzaUnitari
                            IF TornaAlGrafico~` = 1 THEN _CONTINUE
                            IF esc~` = 1 OR riavvio~` = 1 OR menu~` = 1 THEN EXIT DO
                            GOSUB VisualizzaMatrici
                            IF TornaAlGrafico~` = 1 THEN _CONTINUE
                            IF esc~` = 1 OR riavvio~` = 1 OR menu~` = 1 THEN EXIT DO
                        LOOP
                END SELECT
            CASE CHR$(27)
                esc~` = 1
            CASE CHR$(9)
                riavvio~` = 1
            CASE CHR$(0) + CHR$(59)
                menu~` = 1
        END SELECT
        IF riavvio~` = 0 AND menu~` = 0 THEN
            VIEW PRINT
            CLS
            IF VisualizzaIeto%% <> 0 THEN
                IF interrompi~`(1) = 0 OR interrompi~`(2) = 0 THEN
                    esc~` = 0
                    PRINT
                    COLOR bianco&: PRINT "Si ricorda che:"
                    PRINT "-";: COLOR R&: PRINT " se il programma non si trova sul computer locale, ma in rete, il salvataggio potrebbe richiedere molti minuti";: COLOR bianco&: PRINT ";"
                    PRINT "- il salvataggio avverr… nella directory:"
                    PRINT "  ";: COLOR G&: PRINT _CWD$; "\RisultatiQB64";: COLOR bianco&: PRINT ";"
                    PRINT "- rieseguendo o riavviando il programma [TAB], o tornando  al menu degli input [F1], la  directory "; CHR$(34); "RisultatiQB64"; CHR$(34); " sar…  cancellata, quindi se  s'intende"
                    PRINT "  preservarne il contenuto, sar… prima necessario o rinominarla o spostarla;"
                    PRINT "- saranno salvati i risultati basati sugli ietogrammi sia Chicago, sia costanti;"
                    PRINT "- saranno salvati anche l'idrogramma di progetto e quello corrispondente all'ora di picco a scelta, se erano stati definiti;"
                    PRINT "- per i file di estensione "; CHR$(34); "CSV"; CHR$(34); ", affinch‚ siano visualizzati correttamente in Excel,";: COLOR R&: PRINT " Š necessario che  nelle impostazioni di Windows il separatore dello"
                    PRINT "  elenco sia la virgola";: COLOR bianco&: PRINT "."
                    PRINT
                    COLOR giallo&
                    PRINT "[1]: salva su disco tabulati e immagini (richiede pi— tempo);"
                    PRINT "[2]: salva solo tabulati;"
                    PRINT "[ESC]: esci; [TAB]: riavvia; [F1]: torna agli input iniziali."
                    PRINT
                    DO
                        _LIMIT 30
                        KeyPress$ = INKEY$
                    LOOP UNTIL KeyPress$ = "1" OR KeyPress$ = "2" OR KeyPress$ = CHR$(27) OR KeyPress$ = CHR$(9) OR KeyPress$ = CHR$(0) + CHR$(59)
                    SELECT CASE KeyPress$
                        CASE "1", "2"
                            MKDIR "RisultatiQB64"
                            CHDIR ".\RisultatiQB64"
                            COLOR bianco&: PRINT "SALVATAGGIO IN CORSO...": COLOR giallo&
                            PRINT
                            PRINT "Per interrompere cliccare su questa schermata, premere [ESC] e attendere qualche istante."
                            SHELL _CWD$
                            GOSUB Risultati
                            CHDIR "..\"
                            LOCATE CSRLIN - 3,: PRINT STRING$(125, 32): PRINT: PRINT STRING$(125, 32): LOCATE CSRLIN - 3,
                            COLOR bianco&: PRINT "FATTO.": COLOR giallo&
                            PRINT
                            PRINT "Cliccare su questa schermata e [ESC]: esci; [TAB]: riavvia; [F1]: torna agli input iniziali."
                            COLOR bianco&
                            BEEP
                            DO
                                _LIMIT 30
                                KeyPress$ = INKEY$
                            LOOP UNTIL KeyPress$ = CHR$(27) OR KeyPress$ = CHR$(9) OR KeyPress$ = CHR$(0) + CHR$(59)
                            SELECT CASE KeyPress$
                                CASE CHR$(27)
                                    esc~` = 1
                                CASE CHR$(9)
                                    riavvio~` = 1
                                CASE CHR$(0) + CHR$(59)
                                    menu~` = 1
                            END SELECT
                        CASE CHR$(27)
                            esc~` = 1
                        CASE CHR$(9)
                            riavvio~` = 1
                        CASE CHR$(0) + CHR$(59)
                            menu~` = 1
                    END SELECT
                END IF
            END IF
        END IF
        IF riavvio~` = 1 OR menu~` = 1 THEN GOSUB freeimage
    LOOP UNTIL esc~` = 1 OR riavvio~` = 1
LOOP UNTIL esc~` = 1
freeimage:
IF DESKTOPWIDTH% >= 1280 THEN
    FOR ieto%% = 1 TO 2
        _FREEIMAGE ComplessivoIeto1e2(ieto%%).grafico
        _FREEIMAGE ComplessivoIeto1e2(ieto%%).composizione
        _FREEIMAGE idrogramma1e2(ieto%%).grafico
        _FREEIMAGE idrogramma1e2(ieto%%).composizione
        FOR z%% = 1 TO 24
            _FREEIMAGE MatriciIeto1e2&(ieto%%, z%%)
        NEXT z%%
    NEXT ieto%%
    _FREEIMAGE unitari&
    _FREEIMAGE quadro&
    ON ERROR GOTO cancel1: _FREEIMAGE OriginaleGrafico&: ON ERROR GOTO 0
END IF
IF riavvio~` = 1 OR menu~` = 1 THEN RETURN
SYSTEM
'/////////////////////////////////////////////////// T E R M I N E  D E L  P R O G R A M M A ////////////////////////////////////////////////////

'**************************************************************************************************************************************************
'*                                                        Inizio sezione gestione errori                                                          *
'**************************************************************************************************************************************************

cancel1:
RESUME NEXT
cancel2:
CLS
PRINT "Almeno un file interno alla directory"
PRINT CHR$(34); _CWD$; "\RisultatiQB64"; CHR$(34)
PRINT "Š aperto in un altro programma."
PRINT "Per proseguire chiudere i file e premere un tasto."
BEEP
SLEEP
DO
    KeyPress$ = INKEY$
    PRINT ""
LOOP UNTIL KeyPress$ = ""
RESUME inizio
salta:
interrompi~`(ieto%%) = 1
IF ieto%% = 1 THEN RESUME continua1 ELSE RESUME continua2

'**************************************************************************************************************************************************
'*                                          Termine sezione gestione errori e inizio sezione routines                                            *
'**************************************************************************************************************************************************

TerminaSeErrore:

IF interrompi~`(1) = 1 THEN
    IF interrompi~`(2) = 1 THEN
        _DEST schermo&
        LOCATE 38,: PRINT STRING$(125, 32)
        PRINT STRING$(125, 32)
        LOCATE 38,: COLOR giallo&: PRINT "  I dati sono incompatibili con risultati attendibili.": COLOR bianco&
        COLOR giallo&: PRINT "  [ESC]: esci; [TAB]: riavvia.": COLOR bianco&
        DO
            _LIMIT 30
            KeyPress$ = INKEY$
        LOOP UNTIL KeyPress$ = CHR$(27) OR KeyPress$ = CHR$(9)
        SELECT CASE KeyPress$
            CASE CHR$(27)
                esc~` = 1
            CASE CHR$(9)
                riavvio~` = 1
        END SELECT
        RETURN
    END IF
END IF
IF interrompi~`(VisualizzaIeto%%) = 1 THEN
    _DEST schermo&
    LOCATE 38,
    COLOR giallo&
    IF interrompi~`(1) = 0 THEN PRINT "  I dati sono incompatibili con risultati attendibili, ma utilizzando lo ietogramma Chicago sono stati ottenuti risultati. Visualizzarli? [S/(ESC o N)]"
    IF interrompi~`(2) = 0 THEN PRINT "  I dati sono incompatibili con risultati attendibili, ma utilizzando lo ietogramma costante sono stati ottenuti risultati. Visualizzarli? [S/(ESC o N)]"
    PRINT "  [ESC]: esci; [TAB]: riavvia; [F1]: torna agli input iniziali."
    COLOR bianco&
    DO
        _LIMIT 30
        KeyPress$ = LCASE$(INKEY$)
    LOOP UNTIL KeyPress$ = "s" OR KeyPress$ = "n" OR KeyPress$ = CHR$(27) OR KeyPress$ = CHR$(9) OR KeyPress$ = CHR$(0) + CHR$(59)
    SELECT CASE KeyPress$
        CASE "s"
            IF interrompi~`(1) = 0 THEN VisualizzaIeto%% = 1
            IF interrompi~`(2) = 0 THEN VisualizzaIeto%% = 2
        CASE "n", CHR$(27)
            esc~` = 1
        CASE CHR$(9)
            riavvio~` = 1
        CASE CHR$(0) + CHR$(59)
            menu~` = 1
    END SELECT
END IF
RETURN
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
CalcolaMatriciIeto1e2:

IF ieto%% = 1 THEN
    dt!(z%%) = CoefficientiDiscretizzazioneTemporale(z%%).tSUta * ta!
    PassiFinePioggia1a24%%(z%%) = (3 * CoefficientiDiscretizzazioneTemporale(z%%).N) / (2 * CoefficientiDiscretizzazioneTemporale(z%%).tSUta)
END IF
FOR i% = 1 TO 50
    matrice1(ieto%%, z%%, i%, 1).tSUta = mockus(i%).tSUta
    matrice1(ieto%%, z%%, i%, 1).qSUqp = mockus(i%).qSUqp
    matrice1(ieto%%, z%%, i%, 1).mdt = i% * dt!(z%%)
    SELECT CASE (_ROUND(10 * (i% * CoefficientiDiscretizzazioneTemporale(z%%).tSUta))) / 10
        CASE IS <= 5
            matrice1(ieto%%, z%%, i%, 1).tmSUta = (_ROUND(10 * (i% * CoefficientiDiscretizzazioneTemporale(z%%).tSUta))) / 10
        CASE ELSE
            matrice1(ieto%%, z%%, i%, 1).tmSUta = 0
    END SELECT
NEXT i%
FOR i% = 1 TO 50
    n%% = 1
    DO
        IF matrice1(ieto%%, z%%, i%, 1).tmSUta = matrice1(ieto%%, z%%, n%%, 1).tSUta THEN
            matrice1(ieto%%, z%%, i%, 1).qmSUqp = matrice1(ieto%%, z%%, n%%, 1).qSUqp
            EXIT DO
        ELSE
            n%% = n%% + 1
        END IF
    LOOP UNTIL n%% = 50
    matrice1(ieto%%, z%%, i%, 1).qm = matrice1(ieto%%, z%%, i%, 1).qmSUqp * qp!
NEXT i%
FOR i% = 1 TO PassiFinePioggia1a24%%(z%%)
    matrice1(ieto%%, z%%, i%, 1).h1 = k! * a1! * matrice1(ieto%%, z%%, i%, 1).mdt ^ n1!
    IF i% = 1 THEN
        matrice1(ieto%%, z%%, i%, 1).i1 = matrice1(ieto%%, z%%, i%, 1).h1 / dt!(z%%)
    ELSE
        matrice1(ieto%%, z%%, i%, 1).i1 = (matrice1(ieto%%, z%%, i%, 1).h1 - matrice1(ieto%%, z%%, i% - 1, 1).h1) / dt!(z%%)
    END IF
NEXT i%
SELECT CASE ieto%%
    CASE 1
        n%% = 1
        DO
            IF z%% = 1 THEN test~` = 0: EXIT DO
            IF dt!(z%%) = dt!(z%% - n%%) THEN test~` = 1: EXIT DO
            IF n%% = z%% - 1 THEN test~` = 0: EXIT DO
            n%% = n%% + 1
        LOOP
        p%% = PassiFinePioggia1a24%%(z%%)
        i% = 0
        DO
            matrice1(ieto%%, z%%, PassiFinePioggia1a24%%(z%%) - i%, 1).i2 = matrice1(ieto%%, z%%, p%%, 1).i1
            p%% = p%% - 1
            IF test~` = 0 THEN IF p%% = 0 THEN EXIT DO
            IF test~` = 1 THEN IF p%% = PassiFinePioggia1a24%%(z%% - n%%) THEN EXIT DO
            matrice1(ieto%%, z%%, i% + 1, 1).i2 = matrice1(ieto%%, z%%, p%%, 1).i1
            p%% = p%% - 1
            i% = i% + 1
            IF test~` = 0 THEN IF p%% = 0 THEN EXIT DO
            IF test~` = 1 THEN IF p%% = PassiFinePioggia1a24%%(z%% - n%%) THEN EXIT DO
        LOOP
        IF test~` = 1 THEN
            IF matrice1(ieto%%, z%%, i%, 1).i2 = 0 THEN i% = i% - 1
            p%% = 1
            DO
                i% = i% + 1
                matrice1(ieto%%, z%%, i%, 1).i2 = matrice1(ieto%%, z%% - n%%, p%%, 1).i2
                p%% = p%% + 1
            LOOP UNTIL p%% > PassiFinePioggia1a24%%(z%% - n%%)
        END IF
    CASE 2
        FOR i% = 1 TO PassiFinePioggia1a24%%(z%%)
            matrice1(ieto%%, z%%, i%, 1).i2 = matrice1(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).h1 / matrice1(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).mdt
        NEXT i%
END SELECT
FOR i% = 1 TO PassiFinePioggia1a24%%(z%%)
    matrice1(ieto%%, z%%, i%, 1).DH = matrice1(ieto%%, z%%, i%, 1).i2 * dt!(z%%)
    IF i% = 1 THEN
        matrice1(ieto%%, z%%, i%, 1).H2 = matrice1(ieto%%, z%%, i%, 1).DH
    ELSE
        matrice1(ieto%%, z%%, i%, 1).H2 = matrice1(ieto%%, z%%, i%, 1).DH + matrice1(ieto%%, z%%, i% - 1, 1).H2
    END IF
    SELECT CASE matrice1(ieto%%, z%%, i%, 1).H2 - Ia!
        CASE IS < 0
            matrice1(ieto%%, z%%, i%, 1).he = 0
        CASE IS >= 0
            matrice1(ieto%%, z%%, i%, 1).he = (matrice1(ieto%%, z%%, i%, 1).H2 - Ia!) ^ 2 / (matrice1(ieto%%, z%%, i%, 1).H2 - Ia! + S2!)
    END SELECT
    IF i% = 1 THEN
        matrice1(ieto%%, z%%, i%, 1).Dhe = matrice1(ieto%%, z%%, i%, 1).he
    ELSE
        matrice1(ieto%%, z%%, i%, 1).Dhe = matrice1(ieto%%, z%%, i%, 1).he - matrice1(ieto%%, z%%, i% - 1, 1).he
    END IF
NEXT i%
FOR n%% = 1 TO 50
    FOR i% = n%% TO 50
        matrice2!(ieto%%, z%%, i%, n%%) = matrice1(ieto%%, z%%, i% - n%% + 1, 1).Dhe * matrice1(ieto%%, z%%, n%%, 1).qm
    NEXT i%
NEXT n%%
FOR i% = 1 TO 50
    FOR n%% = 1 TO 50
        idrogrammi1a24(ieto%%, z%%, i%, 1).portata = idrogrammi1a24(ieto%%, z%%, i%, 1).portata + matrice2!(ieto%%, z%%, i%, n%%)
    NEXT n%%
    idrogrammi1a24(ieto%%, z%%, i%, 1).ore = matrice1(ieto%%, z%%, i%, 1).mdt
NEXT i%
i% = 1
DO
    IF MassimiIdrogrammi1a24(ieto%%, z%%, 1).portata <= idrogrammi1a24(ieto%%, z%%, i%, 1).portata THEN
        MassimiIdrogrammi1a24(ieto%%, z%%, 1).portata = idrogrammi1a24(ieto%%, z%%, i%, 1).portata
        MassimiIdrogrammi1a24(ieto%%, z%%, 1).ore = idrogrammi1a24(ieto%%, z%%, i%, 1).ore
        MassimiIdrogrammi1a24(ieto%%, z%%, 1).i = i%
    ELSEIF MassimiIdrogrammi1a24(ieto%%, z%%, 1).portata > idrogrammi1a24(ieto%%, z%%, i%, 1).portata THEN EXIT DO
    END IF
    i% = i% + 1
LOOP UNTIL i% = 51
FinePioggiaIdrogrammi1a24(ieto%%, z%%, 1).ore = idrogrammi1a24(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).ore
FinePioggiaIdrogrammi1a24(ieto%%, z%%, 1).portata = idrogrammi1a24(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).portata
i% = 1
DO
    IF MassimiQuadrante2(ieto%%, z%%, 1).portata < matrice1(ieto%%, z%%, i%, 1).qm THEN
        MassimiQuadrante2(ieto%%, z%%, 1).portata = matrice1(ieto%%, z%%, i%, 1).qm
        MassimiQuadrante2(ieto%%, z%%, 1).ore = matrice1(ieto%%, z%%, i%, 1).mdt
    ELSEIF MassimiQuadrante2(ieto%%, z%%, 1).portata > matrice1(ieto%%, z%%, i%, 1).qm THEN EXIT DO
    END IF
    i% = i% + 1
LOOP
SELECT CASE idrogrammi1a24(ieto%%, z%%, 50, 1).portata
    CASE IS >= MassimiIdrogrammi1a24(ieto%%, z%%, 1).portata * 0.05
        MinimiMatriciQuadrante1(ieto%%, z%%, 1).ore = idrogrammi1a24(ieto%%, z%%, 50, 1).ore
        MinimiMatriciQuadrante1(ieto%%, z%%, 1).i = 50
    CASE IS < MassimiIdrogrammi1a24(ieto%%, z%%, 1).portata * 0.05
        i% = MassimiIdrogrammi1a24(ieto%%, z%%, 1).i
        DO
            IF idrogrammi1a24(ieto%%, z%%, i%, 1).portata < MassimiIdrogrammi1a24(ieto%%, z%%, 1).portata * 0.05 THEN
                MinimiMatriciQuadrante1(ieto%%, z%%, 1).ore = idrogrammi1a24(ieto%%, z%%, i%, 1).ore
                MinimiMatriciQuadrante1(ieto%%, z%%, 1).i = i%
                EXIT DO
            END IF
            i% = i% + 1
        LOOP
END SELECT
i% = 1
DO
    IF matrice1(ieto%%, z%%, i%, 1).qm = 0 THEN
        MinimiMatriciQuadrante2(ieto%%, z%%, 1).ore = matrice1(ieto%%, z%%, i%, 1).mdt
        MinimiMatriciQuadrante2(ieto%%, z%%, 1).i = i%
        EXIT DO
    END IF
    i% = i% + 1
LOOP
IF MassimiAssolutiIeto(ieto%%).portata < MassimiIdrogrammi1a24(ieto%%, z%%, 1).portata THEN
    MassimiAssolutiIeto(ieto%%).portata = MassimiIdrogrammi1a24(ieto%%, z%%, 1).portata
    MassimiAssolutiIeto(ieto%%).ore = MassimiIdrogrammi1a24(ieto%%, z%%, 1).ore
    IdroMaxieto%%(ieto%%) = z%%
END IF
RETURN
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
DisegnaMatriciIeto1e2:

posizione% = _WIDTH(MatriciIeto1e2&(1, 1)) \ 8 - 94
_DEST MatriciIeto1e2&(ieto%%, z%%)
CLS
LINE (0, 0)-(_WIDTH(MatriciIeto1e2&(ieto%%, z%%)) - 1, _HEIGHT(MatriciIeto1e2&(ieto%%, z%%)) - 1), R&, B
LOCATE 2, posizione%
COLOR bianco&: PRINT "Legenda: ";
COLOR G&: PRINT "[Idrogramma]";
COLOR R&: PRINT "[Pioggia effettiva]";
COLOR B&: PRINT "[Pioggia efficace]"
PRINT
IF H% \ 16 >= 55 THEN
    i% = 1: n%% = 1
ELSE
    i% = 2: n%% = 2
END IF
LOCATE , posizione%
FOR i% = i% TO 50 STEP n%%
    CALL Tabella(i%, n%%,0, "-", bianco&, "ore", bianco&, "ore:min", G&, "mc/sec", R&, "mm", B&, "mm", bianco&, "mm/ora", 0, "", 2 ^ 4, 1, bianco&, i%, grigio&, matrice1(ieto%%, z%%, i%, 1).mdt,_
    grigio&, matrice1(ieto%%, z%%, i%, 1).mdt,grigio&, idrogrammi1a24(ieto%%, z%%, i%, 1).portata, grigio&, matrice1(ieto%%, z%%, i%, 1).DH, grigio&, matrice1(ieto%%, z%%, i%, 1).Dhe, grigio&, matrice1(ieto%%, z%%, i%, 1).i2)
    LOCATE CSRLIN - 1, FineColonna%(7): PRINT "³"
NEXT i%
LOCATE , posizione%: COLOR bianco&: PRINT "Sommano:";
LOCATE , FineColonna%(4) + 1: COLOR R&: PRINT _TRIM$(STR$(Arrotonda!(matrice1(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).H2)));
LOCATE , FineColonna%(5) + 1: COLOR B&: PRINT _TRIM$(STR$(Arrotonda!(matrice1(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).he)))
LOCATE , posizione%: COLOR bianco&: PRINT "Media:";
LOCATE , FineColonna%(6) + 1: PRINT _TRIM$(STR$(Arrotonda!(matrice1(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).H2 / matrice1(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).mdt)))
LOCATE 4,
CALL Dati(2 ^ 3 + 2 ^ 2 + 2 ^ 1 + 2 ^ 0, posizione% + 55)
CALL DisegnaAssi("ore", "mc/s(idrogramma) - mm(ietogramma<--ordinate non in scala)", MinimiMatriciQuadrante1(ieto%%, z%%, 1).ore, MassimiIdrogrammi1a24(ieto%%, z%%, 1).portata, quadro&, R&, bianco&, bianco&, bianco&)
istoX! = matrice1(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).mdt / PassiFinePioggia1a24%%(z%%)
SELECT CASE ieto%%
    CASE IS = 1
        CALL ScalaOrigine(1, 1, MinimiMatriciQuadrante1(ieto%%, z%%, 1).ore, matrice1(ieto%%, z%%, 1, 1).i1 * dt!(z%%) * 2.5, quadro&)
        LINE (dx!, dy!)-(dx! + istoX!, dy! + matrice1(ieto%%, z%%, 1, 1).DH), R&, BF
        LINE (dx!, dy!)-(dx! + istoX!, dy! + matrice1(ieto%%, z%%, 1, 1).DH), bianco&, B
        i% = 2
        DO UNTIL matrice1(ieto%%, z%%, i%, 1).DH = 0
            LINE (dx! + (i% - 1) * istoX!, dy!)-(dx! + i% * istoX!, dy! + matrice1(ieto%%, z%%, i%, 1).DH), R&, BF
            LINE (dx! + (i% - 1) * istoX!, dy!)-(dx! + i% * istoX!, dy! + matrice1(ieto%%, z%%, i%, 1).DH), bianco&, B
            i% = i% + 1
        LOOP
        LINE (dx!, dy!)-(dx! + istoX!, dy! + matrice1(ieto%%, z%%, 1, 1).Dhe), B&, BF
        LINE (dx!, dy!)-(dx! + istoX!, dy! + matrice1(ieto%%, z%%, 1, 1).Dhe), bianco&, B
        i% = 2
        DO
            IF matrice1(ieto%%, z%%, i%, 1).Dhe = 0 THEN
                IF matrice1(ieto%%, z%%, i% - 1, 1).Dhe > 0 THEN EXIT DO
            END IF
            LINE (dx! + (i% - 1) * istoX!, dy!)-(dx! + i% * istoX!, dy! + matrice1(ieto%%, z%%, i%, 1).Dhe), B&, BF
            LINE (dx! + (i% - 1) * istoX!, dy!)-(dx! + i% * istoX!, dy! + matrice1(ieto%%, z%%, i%, 1).Dhe), bianco&, B
            i% = i% + 1
        LOOP
        LINE (dx!, dy!)-(dx! + istoX!, dy! + matrice1(ieto%%, z%%, 1, 1).DH), giallo&
        i% = 2
        DO UNTIL matrice1(ieto%%, z%%, i% + 1, 1).DH = 0
            LINE (dx! + (i% - 1) * istoX!, dy! + matrice1(ieto%%, z%%, i% - 1, 1).DH)-(dx! + i% * istoX!, dy! + matrice1(ieto%%, z%%, i%, 1).DH), giallo&
            i% = i% + 1
        LOOP
        LINE -(dx! + i% * istoX!, dy!), giallo&
        LINE (dx!, dy!)-(dx! + istoX!, dy! + matrice1(ieto%%, z%%, 1, 1).Dhe), giallo&
        i% = 2
        DO UNTIL i% = PassiFinePioggia1a24%%(z%%)
            LINE (dx! + (i% - 1) * istoX!, dy! + matrice1(ieto%%, z%%, i% - 1, 1).Dhe)-(dx! + i% * istoX!, dy! + matrice1(ieto%%, z%%, i%, 1).Dhe), giallo&
            i% = i% + 1
        LOOP
        LINE -(dx! + i% * istoX!, dy!), giallo&
        n%% = 0
        DO
            n%% = n%% + 1
            IF matrice1(ieto%%, z%%, 1, 1).i1 * dt!(z%%) = matrice1(ieto%%, z%%, n%%, 1).DH THEN EXIT DO
        LOOP
        CALL DisegnaValore(matrice1(ieto%%, z%%, n%%, 1).mdt, matrice1(ieto%%, z%%, n%%, 1).DH, 0, 0, bianco&)
    CASE IS = 2
        CALL ScalaOrigine(1, 1, MinimiMatriciQuadrante1(ieto%%, z%%, 1).ore, matrice1(ieto%%, z%%, 1, 1).DH * 2.5, quadro&)
        LINE (dx!, dy!)-(dx! + istoX! * PassiFinePioggia1a24%%(z%%), dy! + matrice1(ieto%%, z%%, 1, 1).DH), R&, BF
        LINE (dx!, dy!)-(dx! + istoX! * PassiFinePioggia1a24%%(z%%), dy! + matrice1(ieto%%, z%%, 1, 1).DH), bianco&, B
        LINE (dx!, dy!)-(dx! + istoX!, dy! + matrice1(ieto%%, z%%, 1, 1).Dhe), bianco&
        i% = 2
        DO
            LINE (dx! + (i% - 1) * istoX!, dy! + matrice1(ieto%%, z%%, i% - 1, 1).Dhe)-(dx! + i% * istoX!, dy! + matrice1(ieto%%, z%%, i%, 1).Dhe), bianco&
            IF i% = PassiFinePioggia1a24%%(z%%) THEN EXIT DO
            i% = i% + 1
        LOOP
        PAINT (0.7 * dx! + i% * istoX!, 0.7 * dy! + matrice1(ieto%%, z%%, i%, 1).Dhe), B&, bianco&
END SELECT
CALL ScalaOrigine(1, 1, MinimiMatriciQuadrante1(ieto%%, z%%, 1).ore, MassimiIdrogrammi1a24(ieto%%, z%%, 1).portata, quadro&)
FOR i% = 1 TO MinimiMatriciQuadrante1(ieto%%, z%%, 1).i
    CIRCLE (dx! + idrogrammi1a24(ieto%%, z%%, i%, 1).ore, dy! + idrogrammi1a24(ieto%%, z%%, i%, 1).portata), PMAP(3, 2), G&
    PAINT (dx! + idrogrammi1a24(ieto%%, z%%, i%, 1).ore - PMAP(2.5, 2), dy! + idrogrammi1a24(ieto%%, z%%, i%, 1).portata), G&
    IF i% = 1 THEN
        LINE (dx!, dy!)-(dx! + idrogrammi1a24(ieto%%, z%%, i%, 1).ore, dy! + idrogrammi1a24(ieto%%, z%%, i%, 1).portata), G&
    ELSE
        LINE (dx! + idrogrammi1a24(ieto%%, z%%, i% - 1, 1).ore, dy! + idrogrammi1a24(ieto%%, z%%, i% - 1, 1).portata)-(dx! + idrogrammi1a24(ieto%%, z%%, i%, 1).ore, dy! + idrogrammi1a24(ieto%%, z%%, i%, 1).portata), G&
    END IF
NEXT i%
CALL DisegnaValore(MassimiIdrogrammi1a24(ieto%%, z%%, 1).ore, MassimiIdrogrammi1a24(ieto%%, z%%, 1).portata, G&, G&, bianco&)
CALL DisegnaValore(FinePioggiaIdrogrammi1a24(ieto%%, z%%, 1).ore, FinePioggiaIdrogrammi1a24(ieto%%, z%%, 1).portata, grigio&, grigio&, bianco&)
COLOR bianco: _PRINTSTRING (_WIDTH(quadro&) - 33 * 8, 4), "Legenda:"
COLOR grigio&: _PRINTSTRING (_WIDTH(quadro&) - 24 * 8, 4), "[Termine della pioggia]"
_PUTIMAGE (0, 0)-(_WIDTH(quadro&), _HEIGHT(quadro&)), quadro&, MatriciIeto1e2&(ieto%%, z%%)
CALL DisegnaAssi("ore", "mc/(s * mm)", MinimiMatriciQuadrante2(1, 1, 1).ore, MassimiQuadrante2(1, 1, 1).portata, quadro&, R&, bianco&, bianco&, bianco&)
CALL DisegnaValore(MassimiQuadrante2(ieto%%, z%%, 1).ore, MassimiQuadrante2(ieto%%, z%%, 1).portata, azzurro&, G&, bianco&)
FOR i% = 1 TO 50
    CIRCLE (dx! + matrice1(1, 1, i%, 1).mdt, dy! + matrice1(1, 1, i%, 1).qm), PMAP(3, 2), pastello&
    PAINT (dx! + matrice1(1, 1, i%, 1).mdt - PMAP(2.5, 2), dy! + matrice1(1, 1, i%, 1).qm), pastello&
    IF i% = 1 THEN
        LINE (dx!, dy!)-(dx! + matrice1(1, 1, i%, 1).mdt, dy! + matrice1(1, 1, i%, 1).qm), pastello&, , 65280
    ELSE
        LINE (dx! + matrice1(1, 1, i% - 1, 1).mdt, dy! + matrice1(1, 1, i% - 1, 1).qm)-(dx! + matrice1(1, 1, i%, 1).mdt, dy! + matrice1(1, 1, i%, 1).qm), pastello&, , 65280
    END IF
NEXT i%
FOR i% = 1 TO MinimiMatriciQuadrante2(ieto%%, z%%, 1).i
    CIRCLE (dx! + matrice1(ieto%%, z%%, i%, 1).mdt, dy! + matrice1(ieto%%, z%%, i%, 1).qm), PMAP(3, 2), azzurro&
    IF i% = 1 THEN
        LINE (dx!, dy!)-(dx! + matrice1(ieto%%, z%%, i%, 1).mdt, dy! + matrice1(ieto%%, z%%, i%, 1).qm), azzurro&
    ELSE
        LINE (dx! + matrice1(ieto%%, z%%, i% - 1, 1).mdt, dy! + matrice1(ieto%%, z%%, i% - 1, 1).qm)-(dx! + matrice1(ieto%%, z%%, i%, 1).mdt, dy! + matrice1(ieto%%, z%%, i%, 1).qm), azzurro&
    END IF
NEXT i%
LOCATE 2, _WIDTH(quadro&) \ 8 - 35: PRINT "Legenda:"
LOCATE 4, _WIDTH(quadro&) \ 8 - 35: COLOR azzurro&: PRINT "[Idrogramma  unitario  del bacino"
LOCATE , _WIDTH(quadro&) \ 8 - 35: PRINT "con la discretizzazione temporale"
LOCATE , _WIDTH(quadro&) \ 8 - 35: PRINT "dt = "; _TRIM$(STR$(Arrotonda!(dt!(z%%)))); " ore = "; _TRIM$(STR$(INT(dt!(z%%)))); " ore e "; _TRIM$(STR$(CINT(60 * (dt!(z%%) - INT(dt!(z%%)))))); " minuti]"
LOCATE 8, _WIDTH(quadro&) \ 8 - 35: COLOR pastello&: PRINT "[Idrogramma  unitario  del bacino"
LOCATE , _WIDTH(quadro&) \ 8 - 35: PRINT "con la discretizzazione temporale"
LOCATE , _WIDTH(quadro&) \ 8 - 35: PRINT "dt = "; _TRIM$(STR$(Arrotonda!(dt!(1)))); " ore = "; _TRIM$(STR$(INT(dt!(1)))); " ore e "; _TRIM$(STR$(CINT(60 * (dt!(1) - INT(dt!(1)))))); " minuti]"
_PUTIMAGE (0, _HEIGHT(MatriciIeto1e2&(ieto%%, z%%)) \ 2)-(_WIDTH(quadro&), _HEIGHT(MatriciIeto1e2&(ieto%%, z%%)) - 1), quadro&, MatriciIeto1e2&(ieto%%, z%%)
RETURN
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
DisegnaComplessivoIeto1e2:

posizione% = _WIDTH(ComplessivoIeto1e2(1).composizione) \ 8 - 45
_DEST ComplessivoIeto1e2(ieto%%).composizione
CLS
LOCATE 2, posizione%: PRINT "T U T T I  G L I  I D R O G R A M M I"
CALL Dati(2 ^ 3, posizione%)
VIEW PRINT _HEIGHT(ComplessivoIeto1e2(ieto%%).composizione) \ 16 - 26 TO _HEIGHT(ComplessivoIeto1e2(ieto%%).composizione) \ 16
LOCATE , posizione%: COLOR bianco&: PRINT "Legenda: ";
COLOR giallo&: PRINT "[Picchi]";
COLOR G&: PRINT "[Durata della pioggia]"
LOCATE , posizione%
FOR z%% = 1 TO 24
        CALL Tabella(z%%,1,0, "-", giallo&, "ore", giallo&, "ore:min", giallo&, "mc/sec", G&, "ore:min", G&, "ore/tc", 0, "", 0, "",2 ^ 4 + 2 ^ 2, 1, bianco&, z%%, giallo&, MassimiIdrogrammi1a24(ieto%%, z%%, 1).ore, giallo&,_
        MassimiIdrogrammi1a24(ieto%%, z%%, 1).ore, giallo&,MassimiIdrogrammi1a24(ieto%%, z%%, 1).portata, grigio&, FinePioggiaIdrogrammi1a24(ieto%%, z%%, 1).ore, grigio&,_
        CoefficientiDiscretizzazioneTemporale(z%%).N, 0, 0)
NEXT z%%
VIEW PRINT
LINE (0, 0)-(_WIDTH(ComplessivoIeto1e2(ieto%%).composizione) - 1, _HEIGHT(ComplessivoIeto1e2(ieto%%).composizione) - 1), R&, B
CALL DisegnaAssi("ore", "mc/s", idrogrammi1a24(ieto%%, 24, 50, 1).ore, MassimiAssolutiIeto(ieto%%).portata, ComplessivoIeto1e2(ieto%%).grafico, R&, bianco&, bianco&, bianco&)
FOR z%% = 1 TO 24
    SELECT CASE z%% MOD 3
        CASE IS = 1
            colore& = R&
        CASE IS = 2
            colore& = G&
        CASE IS = 0
            colore& = B&
    END SELECT
    FOR i% = 1 TO 50
        IF i% = 1 THEN
            LINE (dx!, dy!)-(dx! + idrogrammi1a24(ieto%%, z%%, i%, 1).ore, dy! + idrogrammi1a24(ieto%%, z%%, i%, 1).portata), colore&
        ELSE
            LINE (dx! + idrogrammi1a24(ieto%%, z%%, i% - 1, 1).ore, dy! + idrogrammi1a24(ieto%%, z%%, i% - 1, 1).portata)-(dx! + idrogrammi1a24(ieto%%, z%%, i%, 1).ore, dy! + idrogrammi1a24(ieto%%, z%%, i%, 1).portata), colore&
        END IF
    NEXT i%
NEXT z%%
CALL DisegnaValore(MassimiAssolutiIeto(ieto%%).ore, MassimiAssolutiIeto(ieto%%).portata, azzurro&, azzurro&, bianco&)
CALL DisegnaLinea(ieto%%, ComplessivoIeto1e2(ieto%%).grafico, giallo&, grigio&)
_PUTIMAGE (0, 0), ComplessivoIeto1e2(ieto%%).grafico, ComplessivoIeto1e2(ieto%%).composizione
OriginaleGrafico& = _COPYIMAGE(ComplessivoIeto1e2(VisualizzaIeto%%).grafico)
RETURN
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
DisegnaUnitari:

posizione% = _WIDTH(unitari&) \ 8 - 94
_DEST unitari&
CLS
LOCATE 2, posizione%
COLOR bianco&: PRINT "Legenda: ";
COLOR giallo&: PRINT "[Idrogramma unitario adimensionale di Mockus]";
COLOR G&: PRINT "[Idrogramma unitario del bacino]";
PRINT
PRINT
IF H% \ 16 >= 55 THEN
    i% = 1: n%% = 1
ELSE
    i% = 2: n%% = 2
END IF
LOCATE , posizione%
FOR i% = i% TO 50 STEP n%%
    CALL Tabella(i%, n%%,0, "-", giallo&, "t/ta", giallo&, "q/qp", G&, "ore", G&, "mc/s*mm", 0, "", 0, "", 0, "", 0, 1, bianco&, i%, grigio&, mockus(i%).tSUta, grigio&, mockus(i%).qSUqp, grigio&, matrice1(1, 1, i%, 1).mdt, grigio&,_
    matrice1(1, 1, i%, 1).qm, 0, 0, 0, 0)
NEXT i%
PRINT
COLOR bianco&: LOCATE 4,
CALL Dati(0, posizione% + 40)
COLOR grigio&
LOCATE 15, posizione% + 40: PRINT "La determinazione dell'idrogramma unitario di"
LOCATE 17, posizione% + 40: PRINT "un bacino  di note  caratteristiche  consiste"
LOCATE 19, posizione% + 40: PRINT "nell'amplificare l'ascissa e l'ordinata dello"
LOCATE 21, posizione% + 40: PRINT "idrogramma unitario  adimensionale di  Mockus"
LOCATE 23, posizione% + 40: PRINT "mediante  i  fattori  ta e  qp, specifici del"
LOCATE 25, posizione% + 40: PRINT "bacino  esaminato. Il calcolo dell'idrogramma"
LOCATE 27, posizione% + 40: PRINT "di piena presuppone poi che gli incrementi di"
LOCATE 29, posizione% + 40: PRINT "deflusso siano utilizzati  per  amplificare i"
LOCATE 31, posizione% + 40: PRINT "valori  dell' idrogramma  unitario  e  siano"
LOCATE 33, posizione% + 40: PRINT "sommati a parit… d'istante."
LINE (0, 0)-(_WIDTH(unitari&) - 1, _HEIGHT(unitari&) - 1), R&, B
CALL DisegnaAssi("t/ta", "q/qp", 5, 1, quadro&, R&, bianco&, bianco&, bianco&)
FOR i% = 1 TO UBOUND(mockus)
    CIRCLE (dx! + mockus(i%).tSUta, dy! + mockus(i%).qSUqp), PMAP(3, 2), giallo&
    PAINT (dx! + mockus(i%).tSUta - PMAP(2.5, 2), dy! + mockus(i%).qSUqp), giallo&
    IF i% = 1 THEN
        LINE (dx!, dy!)-(dx! + mockus(i%).tSUta, dy! + mockus(i%).qSUqp), giallo&
    ELSE
        LINE (dx! + mockus(i% - 1).tSUta, dy! + mockus(i% - 1).qSUqp)-(dx! + mockus(i%).tSUta, dy! + mockus(i%).qSUqp), giallo&
    END IF
NEXT i%
_PUTIMAGE (0, 0)-(_WIDTH(quadro&), _HEIGHT(quadro&)), quadro&, unitari&
CALL DisegnaAssi("ore", "mc/(s * mm)", matrice1(1, 1, 50, 1).mdt, MassimiQuadrante2(1, 1, 1).portata, quadro&, R&, bianco&, bianco&, bianco&)
CALL DisegnaValore(MassimiQuadrante2(1, 1, 1).ore, MassimiQuadrante2(1, 1, 1).portata, azzurro&, azzurro&, bianco&)
FOR i% = 1 TO 50
    CIRCLE (dx! + matrice1(1, 1, i%, 1).mdt, dy! + matrice1(1, 1, i%, 1).qm), PMAP(3, 2), G&
    PAINT (dx! + matrice1(1, 1, i%, 1).mdt - PMAP(2.5, 2), dy! + matrice1(1, 1, i%, 1).qm), G&
    IF i% = 1 THEN
        LINE (dx!, dy!)-(dx! + matrice1(1, 1, i%, 1).mdt, dy! + matrice1(1, 1, i%, 1).qm), G&
    ELSE
        LINE (dx! + matrice1(1, 1, i% - 1, 1).mdt, dy! + matrice1(1, 1, i% - 1, 1).qm)-(dx! + matrice1(1, 1, i%, 1).mdt, dy! + matrice1(1, 1, i%, 1).qm), G&
    END IF
NEXT i%
WINDOW
LOCATE 2, _WIDTH(quadro&) \ 8 - 35: PRINT "Idrogramma  unitario  del  bacino"
LOCATE , _WIDTH(quadro&) \ 8 - 35: PRINT "con la discretizzazione temporale"; ""
LOCATE , _WIDTH(quadro&) \ 8 - 35: PRINT "dt = "; _TRIM$(STR$(Arrotonda!(dt!(1)))); " ore = "; _TRIM$(STR$(INT(dt!(1)))); " ore e "; _TRIM$(STR$(CINT(60 * (dt!(1) - INT(dt!(1)))))); " minuti."
_PUTIMAGE (0, _HEIGHT(unitari&) \ 2)-(_WIDTH(quadro&), _HEIGHT(unitari&) - 1), quadro&, unitari&
RETURN
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
VisualizzaComplessivo:

CLS 2
ComplessivoIeto1e2(VisualizzaIeto%%).grafico = _COPYIMAGE(OriginaleGrafico&)
_PUTIMAGE (0, 0), ComplessivoIeto1e2(VisualizzaIeto%%).grafico, ComplessivoIeto1e2(VisualizzaIeto%%).composizione
_PUTIMAGE ((DESKTOPWIDTH% - _WIDTH(ComplessivoIeto1e2(VisualizzaIeto%%).composizione)), (DESKTOPHEIGHT% - _HEIGHT(ComplessivoIeto1e2(VisualizzaIeto%%).composizione) - 16)), ComplessivoIeto1e2(VisualizzaIeto%%).composizione, schermo&
RETURN
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
DisegnaIdrogramma:

FOR n%% = 1 TO 2
    IF n%% = 1 THEN posizione% = _WIDTH(idrogramma1e2(n%%).composizione) \ 8 - 56
    IF n%% = 2 THEN IF ore!(n%%) = 0 THEN EXIT FOR
    _DEST idrogramma1e2(n%%).composizione
    CLS: COLOR bianco&
    IF n%% = 1 THEN
        LOCATE 2, posizione%: PRINT "I D R O G R A M M A  D I  P R O G E T T O"
    ELSEIF n%% = 2 THEN
        LOCATE 2, posizione%: PRINT "IDROGRAMMA CORRISPONDENTE ALL'ORA DI PICCO SCELTA"
    END IF
    CALL Dati(2 ^ 3, posizione%)
    VIEW PRINT _HEIGHT(idrogramma1e2(n%%).composizione) \ 16 - 26 TO _HEIGHT(idrogramma1e2(n%%).composizione) \ 16
    LOCATE , posizione%
    SELECT CASE n%%
        CASE IS = 1
            FOR i% = 1 TO 25
                CALL Tabella(i%, 1,0, "-", bianco&, "ore", bianco&, "ore:min", bianco&, "mc/sec", 0, "-", bianco&, "ore", bianco&, "ore:min", bianco&, "mc/sec", 2 ^ 4, 1, bianco%, i%, grigio&, idrogramma1(i%).ore, grigio&,_
                idrogramma1(i%).ore, grigio&, idrogramma1(i%).portata, 0, 0, 0, 0, 0, 0)
                LOCATE CSRLIN - 1, FineColonna%(4): PRINT "³"
            NEXT i%
            LOCATE _HEIGHT(idrogramma1e2(n%%).composizione) \ 16 - 26 + 1,
            FOR i% = 26 TO UBOUND(idrogramma1)
                CALL Tabella(i%, 1,0, "-", bianco&, "ore", bianco&, "ore:min", bianco&, "mc/sec", 0, "-", bianco&, "ore", bianco&, "ore:min", bianco&, "mc/sec", 2 ^ 4, 5, bianco%, i%, grigio&, idrogramma1(i%).ore, grigio&,_
                idrogramma1(i%).ore, grigio&, idrogramma1(i%).portata, 0, 0, 0, 0, 0, 0)
            NEXT i%
        CASE IS = 2
            FOR i% = 1 TO 25
                CALL Tabella(i%, 1,0, "-", bianco&, "ore", bianco&, "ore:min", bianco&, "mc/sec", 0, "-", bianco&, "ore", bianco&, "ore:min", bianco&, "mc/sec", 2 ^ 4, 1, bianco%, i%, grigio&, idrogramma2(i%).ore, grigio&,_
                idrogramma2(i%).ore, grigio&, idrogramma2(i%).portata, 0, 0, 0, 0, 0, 0)
                LOCATE CSRLIN - 1, FineColonna%(4): PRINT "³"
            NEXT i%
            LOCATE _HEIGHT(idrogramma1e2(n%%).composizione) \ 16 - 26 + 1,
            FOR i% = 26 TO UBOUND(idrogramma2)
                CALL Tabella(i%, 1,0, "-", bianco&, "ore", bianco&, "ore:min", bianco&, "mc/sec", 0, "-", bianco&, "ore", bianco&, "ore:min", bianco&, "mc/sec", 2 ^ 4, 5, bianco%, i%, grigio&, idrogramma2(i%).ore, grigio&,_
                idrogramma2(i%).ore, grigio&, idrogramma2(i%).portata, 0, 0, 0, 0, 0, 0)
            NEXT i%
    END SELECT
    VIEW PRINT
    LINE (0, 0)-(_WIDTH(idrogramma1e2(n%%).composizione) - 1, _HEIGHT(idrogramma1e2(n%%).composizione) - 1), R&, B
NEXT n%%
CALL DisegnaAssi("ore", "mc/s", IdroPixel1(UBOUND(IdroPixel1)).ore, portata!(1), idrogramma1e2(1).grafico, R&, bianco&, bianco&, bianco&)
CALL DisegnaValore(ore!(1), portata!(1), azzurro&, azzurro&, bianco&)
LOCATE 2, _WIDTH(idrogramma1e2(1).grafico) \ 8 - 25: COLOR bianco&: PRINT "Legenda: "
LOCATE 4, _WIDTH(idrogramma1e2(1).grafico) \ 8 - 25: COLOR B&: PRINT "[Termine della pioggia]"
n%% = 0
GOSUB idro1
_SOURCE idrogramma1e2(1).grafico
IF FinePioggiaIdrogrammi1e2(1).ore = FinePioggiaIdrogrammi1a24(VisualizzaIeto%%, IdroMaxieto%%(VisualizzaIeto%%), 1).ore THEN
    FinePioggiaIdrogrammi1e2(1).portata = FinePioggiaIdrogrammi1a24(VisualizzaIeto%%, IdroMaxieto%%(VisualizzaIeto%%), 1).portata
ELSE
    y% = PMAP(dy!, 1)
    DO
        IF POINT(dx! + FinePioggiaIdrogrammi1e2(1).ore, PMAP(y%, 3)) = giallo& THEN EXIT DO
        y% = y% - 1
    LOOP
    FinePioggiaIdrogrammi1e2(1).portata = PMAP(y%, 3) - dy!
END IF
CALL DisegnaValore(FinePioggiaIdrogrammi1e2(1).ore, FinePioggiaIdrogrammi1e2(1).portata, B&, B&, bianco&)
idro1:
n%% = n%% + 1
FOR i% = 1 TO UBOUND(idrogramma1)
    CIRCLE (dx! + idrogramma1(i%).ore, dy! + idrogramma1(i%).portata), PMAP(3, 2), G&
    PAINT (dx! + idrogramma1(i%).ore - PMAP(2.5, 2), dy! + idrogramma1(i%).portata), G&
NEXT i%
FOR i% = 1 TO UBOUND(IdroPixel1)
    IF i% = 1 THEN
        LINE (dx!, dy!)-(dx! + IdroPixel1(i%).ore, dy! + IdroPixel1(i%).portata), giallo&
    ELSE
        LINE (dx! + IdroPixel1(i% - 1).ore, dy! + IdroPixel1(i% - 1).portata)-(dx! + IdroPixel1(i%).ore, dy! + IdroPixel1(i%).portata), giallo&
    END IF
NEXT i%
IF n%% = 1 THEN RETURN
_PUTIMAGE (0, 0), idrogramma1e2(1).grafico, idrogramma1e2(1).composizione
IF ore!(2) = 0 THEN RETURN
CALL DisegnaAssi("ore", "mc/s", IdroPixel2(UBOUND(IdroPixel2)).ore, portata!(2), idrogramma1e2(2).grafico, R&, bianco&, bianco&, bianco&)
CALL DisegnaValore(ore!(2), portata!(2), azzurro&, azzurro&, bianco&)
LOCATE 2, _WIDTH(idrogramma1e2(1).grafico) \ 8 - 25: COLOR bianco&: PRINT "Legenda: "
LOCATE 4, _WIDTH(idrogramma1e2(1).grafico) \ 8 - 25: COLOR B&: PRINT "[Termine della pioggia]"
GOSUB idro2
_SOURCE idrogramma1e2(2).grafico
y% = PMAP(dy!, 1)
DO
    IF POINT(dx! + FinePioggiaIdrogrammi1e2(2).ore, PMAP(y%, 3)) = giallo& THEN EXIT DO
    y% = y% - 1
LOOP
FinePioggiaIdrogrammi1e2(2).portata = PMAP(y%, 3) - dy!
CALL DisegnaValore(FinePioggiaIdrogrammi1e2(2).ore, FinePioggiaIdrogrammi1e2(2).portata, B&, B&, bianco&)
idro2:
FOR i% = 1 TO UBOUND(idrogramma1)
    CIRCLE (dx! + idrogramma2(i%).ore, dy! + idrogramma2(i%).portata), PMAP(3, 2), G&
    PAINT (dx! + idrogramma2(i%).ore - PMAP(2.5, 2), dy! + idrogramma2(i%).portata), G&
NEXT i%
FOR i% = 1 TO UBOUND(IdroPixel2)
    IF i% = 1 THEN
        LINE (dx!, dy!)-(dx! + IdroPixel2(i%).ore, dy! + IdroPixel2(i%).portata), giallo&
    ELSE
        LINE (dx! + IdroPixel2(i% - 1).ore, dy! + IdroPixel2(i% - 1).portata)-(dx! + IdroPixel2(i%).ore, dy! + IdroPixel2(i%).portata), giallo&
    END IF
NEXT i%
_PUTIMAGE (0, 0), idrogramma1e2(2).grafico, idrogramma1e2(2).composizione
RETURN
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
VisualizzaIdrogramma:

_DEST schermo&: CLS 2
COLOR giallo&: PRINT "[ESC]: salva; [TAB]: riavvia; [F1]: torna agli input iniziali; [F2]: ripristina il grafico; []: visualizza l'idrogramma di progetto.": COLOR bianco&
DO
    _LIMIT 30
    KeyPress$ = INKEY$
LOOP UNTIL KeyPress$ = CHR$(27) OR KeyPress$ = CHR$(9) OR KeyPress$ = CHR$(0) + CHR$(59) OR KeyPress$ = CHR$(0) + CHR$(60) OR KeyPress$ = CHR$(0) + CHR$(77)
SELECT CASE KeyPress$
    CASE CHR$(27)
        esc~` = 1
    CASE CHR$(9)
        riavvio~` = 1
    CASE CHR$(0) + CHR$(59)
        menu~` = 1
    CASE CHR$(0) + CHR$(60)
        TornaAlGrafico~` = 1
    CASE CHR$(0) + CHR$(77)
        tipo%% = 3
        _PUTIMAGE ((DESKTOPWIDTH% - _WIDTH(idrogramma1e2(1).composizione)), (DESKTOPHEIGHT% - _HEIGHT(idrogramma1e2(1).composizione) - 16)), idrogramma1e2(1).composizione, schermo&
        CALL DisegnaPortata(idrogramma1(UBOUND(idrogramma1)).ore, idrogramma1e2(1).grafico, idrogramma1e2(1).composizione)
        IF portata!(1) = MassimiIdrogrammi1a24(VisualizzaIeto%%, IdroMaxieto%%(VisualizzaIeto%%), 1).portata THEN
            IF ore!(1) = MassimiIdrogrammi1a24(VisualizzaIeto%%, IdroMaxieto%%(VisualizzaIeto%%), 1).ore THEN
                CLS 2
                COLOR giallo&
                PRINT "- Poich‚ l'idrogramma di progetto coincide con uno dei 24 calcolati, Š possibile visualizzarne i dettagli. Visualizzare? [S/N]"
                PRINT "[ESC]: salva; [TAB]: riavvia; [F1]: torna agli input iniziali; [F2]: torna al grafico iniziale."
                COLOR bianco&
                DO
                    _LIMIT 30
                    KeyPress$ = LCASE$(INKEY$)
                LOOP UNTIL KeyPress$ = "s" OR KeyPress$ = "n" OR KeyPress$ = CHR$(27) OR KeyPress$ = CHR$(9) OR KeyPress$ = CHR$(0) + CHR$(59) OR KeyPress$ = CHR$(0) + CHR$(60)
                SELECT CASE KeyPress$
                    CASE "s"
                _PUTIMAGE ((DESKTOPWIDTH% - _WIDTH(MatriciIeto1e2&(VisualizzaIeto%%, IdroMaxieto%%(VisualizzaIeto%%)))), (DESKTOPHEIGHT% - _HEIGHT(MatriciIeto1e2&(VisualizzaIeto%%, IdroMaxieto%%(VisualizzaIeto%%))) - 16)),_
                MatriciIeto1e2&(VisualizzaIeto%%, IdroMaxieto%%(VisualizzaIeto%%)), schermo&
                    CASE CHR$(27)
                        esc~` = 1
                    CASE CHR$(9)
                        riavvio~` = 1
                    CASE CHR$(0) + CHR$(59)
                        menu~` = 1
                    CASE CHR$(0) + CHR$(60)
                        TornaAlGrafico~` = 1
                END SELECT
            END IF
        END IF
        IF esc~` = 1 OR riavvio~` = 1 OR menu~` = 1 OR TornaAlGrafico~` = 1 OR ore!(2) = 0 THEN EXIT SELECT
        _DEST schermo&: CLS 2
        COLOR giallo&: PRINT "[ESC]: salva; [TAB]: riavvia; [F1]: torna agli input iniziali; [F2]: torna al grafico iniziale; []: visualizza l'idrogramma corrispondente all'ora scelta.": COLOR bianco&
        DO
            _LIMIT 30
            KeyPress$ = INKEY$
        LOOP UNTIL KeyPress$ = CHR$(27) OR KeyPress$ = CHR$(9) OR KeyPress$ = CHR$(0) + CHR$(59) OR KeyPress$ = CHR$(0) + CHR$(60) OR KeyPress$ = CHR$(0) + CHR$(77)
        SELECT CASE KeyPress$
            CASE CHR$(27)
                esc~` = 1
            CASE CHR$(9)
                riavvio~` = 1
            CASE CHR$(0) + CHR$(59)
                menu~` = 1
            CASE CHR$(0) + CHR$(60)
                TornaAlGrafico~` = 1
            CASE CHR$(0) + CHR$(77)
                CLS 2
                _PUTIMAGE ((DESKTOPWIDTH% - _WIDTH(idrogramma1e2(2).composizione)), (DESKTOPHEIGHT% - _HEIGHT(idrogramma1e2(2).composizione) - 16)), idrogramma1e2(2).composizione, schermo&
                CALL DisegnaPortata(idrogramma2(UBOUND(idrogramma2)).ore, idrogramma1e2(2).grafico, idrogramma1e2(2).composizione)
        END SELECT
END SELECT
RETURN
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
VisualizzaUnitari:

CLS 2
COLOR giallo&
PRINT "Visualizza l'idrogramma unitario adimesionale di Mockus e l'idrogramma unitario del bacino? [S/N]"
PRINT "[ESC]: salva; [TAB]: riavvia; [F1]: torna agli input iniziali; [F2]: torna al grafico iniziale."
COLOR bianco&
DO
    _LIMIT 30
    KeyPress$ = LCASE$(INKEY$)
LOOP UNTIL KeyPress$ = "s" OR KeyPress$ = "n" OR KeyPress$ = CHR$(27) OR KeyPress$ = CHR$(9) OR KeyPress$ = CHR$(0) + CHR$(59) OR KeyPress$ = CHR$(0) + CHR$(60)
SELECT CASE KeyPress$
    CASE "s"
        _DEST schermo&: CLS
        _PUTIMAGE ((DESKTOPWIDTH% - _WIDTH(unitari&)), (DESKTOPHEIGHT% - _HEIGHT(unitari&) - 16)), unitari&, schermo&
    CASE CHR$(27)
        esc~` = 1
    CASE CHR$(9)
        riavvio~` = 1
    CASE CHR$(0) + CHR$(59)
        menu~` = 1
    CASE CHR$(0) + CHR$(60)
        TornaAlGrafico~` = 1
END SELECT
RETURN
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
VisualizzaMatrici:

CLS 2
COLOR giallo&
PRINT "Visualizza i singoli idrogrammi calcolati? [S/(ESC o N)]"
PRINT "[ESC/N]: salva; [TAB]: riavvia; [F1]: torna agli input iniziali; [F2]: torna al grafico iniziale."
COLOR bianco&
DO
    _LIMIT 30
    KeyPress$ = LCASE$(INKEY$)
LOOP UNTIL KeyPress$ = "s" OR KeyPress$ = "n" OR KeyPress$ = CHR$(27) OR KeyPress$ = CHR$(9) OR KeyPress$ = CHR$(0) + CHR$(59) OR KeyPress$ = CHR$(0) + CHR$(60)
SELECT CASE KeyPress$
    CASE "s"
        z%% = 1
        DO
            CLS 2
            COLOR giallo&
            IF z%% <> 24 THEN
                PRINT "[ESC]: salva; [TAB]: riavvia; [F1]: torna agli input iniziali; [F2]: torna al grafico iniziale; []: precedente; []: successivo."
            ELSE
                PRINT "................................ T E R M I N E  D E L  P R O G R A M M A ............................................"
                PRINT "[ESC]: salva; [TAB]: riavvia; [F1]: torna agli input iniziali; [F2]: torna al grafico iniziale; []: precedente."
                PRINT "......................................................................................................................."
            END IF
            _PUTIMAGE ((DESKTOPWIDTH% - _WIDTH(MatriciIeto1e2&(VisualizzaIeto%%, z%%))), (DESKTOPHEIGHT% - _HEIGHT(MatriciIeto1e2&(VisualizzaIeto%%, z%%)) - 16)), MatriciIeto1e2&(VisualizzaIeto%%, z%%), schermo&
            DO
                _LIMIT 30
                KeyPress$ = INKEY$
            LOOP UNTIL KeyPress$ = CHR$(27) OR KeyPress$ = CHR$(9) OR KeyPress$ = CHR$(0) + CHR$(59) OR KeyPress$ = CHR$(0) + CHR$(60) OR KeyPress$ = CHR$(0) + CHR$(75) OR KeyPress$ = CHR$(0) + CHR$(77)
            SELECT CASE KeyPress$
                CASE CHR$(27)
                    esc~` = 1
                CASE CHR$(9)
                    riavvio~` = 1
                CASE CHR$(0) + CHR$(59)
                    menu~` = 1
                CASE CHR$(0) + CHR$(60)
                    TornaAlGrafico~` = 1
                CASE CHR$(0) + CHR$(75)
                    IF z%% = 1 THEN
                        z%% = z%% - 1
                    ELSE
                        z%% = z%% - 2
                    END IF
                CASE CHR$(0) + CHR$(77)
                    IF z%% = 24 THEN z%% = z%% - 1
            END SELECT
            IF esc~` = 1 OR riavvio~` = 1 OR menu~` = 1 OR TornaAlGrafico~` = 1 THEN EXIT SELECT
            z%% = z%% + 1
        LOOP
    CASE CHR$(27), "n"
        esc~` = 1
    CASE CHR$(9)
        riavvio~` = 1
    CASE CHR$(0) + CHR$(59)
        menu~` = 1
    CASE CHR$(0) + CHR$(60)
        TornaAlGrafico~` = 1
END SELECT
RETURN
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
Risultati:

testo$ = "Nelle impostazioni di Windows il separatore dell'elenco dev'essere la virgola."
'COLOR trasparente&: PRINT WriteCodiceData$("CODICE.bas.txt"): LOCATE CSRLIN - 1: COLOR bianco&
IF VisualizzaIeto%% = 1 THEN
    OPEN "A.IdrogrammaProgettoCHICAGO+PortataPiccoProgetto.csv" FOR OUTPUT AS #1
    OPEN "B.IdrogrammaSceltoCHICAGO+PortataOraPiccoScelta.csv" FOR OUTPUT AS #2
ELSEIF VisualizzaIeto%% = 2 THEN
    OPEN "A.IdrogrammaProgettoCOSTANTE+PortataPiccoProgetto.csv" FOR OUTPUT AS #1
    OPEN "B.IdrogrammaSceltoCOSTANTE+PortataOraPiccoScelta.csv" FOR OUTPUT AS #2
END IF
IF ore!(1) <> 0 THEN
    WRITE #1, testo$
    n%% = 1: GOSUB DatiBase
    WRITE #1,
    SELECT CASE VisualizzaIeto%%
        CASE IS = 1
            IF soglia%% = 0 THEN
                WRITE #1, "La soglia percentuale S scelta non permette di individuare all'interno del campo la corrispondente portata di picco. Verrà considerato come idrogramma di progetto quello relativo alla portata di picco massima tra i 24 calcolati."
            ELSE
                PRINT #1, "S="; _TRIM$(STR$(soglia%%)); "%: Soglia percentuale scelta."
                PRINT #1, "La soglia percentuale S scelta corrisponde all'ora di picco "; _TRIM$(STR$(ore!(1))); ". Ciò significa che la portata di picco che si avrebbe all'ora "; _TRIM$(STR$(ore!(1) + 1)); " sarebbe minore della portata di picco dell'ora"; ore(1); " aumentata del "; _TRIM$(STR$(soglia%%)); "%."
            END IF
        CASE IS = 2
            WRITE #1, "E' computato come idrogramma di progetto quello relativo alla portata di picco massima tra i 24 calcolati."
    END SELECT
    WRITE #1,
    PRINT #1, "LA PORTATA DI PICCO DI PROGETTO E' "; _TRIM$(STR$(portata!(1))); " MC/S ALL'ORA "; _TRIM$(STR$(ore!(1))); " CON TEMPO DI RITORNO "; UCASE$(T$); " CON DURATA DELLA PIOGGIA PARI A "; _TRIM$(STR$(FinePioggiaIdrogrammi1e2(1).ore)); " ORE."
    WRITE #1,
    WRITE #1, "IDROGRAMMA DI PROGETTO:"
    WRITE #1, "", "ore", "portata [mc/s]"
    FOR i% = 1 TO UBOUND(idrogramma1)
        WRITE #1, i%, idrogramma1(i%).ore, idrogramma1(i%).portata
    NEXT i%
ELSE
    PRINT #1, "Non è stato definito dall'utente."
END IF
CLOSE #1
IF ore!(2) <> 0 THEN
    WRITE #2, testo$
    n%% = 2: GOSUB DatiBase
    WRITE #2,
    PRINT #2, "L'ORA DI PICCO SCELTA E' "; _TRIM$(STR$(ore!(2))); " A CUI CORRISPONDE LA PORTATA DI PICCO "; _TRIM$(STR$(portata!(2))); " MC/S CON TEMPO DI RITORNO "; UCASE$(T$); " CON DURATA DELLA PIOGGIA PARI A "; _TRIM$(STR$(FinePioggiaIdrogrammi1e2(2).ore)); " ORE."
    WRITE #2,
    PRINT #2, "IDROGRAMMA:"
    WRITE #2, "", "ore", "portata [mc/s]"
    FOR i% = 1 TO UBOUND(idrogramma2)
        WRITE #2, i%, idrogramma2(i%).ore, idrogramma2(i%).portata
    NEXT i%
ELSE
    PRINT #2, "Non è stato definito dall'utente."
END IF
CLOSE #2
OPEN "C.IdrogrammiUnitari.csv" FOR OUTPUT AS #1
WRITE #1, testo$
n%% = 1: GOSUB DatiBase
WRITE #1, "La determinazione dell'idrogramma unitario di un bacino di note caratteristiche consiste nell'amplificare l'ascissa e l'ordinata dell'idrogramma unitario adimensionale di Mockus mediante i fattori ta e qp, specifici del bacino esaminato. Il calcolo dell'idrogramma di piena presuppone poi che gli incrementi di deflusso siano utilizzati per amplificare i valori dell'idrogramma unitario e siano sommati a parit… d'istante."
WRITE #1, "", "IDROGRAMMA UNITARIO ADIMENSIONALE DI MOCKUS:", "", "IDROGRAMMA UNITARIO DEL BACINO:"
WRITE #1, "", "t/ta", "q/qp", "ore", "mc/s*mm"
FOR i% = 1 TO 50
    WRITE #1, i%, mockus(i%).tSUta, mockus(i%).qSUqp, matrice1(1, 1, i%, 1).mdt, matrice1(1, 1, i%, 1).qm
NEXT i%
CLOSE #1
FOR ieto%% = 1 TO 2
    IF ieto%% = 1 THEN OPEN "D._1-24,idrogrammiCHICAGO+PortatePicco(da_1_a_32_volte_tc).csv" FOR OUTPUT AS #1
    IF ieto%% = 2 THEN OPEN "E._1-24,idrogrammiCOSTANTE+PortatePicco(da_1_a_32_volte_tc).csv" FOR OUTPUT AS #1
    WRITE #1, testo$
    n%% = 1: GOSUB DatiBase
    WRITE #1, "Di seguito sono riportate le portate di picco dei 24 idrogrammi calcolati e i relativi idrogrammi."
    WRITE #1, "Valori espressi in mc/s. Per i dati completi sui singoli idrogrammi, fare riferimento ai rispettivi file."
    WRITE #1, "PORTATE DI PICCO:"
    WRITE #1, "", "ora picco", "portata picco", "ora fine pioggia", "ore/tc"
    FOR z%% = 1 TO 24
        WRITE #1, z%%, MassimiIdrogrammi1a24(ieto%%, z%%, 1).ore, MassimiIdrogrammi1a24(ieto%%, z%%, 1).portata, FinePioggiaIdrogrammi1a24(ieto%%, z%%, 1).ore, CoefficientiDiscretizzazioneTemporale(z%%).N
    NEXT z%%
    WRITE #1, "IDROGRAMMI:"
    WRITE #1, "",
    FOR z%% = 1 TO 24
        WRITE #1, "", _TRIM$(STR$(CoefficientiDiscretizzazioneTemporale(z%%).N)) + " volte tc",
    NEXT z%%
    WRITE #1,
    WRITE #1, "",
    FOR z%% = 1 TO 24
        WRITE #1, "ore", "idrogramma n." + _TRIM$(STR$(z%%)),
    NEXT z%%
    WRITE #1,
    FOR i% = 1 TO 50
        WRITE #1, i%,
        FOR z%% = 1 TO 24
            WRITE #1, idrogrammi1a24(ieto%%, z%%, i%, 1).ore, idrogrammi1a24(ieto%%, z%%, i%, 1).portata,
        NEXT z%%
        WRITE #1,
    NEXT i%
    CLOSE #1
    DO
        FOR z%% = 1 TO 24
            TerminaSalvataggio$ = INKEY$
            IF TerminaSalvataggio$ = CHR$(27) THEN EXIT DO
            IF ieto%% = 1 THEN OPEN "D." + _TRIM$(STR$(z%%)) + ",idrogrammaCHICAGO(" + _TRIM$(STR$(CoefficientiDiscretizzazioneTemporale(z%%).N)) + "_volte_tc).csv" FOR OUTPUT AS #1
            IF ieto%% = 2 THEN OPEN "E." + _TRIM$(STR$(z%%)) + ",idrogrammaCOSTANTE(" + _TRIM$(STR$(CoefficientiDiscretizzazioneTemporale(z%%).N)) + "_volte_tc).csv" FOR OUTPUT AS #1
            WRITE #1, testo$
            WRITE #1, "DATI", "", "", "", "", "", "", "", "", "LEGENDA"
            WRITE #1, "T=", "[anni]", T$, "tempo di ritorno", "", "", "", "", "", "P=", "[-]", "numero dell'iterazione."
            WRITE #1, "A=", "mq", A2&, "area del bacino idrografico", "", "", "", "", "", "P*dt=", "[ore]", "numero dell'iterazione moltiplicato per il passo temporale."
            WRITE #1, "K=", "[-]", k!, "parametro del Centro Funzionale", "", "", "", "", "", "h=", "[mm]", "altezza di pioggia secondo la curva di possibilità climatica."
            WRITE #1, "a=", "[mm/d^n]", a1!, "coefficiente della curva di possibilità climatica.", "", "", "", "", "", "i=", "[mm/ora]", "intensità di piggia della singola iterazione."
            WRITE #1, "n=", "[-]", n1!, "coefficiente della curva di possibilità climatica.", "", "", "", "", "", "iC=", "[mm/ora]", "intensità di pioggia della singola iterazione secondo lo ietogramma CHICAGO o costante."
            WRITE #1, "L=", "[m]", L~%, "lunghezza dell'asta principale del bacino idrografico.", "", "", "", "", "", "DH=", "[mm]", "altezza di pioggia della singola iterazione."
            WRITE #1, "s=", "[%]", s1!, "pendenza media del bacino idrografico.", "", "", "", "", "", "H=", "[mm]", "altezza di pioggia cumulata sino all'iterazione in corso."
            WRITE #1, "CN(II)=", "[-]", CNII%%, "", "", "", "", "", "", "he=", "[mm]", "pioggia efficace cumulata sino all'iterazione in corso."
            WRITE #1, "S=", "[mm]", "=25.4*((1000/C13)-10)", "contenuto idrico massimo del terreno.", "", "", "", "", "", "Dhe=", "[mm]", "altezza di pioggia efficace della singola iterazione."
            WRITE #1, "Ia=", "[mm]", "=0.1*C11", "perdite iniziali.", "", "", "", "", "", "t/ta=", "[-]", "valori in ascissa dell'idrogramma unitario adimensionale di Mockus."
            WRITE #1, "CN(III)=", "[-]", "=(23*C10)/(10+0.13*C10)", "", "", "", "", "", "", "q/qp=", "[-]", "valori in ordinata dell'idrogramma unitario adimensionale di Mockus."
            WRITE #1, "tl=", "[ore]", "=0.342*(((C8/1000)^0.8)/(C9^0.5))*(1000/C13-9)^0.7", "formula di Mockus esprimente il tempo di ritardo.", "", "", "", "", "", "tm/ta=", "[-]", "valori in ascissa dell'idrogramma unitario adimensionale di Mockus secondo il passo temporale dt utilizzato."
            WRITE #1, "tc=", "[ore]", "=C14/0.6", "tempo di corrivazione.", "", "", "", "", "", "qm/qp=", "[-]", "valori in ordinata dell'idrogramma unitario adimensionale di Mockus secondo il passo temporale dt utilizzato."
            WRITE #1, "N=d/tc=", "[-]", CoefficientiDiscretizzazioneTemporale(z%%).N, "moltiplicatore del tempo di corrivazione.", "", "", "", "", "", "qm=", "[mc/(s*mm)]", "valore dell'idrogramma unitario del bacino corrispondente alla colonna N*dt."
            WRITE #1, "d=", "[ore]", "=C16*C15", "durata della pioggia.", "", "", "", "", "", "Dhe*qm1-50=", "[mc/s]", "idrogramma relativo alla singole altezze di pioggia Dhe", " amplificata dal rispettivo valore qm."
            WRITE #1, "dt=", "[ore]", "=C21*C19", "passo temporale.", "", "", "", "", "", "Idrogramma=", "[mc/s]", "idrogramma complessivo, dato dalla somma a parità d'istante dei Dhe*qm1-50."
            WRITE #1, "ta=", "[ore]", "=C14/0.9", "tempo di picco."
            WRITE #1, "qp=", "[mc/(s*mm)]", "=0.208*((C4/1000000)/C19)", "portata al colmo dell'idrogramma unitario del bacino idrografico."
            WRITE #1, "C=", "[-]", CoefficientiDiscretizzazioneTemporale(z%%).tSUta, "coefficiente t/ta di Mockus utilizzato per la discretizzazione temporale."
            GOSUB DatiColonna
            WRITE #1, "1", "=A23*$C$18", "=SE(ARROTONDA(B23,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B23^$C$7,0)", "=SE(C23>0,C23/B23,0)", matrice1(ieto%%, z%%, 1, 1).i2, "=E23*$C$18", "=SE(C23>0,F23,0)", "=SE(G23-$C$12>=0,((G23-$C$12)^2)/(G23-$C$12+$C$11),0)", "=SE(C23>0,H23,0)", mockus(1).tSUta, mockus(1).qSUqp, matrice1(ieto%%, z%%, 1, 1).tmSUta, matrice1(ieto%%, z%%, 1, 1).qmSUqp, "=M23*$C$20", "=I23*$N$23", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O23:BL23)"
            WRITE #1, "2", "=A24*$C$18", "=SE(ARROTONDA(B24,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B24^$C$7,0)", "=SE(C24>0,(C24-C23)/$C$18,0)", matrice1(ieto%%, z%%, 2, 1).i2, "=E24*$C$18", "=SE(C24>0,G23+F24,0)", "=SE(G24-$C$12>=0,((G24-$C$12)^2)/(G24-$C$12+$C$11),0)", "=SE(C24>0,H24-H23,0)", mockus(2).tSUta, mockus(2).qSUqp, matrice1(ieto%%, z%%, 2, 1).tmSUta, matrice1(ieto%%, z%%, 2, 1).qmSUqp, "=M24*$C$20", "=I24*$N$23", "=I23*$N$24", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O24:BL24)"
            WRITE #1, "3", "=A25*$C$18", "=SE(ARROTONDA(B25,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B25^$C$7,0)", "=SE(C25>0,(C25-C24)/$C$18,0)", matrice1(ieto%%, z%%, 3, 1).i2, "=E25*$C$18", "=SE(C25>0,G24+F25,0)", "=SE(G25-$C$12>=0,((G25-$C$12)^2)/(G25-$C$12+$C$11),0)", "=SE(C25>0,H25-H24,0)", mockus(3).tSUta, mockus(3).qSUqp, matrice1(ieto%%, z%%, 3, 1).tmSUta, matrice1(ieto%%, z%%, 3, 1).qmSUqp, "=M25*$C$20", "=I25*$N$23", "=I24*$N$24", "=$I23*$N$25", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O25:BL25)"
            WRITE #1, "4", "=A26*$C$18", "=SE(ARROTONDA(B26,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B26^$C$7,0)", "=SE(C26>0,(C26-C25)/$C$18,0)", matrice1(ieto%%, z%%, 4, 1).i2, "=E26*$C$18", "=SE(C26>0,G25+F26,0)", "=SE(G26-$C$12>=0,((G26-$C$12)^2)/(G26-$C$12+$C$11),0)", "=SE(C26>0,H26-H25,0)", mockus(4).tSUta, mockus(4).qSUqp, matrice1(ieto%%, z%%, 4, 1).tmSUta, matrice1(ieto%%, z%%, 4, 1).qmSUqp, "=M26*$C$20", "=I26*$N$23", "=I25*$N$24", "=$I24*$N$25", "=$I23*$N$26", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O26:BL26)"
            WRITE #1, "5", "=A27*$C$18", "=SE(ARROTONDA(B27,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B27^$C$7,0)", "=SE(C27>0,(C27-C26)/$C$18,0)", matrice1(ieto%%, z%%, 5, 1).i2, "=E27*$C$18", "=SE(C27>0,G26+F27,0)", "=SE(G27-$C$12>=0,((G27-$C$12)^2)/(G27-$C$12+$C$11),0)", "=SE(C27>0,H27-H26,0)", mockus(5).tSUta, mockus(5).qSUqp, matrice1(ieto%%, z%%, 5, 1).tmSUta, matrice1(ieto%%, z%%, 5, 1).qmSUqp, "=M27*$C$20", "=I27*$N$23", "=I26*$N$24", "=$I25*$N$25", "=$I24*$N$26", "=$I23*$N$27", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O27:BL27)"
            WRITE #1, "6", "=A28*$C$18", "=SE(ARROTONDA(B28,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B28^$C$7,0)", "=SE(C28>0,(C28-C27)/$C$18,0)", matrice1(ieto%%, z%%, 6, 1).i2, "=E28*$C$18", "=SE(C28>0,G27+F28,0)", "=SE(G28-$C$12>=0,((G28-$C$12)^2)/(G28-$C$12+$C$11),0)", "=SE(C28>0,H28-H27,0)", mockus(6).tSUta, mockus(6).qSUqp, matrice1(ieto%%, z%%, 6, 1).tmSUta, matrice1(ieto%%, z%%, 6, 1).qmSUqp, "=M28*$C$20", "=I28*$N$23", "=I27*$N$24", "=$I26*$N$25", "=$I25*$N$26", "=$I24*$N$27", "=$I23*$N$28", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O28:BL28)"
            WRITE #1, "7", "=A29*$C$18", "=SE(ARROTONDA(B29,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B29^$C$7,0)", "=SE(C29>0,(C29-C28)/$C$18,0)", matrice1(ieto%%, z%%, 7, 1).i2, "=E29*$C$18", "=SE(C29>0,G28+F29,0)", "=SE(G29-$C$12>=0,((G29-$C$12)^2)/(G29-$C$12+$C$11),0)", "=SE(C29>0,H29-H28,0)", mockus(7).tSUta, mockus(7).qSUqp, matrice1(ieto%%, z%%, 7, 1).tmSUta, matrice1(ieto%%, z%%, 7, 1).qmSUqp, "=M29*$C$20", "=I29*$N$23", "=I28*$N$24", "=$I27*$N$25", "=$I26*$N$26", "=$I25*$N$27", "=$I24*$N$28", "=$I23*$N$29", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O29:BL29)"
            WRITE #1, "8", "=A30*$C$18", "=SE(ARROTONDA(B30,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B30^$C$7,0)", "=SE(C30>0,(C30-C29)/$C$18,0)", matrice1(ieto%%, z%%, 8, 1).i2, "=E30*$C$18", "=SE(C30>0,G29+F30,0)", "=SE(G30-$C$12>=0,((G30-$C$12)^2)/(G30-$C$12+$C$11),0)", "=SE(C30>0,H30-H29,0)", mockus(8).tSUta, mockus(8).qSUqp, matrice1(ieto%%, z%%, 8, 1).tmSUta, matrice1(ieto%%, z%%, 8, 1).qmSUqp, "=M30*$C$20", "=I30*$N$23", "=I29*$N$24", "=$I28*$N$25", "=$I27*$N$26", "=$I26*$N$27", "=$I25*$N$28", "=$I24*$N$29", "=$I23*$N$30", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O30:BL30)"
            WRITE #1, "9", "=A31*$C$18", "=SE(ARROTONDA(B31,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B31^$C$7,0)", "=SE(C31>0,(C31-C30)/$C$18,0)", matrice1(ieto%%, z%%, 9, 1).i2, "=E31*$C$18", "=SE(C31>0,G30+F31,0)", "=SE(G31-$C$12>=0,((G31-$C$12)^2)/(G31-$C$12+$C$11),0)", "=SE(C31>0,H31-H30,0)", mockus(9).tSUta, mockus(9).qSUqp, matrice1(ieto%%, z%%, 9, 1).tmSUta, matrice1(ieto%%, z%%, 9, 1).qmSUqp, "=M31*$C$20", "=I31*$N$23", "=I30*$N$24", "=$I29*$N$25", "=$I28*$N$26", "=$I27*$N$27", "=$I26*$N$28", "=$I25*$N$29", "=$I24*$N$30", "=$I23*$N$31", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O31:BL31)"
            WRITE #1, "10", "=A32*$C$18", "=SE(ARROTONDA(B32,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B32^$C$7,0)", "=SE(C32>0,(C32-C31)/$C$18,0)", matrice1(ieto%%, z%%, 10, 1).i2, "=E32*$C$18", "=SE(C32>0,G31+F32,0)", "=SE(G32-$C$12>=0,((G32-$C$12)^2)/(G32-$C$12+$C$11),0)", "=SE(C32>0,H32-H31,0)", mockus(10).tSUta, mockus(10).qSUqp, matrice1(ieto%%, z%%, 10, 1).tmSUta, matrice1(ieto%%, z%%, 10, 1).qmSUqp, "=M32*$C$20", "=I32*$N$23", "=I31*$N$24", "=$I30*$N$25", "=$I29*$N$26", "=$I28*$N$27", "=$I27*$N$28", "=$I26*$N$29", "=$I25*$N$30", "=$I24*$N$31", "=$I23*$N$32", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O32:BL32)"
            WRITE #1, "11", "=A33*$C$18", "=SE(ARROTONDA(B33,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B33^$C$7,0)", "=SE(C33>0,(C33-C32)/$C$18,0)", matrice1(ieto%%, z%%, 11, 1).i2, "=E33*$C$18", "=SE(C33>0,G32+F33,0)", "=SE(G33-$C$12>=0,((G33-$C$12)^2)/(G33-$C$12+$C$11),0)", "=SE(C33>0,H33-H32,0)", mockus(11).tSUta, mockus(11).qSUqp, matrice1(ieto%%, z%%, 11, 1).tmSUta, matrice1(ieto%%, z%%, 11, 1).qmSUqp, "=M33*$C$20", "=I33*$N$23", "=I32*$N$24", "=$I31*$N$25", "=$I30*$N$26", "=$I29*$N$27", "=$I28*$N$28", "=$I27*$N$29", "=$I26*$N$30", "=$I25*$N$31", "=$I24*$N$32", "=$I23*$N$33", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O33:BL33)"
            WRITE #1, "12", "=A34*$C$18", "=SE(ARROTONDA(B34,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B34^$C$7,0)", "=SE(C34>0,(C34-C33)/$C$18,0)", matrice1(ieto%%, z%%, 12, 1).i2, "=E34*$C$18", "=SE(C34>0,G33+F34,0)", "=SE(G34-$C$12>=0,((G34-$C$12)^2)/(G34-$C$12+$C$11),0)", "=SE(C34>0,H34-H33,0)", mockus(12).tSUta, mockus(12).qSUqp, matrice1(ieto%%, z%%, 12, 1).tmSUta, matrice1(ieto%%, z%%, 12, 1).qmSUqp, "=M34*$C$20", "=I34*$N$23", "=I33*$N$24", "=$I32*$N$25", "=$I31*$N$26", "=$I30*$N$27", "=$I29*$N$28", "=$I28*$N$29", "=$I27*$N$30", "=$I26*$N$31", "=$I25*$N$32", "=$I24*$N$33", "=$I23*$N$34", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O34:BL34)"
            WRITE #1, "13", "=A35*$C$18", "=SE(ARROTONDA(B35,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B35^$C$7,0)", "=SE(C35>0,(C35-C34)/$C$18,0)", matrice1(ieto%%, z%%, 13, 1).i2, "=E35*$C$18", "=SE(C35>0,G34+F35,0)", "=SE(G35-$C$12>=0,((G35-$C$12)^2)/(G35-$C$12+$C$11),0)", "=SE(C35>0,H35-H34,0)", mockus(13).tSUta, mockus(13).qSUqp, matrice1(ieto%%, z%%, 13, 1).tmSUta, matrice1(ieto%%, z%%, 13, 1).qmSUqp, "=M35*$C$20", "=I35*$N$23", "=I34*$N$24", "=$I33*$N$25", "=$I32*$N$26", "=$I31*$N$27", "=$I30*$N$28", "=$I29*$N$29", "=$I28*$N$30", "=$I27*$N$31", "=$I26*$N$32", "=$I25*$N$33", "=$I24*$N$34", "=$I23*$N$35", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O35:BL35)"
            WRITE #1, "14", "=A36*$C$18", "=SE(ARROTONDA(B36,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B36^$C$7,0)", "=SE(C36>0,(C36-C35)/$C$18,0)", matrice1(ieto%%, z%%, 14, 1).i2, "=E36*$C$18", "=SE(C36>0,G35+F36,0)", "=SE(G36-$C$12>=0,((G36-$C$12)^2)/(G36-$C$12+$C$11),0)", "=SE(C36>0,H36-H35,0)", mockus(14).tSUta, mockus(14).qSUqp, matrice1(ieto%%, z%%, 14, 1).tmSUta, matrice1(ieto%%, z%%, 14, 1).qmSUqp, "=M36*$C$20", "=I36*$N$23", "=I35*$N$24", "=$I34*$N$25", "=$I33*$N$26", "=$I32*$N$27", "=$I31*$N$28", "=$I30*$N$29", "=$I29*$N$30", "=$I28*$N$31", "=$I27*$N$32", "=$I26*$N$33", "=$I25*$N$34", "=$I24*$N$35", "=$I23*$N$36", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O36:BL36)"
            WRITE #1, "15", "=A37*$C$18", "=SE(ARROTONDA(B37,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B37^$C$7,0)", "=SE(C37>0,(C37-C36)/$C$18,0)", matrice1(ieto%%, z%%, 15, 1).i2, "=E37*$C$18", "=SE(C37>0,G36+F37,0)", "=SE(G37-$C$12>=0,((G37-$C$12)^2)/(G37-$C$12+$C$11),0)", "=SE(C37>0,H37-H36,0)", mockus(15).tSUta, mockus(15).qSUqp, matrice1(ieto%%, z%%, 15, 1).tmSUta, matrice1(ieto%%, z%%, 15, 1).qmSUqp, "=M37*$C$20", "=I37*$N$23", "=I36*$N$24", "=$I35*$N$25", "=$I34*$N$26", "=$I33*$N$27", "=$I32*$N$28", "=$I31*$N$29", "=$I30*$N$30", "=$I29*$N$31", "=$I28*$N$32", "=$I27*$N$33", "=$I26*$N$34", "=$I25*$N$35", "=$I24*$N$36", "=$I23*$N$37", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O37:BL37)"
            WRITE #1, "16", "=A38*$C$18", "=SE(ARROTONDA(B38,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B38^$C$7,0)", "=SE(C38>0,(C38-C37)/$C$18,0)", matrice1(ieto%%, z%%, 16, 1).i2, "=E38*$C$18", "=SE(C38>0,G37+F38,0)", "=SE(G38-$C$12>=0,((G38-$C$12)^2)/(G38-$C$12+$C$11),0)", "=SE(C38>0,H38-H37,0)", mockus(16).tSUta, mockus(16).qSUqp, matrice1(ieto%%, z%%, 16, 1).tmSUta, matrice1(ieto%%, z%%, 16, 1).qmSUqp, "=M38*$C$20", "=I38*$N$23", "=I37*$N$24", "=$I36*$N$25", "=$I35*$N$26", "=$I34*$N$27", "=$I33*$N$28", "=$I32*$N$29", "=$I31*$N$30", "=$I30*$N$31", "=$I29*$N$32", "=$I28*$N$33", "=$I27*$N$34", "=$I26*$N$35", "=$I25*$N$36", "=$I24*$N$37", "=$I23*$N$38", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O38:BL38)"
            WRITE #1, "17", "=A39*$C$18", "=SE(ARROTONDA(B39,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B39^$C$7,0)", "=SE(C39>0,(C39-C38)/$C$18,0)", matrice1(ieto%%, z%%, 17, 1).i2, "=E39*$C$18", "=SE(C39>0,G38+F39,0)", "=SE(G39-$C$12>=0,((G39-$C$12)^2)/(G39-$C$12+$C$11),0)", "=SE(C39>0,H39-H38,0)", mockus(17).tSUta, mockus(17).qSUqp, matrice1(ieto%%, z%%, 17, 1).tmSUta, matrice1(ieto%%, z%%, 17, 1).qmSUqp, "=M39*$C$20", "=I39*$N$23", "=I38*$N$24", "=$I37*$N$25", "=$I36*$N$26", "=$I35*$N$27", "=$I34*$N$28", "=$I33*$N$29", "=$I32*$N$30", "=$I31*$N$31", "=$I30*$N$32", "=$I29*$N$33", "=$I28*$N$34", "=$I27*$N$35", "=$I26*$N$36", "=$I25*$N$37", "=$I24*$N$38", "=$I23*$N$39", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O39:BL39)"
            WRITE #1, "18", "=A40*$C$18", "=SE(ARROTONDA(B40,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B40^$C$7,0)", "=SE(C40>0,(C40-C39)/$C$18,0)", matrice1(ieto%%, z%%, 18, 1).i2, "=E40*$C$18", "=SE(C40>0,G39+F40,0)", "=SE(G40-$C$12>=0,((G40-$C$12)^2)/(G40-$C$12+$C$11),0)", "=SE(C40>0,H40-H39,0)", mockus(18).tSUta, mockus(18).qSUqp, matrice1(ieto%%, z%%, 18, 1).tmSUta, matrice1(ieto%%, z%%, 18, 1).qmSUqp, "=M40*$C$20", "=I40*$N$23", "=I39*$N$24", "=$I38*$N$25", "=$I37*$N$26", "=$I36*$N$27", "=$I35*$N$28", "=$I34*$N$29", "=$I33*$N$30", "=$I32*$N$31", "=$I31*$N$32", "=$I30*$N$33", "=$I29*$N$34", "=$I28*$N$35", "=$I27*$N$36", "=$I26*$N$37", "=$I25*$N$38", "=$I24*$N$39", "=$I23*$N$40", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O40:BL40)"
            WRITE #1, "19", "=A41*$C$18", "=SE(ARROTONDA(B41,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B41^$C$7,0)", "=SE(C41>0,(C41-C40)/$C$18,0)", matrice1(ieto%%, z%%, 19, 1).i2, "=E41*$C$18", "=SE(C41>0,G40+F41,0)", "=SE(G41-$C$12>=0,((G41-$C$12)^2)/(G41-$C$12+$C$11),0)", "=SE(C41>0,H41-H40,0)", mockus(19).tSUta, mockus(19).qSUqp, matrice1(ieto%%, z%%, 19, 1).tmSUta, matrice1(ieto%%, z%%, 19, 1).qmSUqp, "=M41*$C$20", "=I41*$N$23", "=I40*$N$24", "=$I39*$N$25", "=$I38*$N$26", "=$I37*$N$27", "=$I36*$N$28", "=$I35*$N$29", "=$I34*$N$30", "=$I33*$N$31", "=$I32*$N$32", "=$I31*$N$33", "=$I30*$N$34", "=$I29*$N$35", "=$I28*$N$36", "=$I27*$N$37", "=$I26*$N$38", "=$I25*$N$39", "=$I24*$N$40", "=$I23*$N$41", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O41:BL41)"
            WRITE #1, "20", "=A42*$C$18", "=SE(ARROTONDA(B42,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B42^$C$7,0)", "=SE(C42>0,(C42-C41)/$C$18,0)", matrice1(ieto%%, z%%, 20, 1).i2, "=E42*$C$18", "=SE(C42>0,G41+F42,0)", "=SE(G42-$C$12>=0,((G42-$C$12)^2)/(G42-$C$12+$C$11),0)", "=SE(C42>0,H42-H41,0)", mockus(20).tSUta, mockus(20).qSUqp, matrice1(ieto%%, z%%, 20, 1).tmSUta, matrice1(ieto%%, z%%, 20, 1).qmSUqp, "=M42*$C$20", "=I42*$N$23", "=I41*$N$24", "=$I40*$N$25", "=$I39*$N$26", "=$I38*$N$27", "=$I37*$N$28", "=$I36*$N$29", "=$I35*$N$30", "=$I34*$N$31", "=$I33*$N$32", "=$I32*$N$33", "=$I31*$N$34", "=$I30*$N$35", "=$I29*$N$36", "=$I28*$N$37", "=$I27*$N$38", "=$I26*$N$39", "=$I25*$N$40", "=$I24*$N$41", "=$I23*$N$42", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O42:BL42)"
            WRITE #1, "21", "=A43*$C$18", "=SE(ARROTONDA(B43,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B43^$C$7,0)", "=SE(C43>0,(C43-C42)/$C$18,0)", matrice1(ieto%%, z%%, 21, 1).i2, "=E43*$C$18", "=SE(C43>0,G42+F43,0)", "=SE(G43-$C$12>=0,((G43-$C$12)^2)/(G43-$C$12+$C$11),0)", "=SE(C43>0,H43-H42,0)", mockus(21).tSUta, mockus(21).qSUqp, matrice1(ieto%%, z%%, 21, 1).tmSUta, matrice1(ieto%%, z%%, 21, 1).qmSUqp, "=M43*$C$20", "=I43*$N$23", "=I42*$N$24", "=$I41*$N$25", "=$I40*$N$26", "=$I39*$N$27", "=$I38*$N$28", "=$I37*$N$29", "=$I36*$N$30", "=$I35*$N$31", "=$I34*$N$32", "=$I33*$N$33", "=$I32*$N$34", "=$I31*$N$35", "=$I30*$N$36", "=$I29*$N$37", "=$I28*$N$38", "=$I27*$N$39", "=$I26*$N$40", "=$I25*$N$41", "=$I24*$N$42", "=$I23*$N$43", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O43:BL43)"
            WRITE #1, "22", "=A44*$C$18", "=SE(ARROTONDA(B44,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B44^$C$7,0)", "=SE(C44>0,(C44-C43)/$C$18,0)", matrice1(ieto%%, z%%, 22, 1).i2, "=E44*$C$18", "=SE(C44>0,G43+F44,0)", "=SE(G44-$C$12>=0,((G44-$C$12)^2)/(G44-$C$12+$C$11),0)", "=SE(C44>0,H44-H43,0)", mockus(22).tSUta, mockus(22).qSUqp, matrice1(ieto%%, z%%, 22, 1).tmSUta, matrice1(ieto%%, z%%, 22, 1).qmSUqp, "=M44*$C$20", "=I44*$N$23", "=I43*$N$24", "=$I42*$N$25", "=$I41*$N$26", "=$I40*$N$27", "=$I39*$N$28", "=$I38*$N$29", "=$I37*$N$30", "=$I36*$N$31", "=$I35*$N$32", "=$I34*$N$33", "=$I33*$N$34", "=$I32*$N$35", "=$I31*$N$36", "=$I30*$N$37", "=$I29*$N$38", "=$I28*$N$39", "=$I27*$N$40", "=$I26*$N$41", "=$I25*$N$42", "=$I24*$N$43", "=$I23*$N$44", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O44:BL44)"
            WRITE #1, "23", "=A45*$C$18", "=SE(ARROTONDA(B45,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B45^$C$7,0)", "=SE(C45>0,(C45-C44)/$C$18,0)", matrice1(ieto%%, z%%, 23, 1).i2, "=E45*$C$18", "=SE(C45>0,G44+F45,0)", "=SE(G45-$C$12>=0,((G45-$C$12)^2)/(G45-$C$12+$C$11),0)", "=SE(C45>0,H45-H44,0)", mockus(23).tSUta, mockus(23).qSUqp, matrice1(ieto%%, z%%, 23, 1).tmSUta, matrice1(ieto%%, z%%, 23, 1).qmSUqp, "=M45*$C$20", "=I45*$N$23", "=I44*$N$24", "=$I43*$N$25", "=$I42*$N$26", "=$I41*$N$27", "=$I40*$N$28", "=$I39*$N$29", "=$I38*$N$30", "=$I37*$N$31", "=$I36*$N$32", "=$I35*$N$33", "=$I34*$N$34", "=$I33*$N$35", "=$I32*$N$36", "=$I31*$N$37", "=$I30*$N$38", "=$I29*$N$39", "=$I28*$N$40", "=$I27*$N$41", "=$I26*$N$42", "=$I25*$N$43", "=$I24*$N$44", "=$I23*$N$45", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O45:BL45)"
            WRITE #1, "24", "=A46*$C$18", "=SE(ARROTONDA(B46,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B46^$C$7,0)", "=SE(C46>0,(C46-C45)/$C$18,0)", matrice1(ieto%%, z%%, 24, 1).i2, "=E46*$C$18", "=SE(C46>0,G45+F46,0)", "=SE(G46-$C$12>=0,((G46-$C$12)^2)/(G46-$C$12+$C$11),0)", "=SE(C46>0,H46-H45,0)", mockus(24).tSUta, mockus(24).qSUqp, matrice1(ieto%%, z%%, 24, 1).tmSUta, matrice1(ieto%%, z%%, 24, 1).qmSUqp, "=M46*$C$20", "=I46*$N$23", "=I45*$N$24", "=$I44*$N$25", "=$I43*$N$26", "=$I42*$N$27", "=$I41*$N$28", "=$I40*$N$29", "=$I39*$N$30", "=$I38*$N$31", "=$I37*$N$32", "=$I36*$N$33", "=$I35*$N$34", "=$I34*$N$35", "=$I33*$N$36", "=$I32*$N$37", "=$I31*$N$38", "=$I30*$N$39", "=$I29*$N$40", "=$I28*$N$41", "=$I27*$N$42", "=$I26*$N$43", "=$I25*$N$44", "=$I24*$N$45", "=$I23*$N$46", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O46:BL46)"
            WRITE #1, "25", "=A47*$C$18", "=SE(ARROTONDA(B47,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B47^$C$7,0)", "=SE(C47>0,(C47-C46)/$C$18,0)", matrice1(ieto%%, z%%, 25, 1).i2, "=E47*$C$18", "=SE(C47>0,G46+F47,0)", "=SE(G47-$C$12>=0,((G47-$C$12)^2)/(G47-$C$12+$C$11),0)", "=SE(C47>0,H47-H46,0)", mockus(25).tSUta, mockus(25).qSUqp, matrice1(ieto%%, z%%, 25, 1).tmSUta, matrice1(ieto%%, z%%, 25, 1).qmSUqp, "=M47*$C$20", "=I47*$N$23", "=I46*$N$24", "=$I45*$N$25", "=$I44*$N$26", "=$I43*$N$27", "=$I42*$N$28", "=$I41*$N$29", "=$I40*$N$30", "=$I39*$N$31", "=$I38*$N$32", "=$I37*$N$33", "=$I36*$N$34", "=$I35*$N$35", "=$I34*$N$36", "=$I33*$N$37", "=$I32*$N$38", "=$I31*$N$39", "=$I30*$N$40", "=$I29*$N$41", "=$I28*$N$42", "=$I27*$N$43", "=$I26*$N$44", "=$I25*$N$45", "=$I24*$N$46", "=$I23*$N$47", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O47:BL47)"
            WRITE #1, "26", "=A48*$C$18", "=SE(ARROTONDA(B48,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B48^$C$7,0)", "=SE(C48>0,(C48-C47)/$C$18,0)", matrice1(ieto%%, z%%, 26, 1).i2, "=E48*$C$18", "=SE(C48>0,G47+F48,0)", "=SE(G48-$C$12>=0,((G48-$C$12)^2)/(G48-$C$12+$C$11),0)", "=SE(C48>0,H48-H47,0)", mockus(26).tSUta, mockus(26).qSUqp, matrice1(ieto%%, z%%, 26, 1).tmSUta, matrice1(ieto%%, z%%, 26, 1).qmSUqp, "=M48*$C$20", "=I48*$N$23", "=I47*$N$24", "=$I46*$N$25", "=$I45*$N$26", "=$I44*$N$27", "=$I43*$N$28", "=$I42*$N$29", "=$I41*$N$30", "=$I40*$N$31", "=$I39*$N$32", "=$I38*$N$33", "=$I37*$N$34", "=$I36*$N$35", "=$I35*$N$36", "=$I34*$N$37", "=$I33*$N$38", "=$I32*$N$39", "=$I31*$N$40", "=$I30*$N$41", "=$I29*$N$42", "=$I28*$N$43", "=$I27*$N$44", "=$I26*$N$45", "=$I25*$N$46", "=$I24*$N$47", "=$I23*$N$48", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O48:BL48)"
            WRITE #1, "27", "=A49*$C$18", "=SE(ARROTONDA(B49,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B49^$C$7,0)", "=SE(C49>0,(C49-C48)/$C$18,0)", matrice1(ieto%%, z%%, 27, 1).i2, "=E49*$C$18", "=SE(C49>0,G48+F49,0)", "=SE(G49-$C$12>=0,((G49-$C$12)^2)/(G49-$C$12+$C$11),0)", "=SE(C49>0,H49-H48,0)", mockus(27).tSUta, mockus(27).qSUqp, matrice1(ieto%%, z%%, 27, 1).tmSUta, matrice1(ieto%%, z%%, 27, 1).qmSUqp, "=M49*$C$20", "=I49*$N$23", "=I48*$N$24", "=$I47*$N$25", "=$I46*$N$26", "=$I45*$N$27", "=$I44*$N$28", "=$I43*$N$29", "=$I42*$N$30", "=$I41*$N$31", "=$I40*$N$32", "=$I39*$N$33", "=$I38*$N$34", "=$I37*$N$35", "=$I36*$N$36", "=$I35*$N$37", "=$I34*$N$38", "=$I33*$N$39", "=$I32*$N$40", "=$I31*$N$41", "=$I30*$N$42", "=$I29*$N$43", "=$I28*$N$44", "=$I27*$N$45", "=$I26*$N$46", "=$I25*$N$47", "=$I24*$N$48", "=$I23*$N$49", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O49:BL49)"
            WRITE #1, "28", "=A50*$C$18", "=SE(ARROTONDA(B50,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B50^$C$7,0)", "=SE(C50>0,(C50-C49)/$C$18,0)", matrice1(ieto%%, z%%, 28, 1).i2, "=E50*$C$18", "=SE(C50>0,G49+F50,0)", "=SE(G50-$C$12>=0,((G50-$C$12)^2)/(G50-$C$12+$C$11),0)", "=SE(C50>0,H50-H49,0)", mockus(28).tSUta, mockus(28).qSUqp, matrice1(ieto%%, z%%, 28, 1).tmSUta, matrice1(ieto%%, z%%, 28, 1).qmSUqp, "=M50*$C$20", "=I50*$N$23", "=I49*$N$24", "=$I48*$N$25", "=$I47*$N$26", "=$I46*$N$27", "=$I45*$N$28", "=$I44*$N$29", "=$I43*$N$30", "=$I42*$N$31", "=$I41*$N$32", "=$I40*$N$33", "=$I39*$N$34", "=$I38*$N$35", "=$I37*$N$36", "=$I36*$N$37", "=$I35*$N$38", "=$I34*$N$39", "=$I33*$N$40", "=$I32*$N$41", "=$I31*$N$42", "=$I30*$N$43", "=$I29*$N$44", "=$I28*$N$45", "=$I27*$N$46", "=$I26*$N$47", "=$I25*$N$48", "=$I24*$N$49", "=$I23*$N$50", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O50:BL50)"
            WRITE #1, "29", "=A51*$C$18", "=SE(ARROTONDA(B51,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B51^$C$7,0)", "=SE(C51>0,(C51-C50)/$C$18,0)", matrice1(ieto%%, z%%, 29, 1).i2, "=E51*$C$18", "=SE(C51>0,G50+F51,0)", "=SE(G51-$C$12>=0,((G51-$C$12)^2)/(G51-$C$12+$C$11),0)", "=SE(C51>0,H51-H50,0)", mockus(29).tSUta, mockus(29).qSUqp, matrice1(ieto%%, z%%, 29, 1).tmSUta, matrice1(ieto%%, z%%, 29, 1).qmSUqp, "=M51*$C$20", "=I51*$N$23", "=I50*$N$24", "=$I49*$N$25", "=$I48*$N$26", "=$I47*$N$27", "=$I46*$N$28", "=$I45*$N$29", "=$I44*$N$30", "=$I43*$N$31", "=$I42*$N$32", "=$I41*$N$33", "=$I40*$N$34", "=$I39*$N$35", "=$I38*$N$36", "=$I37*$N$37", "=$I36*$N$38", "=$I35*$N$39", "=$I34*$N$40", "=$I33*$N$41", "=$I32*$N$42", "=$I31*$N$43", "=$I30*$N$44", "=$I29*$N$45", "=$I28*$N$46", "=$I27*$N$47", "=$I26*$N$48", "=$I25*$N$49", "=$I24*$N$50", "=$I23*$N$51", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O51:BL51)"
            WRITE #1, "30", "=A52*$C$18", "=SE(ARROTONDA(B52,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B52^$C$7,0)", "=SE(C52>0,(C52-C51)/$C$18,0)", matrice1(ieto%%, z%%, 30, 1).i2, "=E52*$C$18", "=SE(C52>0,G51+F52,0)", "=SE(G52-$C$12>=0,((G52-$C$12)^2)/(G52-$C$12+$C$11),0)", "=SE(C52>0,H52-H51,0)", mockus(30).tSUta, mockus(30).qSUqp, matrice1(ieto%%, z%%, 30, 1).tmSUta, matrice1(ieto%%, z%%, 30, 1).qmSUqp, "=M52*$C$20", "=I52*$N$23", "=I51*$N$24", "=$I50*$N$25", "=$I49*$N$26", "=$I48*$N$27", "=$I47*$N$28", "=$I46*$N$29", "=$I45*$N$30", "=$I44*$N$31", "=$I43*$N$32", "=$I42*$N$33", "=$I41*$N$34", "=$I40*$N$35", "=$I39*$N$36", "=$I38*$N$37", "=$I37*$N$38", "=$I36*$N$39", "=$I35*$N$40", "=$I34*$N$41", "=$I33*$N$42", "=$I32*$N$43", "=$I31*$N$44", "=$I30*$N$45", "=$I29*$N$46", "=$I28*$N$47", "=$I27*$N$48", "=$I26*$N$49", "=$I25*$N$50", "=$I24*$N$51", "=$I23*$N$52", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O52:BL52)"
            WRITE #1, "31", "=A53*$C$18", "=SE(ARROTONDA(B53,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B53^$C$7,0)", "=SE(C53>0,(C53-C52)/$C$18,0)", matrice1(ieto%%, z%%, 31, 1).i2, "=E53*$C$18", "=SE(C53>0,G52+F53,0)", "=SE(G53-$C$12>=0,((G53-$C$12)^2)/(G53-$C$12+$C$11),0)", "=SE(C53>0,H53-H52,0)", mockus(31).tSUta, mockus(31).qSUqp, matrice1(ieto%%, z%%, 31, 1).tmSUta, matrice1(ieto%%, z%%, 31, 1).qmSUqp, "=M53*$C$20", "=I53*$N$23", "=I52*$N$24", "=$I51*$N$25", "=$I50*$N$26", "=$I49*$N$27", "=$I48*$N$28", "=$I47*$N$29", "=$I46*$N$30", "=$I45*$N$31", "=$I44*$N$32", "=$I43*$N$33", "=$I42*$N$34", "=$I41*$N$35", "=$I40*$N$36", "=$I39*$N$37", "=$I38*$N$38", "=$I37*$N$39", "=$I36*$N$40", "=$I35*$N$41", "=$I34*$N$42", "=$I33*$N$43", "=$I32*$N$44", "=$I31*$N$45", "=$I30*$N$46", "=$I29*$N$47", "=$I28*$N$48", "=$I27*$N$49", "=$I26*$N$50", "=$I25*$N$51", "=$I24*$N$52", "=$I23*$N$53", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O53:BL53)"
            WRITE #1, "32", "=A54*$C$18", "=SE(ARROTONDA(B54,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B54^$C$7,0)", "=SE(C54>0,(C54-C53)/$C$18,0)", matrice1(ieto%%, z%%, 32, 1).i2, "=E54*$C$18", "=SE(C54>0,G53+F54,0)", "=SE(G54-$C$12>=0,((G54-$C$12)^2)/(G54-$C$12+$C$11),0)", "=SE(C54>0,H54-H53,0)", mockus(32).tSUta, mockus(32).qSUqp, matrice1(ieto%%, z%%, 32, 1).tmSUta, matrice1(ieto%%, z%%, 32, 1).qmSUqp, "=M54*$C$20", "=I54*$N$23", "=I53*$N$24", "=$I52*$N$25", "=$I51*$N$26", "=$I50*$N$27", "=$I49*$N$28", "=$I48*$N$29", "=$I47*$N$30", "=$I46*$N$31", "=$I45*$N$32", "=$I44*$N$33", "=$I43*$N$34", "=$I42*$N$35", "=$I41*$N$36", "=$I40*$N$37", "=$I39*$N$38", "=$I38*$N$39", "=$I37*$N$40", "=$I36*$N$41", "=$I35*$N$42", "=$I34*$N$43", "=$I33*$N$44", "=$I32*$N$45", "=$I31*$N$46", "=$I30*$N$47", "=$I29*$N$48", "=$I28*$N$49", "=$I27*$N$50", "=$I26*$N$51", "=$I25*$N$52", "=$I24*$N$53", "=$I23*$N$54", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O54:BL54)"
            WRITE #1, "33", "=A55*$C$18", "=SE(ARROTONDA(B55,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B55^$C$7,0)", "=SE(C55>0,(C55-C54)/$C$18,0)", matrice1(ieto%%, z%%, 33, 1).i2, "=E55*$C$18", "=SE(C55>0,G54+F55,0)", "=SE(G55-$C$12>=0,((G55-$C$12)^2)/(G55-$C$12+$C$11),0)", "=SE(C55>0,H55-H54,0)", mockus(33).tSUta, mockus(33).qSUqp, matrice1(ieto%%, z%%, 33, 1).tmSUta, matrice1(ieto%%, z%%, 33, 1).qmSUqp, "=M55*$C$20", "=I55*$N$23", "=I54*$N$24", "=$I53*$N$25", "=$I52*$N$26", "=$I51*$N$27", "=$I50*$N$28", "=$I49*$N$29", "=$I48*$N$30", "=$I47*$N$31", "=$I46*$N$32", "=$I45*$N$33", "=$I44*$N$34", "=$I43*$N$35", "=$I42*$N$36", "=$I41*$N$37", "=$I40*$N$38", "=$I39*$N$39", "=$I38*$N$40", "=$I37*$N$41", "=$I36*$N$42", "=$I35*$N$43", "=$I34*$N$44", "=$I33*$N$45", "=$I32*$N$46", "=$I31*$N$47", "=$I30*$N$48", "=$I29*$N$49", "=$I28*$N$50", "=$I27*$N$51", "=$I26*$N$52", "=$I25*$N$53", "=$I24*$N$54", "=$I23*$M$55", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O55:BL55)"
            WRITE #1, "34", "=A56*$C$18", "=SE(ARROTONDA(B56,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B56^$C$7,0)", "=SE(C56>0,(C56-C55)/$C$18,0)", matrice1(ieto%%, z%%, 34, 1).i2, "=E56*$C$18", "=SE(C56>0,G55+F56,0)", "=SE(G56-$C$12>=0,((G56-$C$12)^2)/(G56-$C$12+$C$11),0)", "=SE(C56>0,H56-H55,0)", mockus(34).tSUta, mockus(34).qSUqp, matrice1(ieto%%, z%%, 34, 1).tmSUta, matrice1(ieto%%, z%%, 34, 1).qmSUqp, "=M56*$C$20", "=I56*$N$23", "=I55*$N$24", "=$I54*$N$25", "=$I53*$N$26", "=$I52*$N$27", "=$I51*$N$28", "=$I50*$N$29", "=$I49*$N$30", "=$I48*$N$31", "=$I47*$N$32", "=$I46*$N$33", "=$I45*$N$34", "=$I44*$N$35", "=$I43*$N$36", "=$I42*$N$37", "=$I41*$N$38", "=$I40*$N$39", "=$I39*$N$40", "=$I38*$N$41", "=$I37*$N$42", "=$I36*$N$43", "=$I35*$N$44", "=$I34*$N$45", "=$I33*$N$46", "=$I32*$N$47", "=$I31*$N$48", "=$I30*$N$49", "=$I29*$N$50", "=$I28*$N$51", "=$I27*$N$52", "=$I26*$N$53", "=$I25*$N$54", "=$I24*$M$55", "=$I23*$M$56", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O56:BL56)"
            WRITE #1, "35", "=A57*$C$18", "=SE(ARROTONDA(B57,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B57^$C$7,0)", "=SE(C57>0,(C57-C56)/$C$18,0)", matrice1(ieto%%, z%%, 35, 1).i2, "=E57*$C$18", "=SE(C57>0,G56+F57,0)", "=SE(G57-$C$12>=0,((G57-$C$12)^2)/(G57-$C$12+$C$11),0)", "=SE(C57>0,H57-H56,0)", mockus(35).tSUta, mockus(35).qSUqp, matrice1(ieto%%, z%%, 35, 1).tmSUta, matrice1(ieto%%, z%%, 35, 1).qmSUqp, "=M57*$C$20", "=I57*$N$23", "=I56*$N$24", "=$I55*$N$25", "=$I54*$N$26", "=$I53*$N$27", "=$I52*$N$28", "=$I51*$N$29", "=$I50*$N$30", "=$I49*$N$31", "=$I48*$N$32", "=$I47*$N$33", "=$I46*$N$34", "=$I45*$N$35", "=$I44*$N$36", "=$I43*$N$37", "=$I42*$N$38", "=$I41*$N$39", "=$I40*$N$40", "=$I39*$N$41", "=$I38*$N$42", "=$I37*$N$43", "=$I36*$N$44", "=$I35*$N$45", "=$I34*$N$46", "=$I33*$N$47", "=$I32*$N$48", "=$I31*$N$49", "=$I30*$N$50", "=$I29*$N$51", "=$I28*$N$52", "=$I27*$N$53", "=$I26*$N$54", "=$I25*$M$55", "=$I24*$M$56", "=$I23*$M$57", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O57:BL57)"
            WRITE #1, "36", "=A58*$C$18", "=SE(ARROTONDA(B58,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B58^$C$7,0)", "=SE(C58>0,(C58-C57)/$C$18,0)", matrice1(ieto%%, z%%, 36, 1).i2, "=E58*$C$18", "=SE(C58>0,G57+F58,0)", "=SE(G58-$C$12>=0,((G58-$C$12)^2)/(G58-$C$12+$C$11),0)", "=SE(C58>0,H58-H57,0)", mockus(36).tSUta, mockus(36).qSUqp, matrice1(ieto%%, z%%, 36, 1).tmSUta, matrice1(ieto%%, z%%, 36, 1).qmSUqp, "=M58*$C$20", "=I58*$N$23", "=I57*$N$24", "=$I56*$N$25", "=$I55*$N$26", "=$I54*$N$27", "=$I53*$N$28", "=$I52*$N$29", "=$I51*$N$30", "=$I50*$N$31", "=$I49*$N$32", "=$I48*$N$33", "=$I47*$N$34", "=$I46*$N$35", "=$I45*$N$36", "=$I44*$N$37", "=$I43*$N$38", "=$I42*$N$39", "=$I41*$N$40", "=$I40*$N$41", "=$I39*$N$42", "=$I38*$N$43", "=$I37*$N$44", "=$I36*$N$45", "=$I35*$N$46", "=$I34*$N$47", "=$I33*$N$48", "=$I32*$N$49", "=$I31*$N$50", "=$I30*$N$51", "=$I29*$N$52", "=$I28*$N$53", "=$I27*$N$54", "=$I26*$M$55", "=$I25*$M$56", "=$I24*$M$57", "=$I23*$M$58", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O58:BL58)"
            WRITE #1, "37", "=A59*$C$18", "=SE(ARROTONDA(B59,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B59^$C$7,0)", "=SE(C59>0,(C59-C58)/$C$18,0)", matrice1(ieto%%, z%%, 37, 1).i2, "=E59*$C$18", "=SE(C59>0,G58+F59,0)", "=SE(G59-$C$12>=0,((G59-$C$12)^2)/(G59-$C$12+$C$11),0)", "=SE(C59>0,H59-H58,0)", mockus(37).tSUta, mockus(37).qSUqp, matrice1(ieto%%, z%%, 37, 1).tmSUta, matrice1(ieto%%, z%%, 37, 1).qmSUqp, "=M59*$C$20", "=I59*$N$23", "=I58*$N$24", "=$I57*$N$25", "=$I56*$N$26", "=$I55*$N$27", "=$I54*$N$28", "=$I53*$N$29", "=$I52*$N$30", "=$I51*$N$31", "=$I50*$N$32", "=$I49*$N$33", "=$I48*$N$34", "=$I47*$N$35", "=$I46*$N$36", "=$I45*$N$37", "=$I44*$N$38", "=$I43*$N$39", "=$I42*$N$40", "=$I41*$N$41", "=$I40*$N$42", "=$I39*$N$43", "=$I38*$N$44", "=$I37*$N$45", "=$I36*$N$46", "=$I35*$N$47", "=$I34*$N$48", "=$I33*$N$49", "=$I32*$N$50", "=$I31*$N$51", "=$I30*$N$52", "=$I29*$N$53", "=$I28*$N$54", "=$I27*$M$55", "=$I26*$M$56", "=$I25*$M$57", "=$I24*$M$58", "=$I23*$M$59", "", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O59:BL59)"
            WRITE #1, "38", "=A60*$C$18", "=SE(ARROTONDA(B60,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B60^$C$7,0)", "=SE(C60>0,(C60-C59)/$C$18,0)", matrice1(ieto%%, z%%, 38, 1).i2, "=E60*$C$18", "=SE(C60>0,G59+F60,0)", "=SE(G60-$C$12>=0,((G60-$C$12)^2)/(G60-$C$12+$C$11),0)", "=SE(C60>0,H60-H59,0)", mockus(38).tSUta, mockus(38).qSUqp, matrice1(ieto%%, z%%, 38, 1).tmSUta, matrice1(ieto%%, z%%, 38, 1).qmSUqp, "=M60*$C$20", "=I60*$N$23", "=I59*$N$24", "=$I58*$N$25", "=$I57*$N$26", "=$I56*$N$27", "=$I55*$N$28", "=$I54*$N$29", "=$I53*$N$30", "=$I52*$N$31", "=$I51*$N$32", "=$I50*$N$33", "=$I49*$N$34", "=$I48*$N$35", "=$I47*$N$36", "=$I46*$N$37", "=$I45*$N$38", "=$I44*$N$39", "=$I43*$N$40", "=$I42*$N$41", "=$I41*$N$42", "=$I40*$N$43", "=$I39*$N$44", "=$I38*$N$45", "=$I37*$N$46", "=$I36*$N$47", "=$I35*$N$48", "=$I34*$N$49", "=$I33*$N$50", "=$I32*$N$51", "=$I31*$N$52", "=$I30*$N$53", "=$I29*$N$54", "=$I28*$M$55", "=$I27*$M$56", "=$I26*$M$57", "=$I25*$M$58", "=$I24*$M$59", "=$I23*$M$60", "", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O60:BL60)"
            WRITE #1, "39", "=A61*$C$18", "=SE(ARROTONDA(B61,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B61^$C$7,0)", "=SE(C61>0,(C61-C60)/$C$18,0)", matrice1(ieto%%, z%%, 39, 1).i2, "=E61*$C$18", "=SE(C61>0,G60+F61,0)", "=SE(G61-$C$12>=0,((G61-$C$12)^2)/(G61-$C$12+$C$11),0)", "=SE(C61>0,H61-H60,0)", mockus(39).tSUta, mockus(39).qSUqp, matrice1(ieto%%, z%%, 39, 1).tmSUta, matrice1(ieto%%, z%%, 39, 1).qmSUqp, "=M61*$C$20", "=I61*$N$23", "=I60*$N$24", "=$I59*$N$25", "=$I58*$N$26", "=$I57*$N$27", "=$I56*$N$28", "=$I55*$N$29", "=$I54*$N$30", "=$I53*$N$31", "=$I52*$N$32", "=$I51*$N$33", "=$I50*$N$34", "=$I49*$N$35", "=$I48*$N$36", "=$I47*$N$37", "=$I46*$N$38", "=$I45*$N$39", "=$I44*$N$40", "=$I43*$N$41", "=$I42*$N$42", "=$I41*$N$43", "=$I40*$N$44", "=$I39*$N$45", "=$I38*$N$46", "=$I37*$N$47", "=$I36*$N$48", "=$I35*$N$49", "=$I34*$N$50", "=$I33*$N$51", "=$I32*$N$52", "=$I31*$N$53", "=$I30*$N$54", "=$I29*$M$55", "=$I28*$M$56", "=$I27*$M$57", "=$I26*$M$58", "=$I25*$M$59", "=$I24*$M$60", "=$I23*$M$61", "", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O61:BL61)"
            WRITE #1, "40", "=A62*$C$18", "=SE(ARROTONDA(B62,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B62^$C$7,0)", "=SE(C62>0,(C62-C61)/$C$18,0)", matrice1(ieto%%, z%%, 40, 1).i2, "=E62*$C$18", "=SE(C62>0,G61+F62,0)", "=SE(G62-$C$12>=0,((G62-$C$12)^2)/(G62-$C$12+$C$11),0)", "=SE(C62>0,H62-H61,0)", mockus(40).tSUta, mockus(40).qSUqp, matrice1(ieto%%, z%%, 40, 1).tmSUta, matrice1(ieto%%, z%%, 40, 1).qmSUqp, "=M62*$C$20", "=I62*$N$23", "=I61*$N$24", "=$I60*$N$25", "=$I59*$N$26", "=$I58*$N$27", "=$I57*$N$28", "=$I56*$N$29", "=$I55*$N$30", "=$I54*$N$31", "=$I53*$N$32", "=$I52*$N$33", "=$I51*$N$34", "=$I50*$N$35", "=$I49*$N$36", "=$I48*$N$37", "=$I47*$N$38", "=$I46*$N$39", "=$I45*$N$40", "=$I44*$N$41", "=$I43*$N$42", "=$I42*$N$43", "=$I41*$N$44", "=$I40*$N$45", "=$I39*$N$46", "=$I38*$N$47", "=$I37*$N$48", "=$I36*$N$49", "=$I35*$N$50", "=$I34*$N$51", "=$I33*$N$52", "=$I32*$N$53", "=$I31*$N$54", "=$I30*$M$55", "=$I29*$M$56", "=$I28*$M$57", "=$I27*$M$58", "=$I26*$M$59", "=$I25*$M$60", "=$I24*$M$61", "=$I23*$M$62", "", "", "", "", "", "", "", "", "", "", "=SOMMA(O62:BL62)"
            WRITE #1, "41", "=A63*$C$18", "=SE(ARROTONDA(B63,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B63^$C$7,0)", "=SE(C63>0,(C63-C62)/$C$18,0)", matrice1(ieto%%, z%%, 41, 1).i2, "=E63*$C$18", "=SE(C63>0,G62+F63,0)", "=SE(G63-$C$12>=0,((G63-$C$12)^2)/(G63-$C$12+$C$11),0)", "=SE(C63>0,H63-H62,0)", mockus(41).tSUta, mockus(41).qSUqp, matrice1(ieto%%, z%%, 41, 1).tmSUta, matrice1(ieto%%, z%%, 41, 1).qmSUqp, "=M63*$C$20", "=I63*$N$23", "=I62*$N$24", "=$I61*$N$25", "=$I60*$N$26", "=$I59*$N$27", "=$I58*$N$28", "=$I57*$N$29", "=$I56*$N$30", "=$I55*$N$31", "=$I54*$N$32", "=$I53*$N$33", "=$I52*$N$34", "=$I51*$N$35", "=$I50*$N$36", "=$I49*$N$37", "=$I48*$N$38", "=$I47*$N$39", "=$I46*$N$40", "=$I45*$N$41", "=$I44*$N$42", "=$I43*$N$43", "=$I42*$N$44", "=$I41*$N$45", "=$I40*$N$46", "=$I39*$N$47", "=$I38*$N$48", "=$I37*$N$49", "=$I36*$N$50", "=$I35*$N$51", "=$I34*$N$52", "=$I33*$N$53", "=$I32*$N$54", "=$I31*$M$55", "=$I30*$M$56", "=$I29*$M$57", "=$I28*$M$58", "=$I27*$M$59", "=$I26*$M$60", "=$I25*$M$61", "=$I24*$M$62", "=$I23*$M$63", "", "", "", "", "", "", "", "", "", "=SOMMA(O63:BL63)"
            WRITE #1, "42", "=A64*$C$18", "=SE(ARROTONDA(B64,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B64^$C$7,0)", "=SE(C64>0,(C64-C63)/$C$18,0)", matrice1(ieto%%, z%%, 42, 1).i2, "=E64*$C$18", "=SE(C64>0,G63+F64,0)", "=SE(G64-$C$12>=0,((G64-$C$12)^2)/(G64-$C$12+$C$11),0)", "=SE(C64>0,H64-H63,0)", mockus(42).tSUta, mockus(42).qSUqp, matrice1(ieto%%, z%%, 42, 1).tmSUta, matrice1(ieto%%, z%%, 42, 1).qmSUqp, "=M64*$C$20", "=I64*$N$23", "=I63*$N$24", "=$I62*$N$25", "=$I61*$N$26", "=$I60*$N$27", "=$I59*$N$28", "=$I58*$N$29", "=$I57*$N$30", "=$I56*$N$31", "=$I55*$N$32", "=$I54*$N$33", "=$I53*$N$34", "=$I52*$N$35", "=$I51*$N$36", "=$I50*$N$37", "=$I49*$N$38", "=$I48*$N$39", "=$I47*$N$40", "=$I46*$N$41", "=$I45*$N$42", "=$I44*$N$43", "=$I43*$N$44", "=$I42*$N$45", "=$I41*$N$46", "=$I40*$N$47", "=$I39*$N$48", "=$I38*$N$49", "=$I37*$N$50", "=$I36*$N$51", "=$I35*$N$52", "=$I34*$N$53", "=$I33*$N$54", "=$I32*$M$55", "=$I31*$M$56", "=$I30*$M$57", "=$I29*$M$58", "=$I28*$M$59", "=$I27*$M$60", "=$I26*$M$61", "=$I25*$M$62", "=$I24*$M$63", "=$I23*$M$64", "", "", "", "", "", "", "", "", "=SOMMA(O64:BL64)"
            WRITE #1, "43", "=A65*$C$18", "=SE(ARROTONDA(B65,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B65^$C$7,0)", "=SE(C65>0,(C65-C64)/$C$18,0)", matrice1(ieto%%, z%%, 43, 1).i2, "=E65*$C$18", "=SE(C65>0,G64+F65,0)", "=SE(G65-$C$12>=0,((G65-$C$12)^2)/(G65-$C$12+$C$11),0)", "=SE(C65>0,H65-H64,0)", mockus(43).tSUta, mockus(43).qSUqp, matrice1(ieto%%, z%%, 43, 1).tmSUta, matrice1(ieto%%, z%%, 43, 1).qmSUqp, "=M65*$C$20", "=I65*$N$23", "=I64*$N$24", "=$I63*$N$25", "=$I62*$N$26", "=$I61*$N$27", "=$I60*$N$28", "=$I59*$N$29", "=$I58*$N$30", "=$I57*$N$31", "=$I56*$N$32", "=$I55*$N$33", "=$I54*$N$34", "=$I53*$N$35", "=$I52*$N$36", "=$I51*$N$37", "=$I50*$N$38", "=$I49*$N$39", "=$I48*$N$40", "=$I47*$N$41", "=$I46*$N$42", "=$I45*$N$43", "=$I44*$N$44", "=$I43*$N$45", "=$I42*$N$46", "=$I41*$N$47", "=$I40*$N$48", "=$I39*$N$49", "=$I38*$N$50", "=$I37*$N$51", "=$I36*$N$52", "=$I35*$N$53", "=$I34*$N$54", "=$I33*$M$55", "=$I32*$M$56", "=$I31*$M$57", "=$I30*$M$58", "=$I29*$M$59", "=$I28*$M$60", "=$I27*$M$61", "=$I26*$M$62", "=$I25*$M$63", "=$I24*$M$64", "=$I23*$M$65", "", "", "", "", "", "", "", "=SOMMA(O65:BL65)"
            WRITE #1, "44", "=A66*$C$18", "=SE(ARROTONDA(B66,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B66^$C$7,0)", "=SE(C66>0,(C66-C65)/$C$18,0)", matrice1(ieto%%, z%%, 44, 1).i2, "=E66*$C$18", "=SE(C66>0,G65+F66,0)", "=SE(G66-$C$12>=0,((G66-$C$12)^2)/(G66-$C$12+$C$11),0)", "=SE(C66>0,H66-H65,0)", mockus(44).tSUta, mockus(44).qSUqp, matrice1(ieto%%, z%%, 44, 1).tmSUta, matrice1(ieto%%, z%%, 44, 1).qmSUqp, "=M66*$C$20", "=I66*$N$23", "=I65*$N$24", "=$I64*$N$25", "=$I63*$N$26", "=$I62*$N$27", "=$I61*$N$28", "=$I60*$N$29", "=$I59*$N$30", "=$I58*$N$31", "=$I57*$N$32", "=$I56*$N$33", "=$I55*$N$34", "=$I54*$N$35", "=$I53*$N$36", "=$I52*$N$37", "=$I51*$N$38", "=$I50*$N$39", "=$I49*$N$40", "=$I48*$N$41", "=$I47*$N$42", "=$I46*$N$43", "=$I45*$N$44", "=$I44*$N$45", "=$I43*$N$46", "=$I42*$N$47", "=$I41*$N$48", "=$I40*$N$49", "=$I39*$N$50", "=$I38*$N$51", "=$I37*$N$52", "=$I36*$N$53", "=$I35*$N$54", "=$I34*$M$55", "=$I33*$M$56", "=$I32*$M$57", "=$I31*$M$58", "=$I30*$M$59", "=$I29*$M$60", "=$I28*$M$61", "=$I27*$M$62", "=$I26*$M$63", "=$I25*$M$64", "=$I24*$M$65", "=$I23*$M$66", "", "", "", "", "", "", "=SOMMA(O66:BL66)"
            WRITE #1, "45", "=A67*$C$18", "=SE(ARROTONDA(B67,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B67^$C$7,0)", "=SE(C67>0,(C67-C66)/$C$18,0)", matrice1(ieto%%, z%%, 45, 1).i2, "=E67*$C$18", "=SE(C67>0,G66+F67,0)", "=SE(G67-$C$12>=0,((G67-$C$12)^2)/(G67-$C$12+$C$11),0)", "=SE(C67>0,H67-H66,0)", mockus(45).tSUta, mockus(45).qSUqp, matrice1(ieto%%, z%%, 45, 1).tmSUta, matrice1(ieto%%, z%%, 45, 1).qmSUqp, "=M67*$C$20", "=I67*$N$23", "=I66*$N$24", "=$I65*$N$25", "=$I64*$N$26", "=$I63*$N$27", "=$I62*$N$28", "=$I61*$N$29", "=$I60*$N$30", "=$I59*$N$31", "=$I58*$N$32", "=$I57*$N$33", "=$I56*$N$34", "=$I55*$N$35", "=$I54*$N$36", "=$I53*$N$37", "=$I52*$N$38", "=$I51*$N$39", "=$I50*$N$40", "=$I49*$N$41", "=$I48*$N$42", "=$I47*$N$43", "=$I46*$N$44", "=$I45*$N$45", "=$I44*$N$46", "=$I43*$N$47", "=$I42*$N$48", "=$I41*$N$49", "=$I40*$N$50", "=$I39*$N$51", "=$I38*$N$52", "=$I37*$N$53", "=$I36*$N$54", "=$I35*$M$55", "=$I34*$M$56", "=$I33*$M$57", "=$I32*$M$58", "=$I31*$M$59", "=$I30*$M$60", "=$I29*$M$61", "=$I28*$M$62", "=$I27*$M$63", "=$I26*$M$64", "=$I25*$M$65", "=$I24*$M$66", "=$I23*$M$67", "", "", "", "", "", "=SOMMA(O67:BL67)"
            WRITE #1, "46", "=A68*$C$18", "=SE(ARROTONDA(B68,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B68^$C$7,0)", "=SE(C68>0,(C68-C67)/$C$18,0)", matrice1(ieto%%, z%%, 46, 1).i2, "=E68*$C$18", "=SE(C68>0,G67+F68,0)", "=SE(G68-$C$12>=0,((G68-$C$12)^2)/(G68-$C$12+$C$11),0)", "=SE(C68>0,H68-H67,0)", mockus(46).tSUta, mockus(46).qSUqp, matrice1(ieto%%, z%%, 46, 1).tmSUta, matrice1(ieto%%, z%%, 46, 1).qmSUqp, "=M68*$C$20", "=I68*$N$23", "=I67*$N$24", "=$I66*$N$25", "=$I65*$N$26", "=$I64*$N$27", "=$I63*$N$28", "=$I62*$N$29", "=$I61*$N$30", "=$I60*$N$31", "=$I59*$N$32", "=$I58*$N$33", "=$I57*$N$34", "=$I56*$N$35", "=$I55*$N$36", "=$I54*$N$37", "=$I53*$N$38", "=$I52*$N$39", "=$I51*$N$40", "=$I50*$N$41", "=$I49*$N$42", "=$I48*$N$43", "=$I47*$N$44", "=$I46*$N$45", "=$I45*$N$46", "=$I44*$N$47", "=$I43*$N$48", "=$I42*$N$49", "=$I41*$N$50", "=$I40*$N$51", "=$I39*$N$52", "=$I38*$N$53", "=$I37*$N$54", "=$I36*$M$55", "=$I35*$M$56", "=$I34*$M$57", "=$I33*$M$58", "=$I32*$M$59", "=$I31*$M$60", "=$I30*$M$61", "=$I29*$M$62", "=$I28*$M$63", "=$I27*$M$64", "=$I26*$M$65", "=$I25*$M$66", "=$I24*$M$67", "=$I23*$M$68", "", "", "", "", "=SOMMA(O68:BL68)"
            WRITE #1, "47", "=A69*$C$18", "=SE(ARROTONDA(B69,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B69^$C$7,0)", "=SE(C69>0,(C69-C68)/$C$18,0)", matrice1(ieto%%, z%%, 47, 1).i2, "=E69*$C$18", "=SE(C69>0,G68+F69,0)", "=SE(G69-$C$12>=0,((G69-$C$12)^2)/(G69-$C$12+$C$11),0)", "=SE(C69>0,H69-H68,0)", mockus(47).tSUta, mockus(47).qSUqp, matrice1(ieto%%, z%%, 47, 1).tmSUta, matrice1(ieto%%, z%%, 47, 1).qmSUqp, "=M69*$C$20", "=I69*$N$23", "=I68*$N$24", "=$I67*$N$25", "=$I66*$N$26", "=$I65*$N$27", "=$I64*$N$28", "=$I63*$N$29", "=$I62*$N$30", "=$I61*$N$31", "=$I60*$N$32", "=$I59*$N$33", "=$I58*$N$34", "=$I57*$N$35", "=$I56*$N$36", "=$I55*$N$37", "=$I54*$N$38", "=$I53*$N$39", "=$I52*$N$40", "=$I51*$N$41", "=$I50*$N$42", "=$I49*$N$43", "=$I48*$N$44", "=$I47*$N$45", "=$I46*$N$46", "=$I45*$N$47", "=$I44*$N$48", "=$I43*$N$49", "=$I42*$N$50", "=$I41*$N$51", "=$I40*$N$52", "=$I39*$N$53", "=$I38*$N$54", "=$I37*$M$55", "=$I36*$M$56", "=$I35*$M$57", "=$I34*$M$58", "=$I33*$M$59", "=$I32*$M$60", "=$I31*$M$61", "=$I30*$M$62", "=$I29*$M$63", "=$I28*$M$64", "=$I27*$M$65", "=$I26*$M$66", "=$I25*$M$67", "=$I24*$M$68", "=$I23*$M$69", "", "", "", "=SOMMA(O69:BL69)"
            WRITE #1, "48", "=A70*$C$18", "=SE(ARROTONDA(B70,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B70^$C$7,0)", "=SE(C70>0,(C70-C69)/$C$18,0)", matrice1(ieto%%, z%%, 48, 1).i2, "=E70*$C$18", "=SE(C70>0,G69+F70,0)", "=SE(G70-$C$12>=0,((G70-$C$12)^2)/(G70-$C$12+$C$11),0)", "=SE(C70>0,H70-H69,0)", mockus(48).tSUta, mockus(48).qSUqp, matrice1(ieto%%, z%%, 48, 1).tmSUta, matrice1(ieto%%, z%%, 48, 1).qmSUqp, "=M70*$C$20", "=I70*$N$23", "=I69*$N$24", "=$I68*$N$25", "=$I67*$N$26", "=$I66*$N$27", "=$I65*$N$28", "=$I64*$N$29", "=$I63*$N$30", "=$I62*$N$31", "=$I61*$N$32", "=$I60*$N$33", "=$I59*$N$34", "=$I58*$N$35", "=$I57*$N$36", "=$I56*$N$37", "=$I55*$N$38", "=$I54*$N$39", "=$I53*$N$40", "=$I52*$N$41", "=$I51*$N$42", "=$I50*$N$43", "=$I49*$N$44", "=$I48*$N$45", "=$I47*$N$46", "=$I46*$N$47", "=$I45*$N$48", "=$I44*$N$49", "=$I43*$N$50", "=$I42*$N$51", "=$I41*$N$52", "=$I40*$N$53", "=$I39*$N$54", "=$I38*$M$55", "=$I37*$M$56", "=$I36*$M$57", "=$I35*$M$58", "=$I34*$M$59", "=$I33*$M$60", "=$I32*$M$61", "=$I31*$M$62", "=$I30*$M$63", "=$I29*$M$64", "=$I28*$M$65", "=$I27*$M$66", "=$I26*$M$67", "=$I25*$M$68", "=$I24*$M$69", "=$I23*$M$70", "", "", "=SOMMA(O70:BL70)"
            WRITE #1, "49", "=A71*$C$18", "=SE(ARROTONDA(B71,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B71^$C$7,0)", "=SE(C71>0,(C71-C70)/$C$18,0)", matrice1(ieto%%, z%%, 49, 1).i2, "=E71*$C$18", "=SE(C71>0,G70+F71,0)", "=SE(G71-$C$12>=0,((G71-$C$12)^2)/(G71-$C$12+$C$11),0)", "=SE(C71>0,H71-H70,0)", mockus(49).tSUta, mockus(49).qSUqp, matrice1(ieto%%, z%%, 49, 1).tmSUta, matrice1(ieto%%, z%%, 49, 1).qmSUqp, "=M71*$C$20", "=I71*$N$23", "=I70*$N$24", "=$I69*$N$25", "=$I68*$N$26", "=$I67*$N$27", "=$I66*$N$28", "=$I65*$N$29", "=$I64*$N$30", "=$I63*$N$31", "=$I62*$N$32", "=$I61*$N$33", "=$I60*$N$34", "=$I59*$N$35", "=$I58*$N$36", "=$I57*$N$37", "=$I56*$N$38", "=$I55*$N$39", "=$I54*$N$40", "=$I53*$N$41", "=$I52*$N$42", "=$I51*$N$43", "=$I50*$N$44", "=$I49*$N$45", "=$I48*$N$46", "=$I47*$N$47", "=$I46*$N$48", "=$I45*$N$49", "=$I44*$N$50", "=$I43*$N$51", "=$I42*$N$52", "=$I41*$N$53", "=$I40*$N$54", "=$I39*$M$55", "=$I38*$M$56", "=$I37*$M$57", "=$I36*$M$58", "=$I35*$M$59", "=$I34*$M$60", "=$I33*$M$61", "=$I32*$M$62", "=$I31*$M$63", "=$I30*$M$64", "=$I29*$M$65", "=$I28*$M$66", "=$I27*$M$67", "=$I26*$M$68", "=$I25*$M$69", "=$I24*$M$70", "=$I23*$M$71", "", "=SOMMA(O71:BL71)"
            WRITE #1, "50", "=A72*$C$18", "=SE(ARROTONDA(B72,4)<=ARROTONDA($C$17,4),$C$5*$C$6*B72^$C$7,0)", "=SE(C71>0,(C71-C71)/$C$18,0)", matrice1(ieto%%, z%%, 50, 1).i2, "=E72*$C$18", "=SE(C71>0,G71+F72,0)", "=SE(G72-$C$12>=0,((G72-$C$12)^2)/(G72-$C$12+$C$11),0)", "=SE(C72>0,H72-H71,0)", mockus(50).tSUta, mockus(50).qSUqp, matrice1(ieto%%, z%%, 50, 1).tmSUta, matrice1(ieto%%, z%%, 50, 1).qmSUqp, "=M72*$C$20", "=I72*$N$23", "=I71*$N$24", "=$I70*$N$25", "=$I69*$N$26", "=$I68*$N$27", "=$I67*$N$28", "=$I66*$N$29", "=$I65*$N$30", "=$I64*$N$31", "=$I63*$N$32", "=$I62*$N$33", "=$I61*$N$34", "=$I60*$N$35", "=$I59*$N$36", "=$I58*$N$37", "=$I57*$N$38", "=$I56*$N$39", "=$I55*$N$40", "=$I54*$N$41", "=$I53*$N$42", "=$I52*$N$43", "=$I51*$N$44", "=$I50*$N$45", "=$I49*$N$46", "=$I48*$N$47", "=$I47*$N$48", "=$I46*$N$49", "=$I45*$N$50", "=$I44*$N$51", "=$I43*$N$52", "=$I42*$N$53", "=$I41*$N$54", "=$I40*$M$55", "=$I39*$M$56", "=$I38*$M$57", "=$I37*$M$58", "=$I36*$M$59", "=$I35*$M$60", "=$I34*$M$61", "=$I33*$M$62", "=$I32*$M$63", "=$I31*$M$64", "=$I30*$M$65", "=$I29*$M$66", "=$I28*$M$67", "=$I27*$M$68", "=$I26*$M$69", "=$I25*$M$70", "=$I24*$M$71", "", "=SOMMA(O72:BL72)"
            WRITE #1, "SOMMA", "", "", "", "", "=SOMMA(F23:F72)", "", "", "=SOMMA(I23:I72)"
            WRITE #1, "MEDIA", "", "", "=SOMMA(D23Big Grin72)/(CONTA.NUMERI(D23Big Grin72)-CONTA.SE(D23Big Grin72,0))", "=SOMMA(E23:E72)/(CONTA.NUMERI(E23:E72)-CONTA.SE(E23:E72,0))"
            WRITE #1, ""
            WRITE #1, "Se sopra compare #NOME?, qui di seguito è riportata la stessa matrice, con l'utilizzo dei valori calcolati dal programma, anziché con l'uso delle formule di Excel, in quanto talvolta, a seconda del computer, al posto del valore, compare #NOME?, anche se la formula è corretta: editandola facendo doppio click su di essa e premendo poi INVIO, compare il valore."
            GOSUB DatiColonna
            FOR i% = 1 TO 50
                WRITE #1,_
                i%,_
                matrice1(ieto%%, z%%, i%, 1).mdt,_
                matrice1(ieto%%, z%%, i%, 1).h1,_
                matrice1(ieto%%, z%%, i%, 1).i1,_
                matrice1(ieto%%, z%%, i%, 1).i2,_
                matrice1(ieto%%, z%%, i%, 1).DH,_
                matrice1(ieto%%, z%%, i%, 1).H2,_
                matrice1(ieto%%, z%%, i%, 1).he,_
                matrice1(ieto%%, z%%, i%, 1).Dhe,_
                matrice1(ieto%%, z%%, i%, 1).tSUta,_
                matrice1(ieto%%, z%%, i%, 1).qSUqp,_
                matrice1(ieto%%, z%%, i%, 1).tmSUta,_
                matrice1(ieto%%, z%%, i%, 1).qmSUqp,_
                matrice1(ieto%%, z%%, i%, 1).qm,
                FOR n%% = 1 TO 50
                    WRITE #1, matrice2!(ieto%%, z%%, i%, n%%),
                NEXT n%%
                WRITE #1, idrogrammi1a24(ieto%%, z%%, i%, 1).portata
            NEXT i%
            WRITE #1, "SOMMA", "", "", "", "", matrice1(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).H2, "", "", matrice1(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).he
            WRITE #1, "MEDIA", "", "", matrice1(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).h1 / matrice1(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).mdt, matrice1(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).H2 / matrice1(ieto%%, z%%, PassiFinePioggia1a24%%(z%%), 1).mdt
            CLOSE #1
        NEXT z%%
    LOOP UNTIL z%% = 25
    IF TerminaSalvataggio$ = CHR$(27) THEN EXIT FOR
NEXT ieto%%
IF KeyPress$ = "1" AND TerminaSalvataggio$ <> CHR$(27) THEN
    IF VisualizzaIeto%% = 1 THEN
        CALL CreaImmagine(idrogramma1e2(1).composizione, "A.IdrogrammaProgettoCHICAGO+PortataPiccoProgetto")
        IF ore!(1) <> 0 THEN CALL CreaImmagine(idrogramma1e2(1).composizione, "A.IdrogrammaProgettoCHICAGO+PortataPiccoProgetto")
        IF ore!(2) <> 0 THEN CALL CreaImmagine(idrogramma1e2(2).composizione, "B.IdrogrammaSceltoCHICAGO+PortataOraPiccoScelta")
    ELSEIF VisualizzaIeto%% = 2 THEN
        CALL CreaImmagine(idrogramma1e2(1).composizione, "A.IdrogrammaProgettoCOSTANTE+PortataPiccoProgetto")
        IF ore!(2) <> 0 THEN CALL CreaImmagine(idrogramma1e2(2).composizione, "B.IdrogrammaSceltoCOSTANTE+PortataOraPiccoScelta")
    END IF
    CALL CreaImmagine(unitari&, "C.IdrogrammiUnitari")
    FOR ieto%% = 1 TO 2
        IF ieto%% = 1 THEN testo$ = "D._1-24,idrogrammiCHICAGO+PortatePicco(da_1_a_32_volte_tc)"
        IF ieto%% = 2 THEN testo$ = "E._1-24,idrogrammiCOSTANTE+PortatePicco(da_1_a_32_volte_tc)"
        CALL CreaImmagine(ComplessivoIeto1e2(ieto%%).composizione, testo$)
        i% = 0
        DO
            FOR z%% = 1 TO 24
                TerminaSalvataggio$ = INKEY$
                IF TerminaSalvataggio$ = CHR$(27) THEN EXIT DO
                i% = i% + 1
                IF ieto%% = 1 THEN testo$ = "D." + _TRIM$(STR$(z%%)) + ",idrogrammaCHICAGO(" + _TRIM$(STR$(CoefficientiDiscretizzazioneTemporale(z%%).N)) + "_volte_tc)"
                IF ieto%% = 2 THEN testo$ = "E." + _TRIM$(STR$(z%%)) + ",idrogrammaCOSTANTE(" + _TRIM$(STR$(CoefficientiDiscretizzazioneTemporale(z%%).N)) + "_volte_tc)"
                CALL CreaImmagine(MatriciIeto1e2&(ieto%%, z%%), testo$)
            NEXT z%%
        LOOP UNTIL z%% = 25
        IF TerminaSalvataggio$ = CHR$(27) THEN EXIT FOR
    NEXT ieto%%
END IF
RETURN
'--------------------------------------------------------------------------------------------------------------------------------------------------
DatiBase:

WRITE #n%%, "DATI"
WRITE #n%%, "T=", "[anni]", T$, "tempo di ritorno"
WRITE #n%%, "A=", "mq", A2&, "area del bacino idrografico"
WRITE #n%%, "K=", "[-]", k!, "parametro del Centro Funzionale"
WRITE #n%%, "a=", "[mm/d^n]", a1!, "coefficiente della curva di possibilità climatica."
WRITE #n%%, "n=", "[-]", n1!, "coefficiente della curva di possibilità climatica."
WRITE #n%%, "L=", "[m]", L~%, "lunghezza dell'asta principale del bacino idrografico."
WRITE #n%%, "s=", "[%]", s1!, "pendenza media del bacino idrografico."
WRITE #n%%, "CN(II)=", "[-]", CNII%%
WRITE #n%%, "S=", "[mm]", "=25.4*((1000/C13)-10)", "contenuto idrico massimo del terreno."
WRITE #n%%, "Ia=", "[mm]", "=0.1*C11", "perdite iniziali."
WRITE #n%%, "CN(III)=", "[-]", "=(23*C10)/(10+0.13*C10)"
WRITE #n%%, "tl=", "[ore]", "=0.342*(((C8/1000)^0.8)/(C9^0.5))*(1000/C13-9)^0.7", "formula di Mockus esprimente il tempo di ritardo."
WRITE #n%%, "tc=", "[ore]", "=C14/0.6", "tempo di corrivazione."
WRITE #n%%, "ta=", "[ore]", "=C14/0.9", "tempo di picco."
WRITE #n%%, "qp=", "[mc/(s*mm)]", "=0.208*((C4/1000000)/C16)", "portata al colmo dell'idrogramma unitario del bacino idrografico."
RETURN
'--------------------------------------------------------------------------------------------------------------------------------------------------
DatiColonna:

WRITE #1, "N", "N*dt", "h", "i", "iC", "DH", "H", "he", "Dhe", "t/ta", "q/qp", "tm/ta", "qm/qp", "qm",
FOR i% = 1 TO 50
    WRITE #1, "Dhe*qm" + _TRIM$(STR$(i%)),
NEXT i%
WRITE #1, "idrogramma"
RETURN

'**************************************************************************************************************************************************
'*                                    Termine sezione routines e inizio sezione subroutines e functions                                          *
'**************************************************************************************************************************************************

SUB InserimentoDati (k!, a1!, n1, A2&, L~%, s1!, CNII%%, CoeffPerditeIniziali!)

    SHARED TempiRitorno() AS TempiRitorno
    SHARED inputs$()
    SHARED PosizioneCursore%%
    SHARED esc~`, riavvio~`
    SHARED T$
    SHARED KeyPress$

    DIM T!
    DIM richiesta%%
    DIM test~`
    DIM debug~`
    DIM punti~`
    DIM cursore~`
    DIM esci~`
    DIM carattere$

    COLOR G&
    PosizioneCursore%% = CSRLIN - 11
    richiesta%% = 1
    DO
        _LIMIT 30
        KeyPress$ = INKEY$
        IF TIMER > T! + 0.5 THEN
            cursore~` = NOT cursore~`
            T! = TIMER
        END IF
        FOR i% = 1 TO 8
            LOCATE PosizioneCursore%% - 1 + i%, 69: PRINT inputs$(i%) + SPACE$(30)
        NEXT i%
        LOCATE PosizioneCursore%% - 1 + richiesta%%, 69 + LEN(inputs$(richiesta%%))
        IF debug~` = 1 OR esci~` = 1 THEN EXIT DO
        IF cursore~` THEN PRINT "_"
        SELECT CASE KeyPress$
            CASE CHR$(27)
                esc~` = 1
                EXIT DO
            CASE CHR$(8)
                IF LEN(inputs$(richiesta%%)) > 0 THEN inputs$(richiesta%%) = LEFT$(inputs$(richiesta%%), LEN(inputs$(richiesta%%)) - 1)
            CASE CHR$(9)
                riavvio~` = 1
                EXIT DO
            CASE CHR$(44), CHR$(46)
                SELECT CASE richiesta%%
                    CASE 4, 5, 7
                        IF KeyPress$ = CHR$(44) OR KeyPress$ = CHR$(46) THEN KeyPress$ = ""
                    CASE ELSE
                        punti~` = 0
                        IF KeyPress$ = CHR$(44) THEN KeyPress$ = CHR$(46)
                        FOR n%% = 1 TO LEN(inputs$(richiesta%%))
                            carattere$ = MID$(inputs$(richiesta%%), n%%, 1)
                            IF carattere$ = CHR$(46) THEN punti~` = 1
                        NEXT n%%
                        IF punti~` = 0 THEN inputs$(richiesta%%) = inputs$(richiesta%%) + KeyPress$
                END SELECT
            CASE CHR$(48) TO CHR$(57)
                inputs$(richiesta%%) = inputs$(richiesta%%) + KeyPress$
            CASE CHR$(0) + CHR$(72)
                GOSUB ValutaInput
                SELECT CASE test~`
                    CASE IS = 0
                        inputs$(richiesta%%) = ""
                    CASE IS = 1
                        IF richiesta%% = 1 THEN
                            EXIT SELECT
                        ELSEIF richiesta%% <= 10 THEN
                            richiesta%% = richiesta%% - 1
                        END IF
                END SELECT
            CASE CHR$(13), CHR$(0) + CHR$(80)
                GOSUB ValutaInput
                IF richiesta%% <> 8 THEN IF KeyPress$ = CHR$(0) + CHR$(80) THEN KeyPress$ = CHR$(13)
                IF richiesta%% <> 8 THEN IF LEN(inputs$(richiesta%%)) = 0 THEN test~` = 0
                SELECT CASE test~`
                    CASE IS = 0
                        inputs$(richiesta%%) = ""
                    CASE IS = 1
                        IF richiesta%% = 8 THEN IF KeyPress$ = CHR$(13) THEN esci~` = 1
                        IF richiesta%% <> 8 THEN richiesta%% = richiesta%% + 1
                END SELECT
        END SELECT
    LOOP
    IF debug~` = 0 THEN k! = VAL(inputs$(1)): a1! = VAL(inputs$(2)): n1! = VAL(inputs$(3)): A2& = VAL(inputs$(4)): L~% = VAL(inputs$(5)): s1! = VAL(inputs$(6)): CNII%% = VAL(inputs$(7)): CoeffPerditeIniziali! = VAL(inputs$(8))
    COLOR bianco&
    EXIT SUB
    '--------------------------------------------------------------------------------------------------------------------------------------------------
    ValutaInput:

    test~` = 0
    SELECT CASE richiesta%%
        CASE 1
            IF inputs$(1) = "123" THEN
                debug~` = 1
                'Cillian:
                k! = 2.34: a1! = 14.6653: n1! = 0.45596: A2& = 2641902: L~% = 3300: s1! = 41.5: CNII%% = 70: CoeffPerditeIniziali! = 0.1
                'pialong:
                'k! = 2.34: a1! = 17.097811: n1! = 0.497753: A2& = 2509318: L~% = 2919: s1! = 66.3: CNII%% = 66: CoeffPerditeIniziali! = 0.1
                'mondange:
                'k! = 2.04: a1! = 10.93228: n1! = 0.482321: A2& = 294873: L~% = 840: s1! = 74.7: CNII%% = 77: CoeffPerditeIniziali! = 0.1
                'baudier:
                'k! = 2.34: a1! = 11.3335: n1! = 0.537101: A2& = 2722894: L~% = 2910: s1! = 104.68: CNII%% = 74: CoeffPerditeIniziali! = 0.1
                'pont du teu:
                'k! = 3.64: a1! = 12.8458: n1! = 0.537748: A2& = 323540: L~% = 1379: s1! = 95: CNII%% = 77: CoeffPerditeIniziali! = 0.1
                inputs$(1) = STR$(k!): inputs$(2) = STR$(a1!): inputs$(3) = STR$(n1!): inputs$(4) = STR$(A2&): inputs$(5) = STR$(L~%): inputs$(6) = STR$(s1!): inputs$(7) = STR$(CNII%%): inputs$(8) = STR$(CoeffPerditeIniziali!)
                GOSUB TrovaT
                EXIT SELECT
            END IF
            IF LEN(inputs$(1)) = 0 THEN IF KeyPress$ = CHR$(13) THEN inputs$(1) = "1"
            GOSUB TrovaT
            IF KeyPress$ = CHR$(0) + CHR$(80) THEN IF LEN(inputs$(1)) = 0 THEN test~` = 0
        CASE 2
            test~` = 1
        CASE 3
            IF VAL(inputs$(3)) <= 1 THEN test~` = 1 ELSE test~` = 0
        CASE 4, 5, 6
            IF VAL(inputs$(richiesta%%)) >= 1 THEN
                test~` = 1
            ELSEIF inputs$(richiesta%%) = "" THEN
                test~` = 1
            ELSE
                test~` = 0
            END IF
        CASE 7
            IF VAL(inputs$(richiesta%%)) >= 1 THEN
                IF VAL(inputs$(richiesta%%)) <= 100 THEN test~` = 1
            ELSEIF inputs$(richiesta%%) = "" THEN test~` = 1
            ELSE
                test~` = 0
            END IF
        CASE IS = 8
            IF LEN(inputs$(8)) = 0 THEN
                IF KeyPress$ = CHR$(13) THEN inputs$(8) = "0.1"
                test~` = 1
                EXIT SELECT
            END IF
            IF VAL(inputs$(8)) >= 0 THEN
                IF VAL(inputs$(8)) <= 0.2 THEN test~` = 1
            ELSE
                test~` = 0
            END IF
    END SELECT
    RETURN
    '--------------------------------------------------------------------------------------------------------------------------------------------------
    TrovaT:

    i% = 1
    FOR i% = 1 TO 10
        IF VAL(inputs$(1)) = TempiRitorno(i%).k THEN
            IF i% = 1 THEN
                T$ = "Definito dall'utente"
                test~` = 1
            ELSE
                T$ = _TRIM$(STR$(TempiRitorno(i%).T)) + " anni"
                test~` = 1
            END IF
            EXIT FOR
        ELSE
            test~` = 0
        END IF
    NEXT i%
    RETURN
END SUB
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
SUB CalcolaIdrogramma (X1!, X2!, X3!, Y!, immagine&, destinazione&)

    SHARED idrogrammi1a24() AS idrogramma
    SHARED MassimiIdrogrammi1a24() AS idrogramma
    SHARED FinePioggiaIdrogrammi1a24() AS idrogramma
    SHARED FinePioggiaIdrogrammi1e2() AS idrogramma
    SHARED IdroPixel1() AS idrogramma
    SHARED IdroPixel2() AS idrogramma
    SHARED idrogramma1() AS idrogramma
    SHARED idrogramma2() AS idrogramma
    SHARED ore!(), portata!()
    SHARED PassiFinePioggia1a24%%()
    SHARED IdroMaxieto%%()
    SHARED schermo&
    SHARED colore&
    SHARED DESKTOPWIDTH%, DESKTOPHEIGHT%
    SHARED ieto%%, VisualizzaIeto%%
    SHARED tipo%%
    SHARED soglia%%
    SHARED esc~`

    REDIM _PRESERVE y%(1)

    DIM originale&
    DIM soglia!
    DIM y%
    DIM max%
    DIM passo%
    DIM test~`

    _DEST schermo&
    COLOR bianco&
    SELECT CASE VisualizzaIeto%%
        CASE IS = 1
            INPUT "- Inserire la soglia percentuale S per il calcolo dell'idrogramma di progetto e illustrata nella prima schermata (INVIO o 0 per tralasciare): ", soglia%%
            soglia! = soglia%% / 100
            _DEST immagine&
            _SOURCE immagine&
            CALL ScalaOrigine(0, 1, 0, 0, immagine&)
            i% = 0
            y%(1) = dy%
            DO
                i% = i% + 1
                REDIM _PRESERVE y%(i%)
                DO
                    IF POINT(dx! + i%, PMAP(y%(i%), 3)) = giallo& THEN EXIT DO
                    y%(i%) = y%(i%) - 1
                LOOP
                IF i% > 1 THEN
                    IF PMAP(y%(i%), 3) < (1 + soglia!) * PMAP(y%(i% - 1), 3) THEN
                        test~` = 1
                        EXIT DO
                    ELSE
                        test~` = 0
                    END IF
                END IF
            LOOP UNTIL i% = INT(X3!)
            SELECT CASE test~`
                CASE IS = 1
                    ore!(1) = i% - 1
                    REDIM _PRESERVE y%(1 TO UBOUND(y%) - 1)
                    portata!(1) = PMAP(y%(UBOUND(y%)), 3) - dy!
                    CALL DisegnaValore(ore!(1), portata!(1), 0, 0, bianco&)
                    _DEST schermo&
                CASE IS = 0
                    _DEST schermo&
                    CLS 2
                    SELECT CASE soglia%%
                        CASE IS = 0
                            PRINT "Verr… considerato come idrogramma di progetto quello relativo alla portata di picco massima."
                        CASE ELSE
                            PRINT "La soglia scelta non permette di individuare, all'interno del campo, la corrispondente portata di picco. Verr… considerato come idrogramma di progetto quello relativo alla portata di picco massima."
                            soglia%% = 0
                    END SELECT
                    portata!(1) = Y!
                    ore!(1) = X3!
            END SELECT
        CASE IS = 2
            test~` = 0
            portata!(1) = Y!
            ore!(1) = X3!
            IF esc~` = 1 THEN
                tipo%% = 1
                GOSUB interpola
                EXIT SUB
            END IF
            PRINT "Verr… considerato come idrogramma di progetto quello relativo alla portata di picco massima."
    END SELECT
    tipo%% = 1
    _DEST immagine&
    LOCATE 2, _WIDTH(immagine&) \ 8 - 27: COLOR bianco&: PRINT "Legenda:"
    LOCATE 4, _WIDTH(immagine&) \ 8 - 27: COLOR azzurro&: PRINT "[Idrogramma di progetto]": COLOR bianco&
    GOSUB interpola
    tipo%% = 2
    CALL DisegnaPortata(X1!, immagine&, destinazione&)
    IF ore!(2) <> 0 THEN
        test~` = 1
        _DEST immagine&
        LOCATE 6, _WIDTH(immagine&) \ 8 - 27: COLOR viola&: PRINT "[Idrogramma corrispondente"
        LOCATE , _WIDTH(immagine&) \ 8 - 27: PRINT "all'ora  di picco  scelta]": COLOR bianco&
        GOSUB interpola
    END IF
    EXIT SUB
    '--------------------------------------------------------------------------------------------------------------------------------------------------
    interpola:

    DIM costruisci(50, 2) AS idrogramma
    DIM k(2) AS idrogramma
    DIM x%(2)

    originale& = _COPYIMAGE(immagine&)
    _SOURCE immagine&
    CALL ScalaOrigine(0, 1, 0, 0, immagine&)
    SELECT CASE test~`
        CASE IS = 0
            FOR i% = 1 TO 50
                REDIM _PRESERVE idrogramma1(i%) AS idrogramma
                REDIM _PRESERVE IdroPixel1(i%) AS idrogramma
                idrogramma1(i%).ore = idrogrammi1a24(VisualizzaIeto%%, IdroMaxieto%%(VisualizzaIeto%%), i%, 1).ore
                idrogramma1(i%).portata = idrogrammi1a24(VisualizzaIeto%%, IdroMaxieto%%(VisualizzaIeto%%), i%, 1).portata
                IdroPixel1(i%).ore = idrogramma1(i%).ore
                IdroPixel1(i%).portata = idrogramma1(i%).portata
            NEXT i%
            FinePioggiaIdrogrammi1e2(tipo%%).ore = FinePioggiaIdrogrammi1a24(VisualizzaIeto%%, IdroMaxieto%%(VisualizzaIeto%%), 1).ore
        CASE IS = 1
            z%% = 2
            DO
                IF MassimiIdrogrammi1a24(VisualizzaIeto%%, z%%, 1).ore > ore!(tipo%%) THEN
                    k(1).ore = ore!(tipo%%) / MassimiIdrogrammi1a24(VisualizzaIeto%%, z%% - 1, 1).ore
                    k(1).portata = portata!(tipo%%) / MassimiIdrogrammi1a24(VisualizzaIeto%%, z%% - 1, 1).portata
                    k(2).ore = ore!(tipo%%) / MassimiIdrogrammi1a24(VisualizzaIeto%%, z%%, 1).ore
                    k(2).portata = portata!(tipo%%) / MassimiIdrogrammi1a24(VisualizzaIeto%%, z%%, 1).portata
                    EXIT DO
                ELSE
                    z%% = z%% + 1
                END IF
            LOOP
            FOR i% = 1 TO 50
                costruisci(i%, 1).ore = k(1).ore * idrogrammi1a24(VisualizzaIeto%%, z%% - 1, i%, 1).ore
                costruisci(i%, 1).portata = k(1).portata * idrogrammi1a24(VisualizzaIeto%%, z%% - 1, i%, 1).portata
                costruisci(i%, 2).ore = k(2).ore * idrogrammi1a24(VisualizzaIeto%%, z%%, i%, 1).ore
                costruisci(i%, 2).portata = k(2).portata * idrogrammi1a24(VisualizzaIeto%%, z%%, i%, 1).portata
            NEXT i%
            FinePioggiaIdrogrammi1e2(tipo%%).ore = (costruisci(PassiFinePioggia1a24%%(z%% - 1), 1).ore + costruisci(PassiFinePioggia1a24%%(z%%), 2).ore) / 2
            _DEST immagine&
            FOR n%% = 1 TO 2
                IF n%% = 1 THEN colore& = pastello&
                IF n%% = 2 THEN colore& = viola&
                FOR i% = 1 TO 50
                    IF i% = 1 THEN LINE (dx!, dy!)-(dx! + costruisci(i%, n%%).ore, dy! + costruisci(i%, n%%).portata), colore&
                    IF i% > 1 THEN LINE (dx! + costruisci(i% - 1, n%%).ore, dy! + costruisci(i% - 1, n%%).portata)-(dx! + costruisci(i%, n%%).ore, dy! + costruisci(i%, n%%).portata), colore&
                NEXT i%
            NEXT n%%
            i% = 0
            y% = PMAP(dy!, 1)
            DO
                i% = i% + 1
                SELECT CASE tipo%%
                    CASE IS = 1
                        REDIM _PRESERVE IdroPixel1(i%) AS idrogramma
                    CASE IS = 2
                        REDIM _PRESERVE IdroPixel2(i%) AS idrogramma
                END SELECT
                x%(1) = PMAP(dx!, 0)
                x%(2) = PMAP(dx!, 0)
                DO
                    IF POINT(PMAP(x%(2), 2), PMAP(y%, 3)) = viola& THEN EXIT DO
                    x%(2) = x%(2) + 1
                LOOP
                DO
                    IF POINT(PMAP(x%(1), 2), PMAP(y%, 3)) = pastello& THEN EXIT DO
                    x%(1) = x%(1) + 1
                LOOP UNTIL PMAP(x%(1), 2) >= dx! + ore!(tipo%%)
                IF PMAP(x%(1), 2) >= dx! + ore!(tipo%%) THEN x%(1) = x%(2)
                SELECT CASE tipo%%
                    CASE IS = 1
                        IdroPixel1(i%).ore = (PMAP(x%(1), 2) + PMAP(x%(2), 2)) / 2 - dx!
                        IdroPixel1(i%).portata = PMAP(y%, 3) - dy!
                    CASE IS = 2
                        IdroPixel2(i%).ore = (PMAP(x%(1), 2) + PMAP(x%(2), 2)) / 2 - dx!
                        IdroPixel2(i%).portata = PMAP(y%, 3) - dy!
                END SELECT
                y% = y% - 1
            LOOP UNTIL y% = PMAP(dy! + portata!(tipo%%), 1)
            max% = i%
            i% = i% - 1
            y% = PMAP(dy! + portata!(tipo%%), 1)
            DO
                i% = i% + 1
                SELECT CASE tipo%%
                    CASE IS = 1
                        REDIM _PRESERVE IdroPixel1(i%) AS idrogramma
                    CASE IS = 2
                        REDIM _PRESERVE IdroPixel2(i%) AS idrogramma
                END SELECT
                x%(1) = PMAP(dx! + ore!(tipo%%), 0)
                x%(2) = PMAP(dx! + ore!(tipo%%), 0)
                DO
                    IF POINT(PMAP(x%(2), 2), PMAP(y%, 3)) = viola& THEN EXIT DO
                    x%(2) = x%(2) + 1
                LOOP
                DO
                    IF POINT(PMAP(x%(1), 2), PMAP(y%, 3)) = pastello& THEN EXIT DO
                    x%(1) = x%(1) + 1
                LOOP UNTIL PMAP(x%(1), 2) >= X2! * 1.15
                IF PMAP(x%(1), 2) >= X2! * 1.15 THEN x%(1) = x%(2)
                SELECT CASE tipo%%
                    CASE IS = 1
                        IdroPixel1(i%).ore = (PMAP(x%(1), 2) + PMAP(x%(2), 2)) / 2 - dx!
                        IdroPixel1(i%).portata = PMAP(y%, 3) - dy!
                    CASE IS = 2
                        IdroPixel2(i%).ore = (PMAP(x%(1), 2) + PMAP(x%(2), 2)) / 2 - dx!
                        IdroPixel2(i%).portata = PMAP(y%, 3) - dy!
                END SELECT
                y% = y% + 1
                IF costruisci(50, 1).portata > costruisci(50, 2).portata THEN IF PMAP(y%, 3) - dy! < costruisci(50, 1).portata THEN EXIT DO
                IF costruisci(50, 1).portata <= costruisci(50, 2).portata THEN IF PMAP(y%, 3) - dy! < costruisci(50, 2).portata THEN EXIT DO
            LOOP UNTIL y% = PMAP(dy!, 1)
            SELECT CASE tipo%%
                CASE IS = 1
                    passo% = UBOUND(IdroPixel1) \ 50
                    i% = 0
                    DO
                        i% = i% + 1
                        REDIM _PRESERVE idrogramma1(i%) AS idrogramma
                        IF i% * passo% >= max% THEN EXIT DO
                        idrogramma1(i%).ore = IdroPixel1(i% * passo%).ore
                        idrogramma1(i%).portata = IdroPixel1(i% * passo%).portata
                    LOOP
                    idrogramma1(i%).ore = ore!(1)
                    idrogramma1(i%).portata = portata!(1)
                    DO
                        i% = i% + 1
                        IF i% * passo% >= UBOUND(IdroPixel1) THEN EXIT DO
                        REDIM _PRESERVE idrogramma1(i%) AS idrogramma
                        idrogramma1(i%).ore = IdroPixel1(i% * passo%).ore
                        idrogramma1(i%).portata = IdroPixel1(i% * passo%).portata
                    LOOP UNTIL i% = 50
                CASE IS = 2
                    passo% = UBOUND(IdroPixel2) \ 50
                    IF passo% >= 1 THEN
                        i% = 0
                        DO
                            i% = i% + 1
                            REDIM _PRESERVE idrogramma2(i%) AS idrogramma
                            IF i% * passo% >= max% THEN EXIT DO
                            idrogramma2(i%).ore = IdroPixel2(i% * passo%).ore
                            idrogramma2(i%).portata = IdroPixel2(i% * passo%).portata
                        LOOP
                        idrogramma2(i%).ore = ore!(2)
                        idrogramma2(i%).portata = portata!(2)
                        DO
                            i% = i% + 1
                            IF i% * passo% >= UBOUND(IdroPixel2) THEN EXIT DO
                            REDIM _PRESERVE idrogramma2(i%) AS idrogramma
                            idrogramma2(i%).ore = IdroPixel2(i% * passo%).ore
                            idrogramma2(i%).portata = IdroPixel2(i% * passo%).portata
                        LOOP UNTIL i% = 50
                    ELSE
                        FOR i% = 1 TO UBOUND(IdroPixel2)
                            REDIM _PRESERVE idrogramma2(i%) AS idrogramma
                            idrogramma2(i%).ore = IdroPixel2(i%).ore
                            idrogramma2(i%).portata = IdroPixel2(i%).portata
                        NEXT i%
                    END IF
            END SELECT
            immagine& = _COPYIMAGE(originale&)
    END SELECT
    _DEST immagine&
    IF tipo%% = 1 THEN colore& = azzurro&
    IF tipo%% = 2 THEN colore& = viola&
    SELECT CASE tipo%%
        CASE IS = 1
            FOR i% = 1 TO UBOUND(IdroPixel1)
                IF i% = 1 THEN
                    LINE (dx!, dy!)-(dx! + IdroPixel1(i%).ore, dy! + IdroPixel1(i%).portata), colore&
                ELSE
                    LINE (dx! + IdroPixel1(i% - 1).ore, dy! + IdroPixel1(i% - 1).portata)-(dx! + IdroPixel1(i%).ore, dy! + IdroPixel1(i%).portata), colore&
                END IF
                CIRCLE (dx! + IdroPixel1(i%).ore, dy! + IdroPixel1(i%).portata), PMAP(1, 2), colore&
                PAINT (dx! + IdroPixel1(i%).ore, dy! + IdroPixel1(i%).portata), colore&
            NEXT i%
        CASE IS = 2
            FOR i% = 1 TO UBOUND(IdroPixel2)
                IF i% = 1 THEN
                    LINE (dx!, dy!)-(dx! + IdroPixel2(i%).ore, dy! + IdroPixel2(i%).portata), colore&
                ELSE
                    LINE (dx! + IdroPixel2(i% - 1).ore, dy! + IdroPixel2(i% - 1).portata)-(dx! + IdroPixel2(i%).ore, dy! + IdroPixel2(i%).portata), colore&
                END IF
                CIRCLE (dx! + IdroPixel2(i%).ore, dy! + IdroPixel2(i%).portata), PMAP(1, 2), colore&
                PAINT (dx! + IdroPixel2(i%).ore, dy! + IdroPixel2(i%).portata), colore&
            NEXT i%
    END SELECT
    CALL DisegnaLinea(VisualizzaIeto%%, immagine&, giallo&, grigio&)
    _PUTIMAGE (0, 0), immagine&, destinazione&
    IF esc~` = 0 THEN _PUTIMAGE ((DESKTOPWIDTH% - _WIDTH(destinazione&)), (DESKTOPHEIGHT% - _HEIGHT(destinazione&) - 16)), destinazione&, schermo&
    ERASE k, costruisci, x%
    _FREEIMAGE originale&
    RETURN
END SUB
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
SUB ScalaOrigine (scala%%, origine%%, X!, Y!, immagine&)

    DIM fattoreX!, fattoreY!

    fattoreX! = 1
    fattoreY! = 1
    IF scala%% = 0 AND origine%% = 1 THEN GOSUB origine
    IF scala%% = 1 AND origine%% = 1 THEN
        DO
            GOSUB scala
            GOSUB origine
            IF Y! * fattoreY! >= dy! + Y! + dy! + dy! THEN
                IF X! * fattoreX! >= dx! + X! + dx! + dx! THEN
                    EXIT DO
                ELSE
                    fattoreX! = fattoreX! + 0.01
                END IF
            ELSE
                fattoreY! = fattoreY! + 0.01
            END IF
        LOOP
    END IF
    EXIT SUB
    '--------------------------------------------------------------------------------------------------------------------------------------------------
    scala:

    WINDOW
    WINDOW (0, 0)-(X! * fattoreX!, Y! * fattoreY!)
    RETURN
    '--------------------------------------------------------------------------------------------------------------------------------------------------
    origine:

    dx% = 39
    dx! = PMAP(dx%, 2)
    dy% = _HEIGHT(immagine&) - 1 - dx%
    dy! = PMAP(dy%, 3)
    RETURN
END SUB
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
SUB DisegnaAssi (X$, Y$, X!, Y!, immagine&, ColoreCartiglio&, ColoreAssi&, ColoreTacca&, ColoreNumeri&)

    DIM x%, y%
    DIM taccaX!, taccaY!

    _DEST immagine&: CLS
    SELECT CASE X!
        CASE IS >= 12
            taccaX! = X! \ 6
        CASE IS <= 1
            taccaX! = 0.25
        CASE ELSE
            taccaX! = 0.5
    END SELECT
    SELECT CASE Y!
        CASE IS >= 12
            taccaY! = Y! \ 6
        CASE IS <= 1
            taccaY! = 0.25
        CASE ELSE
            taccaY! = 0.5
    END SELECT
    WINDOW
    LINE (0, 0)-(_WIDTH(immagine&) - 1, _HEIGHT(immagine&) - 1), ColoreCartiglio&, B
    CALL ScalaOrigine(1, 1, X!, Y!, immagine&)
    LINE (dx!, dy! + Y! + dy!)-(dx!, dy!), ColoreAssi&: LINE -(dx! + X! + dx!, dy!), ColoreAssi&
    PSET (dx!, dy! + Y! + dy!), ColoreAssi&: DRAW "F20": PSET (dx!, dy! + Y! + dy!), ColoreAssi&: DRAW "G20"
    PSET (dx! + X! + dx!, dy!), ColoreAssi&: DRAW "G20": PSET (dx! + X! + dx!, dy!), ColoreAssi&: DRAW "H20"
    COLOR ColoreNumeri&
    _PRINTSTRING (PMAP(dx! + X! + dx!, 0), dy%), X$
    _PRINTSTRING (dx%, PMAP(dy! + Y! + dy!, 1) - dx% \ 2), Y$
    _PRINTSTRING (dx% \ 4, dy% - 7), "0"
    i% = 1
    WHILE i% * taccaX! <= X!
        LINE (dx! + i% * taccaX!, PMAP(dy% + 5, 3))-(dx! + i% * taccaX!, PMAP(dy% - 5, 3)), ColoreTacca&
        x% = PMAP(dx! + i% * taccaX!, 0)
        _PRINTSTRING (x% - 3 * LEN(_TRIM$(STR$(i% * taccaX!))), _HEIGHT(immagine&) - 1 - dx% + 5), _TRIM$(STR$(i% * taccaX!))
        i% = i% + 1
    WEND
    i% = 1
    WHILE i% * taccaY! <= Y!
        LINE (PMAP(dx% - 5, 2), dy! + i% * taccaY!)-(PMAP(dx% + 5, 2), dy! + i% * taccaY!), ColoreTacca&
        y% = PMAP(dy! + i% * taccaY!, 1)
        _PRINTSTRING (dx% \ 4, y% - 7), _TRIM$(STR$(i% * taccaY!))
        i% = i% + 1
    WEND
END SUB
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
SUB DisegnaValore (X!, Y!, ColoreLinea&, ColorePunto&, ColoreTesto&)

    DIM x%, y%

    CIRCLE (dx! + X!, dy! + Y!), PMAP(3, 2), ColorePunto&
    PAINT (dx! + X! + PMAP(0.5, 2), dy! + Y! + PMAP(0.5, 2)), ColorePunto&
    LINE (dx!, dy! + Y!)-(dx! + X!, dy! + Y!), ColoreLinea&, , 65520
    LINE -(dx! + X!, dy!), ColoreLinea&, , 65520
    x% = PMAP(dx! + X!, 0)
    y% = PMAP(dy! + Y!, 1)
    COLOR ColoreTesto&
    _PRINTSTRING (x% + 4, y% - 16), "(" + _TRIM$(STR$(Arrotonda!(X!))) + ";" + _TRIM$(STR$(Arrotonda!(Y!))) + ")"
END SUB
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
SUB DisegnaPortata (X!, immagine&, destinazione&)

    SHARED ore!(), portata!()
    SHARED schermo&
    SHARED DESKTOPWIDTH%, DESKTOPHEIGHT%
    SHARED tipo%%

    DIM x%, y%
    DIM ore%%, minuti%%

    _DEST schermo&
    SELECT CASE tipo%%
        CASE IS <> 3
            DO
                DO
                    DO
                        VIEW PRINT 2 TO 5
                        CLS 2
                        PRINT "- Digitare le ore e i minuti a scelta (>= 20 minuti e <= "; _TRIM$(STR$(INT(X!))); " ore e "; _TRIM$(STR$(INT((X! - INT(X!)) * 60) - 1)); " minuti) di cui viene calcolata la corrispondente portata di picco e relativo idrogramma (INVIO o 0 per tralasciare)."
                        PRINT "Ore:"
                        PRINT "Minuti:"
                        LOCATE 3, 9
                        INPUT "", ore%%
                    LOOP WHILE ore%% > INT(X!)
                    DO
                        LOCATE 4, 9
                        INPUT "", minuti%%
                        IF minuti%% >= 60 THEN LOCATE 4, 9: PRINT SPACE$(30)
                    LOOP WHILE minuti%% >= 60
                    ore!(tipo%%) = Arrotonda!(ore%% + minuti%% / 60)
                    IF ore!(tipo%%) = 0 THEN EXIT DO
                LOOP WHILE ore!(tipo%%) >= Arrotonda!(X!)
                VIEW PRINT 1 TO 4
                IF ore!(tipo%%) = 0 THEN EXIT SUB
            LOOP WHILE ore!(tipo%%) < Arrotonda!(20 / 60)
        CASE IS = 3
            DO
                DO
                    CLS 2
                    PRINT "- Digitare le ore e i minuti (<= "; _TRIM$(STR$(INT(X!))); " ore e "; _TRIM$(STR$(INT((X! - INT(X!)) * 60) - 1)); " minuti) di cui si vuole conoscere la portata (INVIO o 0 per tralasciare)."
                    PRINT "Ore:"
                    PRINT "Minuti:"
                    LOCATE 2, 9
                    INPUT "", ore%%
                LOOP WHILE ore%% > INT(X!)
                DO
                    LOCATE 3, 9
                    INPUT "", minuti%%
                    IF minuti%% >= 60 THEN LOCATE 3, 9: PRINT SPACE$(30)
                LOOP WHILE minuti%% >= 60
                ore!(tipo%%) = Arrotonda!(ore%% + minuti%% / 60)
                IF ore!(tipo%%) = 0 THEN EXIT SUB
            LOOP WHILE ore!(tipo%%) >= Arrotonda(X!)
    END SELECT
    _DEST immagine&
    _SOURCE immagine&
    CALL ScalaOrigine(0, 1, 0, 0, immagine&)
    x% = PMAP(dx! + ore!(tipo%%), 0)
    y% = PMAP(dy!, 1)
    DO
        y% = y% - 1
        IF tipo%% = 3 THEN
            IF POINT(dx! + ore!(tipo%%), PMAP(y%, 3)) = azzurro& THEN
                _DEST schermo&
                EXIT SUB
            END IF
        END IF
        IF POINT(dx! + ore!(tipo%%), PMAP(y%, 3)) = giallo& THEN EXIT DO
        LINE (dx! + ore!(tipo%%), dy!)-(dx! + ore!(tipo%%), PMAP(y%, 3)), grigio&, , 65520
        _PUTIMAGE ((DESKTOPWIDTH% - _WIDTH(destinazione&)), (DESKTOPHEIGHT% - _HEIGHT(destinazione&) - 16)), immagine&, schermo&
    LOOP
    portata!(tipo%%) = PMAP(y%, 3) - dy!
    CALL DisegnaValore(ore!(tipo%%), portata!(tipo%%), 0, 0, bianco&)
    i% = 2
    DO
        IF PMAP(x%, 2) = dx! THEN EXIT DO
        x% = x% - 1
        LINE (dx! + ore!(tipo%%), PMAP(y%, 3))-(PMAP(x%, 2), PMAP(y%, 3)), grigio&, , 65520
        _PUTIMAGE ((DESKTOPWIDTH% - _WIDTH(destinazione&)), (DESKTOPHEIGHT% - _HEIGHT(destinazione&) - 16)), immagine&, schermo&
    LOOP
    _DEST schermo&
END SUB
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
SUB DisegnaLinea (visualizza%%, immagine&, ColoreLinea&, ColorePunto&)

    SHARED MassimiIdrogrammi1a24() AS idrogramma

    CALL ScalaOrigine(0, 1, 0, 0, immagine&)
    _SOURCE immagine&
    FOR z%% = 1 TO 24
        CIRCLE (dx! + MassimiIdrogrammi1a24(visualizza%%, z%%, 1).ore, dy! + MassimiIdrogrammi1a24(visualizza%%, z%%, 1).portata), PMAP(3, 2), ColorePunto&
        PAINT (dx! + MassimiIdrogrammi1a24(visualizza%%, z%%, 1).ore - PMAP(2.5, 2), dy! + MassimiIdrogrammi1a24(visualizza%%, z%%, 1).portata), ColorePunto&
        IF z%% = 1 THEN
            LINE (dx!, dy!)-(dx! + MassimiIdrogrammi1a24(visualizza%%, z%%, 1).ore, dy! + MassimiIdrogrammi1a24(visualizza%%, z%%, 1).portata), ColoreLinea&
        ELSE
            LINE (dx! + MassimiIdrogrammi1a24(visualizza%%, z%% - 1, 1).ore, dy! + MassimiIdrogrammi1a24(visualizza%%, z%% - 1, 1).portata)-(dx! + MassimiIdrogrammi1a24(visualizza%%, z%%, 1).ore, dy! + MassimiIdrogrammi1a24(visualizza%%, z%%, 1).portata), ColoreLinea&
        END IF
    NEXT z%%
END SUB
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
SUB Dati (binario%%, colonna%)

    SHARED CoefficientiDiscretizzazioneTemporale() AS CoefficientiDiscretizzazioneTemporale
    SHARED CNIII!, S2!, Ia!, tc!, dt!()
    SHARED ieto%%, VisualizzaIeto%%
    SHARED T$

    LOCATE , colonna%: PRINT "- Tempo di ritorno:"
    LOCATE , colonna% + 2: PRINT "T = "; T$; ";"
    LOCATE , colonna%: PRINT "- CN(III) = "; _TRIM$(STR$(Arrotonda!(CNIII!))); ";"
    LOCATE , colonna%: PRINT "- Contenuto idrico massimo del terreno:"
    LOCATE , colonna% + 2: PRINT "S = "; _TRIM$(STR$(Arrotonda!(S2!))); " mm;"
    LOCATE , colonna%: PRINT "- Perdite iniziali:"
    LOCATE , colonna% + 2: PRINT "Ia = "; _TRIM$(STR$(Arrotonda!(Ia!))); " mm;"
    LOCATE , colonna%: PRINT "- Tempo di corrivazione:"
    LOCATE , colonna% + 2: PRINT "tc = "; _TRIM$(STR$(Arrotonda!(tc!))); " ore = "; _TRIM$(STR$(INT(tc!))); " ore e "; _TRIM$(STR$(CINT(60 * (tc! - INT(tc!))))); " minuti."
    IF binario%% AND 2 ^ 3 THEN
        LOCATE , colonna%: PRINT "- Tipo di ietogrammi di calcolo:"
        LOCATE , colonna% + 2
        IF ieto%% = 1 THEN PRINT "CHICAGO;"
        IF ieto%% = 2 THEN PRINT "COSTANTE;"
        IF ieto%% > 2 THEN
            IF VisualizzaIeto%% = 1 THEN PRINT "CHICAGO;"
            IF VisualizzaIeto%% = 2 THEN PRINT "COSTANTE;"
        END IF
    END IF
    IF binario%% AND 2 ^ 2 THEN
        LOCATE , colonna%: PRINT "- Idrogramma di calcolo:"
        LOCATE , colonna% + 2: PRINT "n. "; _TRIM$(STR$(z%%)); ";"
    END IF
    IF binario%% AND 2 ^ 1 THEN
        LOCATE , colonna%: PRINT "- Durata della pioggia:"
        LOCATE , colonna% + 2: PRINT "d = "; _TRIM$(STR$(CoefficientiDiscretizzazioneTemporale(z%%).N)); " volte tc = "; _TRIM$(STR$(Arrotonda!(CoefficientiDiscretizzazioneTemporale(z%%).N * tc!))); " ore = "
        LOCATE , colonna% + 2: PRINT "= "; _TRIM$(STR$(INT(CoefficientiDiscretizzazioneTemporale(z%%).N * tc!))); " ore e "; _TRIM$(STR$(CINT(60 * (CoefficientiDiscretizzazioneTemporale(z%%).N * tc! - INT(CoefficientiDiscretizzazioneTemporale(z%%).N * tc!))))); " minuti;"
    END IF
    IF binario%% AND 2 ^ 0 THEN
        LOCATE , colonna%: PRINT "- Passo temporale:"
        LOCATE , colonna% + 2: PRINT "dt = "; _TRIM$(STR$(Arrotonda!(dt!(z%%)))); " ore = "; _TRIM$(STR$(INT(dt!(z%%)))); " ore e "; _TRIM$(STR$(CINT(60 * (dt!(z%%) - INT(dt!(z%%)))))); " minuti."
    END IF
END SUB
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
SUB Tabella (k%%, n%%, ca1&, t1$, ca2&, t2$, ca3&, t3$, ca4&, t4$, ca5&, t5$, ca6&, t6$, ca7&, t7$, ca8&, t8$, binario%%, finecolonna%%, cb1&, v1!, cb2&, v2!, cb3&, v3!, cb4&, v4!, cb5&, v5!, cb6&, v6!, cb7&, v7!)

    SHARED FineColonna%()
    SHARED p%%

    DIM c&(8), t$(8), v!(7)

    c&(1) = ca1&: c&(2) = ca2&: c&(3) = ca3&: c&(4) = ca4&: c&(5) = ca5&: c&(6) = ca6&: c&(7) = ca7&: c&(8) = ca8&: t$(1) = t1$: t$(2) = t2$: t$(3) = t3$: t$(4) = t4$: t$(5) = t5$: t$(6) = t6$: t$(7) = t7$: t$(8) = t8$
    IF k%% = n%% THEN
        FOR p%% = 1 TO 8
            REDIM _PRESERVE FineColonna%(p%%)
            COLOR c&(p%%): PRINT t$(p%%);
            IF t$(p%%) = "-" THEN FineColonna%(p%%) = POS(0) - 1 + 4
            IF t$(p%%) <> "-" THEN FineColonna%(p%%) = POS(0) - (LEN(t$(p%%)) + 1) + LarghezzaColonna%%
            IF p%% <= 7 THEN IF LEN(t$(p%% + 1)) > 0 THEN COLOR grigio&: LOCATE , FineColonna%(p%%): PRINT "³";
        NEXT p%%
        PRINT
    END IF
    c&(1) = cb1&: c&(2) = cb2&: c&(3) = cb3&: c&(4) = cb4&: c&(5) = cb5&: c&(6) = cb6&: c&(7) = cb7&: c&(8) = 0: v!(1) = v1!: v!(2) = v2!: v!(3) = v3!: v!(4) = v4!: v!(5) = v5!: v!(6) = v6!: v!(7) = v7!
    t$(1) = _TRIM$(STR$(Arrotonda!(v!(1)))): t$(2) = _TRIM$(STR$(Arrotonda!(v!(2)))): t$(3) = _TRIM$(STR$(Arrotonda!(v!(3)))): t$(4) = _TRIM$(STR$(Arrotonda!(v!(4)))): t$(5) = _TRIM$(STR$(Arrotonda!(v!(5)))):_
    t$(6) = _TRIM$(STR$(Arrotonda!(v!(6)))): t$(7) = _TRIM$(STR$(Arrotonda!(v!(7)))):t$(8) = ""
    FOR p%% = UBOUND(v!) - 1 TO 0 STEP -1
        IF binario%% AND 2 ^ p%% THEN t$(UBOUND(v!) - p%%) = _TRIM$(STR$(INT(v!(UBOUND(v!) - p%%)))) + ":" + _TRIM$(STR$(CINT(60 * (v!(UBOUND(v!) - p%%) - INT(v!(UBOUND(v!) - p%%))))))
    NEXT p%%
    LOCATE , FineColonna%(finecolonna%%) - 4
    FOR p%% = 1 TO 7
        COLOR c&(p%%): PRINT t$(p%%);
        IF p%% <= 6 THEN IF c&(p%% + 1) = 0 THEN EXIT FOR
        COLOR grigio&: LOCATE , FineColonna%(finecolonna%% - 1 + p%%): PRINT "³";
    NEXT p%%
    PRINT
END SUB
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
SUB CreaImmagine (image&, filename$) 'subroutine presa da "http://www.qb64.org/wiki/SAVEIMAGE"

    DIM bytesperpixel%, x&, y&, bb$, bpp&, c&, cv&, lastsource&, padder$, px&, py&, rr$, d$, ext$, f&

    bytesperpixel% = _PIXELSIZE(image&)
    IF bytesperpixel% = 0 THEN PRINT "Text modes unsupported!": END
    IF bytesperpixel% = 1 THEN bpp& = 8 ELSE bpp& = 24
    x& = _WIDTH(image&)
    y& = _HEIGHT(image&)
    bb$ = "BM????QB64????" + MKL$(40) + MKL$(x&) + MKL$(y&) + MKI$(1) + MKI$(bpp&) + MKL$(0) + "????" + STRING$(16, 0)
    IF bytesperpixel% = 1 THEN
        FOR c& = 0 TO 255
            cv& = _PALETTECOLOR(c&, image&)
            bb$ = bb$ + CHR$(_BLUE32(cv&)) + CHR$(_GREEN32(cv&)) + CHR$(_RED32(cv&)) + CHR$(0)
        NEXT
    END IF
    MID$(bb$, 11, 4) = MKL$(LEN(bb$))
    lastsource& = _SOURCE
    _SOURCE image&
    IF ((x& * 3) MOD 4) THEN padder$ = STRING$(4 - ((x& * 3) MOD 4), 0)
    FOR py& = y& - 1 TO 0 STEP -1
        rr$ = ""
        FOR px& = 0 TO x& - 1
            c& = POINT(px&, py&)
            IF bytesperpixel% = 1 THEN rr$ = rr$ + CHR$(c&) ELSE rr$ = rr$ + LEFT$(MKL$(c&), 3)
        NEXT px&
        d$ = d$ + rr$ + padder$
    NEXT py&
    _SOURCE lastsource&
    MID$(bb$, 35, 4) = MKL$(LEN(d$))
    bb$ = bb$ + d$
    MID$(bb$, 3, 4) = MKL$(LEN(bb$))
    IF LCASE$(RIGHT$(filename$, 4)) <> ".bmp" THEN ext$ = ".bmp"
    f& = FREEFILE
    OPEN filename$ + ext$ FOR OUTPUT AS #f&: CLOSE #f&
    OPEN filename$ + ext$ FOR BINARY AS #f&
    PUT #f&, , bb$
    CLOSE #f&
END SUB
'--------------------------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------------------------
FUNCTION Arrotonda! (num!)

    Arrotonda! = _ROUND(num! * 100) / 100
END FUNCTION

'**************************************************************************************************************************************************
'*                                                Termine sezione subroutines e functions                                                        *
'**************************************************************************************************************************************************

''$include: 'Codice.bm'
Reply


Messages In This Thread
ARRAY declaration in GOSUB routines. - by bartok - 02-04-2024, 01:05 PM
RE: ARRAY declaration in GOSUB routines. - by bartok - 02-04-2024, 09:15 PM



Users browsing this thread: 1 Guest(s)