Commit ba63b18d authored by SOLIMAN Sylvain's avatar SOLIMAN Sylvain

Removed apparently useless fake initial state for reaction export to NuSMV

might be useful to do the same cleanup for influences?
parent e5618dfd
......@@ -20,10 +20,6 @@ export_nusmv(OutputFile) :-
).
no_false_initial_state :-
fail.
export_nusmv_stream(Stream) :-
(
is_reaction_model
......@@ -37,7 +33,7 @@ export_nusmv_stream(Stream) :-
export_nusmv_stream_reactions(Stream) :-
write(Stream, 'MODULE main\n'),
write(Stream, 'MODULE main\n\n'),
findall(
(Reactants, Products),
(
......@@ -54,15 +50,16 @@ export_nusmv_stream_reactions(Stream) :-
export_initial_state_reactions(Stream, Molecules, ReactionCount) :-
write(Stream, 'VAR\n'),
(
no_false_initial_state
ReactionCount < 2
->
FirstState = 1
NextStates = '1'
;
FirstState = 0
format(atom(NextStates), '1..~d', [ReactionCount])
),
format(Stream, 'R: ~d..~d;\n', [FirstState, ReactionCount]),
format(Stream, 'DEFINE allreactions := ~a;\n\n', [NextStates]),
write(Stream, 'VAR\n'),
write(Stream, 'R: allreactions;\n'),
\+ (
member(Molecule, Molecules),
\+ (
......@@ -70,18 +67,11 @@ export_initial_state_reactions(Stream, Molecules, ReactionCount) :-
format(Stream, '~a: boolean;\n', [Name])
)
),
(
ReactionCount < 2
->
NextStates = '1'
;
format(atom(NextStates), '1..~d', [ReactionCount])
),
format(Stream, '\c
write(Stream, '\n\c
ASSIGN
init(R) := ~d;
next(R) := ~a;
', [FirstState, NextStates]).
init(R) := allreactions;
next(R) := allreactions;\n
').
export_reactions(Stream, Molecules, Reactions) :-
......@@ -98,10 +88,9 @@ export_molecule_reactions(Stream, Molecule, Reactions) :-
get_initial_state(Molecule, InitialState),
nusmv_initial_state(InitialState, NusmvInitialState),
format(Stream, '\c
init(~a) := FALSE;
init(~a) := ~a;
next(~a) := case
R = 0: ~a;
', [Name, Name, NusmvInitialState]),
', [Name, NusmvInitialState, Name]),
\+ (
nth1(ReactionIndex, Reactions, (Reactants, Products)),
\+ (
......@@ -138,11 +127,10 @@ next(~a) := case
),
format(Stream, ' \c
TRUE: ~a;
esac;
esac;\n
', [Name]).
%-----------------------new----------------------
export_nusmv_stream_influences(Stream) :-
write(Stream, 'MODULE main\n'),
findall(
......@@ -160,13 +148,7 @@ export_nusmv_stream_influences(Stream) :-
export_initial_state_influences(Stream, Molecules, InfluenceCount) :-
write(Stream, 'VAR\n'),
(
no_false_initial_state
->
FirstState = 1
;
FirstState = 0
),
FirstState = 0,
format(Stream, 'I: ~d..~d;\n', [FirstState, InfluenceCount]),
\+ (
member(Molecule, Molecules),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment