\title{\Large\bf VDM-SL Specifications for a Simulation Tool - Version I\footnote
{This work is supported by grants from Natural Sciences and
Engineering Research Council, Canada and Concordia University Graduate
Fellowships.}}
\normalsize
\author{V. S. Alagar \and D. Muthiayen}
\date{Department of Computer Science\\ Concordia University\\
Montreal, Quebec H3G 1M8, Canada\\
Phone: +1 (514) 848-3022\\
\{alagar,d\_muthi\}@cs.concordia.ca\\~\\
February 1996}
(((type = <INTERNAL>) and (porttype.label = "NULLPORT")) or
((type = <INPUT>) and (porttype.label <> "NULLPORT")) or
((type = <OUTPUT>) and (porttype.label <> "NULLPORT")));
State :: label : String
type : StateType
isinitial : bool
substates : setofState
(forall e inset events &
(exists pt inset porttypes & (pt = e.porttype))) and
(exists1 s inset states &
(s.isinitial = true)) and
(exists1 s inset states &
((currentstate = s) or (substate_of(currentstate, s)))) and
(forall a inset attributes &
((exists1 pt inset porttypes & (pt.label = a.type)) or
(exists1 tr inset lsltraits & (tr.traittype = a.type)))) and
(forall tr inset lsltraits &
(forall el insetelems tr.elementtypes &
((exists1 pt inset porttypes & (pt.label = el)) or
(exists1 tr2 inset lsltraits & (tr2.traittype = el))))) and
(forall af inset attrfunctions &
((exists1 s inset states & ((s = af.stat) or
(substate_of(af.stat, s)))) and
(forall afa inset af.attributes &
(exists1 a inset attributes & (a = afa))))) and
(forall ts inset transitionspecs &
((exists1 s inset states & ((s = ts.sourcestate) or
(substate_of(ts.sourcestate, s)))) and
(exists1 d inset states & ((d = ts.destinstate) or
(substate_of(ts.destinstate, d)))) and
(exists1 e inset events & (e = ts.triggerevent)))) and
(forall tc inset timeconstraints &
((exists1 ts inset transitionspecs & (ts = tc.transition)) and
(exists1 e inset events &
((e = tc.constrainedevent) and
((e.type = <INTERNAL>) or (e.type = <OUTPUT>)))) and
(forall ds inset tc.disablingstates &
(exists1 s inset states & ((s = ds) or (substate_of(ds, s)))))));
linked_subsystem : TromPortTuple * setof Subsystem +> bool
linked_subsystem(tptuple, subsystems) ==
(exists1 s inset subsystems &
(((linked_trom(tptuple, s.troms)) and
(not linked_subsystem(tptuple, s.includes))) or
((not linked_trom(tptuple, s.troms)) and
(linked_subsystem(tptuple, s.includes)))) and
(forall s2 inset {su | su : Subsystem &
su inset subsystems and su <> s} &
((not linked_trom(tptuple, s2.troms)) and
(not linked_subsystem(tptuple, s2.includes))))) in
(forall pl inset portlinks &
((((linked_trom(pl.tromporttuple1, troms)) and
(not linked_subsystem(pl.tromporttuple1, includes))) or
((not linked_trom(pl.tromporttuple1, troms)) and
(linked_subsystem(pl.tromporttuple1, includes)))) and
(((linked_trom(pl.tromporttuple2, troms)) and
(not linked_subsystem(pl.tromporttuple2, includes))) or
((not linked_trom(pl.tromporttuple2, troms)) and
(linked_subsystem(pl.tromporttuple2, includes)))))))
(let contains_trom : Subsystem +> bool
contains_trom(subsys) ==
((subsys.troms <> { }) or
(exists1 s inset subsys.includes & (contains_trom(s)))) in
contains_trom(subsystem)) and
(let contains_portlink : Subsystem +> bool
contains_portlink(subsys) ==
((subsys.portlinks <> { }) or
(exists1 s inset subsys.includes & (contains_portlink(s)))) in
contains_portlink(subsystem)) and
(forall i, j insetinds simulationeventlist &
(((i = j) and (simulationeventlist(i) = simulationeventlist(j)))or
((i < j) and (simulationeventlist(i).occurtime <=
simulationeventlist(j).occurtime)) or
((i > j) and (simulationeventlist(i).occurtime >=
simulationeventlist(j).occurtime)))) and
(forall se1, se2 insetelems simulationeventlist &
(((se1.occurtime = se2.occurtime) and
(se1.tromlabel <> se2.tromlabel)) or
(se1.occurtime <> se2.occurtime))) and
(let accepted_by_trom : SimulationEvent * Subsystem +> bool
accepted_by_trom(se, subsys) ==
(exists1 trom inset subsys.troms &
((trom.label = se.tromlabel) and
(exists1 e inset trom.events &
((e.label = se.eventlabel) and
(exists1 pt inset trom.porttypes &
((pt = e.porttype) and
(exists1 p insetelems pt.portlist &
(p.label = se.portlabel)))))))) in
let accepted_by_subsystem : SimulationEvent * Subsystem +> bool
accepted_by_subsystem(se, subsys) ==
(exists1 s inset subsys.includes &
((((accepted_by_trom(se, s)) and
(not accepted_by_subsystem(se, s))) or
((not accepted_by_trom(se, s)) and
(accepted_by_subsystem(se, s)))) and
(forall s2 inset {su | su : Subsystem &
su inset subsys.includes and su <> s} &
((not accepted_by_trom(se, s2)) and
(not accepted_by_subsystem(se, s2)))))) in
(forall se insetelems simulationeventlist &
(((accepted_by_trom(se, subsystem)) and
(not accepted_by_subsystem(se, subsystem))) or
((not accepted_by_trom(se, subsystem)) and
(accepted_by_subsystem(se, subsystem)))))) and
(let event : [Event] = get_unconstrained_internal_event(trom) in
(((event <> nil) and
(let se : SimulationEvent best
se = mk_SimulationEvent
(event.label, trom.label, "NULLPORT", CLOCK, nil) in
((se insetelems SIMULATIONEVENTLIST) and
(let i : nat1best
SIMULATIONEVENTLIST(i) = se in
(forall se2 insetelems SIMULATIONEVENTLIST~ &
(let j : nat1best
SIMULATIONEVENTLIST(j) = se2 in
i < j)))))) or
(event = nil)))));
schedule_unconstrained_internal_event(trom : Trom, se : SimulationEvent)
extrd CLOCK : nat
wr SIMULATIONEVENTLIST : seqof SimulationEvent
pre
((se insetelems SIMULATIONEVENTLIST) and (se.tromlabel = trom.label))
post
(let event : [Event] = get_unconstrained_internal_event(trom) in
(((event <> nil) and
(let j : nat1best
j = get_simevent_index(se, SIMULATIONEVENTLIST) in
(let se2 : SimulationEvent best
se2 = mk_SimulationEvent
(event.label, trom.label, "NULLPORT", CLOCK, nil) in
(SIMULATIONEVENTLIST =
[SIMULATIONEVENTLIST~(i)
| i insetinds SIMULATIONEVENTLIST~ & i <= j] ^
[se2] ^
[SIMULATIONEVENTLIST~(i)
| i insetinds SIMULATIONEVENTLIST~ & i > j])))) or
(event = nil)));
initialize_simulation_clock()
extwr CLOCK : nat
post
CLOCK = 0;
update_simulation_clock()
extwr CLOCK : nat
post
CLOCK = CLOCK~ + 1
end TROM
\end{vdm_al}
\end{document}
¤ Dauer der Verarbeitung: 0.22 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.