Hey guys,
What is the frequency the nasal scripts are calling during running FG (like local_weather.nas)?
Best regads,
Sebastian
unfortunately it is not possible/so easy to define multidimensional array like 257 gridpoints x 257 gridpoints x130 gridpoints with nasal
Therfore, I want to realize with Nasal a determination of the wind at the aircraft position in the same time interval JSBSim and therefore the flight dynamic calculations are calling and commit the calculated wind from the nasal script to the right position in the JSBSim.
You mean you get into memory issues or that the data structure doesn't work for you (because Nasal sure can do arrays of arrays - or arrays of hashes - or any combination)?
u_palm = split("\n", io.readfile("filname of .txt data"));
var dummy1 = setsize([], dimensionx);
var 2Dfield = [dummy1]
for (var i = 0; i < dimx; i += 1){
u[0][i] = u_palm[i];
};
var n = 0
for (var j = 0; j < dimy; j += 1){
for (var i = 0; i < dimx; i += 1){
u[j][i] = u_palm[n];
n = n + 1;
};
};
var dummy1 = setsize([], dimensionx);
var dummy1 = setsize([], dimensionx);
var dummy2 = setsize([], dimensionx);
var dummy3 = setsize([], dimensionx);
...
var 2Dfield = [dummy1,dummy2,dummy3,....,dummy257]
for (var k = 0; k < 130; k += 1){
for (var j = 0; j < 257; j += 1){
for (var i = 0; i < 257; i += 1){
u[k][j][i] = u_palm[n];
n = n + 1;
};
};
};
Basically the only way to achieve this is to tie a listener to a JSBSim property which calls the Nasal update routine - inserting into any place into AW is not going to work because that never runs faster than framerate (and utilizes the JSBSim turbulence field).
So is it possible to use the setlistener concept with, e.g., the "/fdm/jsbsim/atmosphere/turb-north-fps" property?Unfortunately, listeners don't work on so-called "tied" properties when the node value isn't set via property methods. [..] Most of the FDM properties are "tied", and a few in other subsystems.
AW is not going to work because that never runs faster than framerate
which calls the Nasal update routine
var data_3d = [];
for (var i=0; i< n; i=i+1)
{
var data_2d = [];
for (var j=0; j<m;j=j+1)
{
data_2d[j] = fill_my_value(i,j);
}
append(data_3d, data_2d);
}
print(data[0][4]);
Another idea would be defining a new function in the local_weather.nas script which overwrites the velocitiy properties in JSBSim to the values in the implemented wind field, wouldn't it?
Am i write, that the Nasal scripts aren't calling in a steady time interval (even when you have a steady framerate) like the FDM which runs with 120Hz?
fill_my_value(i,j)
data[0][4]
fill_my_value(i,j) a new defined function?
is also a 2D structure i don't know where it comes from.
In addition, i get the error message:
for (var j=0; j<m;j=j+1)
{
var point = fill_my_value(i,j);
append(data_2d, point);
}
var n = 0;
var data_3d = [];
for (var k = 0; k < dimz; k += 1){
var dummy_2d = [];
for (var j = 0; j < dimy; j += 1){
dummy_1d = [];
for (var i = 0; i < dimx; i += 1){
pointer = u_input[n];
n = n + 1;
append(dummy_1d, pointer);
};
append(dummy_2d,dummy_1d);
};
append(data_3d, dummy_2d);
};
var update_wind = func(){
setprop("/fdm/jsbsim/atmosphere/turb-north-fps", 5.0);
}
var timer = maketimer(1/120, update_wind);
timer.start();
maybe i could overwrite the jsbsim velocites with the maketimer function?:
.whatever your constant is, it won't run faster than framerate
Basically the only way to achieve this is to tie a listener to a JSBSim property which calls the Nasal update routine
setlistener("/fdm/jsbsim/atmosphere/turb-north-fps", Nasal update routine, 5.0); }, 1, 1);
Users browsing this forum: No registered users and 5 guests