From: Roberts, D. J. <dro...@mi...> - 2009-04-07 17:38:55
|
Brian, Stuart pointed me towards your mathworks submission. I tried your sfuntest3.mdl and it works nicely. I'm interested in making use of it. I noticed it is slower than JSBSim. I think this is probably due to use of the GetPropertyValue() method at 120hz. From looking at JSBSim source I notice that comments suggest using the GetNode() function and then using the node's getDoubleValue() function for calls at 120hz. I'm going to try to modify JSBSimInterface.cpp & JSBSimInterface.h to incorporate this. Do you have the mex statement that you used to compile JSBSim_SFunction.mexw32? I tried with the following statement: mex -g JSBSim_SFunction.cpp JSBSimInterface.cpp MexJSBSim.cpp SfunInterface.cpp stdafx.cpp -I"..\JSBSim\src\" -L"..\JSBSim\lib\" When I do this I get an error concerning MexJSBSim.cpp at line 111. The compiler spits out: 'JSBSimInterface::Open' : cannot convert parameter 1 from 'const mxArray *' to 'std::string'. Is there a compile option that I'm forgetting that handles data type conversions? Regards, David Roberts |
From: Agostino De M. <ago...@un...> - 2009-04-07 20:30:40
|
David, that project is compiled with MS Visual Studio 2008 Express. That might be a bad thing for someone. For others that is one good example of mex files done with the popular IDE from MS. It helps a lot when you have big a project. Agostino Quoting "Roberts, David J." <dro...@mi...>: > Brian, > > Stuart pointed me towards your mathworks submission. I tried your > sfuntest3.mdl and it works nicely. I'm interested in making use of > it. > > I noticed it is slower than JSBSim. I think this is probably due to > use of the GetPropertyValue() method at 120hz. From looking at > JSBSim source I notice that comments suggest using the GetNode() > function and then using the node's getDoubleValue() function for > calls at 120hz. > > I'm going to try to modify JSBSimInterface.cpp & JSBSimInterface.h > to incorporate this. Do you have the mex statement that you used > to compile JSBSim_SFunction.mexw32? > > I tried with the following statement: > > mex -g JSBSim_SFunction.cpp JSBSimInterface.cpp MexJSBSim.cpp > SfunInterface.cpp stdafx.cpp -I"..\JSBSim\src\" -L"..\JSBSim\lib\" > > When I do this I get an error concerning MexJSBSim.cpp at line 111. > The compiler spits out: 'JSBSimInterface::Open' : cannot convert > parameter 1 from 'const mxArray *' to 'std::string'. > > Is there a compile option that I'm forgetting that handles data type > conversions? > > Regards, > > David Roberts > > ------------------------------------------------------- Agostino De Marco, PhD Assistant Professor Università degli Studi di Napoli Federico II / University of Naples Federico II / Dipartimento di Ingegneria Aerospaziale / Department of Aerospace Engineering / via Claudio 21, 80125 Napoli - Italy Tel.: +39 0817683323 Fax: +39 0817683622 Email: ago...@un... Web 1: www.dpa.unina.it/adag Web 2: www.dpa.unina.it/demarco ------------------------------------------------------- |
From: b m. <bri...@in...> - 2009-04-07 20:59:28
|
Hi David, Are you sure about it being slower? Do you have your Simulink Parameters set up for a sample time of 1/120 ? Brian ----- Original Message ----- From: "Roberts, David J." <dro...@mi...> Date: Tuesday, April 7, 2009 13:39 Subject: [Jsbsim-matlab] compiling mex file for S-Function To: "jsb...@li..." <jsb...@li...> > Brian, > > Stuart pointed me towards your mathworks submission. I > tried your sfuntest3.mdl and it works nicely. I'm > interested in making use of it. > > I noticed it is slower than JSBSim. I think this is > probably due to use of the GetPropertyValue() method at > 120hz. From looking at JSBSim source I notice that > comments suggest using the GetNode() function and then using the > node's getDoubleValue() function for calls at 120hz. > > I'm going to try to modify JSBSimInterface.cpp & > JSBSimInterface.h to incorporate this. Do you have > the mex statement that you used to compile JSBSim_SFunction.mexw32? > > I tried with the following statement: > > mex -g JSBSim_SFunction.cpp JSBSimInterface.cpp MexJSBSim.cpp > SfunInterface.cpp stdafx.cpp -I"..\JSBSim\src\" - > L"..\JSBSim\lib\" > When I do this I get an error concerning MexJSBSim.cpp at line > 111. The compiler spits out: 'JSBSimInterface::Open' : > cannot convert parameter 1 from 'const mxArray *' to 'std::string'. > > Is there a compile option that I'm forgetting that handles data > type conversions? > > Regards, > > David Roberts > > |
From: b m. <bri...@in...> - 2009-04-08 10:39:35
|
Hi Robert, I double checked and using a simulation run of 0.1 seconds- the S-Function completed 13 cycles. This validates that the simulation is running at 120 cyles per "sim second." One thing to keep in mind though- Simulink is not necessarily run in real-time, so a "sim-second" may not last an "actual" second. So 10 seconds in Simulink may not take 10 seconds in real-time. I take it this is what you are are talking about. Now, it's not that I'm saying that you are incorrect, just that it's possbile that the issue resides in the fact that Simulink, and in fact JSBSim, are not necessarily truly running in real-time. On our commercial sims that run on Windows PCs, the sim real-time application is augmented with a 3rd party real-time application. Brian ----- Original Message ----- From: "Roberts, David J." <dro...@mi...> Date: Tuesday, April 7, 2009 13:39 Subject: [Jsbsim-matlab] compiling mex file for S-Function To: "jsb...@li..." <jsb...@li...> > Brian, > > Stuart pointed me towards your mathworks submission. I > tried your sfuntest3.mdl and it works nicely. I'm > interested in making use of it. > > I noticed it is slower than JSBSim. I think this is > probably due to use of the GetPropertyValue() method at > 120hz. From looking at JSBSim source I notice that > comments suggest using the GetNode() function and then using the > node's getDoubleValue() function for calls at 120hz. > > I'm going to try to modify JSBSimInterface.cpp & > JSBSimInterface.h to incorporate this. Do you have > the mex statement that you used to compile JSBSim_SFunction.mexw32? > > I tried with the following statement: > > mex -g JSBSim_SFunction.cpp JSBSimInterface.cpp MexJSBSim.cpp > SfunInterface.cpp stdafx.cpp -I"..\JSBSim\src\" - > L"..\JSBSim\lib\" > When I do this I get an error concerning MexJSBSim.cpp at line > 111. The compiler spits out: 'JSBSimInterface::Open' : > cannot convert parameter 1 from 'const mxArray *' to 'std::string'. > > Is there a compile option that I'm forgetting that handles data > type conversions? > > Regards, > > David Roberts > > |