Skip to content

Commit

Permalink
Added information for predefined types. Some implementation to extrac…
Browse files Browse the repository at this point in the history
…t the data from modification has been made but not called yet from a significant part of the program. (read it is not called at all from the main stream of the program!)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1534 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
x02lucpo committed Feb 23, 2005
1 parent 6c90aad commit 6095deb
Show file tree
Hide file tree
Showing 4 changed files with 313 additions and 81 deletions.
97 changes: 97 additions & 0 deletions modeq/dae.rml
Expand Up @@ -70,6 +70,8 @@ module DAE:
unconnected flow variables *)
Absyn.Path list (* The class the variable is instantiated from *)



| DEFINE of Exp.ComponentRef * Exp.Exp
| INITIALDEFINE of Exp.ComponentRef * Exp.Exp
| EQUATION of Exp.Exp * Exp.Exp
Expand All @@ -87,6 +89,28 @@ module DAE:
| EXTFUNCTION of Absyn.Path * DAElist * Types.Type * ExternalDecl
| ASSERT of Exp.Exp

datatype VariableAttributes = VAR_ATTR_REAL of string * (* quantity *)
string *(* unit *)
string *(* displayUnit *)
(real * real) * (* min , max *)
real * (* Initial value *)
bool * (* fixed - true: default for parameter/constant, false - default for other variables *)
real * (* nominal *)
StateSelect
| VAR_ATTR_INT of string * (* quantity *)
(int * int) * (* min , max *)
int * (* Initial value *)
bool (* fixed - true: default for parameter/constant, false - default for other variables *)
| VAR_ATTR_BOOL of string * (* quantity *)
bool * (* Initial value *)
bool (* fixed - true: default for parameter/constant, false - default for other variables *)
| VAR_ATTR_STRING of string * (* quantity *)
string (* Initial value *)



datatype StateSelect = NEVER | AVOID | DEFAULT | PREFER | ALWAYS

datatype ExtArg = EXTARG of Exp.ComponentRef * Types.Attributes * Types.Type
| EXTARGEXP of Exp.Exp * Types.Type
| EXTARGSIZE of Exp.ComponentRef * Types.Attributes * Types.Type * Exp.Exp
Expand Down Expand Up @@ -123,6 +147,8 @@ module DAE:
relation dump_algorithm: Element => ()
relation dump_algorithm_str : Element => string
relation dump_direction_str: VarDirection => string
relation dump_variable_attributes: VariableAttributes => ()
relation dump_variable_attributes_str: VariableAttributes => string
relation get_matching_elements: (Element list, Element => () ) => Element list
relation get_matching: ('a list, 'a => () ) => 'a list
relation get_output_vars: Element list => Element list
Expand Down Expand Up @@ -673,6 +699,77 @@ relation dump_direction_str: VarDirection => string =

end

relation dump_stateSelect_str: StateSelect => string =

axiom dump_stateSelect_str(NEVER) => "NEVER"
axiom dump_stateSelect_str(AVOID) => "AVOID"
axiom dump_stateSelect_str(PREFER) => "PREFER"
axiom dump_stateSelect_str(ALWAYS) => "ALWAYS"
axiom dump_stateSelect_str(DEFAULT) => "DEFAULT"

end

relation dump_variable_attributes: VariableAttributes => () =

rule dump_variable_attributes_str(attr) => res &
print res
--------------------------------
dump_variable_attributes(attr)




end

relation dump_variable_attributes_str: VariableAttributes => string =

rule Dump.print_bool_str(fixed) => fixed_str &
dump_stateSelect_str(stateSel) => stateSel_str &
real_string(min) => min_str &
real_string(max) => max_str &
real_string(Initial) => Initial_str &

Util.string_append_list([" quantity: ",quantity,
" unit: ", unit,
" displayUnit: ", displayUnit,
" min: ", min_str,
" max: ", max_str,
" Initial: ", Initial_str,
" fixed: ", fixed_str,
" stateSel: ", stateSel_str]) => res
--------------------------------
dump_variable_attributes_str(VAR_ATTR_REAL(quantity,unit,displayUnit, (min , max),Initial,fixed,nominal,stateSel)) => res

rule Dump.print_bool_str(fixed) => fixed_str &
int_string(min) => min_str &
int_string(max) => max_str &
int_string(Initial) => Initial_str &
Util.string_append_list([" quantity: ",quantity,
" min: ", min_str,
" max: ", max_str,
" Initial: ", Initial_str,
" fixed: ", fixed_str]) => res
-----------------------------------------
dump_variable_attributes_str(VAR_ATTR_INT(quantity, (min , max),Initial,fixed)) => res

rule Dump.print_bool_str(fixed) => fixed_str &
Dump.print_bool_str(Initial) => Initial_str &
Util.string_append_list([" quantity: ",quantity,
" Initial: ", Initial_str,
" fixed: ", fixed_str]) => res
-----------------------------------------
dump_variable_attributes_str(VAR_ATTR_BOOL(quantity,Initial,fixed)) => res

rule Util.string_append_list([" quantity: ",quantity,
" Initial: ", Initial]) => res
-----------------------------------------
dump_variable_attributes_str(VAR_ATTR_STRING(quantity,Initial)) => res

axiom dump_variable_attributes_str(VAR_ATTR_STRING(quantity,Initial)) => "unknown VariableAttributes"

end


relation dump_type =

rule Print.print_buf "Integer "
Expand Down
51 changes: 31 additions & 20 deletions modeq/daelow.rml
@@ -1,23 +1,23 @@
(*
Copyright PELAB, Linkoping University

This file is part of Open Source Modelica (OSM).

OSM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Copyright PELAB, Linkoping University
This file is part of Open Source Modelica (OSM).
OSM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

OSM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenModelica; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

*)
(at your option) any later version.
OSM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenModelica; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*)

(**
** file: daelow.rml
Expand All @@ -40,8 +40,8 @@
** dummy derivatives for solving higher index problems.
** It also includes the tarjan algorithm to detect strong components
** in the BLT sorting.
**)
module DAELow:
**)
module DAELow:

with "dae.rml"
with "exp.rml"
Expand All @@ -64,6 +64,17 @@ module DAELow:
string *(* original variable name *)
Absyn.Path list (* classname variable belongs to *)

datatype VariableAttributes = VAR_ATTR of string * (* quantity *)
string *(* unit *)
string *(* displayUnit *)
(real * real) * (* min , max *)
real * (* Initial value *)
bool * (* fixed - true: default for parameter/constant, false - default for other variables *)
real * (* nominal *)
StateSelect

datatype StateSelect = NEVER | AVOID | DEFAULT | PREFER | ALWAYS


datatype Equation = EQUATION of Exp.Exp * Exp.Exp
| SOLVED_EQUATION of Exp.ComponentRef * Exp.Exp
Expand Down
1 change: 1 addition & 0 deletions modeq/dump.rml
Expand Up @@ -73,6 +73,7 @@ module Dump:
relation print_import : Absyn.Import => ()
relation op_symbol : Absyn.Operator => string
relation print_bool : bool => ()
relation print_bool_str : bool => string
relation print_select: (bool,string,string) => ()
relation print_option : (('a option),('a => ())) => ()
relation select_string: (bool,string,string) => string
Expand Down

0 comments on commit 6095deb

Please sign in to comment.