#excitation_file with a file MATLAB to generate a sfcw signal

334 views
Skip to first unread message

Andrea

unread,
Mar 5, 2020, 10:50:06 AM3/5/20
to gprMax-users
Good morning I have some questions. Can anyone help me please?
I want to create a simulation for a Stepped Frequency Continuous Wave radar.
 I generate my signal in MATLAB and i want import it in GprMax to simulate it.

Matlab parameter:
Stepped Frequency Continuous Wave Signal GENERATION
PARAMETER:
Amplitude= 1.000000 [V]
N= 51
Bw= 5e+08 [Hz]
Dwell Time= 8.33333e-11[s]
PRI=4.25e-09 [s]
Frequency Step= 10.000000 [MHz]
Range Resolution= 0.094868 [m]
Unambiguous Range= 4.838285[m]

this code generate a txt file named my_wave.txt :

time my_pulse
0 1 
8.33333e-13 0.992115 
1.66667e-12 0.968583 
2.5e-12 0.929776 
3.33333e-12 0.876307 
4.16667e-12 0.809017 
5e-12 0.728969 
5.83333e-12 0.637424 
6.66667e-12 0.535827 
7.5e-12 0.425779 
.. .. ..

GprMax code

#title: scenario_0_cubo_cilindro_al_centro
#domain: 2.0 1.5 0.002
#dx_dy_dz: 0.002 0.002 0.002
#time_window: 8.5e-9

#material: 10 0 1 0 ground
#excitation_file: my_wave.txt

#hertzian_dipole: z 1.0 1.0 0.0 my_pulse
#rx: 1 1.01 0.0

#box: 0 0 0 2.0 1.0 0.002 ground
#cylinder: 1 0.5 0.0 1.0 0.5 0.02 0.1 pec

#geometry_view: 0 0 0 2.0 1.5 0.002 0.002 0.002 0.002 scenario_0_cubo_cilindro_al_centro n
#snapshot: 0 0 0 2.0 1.5 0.002 0.002 0.002 0.002 8.5e-9 snap1

I'm sorry but I can't understand where I'm wrong

The cmd return:

Model title: scenario_0_cubo_cilindro_al_centro
Number of CPU (OpenMP) threads: 4
Spatial discretisation: 0.002 x 0.002 x 0.002m
Domain size: 2 x 1.5 x 0.002m (1000 x 750 x 1 = 750000 cells)
Mode: 2D TMz
Time step (at CFL limit): 4.71731e-12 secs
Time window: 8.5e-09 secs (1803 iterations)

Excitation file: C:\Users\andre\Desktop\gprMax\ESEMPI_PROVA\scenario_0_sfera\my_wave.txt
User waveform my_pulse created using user-defined time array and, if required, interpolation parameters (kind: linear, fill value: nan).

Traceback (most recent call last):
  File "C:\Users\andre\Miniconda3\envs\gprMax\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\andre\Miniconda3\envs\gprMax\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\andre\Desktop\gprMax\gprMax\__main__.py", line 6, in <module>
    gprMax.gprMax.main()
  File "C:\Users\andre\Desktop\gprMax\gprMax\gprMax.py", line 66, in main
    run_main(args)
  File "C:\Users\andre\Desktop\gprMax\gprMax\gprMax.py", line 188, in run_main
    run_std_sim(args, inputfile, usernamespace)
  File "C:\Users\andre\Desktop\gprMax\gprMax\gprMax.py", line 229, in run_std_sim
    run_model(args, currentmodelrun, modelend - 1, numbermodelruns, inputfile, modelusernamespace)
  File "C:\Users\andre\Desktop\gprMax\gprMax\model_build_run.py", line 166, in run_model
    process_multicmds(multicmds, G)
  File "C:\Users\andre\Desktop\gprMax\gprMax\input_cmds_multiuse.py", line 230, in process_multicmds
    h.calculate_waveform_values(G)
  File "C:\Users\andre\Desktop\gprMax\gprMax\sources.py", line 67, in calculate_waveform_values
    self.waveformvaluesJ[iteration] = waveform.calculate_value(time + 0.5 * G.dt, G.dt)
  File "C:\Users\andre\Desktop\gprMax\gprMax\waveforms.py", line 118, in calculate_value
    ampvalue = self.userfunc(time)
  File "C:\Users\andre\Miniconda3\envs\gprMax\lib\site-packages\scipy\interpolate\polyint.py", line 79, in __call__
    y = self._evaluate(x)
  File "C:\Users\andre\Miniconda3\envs\gprMax\lib\site-packages\scipy\interpolate\interpolate.py", line 663, in _evaluate
    below_bounds, above_bounds = self._check_bounds(x_new)
  File "C:\Users\andre\Miniconda3\envs\gprMax\lib\site-packages\scipy\interpolate\interpolate.py", line 695, in _check_bounds
    raise ValueError("A value in x_new is above the interpolation "
ValueError: A value in x_new is above the interpolation range.

Can anyone help me please?


Craig Warren

unread,
Mar 9, 2020, 5:43:41 AM3/9/20
to gprMax-users

Andrea

unread,
Mar 11, 2020, 6:55:41 AM3/11/20
to gprMax-users
thank you very much. I think I understand the mistake. I generate my wave for 4.25e-09 (PRI) second. while I was setting the #time_window: 8.5e-9 (2*PRI), if I set #time_window: 4.25e-09, it works.
So in order not to have the error and to have the time to receive the signal I increased the time up to 8.5e-9 and added 0 as an amplitude value after the time 4.25e-09.
ex:
time my_pulse
0 1
5e-13 0.998027
1e-12 0.992115
1.5e-12 0.982287
2e-12 0.968583
2.5e-12 0.951057
3e-12 0.929776
3.5e-12 0.904827
4e-12 0.876307
4.5e-12 0.844328
5e-12 0.809017
5.5e-12 0.770513
6e-12 0.728969
6.5e-12 0.684547
7e-12 0.637424
7.5e-12 0.587785
....
..
..
2.547e-09 -0.45399
2.5475e-09 -0.382683
2.548e-09 -0.309017
2.5485e-09 -0.233445
2.549e-09 -0.156434
2.5495e-09 -0.0784591
2.55e-09 0
2.5505e-09 0
2.551e-09 0
2.5515e-09 0
...
..
..
.

Reply all
Reply to author
Forward
0 new messages