Tips

Distributing your models on a USB Stick
Debugging an MyM simulation model

The m2c compiler offers several options for run-time error messages. If your model crashes you can use several options to discover where model calculations result in errors. On the other hand it might be a good idea to check for run-time errors even if your models seems to run smoothly. By running m2c on the commandline with the option -h all options are listed:


>m2c -h
Usage      : m2c.exe [options] file.m
Description: Converts a modelfile (.m) into a C source file (.c)
Options:

   -o name	: write C source to file name
   -e name write errors to file name
   -s name : use name as scratch-file
   -array : check run-time on array bound overflow
   -ARRAY : check run-time on array bound overflow and use of array elements
   -woff list : do not show warnings in list
   -c 		: put comments in C source
   -Dname       : define name (as 1) for preprocessor
   -Dname=def    : define name as def for preprocessor
   -fltcheck     : check run-time on (some) floating point operations
   -fullwarn     : equivalent to -ARRAY and -fltcheck
   -eps value  : set the epsilon for -fltcheck test to eps
                   default value:   1e-10
   -trace        : print trace information at run-time
   -rte name     : filename for run-time error output (default rterror.txt)
   -h            : print this info


E.g. if you want to check for all potential run-time errors use


>m2c -fullwarn file.m

If you create models using the right menu in the explorer or use the command-line program mmake you can set these options by setting the environment variable M2CFLAGS. Here's how on the command line for the example above:


>set M2CFLAGS=-fullwarn
>mmake file.mdl

Note that if your model is free from run-time errors you would probably want to recompile it without the run-time checks because it slows down simulation.

Last updated: 2010-02-16

Choosing colors for your views

© Copyright 1998 - 2024 Tizio BV

onderrand
logo My-M
a visual simulation tool
zoekknop