in data 03-23-2021 09:58 AM
Ciao a tutti, devo sviluppare un progetto dove una fabbrica ha 3 prodotti differenti A,B e C, ognuno con un numero di serie differente con formato: (anno-mese-prodotto – 4 numeri) es. 202102B0021. Solo si può produrre un prodotto alla volta e è necessario registrare quanto ha impiegato ogni unità a fabbricarsi. L’informazione deve essere salvata su un archivio txt.
Bisogna inserire:
Actual unit: unità che si sta fabbricando attualmente
Lasted time: indica il tempo che impiega a fabbricarsi
Start: per avviare il sistema
Stop: per fermare il sistema
Dovrei inserire anche una barra di progresso della produzione. Quindi in definitiva devo stampare una stringa che sia:
202103A0001
202103B0001
202103C0001
202103A0002
202103B0002
E così via. Il mio problema per adesso è sapere come faccio a selezionare nei differenti cicli prima A, poi B e poi C. Un'altra cosa che credo di non saper fare è l’avanzamento della barra col passare del tempo. Allego immagine del VI svolto fino ad ora e della schermata che dovrei ottenere.
in data 03-23-2021 10:13 AM
Un altro problema che sto avendo, è che quando stampo i 4 numero che vanno dopo la lettera, invece di stampare ad esempio 0009, come dovrebbe essere, stampo solo 9. Come posso definire la lunghezza della stringa/numero e che questa si riempia di zeri se non arriva ai 4 numeri? Allego immagine.
03-23-2021 10:58 AM - modificato 03-23-2021 11:47 AM
@andrea080690 wrote:
Un altro problema che sto avendo, è che quando stampo i 4 numero che vanno dopo la lettera, invece di stampare ad esempio 0009, come dovrebbe essere, stampo solo 9.
Here's what you should do.
in data 03-23-2021 03:27 PM
Thank you, but in this case I am missing the code in the middle. It should be like:
202103A0001
202103B0001
202103C0001
202103A0002
202103B0002
202103C0002
202103A0003
...
How can I use alternatively the letter A, B and C?
in data 03-23-2021 03:56 PM
Try this (Of course you could use a slow while loop too. The time formatting can go before the loop if you can guarantee that the month and year does not change during run. Can you?):
in data 03-23-2021 04:23 PM
Non ho ben capito questo secondo codice, il problema è che devo stampare linea a linea i vari valori; la traccia dice questo:
Sviluppa un progetto in LabVIEW che simuli una situazione come la seguente:
Una fabbrica ha 3 diversi prodotti (A, B e C), ognuno con un numero di serie diverso con il formato: [ANNO-MESE-4 CIFRE CONTATORE] -> (es: 202101A1234)
Esiste solo la capacità di produrre un'unità alla volta e si desidera registrare il tempo impiegato da ciascuna unità per la produzione. Le informazioni devono essere salvate in un file "Log.txt"
Dove:
- Unità effettiva: indica l'unità corrente che viene prodotta
- Lasted Time: indica il tempo necessario per la produzione
- Avvia: avvia il sistema quando tutto è pronto
- Stop: arresto di emergenza
Sono stati aggiunti una barra di avanzamento opzionale e un indicatore di uscita dall'errore.
Punti da tenere in considerazione durante lo svolgimento dell'esercizio:
Questo esercizio può essere svolto in diversi modi, sebbene preferibilmente si cerchi una struttura di base della macchina a stati.
Eventuali aggiunte extra che migliorano la funzionalità del programma di esempio saranno molto apprezzate.
Saranno valutati la chiarezza del codice e il suo controllo degli errori, nonché i suoi commenti e la documentazione.
03-23-2021 05:15 PM - modificato 03-23-2021 05:16 PM
Finally, I have done this machine state, but I have still three problems. The first one is that When I stop the code, it saves me just the last 3 values, how can I save all of it?
The second is that I want a progress bar to go from 0 to the top following the end of the time out which is random.
Third, I want to use a start button to start the machine, how can I do it?
in data 03-24-2021 02:18 AM
First of all, you need to do some tutorial and actually do a state machine as requested.
There is no need for any sequence structures or local variables!
The attached code shows just how to accumulate a string in a shift register. First try to fully understand it, then expand it to add all the other functionality needed. Note that if a unit takes more than a fraction of a second, you should use two loops and separate the UI code and the processing. If you don't know the final number of units or time, it is not clear how you want to scale the progress bar.
in data 03-24-2021 03:27 AM
Thank you, I have solved how to save continuously the data. But I still have two problems:
1) I want a progress bar to go from 0 to the top following the end of the time out which is random.
2) I want to use a start button to start the machine, how can I do it?
in data 03-24-2021 05:19 AM
When I try to use a case true false to put a start button, I have errors in the code, instead of having 202103A0001 I have 202103AXXXX where XXXX are random numbers.