-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Basic classes and Methods for simulation #1044
- Loading branch information
maur_pa
authored and
maur_pa
committed
Jan 7, 2022
1 parent
078a3a3
commit 21629f2
Showing
4 changed files
with
571 additions
and
0 deletions.
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
...c/de/dlr/sc/virsat/model/extension/statemachines/simulator/StateMachineSimulatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2008-2019 German Aerospace Center (DLR), Simulation and Software Technology, Germany. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package de.dlr.sc.virsat.model.extension.statemachines.simulator; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.Iterator; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.Stack; | ||
|
||
import de.dlr.sc.virsat.model.concept.list.IBeanList; | ||
import de.dlr.sc.virsat.model.extension.statemachines.model.AConstraint; | ||
import de.dlr.sc.virsat.model.extension.statemachines.model.StateMachine; | ||
import de.dlr.sc.virsat.model.extension.statemachines.model.Transition; | ||
import org.junit.Test; | ||
|
||
public class StateMachineSimulatorTest { | ||
|
||
/** | ||
* used to compute information for transition | ||
* | ||
* @param a: name of the given state machine | ||
* @param b: name of stateFrom | ||
* @param c: name of stateTo | ||
* @param d: name of gardStates | ||
*/ | ||
@Test | ||
private void updateMapTest() { | ||
} | ||
|
||
@Test | ||
private void compLocalEnabledTransTest() { | ||
} | ||
|
||
@Test | ||
private void getLocalEnabledTest() { | ||
|
||
} | ||
|
||
@Test | ||
private void getGlobalEnabledTransTest() { | ||
} | ||
|
||
@Test | ||
private void compConstraintsTest() { | ||
} | ||
|
||
@Test | ||
public void getGlobalInitialStateTest() { | ||
} | ||
|
||
@Test | ||
private void executeTranTest() { | ||
} | ||
|
||
@Test | ||
public void isDependentTest() { | ||
|
||
} | ||
|
||
@Test | ||
public void getNextTransitionsTest() { | ||
|
||
} | ||
|
||
@Test | ||
public void eqCheckTest() { | ||
} | ||
|
||
@Test | ||
public void containTest() { | ||
|
||
} | ||
|
||
@Test | ||
public void explorationTest() { | ||
|
||
} | ||
|
||
} | ||
|
62 changes: 62 additions & 0 deletions
62
...atemachines/src/de/dlr/sc/virsat/model/extension/statemachines/simulator/GlobalState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2008-2019 German Aerospace Center (DLR), Simulation and Software Technology, Germany. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package de.dlr.sc.virsat.model.extension.statemachines.simulator; | ||
|
||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.Map.Entry; | ||
|
||
|
||
public class GlobalState { | ||
|
||
HashMap<String, String> smStates = new HashMap<String, String>(); | ||
|
||
HashMap<String, Boolean> updated = new HashMap<String, Boolean>(); | ||
|
||
Set<Trans> globalEnabledTrans = new HashSet<Trans>(); | ||
|
||
GlobalState() { | ||
}; | ||
|
||
// the transition will be fired to get the next global state. | ||
Trans exeTran = new Trans(); | ||
// Set<String> backtrack = new HashSet<String>(); | ||
|
||
Set<Trans> backtrackingSet = new HashSet<Trans>(); | ||
/** | ||
* States | ||
* @return | ||
*/ | ||
protected Set<String> statesToString() { | ||
|
||
Set<String> strSet = new HashSet<String>(); | ||
|
||
for (Map.Entry<String, String> sm : smStates.entrySet()) { | ||
strSet.add(sm.getKey() + "." + sm.getValue()); | ||
} | ||
return strSet; | ||
} | ||
|
||
protected void setExecutedTran(Trans t) { | ||
this.exeTran.stateMachine = t.stateMachine; | ||
this.exeTran.startState = t.startState; | ||
this.exeTran.destinationState = t.destinationState; | ||
|
||
} | ||
|
||
void printState() { | ||
|
||
for (Entry<String, String> sm : smStates.entrySet()) { | ||
System.out.println(sm.getKey() + "--" + sm.getValue()); | ||
} | ||
} | ||
} |
Oops, something went wrong.