|
From: Jon S. B. <js...@ha...> - 2006-02-20 18:17:46
|
> Basically, I wrote a Matlab MEX file in C and > compiled it into a DLL (as MEX files are compiled in a > Windows environment), which contains multiple > functions doing the following: > > 1. Create a socket given a port number ... > 2. Delete a socket given the base socket ID ... > 3. Connect to an already existent socket ... > 4. Send data to a Socket ... > 5. Receive data from a socket ... > > Functions 1-4 are working fine as of > now...ofcourse, there is room for improvement on the > user friendliness (read..help/usage documentation), > but I am able to do all those functions, and control > JSBSim from within matlab. Good work! > Jon, I was thinking...now that its more or less > clear that this is possible...do you think it would be > possible for you to consider creating a similar interface as > FGOutput also on the input side...where you can > specify in the XML file what data for the simulation > ... I have thought about this. So, instead of sending data over a socket like this: set fcs/elevator-cmd-norm 0.03 set fcs/rudder-cmd-norm 0.00 ... you could do this: 0.03, 0.00 ... The spec would be: <input port="port#"> <property>fcs/elevator-cmd-norm</property> <property>fcs/rudder-cmd-norm</property> </input> To avoid the endian issue, I'd still probably do the data transfer using character strings, unless that's a really bad idea for some reason I'm not yet aware of. I guess that would require your Matlab/Simulink side to convert the data, first. It may also then require a precision attribute in the spec: <input port="port#"> <property precision="##.####">fcs/elevator-cmd-norm</property> > One more question....does JSBSim work with a fixed > time step during the simulation...or does it use a > variable time step solver...? Fixed timestep. For the moment - given the recent changes to fix the landing gear jitter problem - that fixed frame rate should be 120 Hz. > And...also...is it by anychance possible to drive > the JSBSim simulation from outside...as in...supply > the time steps from say..Simulink? (Basically...for > synchronization between the two systems) It might be possible to supply a stepping command in the input socket interface: step -or- step 2 Would that be helpful? I don't think it would be too hard to provide a step function that would allow a single step to be made or a number of specified steps. > Anyway...now time for driving lessons (ya...my > Indian license is not valid here in Germany...so need > to do it all over again :-)!) I hope it's not too icy there on the roads! Jon |