huangxingxing 9 місяців тому
батько
коміт
6df1a18586
2 змінених файлів з 155 додано та 89 видалено
  1. 123 57
      src/control/fireControl.js
  2. 32 32
      src/control/vtkModel.js

+ 123 - 57
src/control/fireControl.js

@@ -108,17 +108,6 @@ export class fireControl {
                 // ["Height", "(m)"],
                 if(skey=="Height"){
                     scalarVarry.forEach(function(value) {
-                        // if(value>=0&&value<0.2){
-                        //     scalar.push(0);
-                        // }else if(value>=0.2&&value<0.5){
-                        //     scalar.push(1);
-                        // }else if(value>=0.5&&value<1){
-                        //     scalar.push(2);
-                        // }else if(value>=1){
-                        //     scalar.push(3);
-                        // }else{
-                        //     scalar.push(0);
-                        // }
                         if(value<1.5){
                             scalar.push(0);
                         }else{
@@ -127,27 +116,29 @@ export class fireControl {
                     });
                 }               
             });
-        }else if(stype =="Fire"){
+        }else if(stype =="Fire"||stype =="Gass"||stype =="Gass1"){
+               // 甲烷	CH4	≥250000
+            // 一氧化碳	CO	30
+            // 二氧化碳	CO2	18000
+            // 二氧化硫	SO2	10
+            // 一氧化氮	NO	10
+            // 二氧化氮	NO2	10
+            // 硫化氢	H2S	10
+            // 氨气	NH3	30
+            // 氯气	CL2	1
             let tscalar=[];
-            let so2scalar=[];
+            let ch4calar=[];
+            let cocalar=[];
             let co2scalar=[];
+            let so2scalar=[];
+            let nocalar=[];
+            let no2calar=[];
+            let h2scalar=[];
+            let nh3calar=[];
+            let cl2calar=[];
             this.scalar.forEach(function(scalarVarry, skey) {
-              // Temperature,SO2,CO2
                 if(skey=="Temperature"){
                     scalarVarry.forEach(function(value) {
-                        // if(value>=0&&value<40){
-                        //     tscalar.push(0);
-                        // }else if(value>=40&&value<45){
-                        //     tscalar.push(1);
-                        // }else if(value>=45&&value<50){
-                        //     tscalar.push(2);
-                        // }else if(value>=50){
-                        //     tscalar.push(3);
-                        // }else{
-                        //     tscalar.push(0);
-                        // }
-
-
                         if(value>=0&&value<40){
                             tscalar.push(0);
                         }else if(value>=40){
@@ -156,21 +147,32 @@ export class fireControl {
                             tscalar.push(0);
                         }
                     });
+                }         
+                if(skey=="CH4"){
+                    scalarVarry.forEach(function(value) {
+                        if(value>=0&&value<250000){
+                            ch4calar.push(0);
+                        }else if(value>=250000){
+                            ch4calar.push(1);
+                        }else{
+                            ch4calar.push(0);
+                        }
+                    });
+                } 
+                if(skey=="CO"){
+                    scalarVarry.forEach(function(value) {
+                        if(value>=0&&value<30){
+                            cocalar.push(0);
+                        }else if(value>=30){
+                            cocalar.push(1);
+                        }else{
+                            cocalar.push(0);
+                        }
+                    });
                 } 
                 if(skey=="CO2"){
                     scalarVarry.forEach(function(value) {
-                        // if(value>=0.04&&value<0.1){
-                        //     co2scalar.push(0);
-                        // }else if(value>=0.1&&value<0.2){
-                        //     co2scalar.push(1);
-                        // }else if(value>=0.2&&value<0.5){
-                        //     co2scalar.push(2);
-                        // }else if(value>=0.5){
-                        //     co2scalar.push(3);
-                        // }else{
-                        //     co2scalar.push(0);
-                        // }
-
+         
                         if(value>=0&&value<18000){
                             co2scalar.push(0);
                         }else if(value>=18000){
@@ -182,18 +184,6 @@ export class fireControl {
                 } 
                 if(skey=="SO2"){
                     scalarVarry.forEach(function(value) {
-                        // if(value>=0.5&&value<3){
-                        //     so2scalar.push(0);
-                        // }else if(value>=3&&value<50){
-                        //     so2scalar.push(1);
-                        // }else if(value>=50&&value<500){
-                        //     so2scalar.push(2);
-                        // }else if(value>=500){
-                        //     so2scalar.push(3);
-                        // }else{
-                        //     so2scalar.push(0);
-                        // }
-
                         if(value>=0&&value<10){
                             so2scalar.push(0);
                         }else if(value>=10){
@@ -203,23 +193,99 @@ export class fireControl {
                         }
                     });
                 } 
+                if(skey=="NO"){
+                    scalarVarry.forEach(function(value) {
+                        if(value>=0&&value<10){
+                            nocalar.push(0);
+                        }else if(value>=10){
+                            nocalar.push(1);
+                        }else{
+                            nocalar.push(0);
+                        }
+                    });
+                } 
+                if(skey=="NO2"){
+                    scalarVarry.forEach(function(value) {
+                        if(value>=0&&value<10){
+                            no2calar.push(0);
+                        }else if(value>=10){
+                            no2calar.push(1);
+                        }else{
+                            no2calar.push(0);
+                        }
+                    });
+                } 
+                if(skey=="H2S"){
+                    scalarVarry.forEach(function(value) {
+                        if(value>=0&&value<10){
+                            h2scalar.push(0);
+                        }else if(value>=10){
+                            h2scalar.push(1);
+                        }else{
+                            h2scalar.push(0);
+                        }
+                    });
+                } 
+                if(skey=="NH3"){
+                    scalarVarry.forEach(function(value) {
+                        if(value>=0&&value<30){
+                            nh3calar.push(0);
+                        }else if(value>=30){
+                            nh3calar.push(1);
+                        }else{
+                            nh3calar.push(0);
+                        }
+                    });
+                } 
+                if(skey=="CL2"){
+                    scalarVarry.forEach(function(value) {
+                        if(value>=0&&value<1){
+                            cl2calar.push(0);
+                        }else if(value>=30){
+                            cl2calar.push(1);
+                        }else{
+                            cl2calar.push(0);
+                        }
+                    });
+                } 
+               
+               
              });
+
              for (let index = 0; index < tscalar.length; index++) {
                 let tm = [];
-                tm.push(tscalar[index]);
-                if(so2scalar.length>0){
-                    tm.push(so2scalar[index]);
+                tm.push(tscalar[index]);  
+                if(ch4calar.length>0){
+                    tm.push(ch4calar[index]);
+                }
+                if(cocalar.length>0){
+                    tm.push(cocalar[index]);
                 }
                 if(co2scalar.length>0){
                     tm.push(co2scalar[index]);
                 }
+                if(so2scalar.length>0){
+                    tm.push(so2scalar[index]);
+                }
+                if(nocalar.length>0){
+                    tm.push(nocalar[index]);
+                }
+                if(no2calar.length>0){
+                    tm.push(no2calar[index]);
+                }
+                if(h2scalar.length>0){
+                    tm.push(h2scalar[index]);
+                }
+                if(nh3calar.length>0){
+                    tm.push(nh3calar[index]);
+                }
+                if(cl2calar.length>0){
+                    tm.push(cl2calar[index]);
+                }
                 scalar.push(Math.max(...tm)); 
                  
              }
          
-        }else if(stype =="Gass"){
-            
-
         }
         this.gjScalar;
     }

+ 32 - 32
src/control/vtkModel.js

@@ -370,48 +370,48 @@ export class VtkModel {
     this.arrowActors = [];
     velocitys.forEach(velocity => {
       velocity.points.forEach(point => {
-        const initialValues = { 
-          base:0,
-          shape: 'triangle',
-          center: [point.x,point.y,point.z],
-          direction:[
+        // const initialValues = { 
+        //   base:0,
+        //   shape: 'arrow4points',
+        //   center: [point.x,point.y,point.z],
+        //   direction:[
+        //     velocity.vector[2],
+        //     velocity.vector[0],
+        //     velocity.vector[1]
+        //   ],
+        //   height: 10.0,
+        //   thickness: 1.5,
+        //   width: 3,
+        //  };
+        // const vtk2d = vtk2DShape.newInstance(initialValues);
+
+        const initialValues = {
+          // base: 0,
+          center: [point.x, point.y, point.z],
+          height: 6,
+          radius: 1,
+          resolution: 6,
+          // height: 4.0,
+          // radius: 1,
+          // resolution: 6,
+          direction: [
+            // velocity.vector[2],
+            // velocity.vector[0],
+            // velocity.vector[1]
             velocity.vector[0],
             velocity.vector[1],
             velocity.vector[2]
           ],
-          height: 10.0,
-          thickness: 1.5,
-          width: 3,
-         };
-        const vtk2d = vtk2DShape.newInstance(initialValues);
-
-
-        
-
-        // const initialValues = {
-        //   // base: 0,
-        //   center: [point.x, point.y, point.z],
-        //   // height: 4,
-        //   // radius: 8,
-        //   // resolution: 3,
-        //   height: 4.0,
-        //   radius: 1,
-        //   resolution: 6,
-        //   direction: [
-        //     velocity.vector[0],
-        //     velocity.vector[1],
-        //     velocity.vector[2]
-        //   ],
-        //   capping: true,
+          capping: true,
 
-        // };
-        // const vtk2d = vtkConeSource.newInstance(initialValues);
+        };
+        const vtk2d = vtkConeSource.newInstance(initialValues);
 
         const mapper = vtkMapper.newInstance();
         mapper.setInputConnection(vtk2d.getOutputPort());
         const actor = vtkActor.newInstance();
         actor.setMapper(mapper);
-          actor.getProperty().setColor(REA);
+        actor.getProperty().setColor(REA);
         this.arrowActors.push(actor);
         // this.renderer.addActor(actor);
       })