I've been working on interacting with the MapleSim optimized C code (first post was here: http://www.mapleprimes.com/questions/145427-MapleSim-Connector-C-Code-Api?sq=145427) and two manuals were recommend to me to read, which were very useful. I ended up writing up an alternate implementation of the main method described in the one manual (http://www.mapleprimes.com/ViewTemp.ashx?f=165895_1365526727/Compiling_C-Code_fro.pdf), that uses a class to store the simulation information and allows you to step through and actually change the input control signal, as that's not possible from the code in the manual.
But, I was getting this strang effect where the control signal was always ignored, and I found this function that is called in the code:
static void inpfn(double T, double *U)
U = 0.;
U = 0.;
Which shows up in all the model sim code I generate (for different models) and just sets the input control signal to zero, and is called from the SolverUpdate function as a first step in simulation.
So I commented out the line that calls this very curious function, and the system runs, but starts to throw seg faults during simulation. I'm having trouble tracking down why this is exactly...I assume the code is meant to be able to be run with a time varying (or even just any non-zero) control signal input, and that this wasn't some sort of safe guard against that. Could you explain to me what's going on?
I'm really excited about being able to work with my models through this optimized C code! I think having a general straightforward bit of code to tack on to the end of these files that lets you do this would be a great thing to have.
If you'd like I can post the code I wrote to do this, but my first question is just in general about what that inpfn function is doing.