From: Claudia on
I'm working on a project which includes a matlab/simulink simulation and an user-interface in c#.
what i do is starting a matlab application from my c# gui, that works fine.
The simulation ends only if a given value is reached. so the endpoint is inf.

my problem is, if the user makes a mistake and the endvalue is not reachable I'm not able to stop the simulation... except of killing the process...
is there a way to stop the simulation, if it was started with the sim command?

I already had a look in the net for a solution and found out, that probably the set_param() command is better to use, because it allows to start and stop the simulation. but the strange thing about the set_param command is that the simulation ist not constantly running if I start it with this command.

if i start the simulation from the c# application and want to run the sequence every second it works fine with the sim-command but with the set_param command the simulation is slower. how is this possible? is there a thread-problem with the c# application?

if i start the matlab simulation in matlab and not from my c# application the timing is fine with the sim-command and set_param command.

I would be very thankful if anyone could help me. I already spent a lot of time on this problem.

regards
claudia
From: Saurabh Mahapatra on
Hi Claudia,

When you say:

"my problem is, if the user makes a mistake and the endvalue is not reachable I'm not able to stop the simulation"

Is there a way for you to determine this apriori:
1. User made a mistake
2. End value unreachable

If you are trying to use simulation to solve for reachability of a system, you may want to think again. Because you cannot prove that unless you run the simulation to Inf time i.e. infinite number of steps.

Please clarify.

Thanks,

Saurabh