diff --git a/demo/plate1n/gendatasetu.js b/demo/plate1n/gendatasetu.js new file mode 100644 index 0000000..33afd31 --- /dev/null +++ b/demo/plate1n/gendatasetu.js @@ -0,0 +1,31 @@ +/* + Generate a set of samples with different damage positions (equidistant distribution) + One transducer (top) and one sensor (bottom, x-centered, 30mm from bottom) +*/ +var fs = require('fs'), + cp = require('child_process') + +var plate = [500,500], + damx = [100,400], + damy = [100,400], + dx = 5, + dy = 5, + simu = '../../bin/simndt2b', + configFile = 'simndt_alu_plate_hole_20mm_sensorshape.json' +function readJSON(file) { + return JSON.parse(fs.readFileSync(file,'utf8')) +} +function writeJSON(file,config) { + return fs.writeFileSync(file,JSON.stringify(config),'utf8') +} +for(var y=damy[0];y<=damy[1];y+=dy) for(var x=damx[0];x<=damx[1];x+=dx) { + var config = readJSON(configFile) + config.GeometricObjects[0].x0=x; + config.GeometricObjects[0].y0=y; + config.Export.Save_filepath = './datau' + config.Export.Filename = 'sample-x'+config.GeometricObjects[0].x0+'-y'+config.GeometricObjects[0].y0; + writeJSON('config.json',config) + console.log(config.Export.Filename) + cp.spawnSync(simu,['config.json']) +} +