Tue 27 Jan 2026 02:37:58 PM CET
This commit is contained in:
parent
67a60dea24
commit
6aa20b15f0
41
demo/plate1n/gendatasets.js
Normal file
41
demo/plate1n/gendatasets.js
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
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],
|
||||||
|
samples = [],
|
||||||
|
dx = 5,
|
||||||
|
dy = 5,
|
||||||
|
simu = '../../bin/simndt2b',
|
||||||
|
configFile = 'simndt_alu_plate_hole_20mm_sensorshape.json';
|
||||||
|
|
||||||
|
for(var x=damx[0];x<=damx[1];x+=dx) {
|
||||||
|
samples.push([x,400]);
|
||||||
|
}
|
||||||
|
for(var y=damy[0];y<=damy[1];y+=dy) {
|
||||||
|
samples.push([400,y]);
|
||||||
|
}
|
||||||
|
function readJSON(file) {
|
||||||
|
return JSON.parse(fs.readFileSync(file,'utf8'))
|
||||||
|
}
|
||||||
|
function writeJSON(file,config) {
|
||||||
|
return fs.writeFileSync(file,JSON.stringify(config),'utf8')
|
||||||
|
}
|
||||||
|
for(var i in samples) {
|
||||||
|
var x=samples[i][0],
|
||||||
|
y=samples[i][1],
|
||||||
|
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'])
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user