Skip to content

Commit

Permalink
Fixed DAELow.VAR bug
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1368 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Dec 16, 2004
1 parent 2f17428 commit 6cf8648
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions modeq/taskgraph.rml
Expand Up @@ -48,7 +48,7 @@ relation build_taskgraph: (DAELow.DAELow, int vector, int vector, int list list
vector_list(varvec) => vars &
vector_list(knvarvec) => knvars &
add_variables(vars,starttask) &
add_variables([DAELow.VAR(Exp.CREF_IDENT("sim_time",[]),DAELow.VARIABLE,DAE.INPUT,DAE.REAL,NONE,NONE,[],NONE,0,"time")],starttask) &
add_variables([DAELow.VAR(Exp.CREF_IDENT("sim_time",[]),DAELow.VARIABLE,DAE.INPUT,DAE.REAL,NONE,NONE,[],NONE,0,"time",Absyn.IDENT("$noclass$"))],starttask) &
build_blocks(dae,ass1,ass2,blocks) &
build_inits(dae)
----------------------------------
Expand Down Expand Up @@ -84,73 +84,73 @@ relation build_inits2:(DAELow.Var list) => () =
build_inits2(rest)
--------------------
build_inits2(DAELow.VAR(_,DAELow.VARIABLE,_,_,_,_,
_,SOME(value),indx,origname)::rest)
_,SOME(value),indx,origname,_)::rest)

rule TaskGraphExt.add_initvar(indx,"0.0",origname) &
build_inits2(rest)
--------------------
build_inits2(DAELow.VAR(_,DAELow.VARIABLE,_,_,_,_,_,NONE,indx,origname)::rest)
build_inits2(DAELow.VAR(_,DAELow.VARIABLE,_,_,_,_,_,NONE,indx,origname,_)::rest)

rule Exp.print_exp_str(value) => v &
TaskGraphExt.add_initstate(indx,v,origname) &
build_inits2(rest)
--------------------
build_inits2(DAELow.VAR(_,DAELow.STATE,_,_,_,_,_,SOME(value),indx,origname)::rest)
build_inits2(DAELow.VAR(_,DAELow.STATE,_,_,_,_,_,SOME(value),indx,origname,_)::rest)

rule TaskGraphExt.add_initstate(indx,"0.0",origname) &
build_inits2(rest)
--------------------
build_inits2(DAELow.VAR(_,DAELow.STATE,_,_,_,_,_,NONE,indx,origname)::rest)
build_inits2(DAELow.VAR(_,DAELow.STATE,_,_,_,_,_,NONE,indx,origname,_)::rest)

rule Exp.print_exp_str(value) => v &
TaskGraphExt.add_initvar(indx,v,origname) &
build_inits2(rest)
--------------------
build_inits2(DAELow.VAR(_,DAELow.DUMMY_DER,_,_,_,_,_,SOME(value),indx,origname)::rest)
build_inits2(DAELow.VAR(_,DAELow.DUMMY_DER,_,_,_,_,_,SOME(value),indx,origname,_)::rest)

rule TaskGraphExt.add_initvar(indx,"0.0",origname) &
build_inits2(rest)
--------------------
build_inits2(DAELow.VAR(_,DAELow.DUMMY_DER,_,_,_,_,_,NONE,indx,origname)::rest)
build_inits2(DAELow.VAR(_,DAELow.DUMMY_DER,_,_,_,_,_,NONE,indx,origname,_)::rest)

rule Exp.print_exp_str(value) => v &
TaskGraphExt.add_initvar(indx,v,origname) &
build_inits2(rest)
--------------------
build_inits2(DAELow.VAR(_,DAELow.DUMMY_STATE,_,_,_,_,
_,SOME(value),indx,origname)::rest)
_,SOME(value),indx,origname,_)::rest)

rule TaskGraphExt.add_initvar(indx,"0.0",origname) &
build_inits2(rest)
--------------------
build_inits2(DAELow.VAR(_,DAELow.DUMMY_STATE,_,_,_,_,_,
NONE,indx,origname)::rest)
NONE,indx,origname,_)::rest)

rule Values.val_string(value) => v &
TaskGraphExt.add_initparam(indx,v,origname) &
build_inits2(rest)
--------------------
build_inits2(DAELow.VAR(_,DAELow.PARAM,_,_,_,SOME(value),_,
_,indx,origname)::rest)
_,indx,origname,_)::rest)

rule TaskGraphExt.add_initparam(indx,"0.0",origname) &
build_inits2(rest)
--------------------
build_inits2(DAELow.VAR(_,DAELow.PARAM,_,_,_,NONE,_,
_,indx,origname)::rest)
_,indx,origname,_)::rest)

rule Values.val_string(value) => v &
TaskGraphExt.add_initparam(indx,v,origname) &
build_inits2(rest)
--------------------
build_inits2(DAELow.VAR(_,DAELow.CONST,_,_,_,SOME(value),_,
_,indx,origname)::rest)
_,indx,origname,_)::rest)

rule TaskGraphExt.add_initparam(indx,"0.0",origname) &
build_inits2(rest)
--------------------
build_inits2(DAELow.VAR(_,DAELow.CONST,_,_,_,NONE,_,
_,indx,origname)::rest)
_,indx,origname,_)::rest)
end

relation add_variables:(DAELow.Var list,int) => () =
Expand Down Expand Up @@ -200,7 +200,7 @@ relation build_equation:(DAELow.DAELow, int vector, int vector, int) => () =
vector_nth(ass2,e') => v &
(* v == variable no solved in this equation *)
int_sub(v,1) => v' &
vector_nth(varvec,v') => (v as DAELow.VAR(cr,kind,_,_,_,_,_,_,_,origname)) &
vector_nth(varvec,v') => (v as DAELow.VAR(cr,kind,_,_,_,_,_,_,_,origname,_)) &
is_non_state kind &
(*print "Solving for non-states\n" &*)
let varexp = Exp.CREF(cr,Exp.REAL) &
Expand All @@ -222,7 +222,7 @@ relation build_equation:(DAELow.DAELow, int vector, int vector, int) => () =
vector_nth(ass2,e') => v &
(* v == variable no solved in this equation *)
int_sub(v,1) => v' &
vector_nth(varvec,v') => DAELow.VAR(cr,DAELow.STATE,_,_,_,_,_,_,indx,origname) &
vector_nth(varvec,v') => DAELow.VAR(cr,DAELow.STATE,_,_,_,_,_,_,indx,origname,_) &
(* print "solving for state\n" &*)
int_string(indx) => indxs &
Util.string_append_list(["xd[",indxs,"]"]) => id &
Expand All @@ -243,7 +243,7 @@ relation build_equation:(DAELow.DAELow, int vector, int vector, int) => () =
list_nth(eqns,e') => DAELow.EQUATION(e1,e2) &
vector_nth(ass2,e') => v & (* v==variable no solved in this equation *)
int_sub(v,1) => v' &
vector_nth(varvec,v') => DAELow.VAR(cr,_,_,_,_,_,_,_,_,origname) &
vector_nth(varvec,v') => DAELow.VAR(cr,_,_,_,_,_,_,_,_,origname,_) &
let varexp = Exp.CREF(cr,Exp.REAL) &
not Exp.solve(e1,e2,varexp) => _ &
print "nonlinear equation not implemented yet\n"
Expand Down Expand Up @@ -280,7 +280,7 @@ relation build_system2: (DAELow.DAELow, int vector, int vector, int list,int) =>
vector_nth(ass2,e') => v &
(* v == variable no solved in this equation *)
int_sub(v,1) => v' &
vector_nth(varvec,v') => (v as DAELow.VAR(cr,DAELow.VARIABLE,_,_,_,_,_,_,_,origname)) &
vector_nth(varvec,v') => (v as DAELow.VAR(cr,DAELow.VARIABLE,_,_,_,_,_,_,_,origname,_)) &
Exp.get_cref_from_exp(e1) => cr1 &
Exp.get_cref_from_exp(e2) => cr2 &
list_append(cr1,cr2) => crs &
Expand All @@ -304,7 +304,7 @@ relation add_variable: (DAELow.Var,int) => () =
(*print "adding variable " & print cfs & print "\n" &*)
TaskGraphExt.store_result(cfs,start,false,name)
------------------------------------
add_variable(DAELow.VAR(cf,_,_,_,_, _,_,_,_,name),start)
add_variable(DAELow.VAR(cf,_,_,_,_, _,_,_,_,name,_),start)
end


Expand Down

0 comments on commit 6cf8648

Please sign in to comment.