I have a class that wrote in reactjs, but would like to convert to function using functional programming and not OOP. Anybody tell me how? Follow my class.
import * as h from './hydraulic';
export default class verticalfloculator_diag {
constructor (width, length, depth, npantalla, espaciamiento, espesor, pasos) {
this.detention_time = 0;
this.ancho = width
this.largo = length
this.profundidad = depth
this.npantalla = npantalla
this.espaciamiento_pantallas = espaciamiento
this.espesor_pantallas = espesor
this.alto_pasos = pasos
this.area_entrepantallas = this.espaciamiento_pantallas * this.ancho
this.volumen = this.ancho * this.profundidad * this.largo
this.radiohidraulico = h.radio_hydraulico(this.area_entrepantallas, 2 * (this.ancho + this.espaciamiento_pantallas))
this.anchohueco = 0.3
this.altohueco = 0.2
}
Q = (q) => h.q_m3s(q);
tiempo = (q) => this.volumen / this.Q(q); // en m3
velocidad_canales = (q) => h.velocity(this.Q(q), (this.area_entrepantallas));
velocidad_pasos = (q) => h.velocity(this.Q(q), (this.alto_pasos * this.ancho));
velocidad_huecos = (q) => h.velocity(this.Q(q), (this.altohueco * this.anchohueco));
perdidascanales = (q) => h.perdidas_canales(0.013, this.velocidad_canales(this.Q(q)), this.radiohidraulico);
perdidasenvueltas = (q) => ((this.npantalla + 1) * Math.pow (this.velocidad_canales(q),2) + (this.npantalla) * Math.pow(this.velocidad_pasos(q),2))/2/9.81
perdidasenhuecos = (q) => Math.pow(this.velocidad_huecos(q),2)/2/9.81
perdidastotales = (q) => this.perdidascanales(q) + this.perdidasenvueltas(q) + this.perdidasenhuecos(q)
}