示例#1
0
def setup():
    """ 
    Setup test module. Compile test model (only needs to be done once) and 
    set log level. 
    """
    oc = OptimicaCompiler()
    oc.set_boolean_option('state_start_values_fixed', True)
    OptimicaCompiler.set_log_level(OptimicaCompiler.LOG_ERROR)
    oc.compile_model(fpath, cpath, target='ipopt')
示例#2
0
import sys
import nose

from jmodelica.tests import testattr

from jmodelica.compiler import OptimicaCompiler
import jmodelica as jm

jm_home = jm.environ['JMODELICA_HOME']
path_to_examples = os.path.join('Python', 'jmodelica', 'examples')

model = os.path.join('files', 'Pendulum_pack.mo')
fpath = os.path.join(jm_home, path_to_examples, model)
cpath = "Pendulum_pack.Pendulum_Opt"

OptimicaCompiler.set_log_level(OptimicaCompiler.LOG_ERROR)
oc = OptimicaCompiler()
oc.set_boolean_option('state_start_values_fixed', True)


@testattr(stddist=True)
def test_optimica_compile():
    """
    Test that compilation is possible with optimicacompiler
    and that all obligatory files are created. 
    """

    # detect platform specific shared library file extension
    suffix = ''
    if sys.platform == 'win32':
        suffix = '.dll'
示例#3
0
def setup():
    """ 
    Setup test module. Compile test model (only needs to be done once) and 
    set log level. 
    """
    OptimicaCompiler.set_log_level(OptimicaCompiler.LOG_ERROR)