ziocembra Posted October 17, 2013 Report Posted October 17, 2013 Buongiorno a tutti . Io acquisisco un segnale 1..10 volt che "scalo" in un segnale da 0.001 millibar a 1000 millibar ora per esigenze di visualizzazione sul touch in unità ingegneristica dovrei vedere a display ad esempio 1000 mbar come 1.0 x 10e3 1 millibar come 1.0 x 10e0 0.001 millibar come 1.0 x 10e-3 e cosi via.. In poche parole visualizzare un numero in esponenziale. quando usavo panasonic dovevo farmi uno script che comprendesse tutti i casi creando una funzione che inserendo il numero mi restituisse valore ed esponente. esiste un metodo meno ortodesso ? grazie e tutti
Elvezio Franco Posted October 17, 2013 Report Posted October 17, 2013 (edited) Non serve compilare 2 messaggi uguali per la stessa richiesta,servono solo a dividere le risposte. Edited October 17, 2013 by Elvezio Franco
Lucky67 Posted October 18, 2013 Report Posted October 18, 2013 Potresti usare i logaritmi in base 10 (ammesso che il 1200 li abbia). Ad esempio Log 1000 = 3 quindi avrai 1 e3 oppure Log 900 = 2,xxx prendi l'intero e avrai 9 e2
Livio Orsini Posted October 18, 2013 Report Posted October 18, 2013 Ma ha senso una scal così ampia quando il normale AD ha solo 4095 livelli discreti?
ziocembra Posted November 6, 2013 Author Report Posted November 6, 2013 in realtàsi perche il sensore mi fornisce una uscita lineare quindi a me che serve una risoluzione di 0.1 basta la conversione a 11 bit. infatti per me la risoluzione di ogni scala logaritmica è spalmata su 1 volt quindi con una risoluzione di 0.01 volt avrei già quanto mi serve. usare i logaritmi direttamente non credo funzioni in quanto il valore 1 millibar non credo lo esprima come 1x10e0 ma direttamente come 1 ... o sbaglio. domandina io con panasonic uusavo questa soluzione : if (bCalcola) then if (rInput >= 850.0) then rValore := 1.0; iEsponente := +3; end_if; if (rInput < 300.0) then rValore := 9.0; iEsponente := -3; end_if; if (rInput < 1000.0) and (rInput >= 900.0) then rValore := (rInput - 899) / 10; iEsponente := +3; end_if; if (rInput < 850.0) and (rInput >= 800.0) then rValore := (rInput - 799) / 10; iEsponente := +2; end_if; if (rInput < 800.0) and (rInput >= 700.0) then rValore := (rInput - 699) / 10; iEsponente := +1; end_if; if (rInput < 700.0) and (rInput >= 600.0) then rValore := (rInput -599) / 10; iEsponente := +0; end_if; if (rInput < 600.0) and (rInput >= 500.0) then rValore := (rInput - 499) / 10; iEsponente := -1; end_if; if (rInput < 500.0) and (rInput >= 400.0) then rValore := (rInput - 399.0) / 10; iEsponente := -2; end_if; if (rInput < 400.0) and (rInput >= 300.0) then rValore := (rInput - 299) / 10; iEsponente := -3; end_if; end_if; secondo voi scalando opportunamente i valori ( panasonic convertiva da 0 a 1000) uno script del genere funziona anche in s7 1200 o il linguaggio è diverso ? abbiate pazienza ma di s7 ero proprio a digiuno.... :-) grazie a tutti
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now