diff --git a/AlgebraicDataflowArchitectureModel/src/simulator/Simulator.java b/AlgebraicDataflowArchitectureModel/src/simulator/Simulator.java index bb90111..6197b03 100644 --- a/AlgebraicDataflowArchitectureModel/src/simulator/Simulator.java +++ b/AlgebraicDataflowArchitectureModel/src/simulator/Simulator.java @@ -215,7 +215,7 @@ @Override public Expression getNextStateValueOf(ResourceIdentifier resId) { - if (nextSystemState.getResource(resId).getState() == null) return null; + if (nextSystemState.getResource(resId) == null) return null; return nextSystemState.getResource(resId).getState().getValue(); } }; @@ -237,6 +237,7 @@ for (ResourcePath inResPath: channel.getInputResources()) { if (inResId.isInstanceOf(inResPath)) { // Update the channel state and resource identifiers by the update of the input resource. + boolean isInputResourceDepended = false; for (ChannelMember dependedMem: invDependency.keySet()) { if (inResPath == dependedMem.getResource()) { // If some depending resources are to be updated by the update of an depended input resource. @@ -251,9 +252,16 @@ nextChState.addDependingParamAndValue(channelSelValues, paramEnt.getKey(), paramEnt.getValue()); } nextEvents.add(nextEvent); + isInputResourceDepended = true; } } - if (invDependency.size() == 0) { + boolean isInputResourceDepending = false; + for (ChannelMember dependingMem: dependency.keySet()) { + if (inResPath == dependingMem.getResource()) { + isInputResourceDepending = true; + } + } + if (!isInputResourceDepended && !isInputResourceDepending) { Event nextEvent = new Event(channel, inResPath, nextSystemState.getResource(inResId)); nextEvent.setMessage(nextEvent.updateDependingParameters(resourceStateValueProvider)); nextEvents.add(nextEvent);