Skip to content

Commit

Permalink
- see r17086
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17093 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Vitalij Ruge committed Sep 6, 2013
1 parent 5b9b40e commit b5c1e52
Show file tree
Hide file tree
Showing 18 changed files with 2,403 additions and 14 deletions.
23 changes: 21 additions & 2 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -4813,12 +4813,24 @@ algorithm
e = DAE.BINARY(inExp1, DAE.MUL(DAE.T_REAL_DEFAULT), DAE.CALL(Absyn.IDENT("cos"),{inExp2},DAE.callAttrBuiltinReal));
(e,_) = ExpressionSimplify.simplify(e);
then e;
//sinh(x)
case (_,_,DAE.CALL(path=Absyn.IDENT("sinh")))
equation
e = DAE.BINARY(inExp1, DAE.MUL(DAE.T_REAL_DEFAULT), DAE.CALL(Absyn.IDENT("cosh"),{inExp2},DAE.callAttrBuiltinReal));
(e,_) = ExpressionSimplify.simplify(e);
then e;
// cos(x)
case (_,_,DAE.CALL(path=Absyn.IDENT("cos")))
equation
e = DAE.UNARY(DAE.UMINUS(DAE.T_REAL_DEFAULT), DAE.BINARY(inExp1,DAE.MUL(DAE.T_REAL_DEFAULT), DAE.CALL(Absyn.IDENT("sin"),{inExp2},DAE.callAttrBuiltinReal)));
(e,_) = ExpressionSimplify.simplify(e);
then e;
//cosh(x)
case (_,_,DAE.CALL(path=Absyn.IDENT("cosh")))
equation
e = DAE.BINARY(inExp1, DAE.MUL(DAE.T_REAL_DEFAULT), DAE.CALL(Absyn.IDENT("sinh"),{inExp2},DAE.callAttrBuiltinReal));
(e,_) = ExpressionSimplify.simplify(e);
then e;
// ln(x)
case (_,_,DAE.CALL(path=Absyn.IDENT("log")))
equation
Expand Down Expand Up @@ -4849,10 +4861,17 @@ algorithm
// abs(x)
case (_,_,DAE.CALL(path=Absyn.IDENT("abs")))
equation
e = DAE.IFEXP(DAE.RELATION(inExp2,DAE.GREATEREQ(DAE.T_REAL_DEFAULT),DAE.RCONST(0.0),-1,NONE()), inExp1, DAE.UNARY(DAE.UMINUS(DAE.T_REAL_DEFAULT),inExp1));
e = DAE.BINARY(DAE.CALL(Absyn.IDENT("sign"),{inExp2},DAE.callAttrBuiltinReal),DAE.MUL(DAE.T_REAL_DEFAULT),inExp1);
(e,_) = ExpressionSimplify.simplify(e);
then e;

// sign(x)
case (_,_,DAE.CALL(path=Absyn.IDENT("sign")))
then DAE.RCONST(0.0);
// noEvent(x)
case (_,_,DAE.CALL(path=Absyn.IDENT("noEvent")))
equation
(e,_) = ExpressionSimplify.simplify(inExp1);
then e;
// openmodelica build call $_start(x)
case (_,_,DAE.CALL(path=Absyn.IDENT("$_start")))
equation
Expand Down
2 changes: 1 addition & 1 deletion Compiler/FrontEnd/ExpressionSimplify.mo
Expand Up @@ -4000,7 +4000,7 @@ algorithm
case(DAE.MUL(ty),DAE.CALL(path=Absyn.IDENT("exp"),expLst={e1}),DAE.CALL(path=Absyn.IDENT("exp"),expLst={e2}))
equation
false = Expression.isConst(e1) or Expression.isConst(e2);
e = DAE.BINARY(e1, DAE.ADD(ty),e1);
e = DAE.BINARY(e1, DAE.ADD(ty),e2);
res = Expression.makeBuiltinCall("exp",{e},ty);
then
res;
Expand Down
6 changes: 4 additions & 2 deletions SimulationRuntime/c/Makefile.common
Expand Up @@ -63,8 +63,10 @@ RUNTIME_HEADERS = $(LIBF2CHEADER) \
./linearization/linearize.h \
./simulation/solver/perform_simulation.c \
./simulation/solver/omp_perform_simulation.c \
./optimization/interfaceOptimization.h \
./simulation/solver/dassl.h


RUNTIME_HEADERS_FMU = \
./simulation/solver/initialization/initialization.h \
./simulation/solver/initialization/initialization_data.h \
Expand Down Expand Up @@ -122,8 +124,8 @@ $(UTILOBJSPATH):%.o: %.c $(UTILHFILESPATH) $(COMMON_HEADERS)
$(MATHOBJSPATH):%.o: %.c $(MATHHFILESPATH) $(COMMON_HEADERS)
$(CC) -c $(CFLAGS) $(FPMATHFORTRAN) -o $@ $< -I$(MATHPATH) -I$(UTILPATH)

$(SOLVEROBJSPATH):%.o: %.c $(SOLVERHFILESPATH) $(RESULTSHFILESPATH) $(INITIALIZATIONHFILESPATH) $(COMMON_HEADERS)
$(CC) -c $(CFLAGS) -o $@ $< -I$(SOLVERPATH) -I$(INITIALIZATIONPATH) -I$(RESULTSPATH) -I$(SIMPATH) -I$(MATHPATH) -I$(UTILPATH)
$(SOLVEROBJSPATH):%.o: %.c $(SOLVERHFILESPATH) $(RESULTSHFILESPATH) $(INITIALIZATIONHFILESPATH) $(OPTIMIZATIONHFILESPATH) $(COMMON_HEADERS)
$(CC) -c $(CFLAGS) -o $@ $< -I$(SOLVERPATH) -I$(INITIALIZATIONPATH) -I$(OPTIMIZATIONPATH) -I$(RESULTSPATH) -I$(SIMPATH) -I$(MATHPATH) -I$(UTILPATH)

$(INITIALIZATIONOBJSPATH):%.o: %.c $(SOLVERHFILESPATH) $(INITIALIZATIONHFILESPATH) $(COMMON_HEADERS)
$(CC) -c $(CFLAGS) -o $@ $< -I$(SOLVERPATH) -I$(INITIALIZATIONPATH) -I$(SIMPATH) -I$(MATHPATH) -I$(UTILPATH)
Expand Down
47 changes: 47 additions & 0 deletions SimulationRuntime/c/optimization/OptimizationFlags.h
@@ -0,0 +1,47 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-CurrentYear, Linköping University,
* Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL).
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S
* ACCEPTANCE OF THE OSMC PUBLIC LICENSE.
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linköping University, either from the above address,
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or
* http://www.openmodelica.org, and in the OpenModelica distribution.
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
*
* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS
* OF OSMC-PL.
*
* See the full OSMC Public License conditions for more details.
*
*/

/*
* Developed by:
* FH-Bielefeld
* Developer: Vitalij Ruge
* Contact: vitalij.ruge@fh-bielefeld.de
*/

#ifndef OPTIMIZATIONFLAGS_H_
#define OPTIMIZATIONFLAGS_H_


#define DF_STEP(x,s) ( (fmin(fmax(1e-4*fabs(s*x),1e-7),1e3)))



#endif /* OPTIMIZATIONFLAGS_H_ */

0 comments on commit b5c1e52

Please sign in to comment.