Skip to content

Commit

Permalink
Add Basic classes and Methods for simulation #1044
Browse files Browse the repository at this point in the history
  • Loading branch information
maur_pa authored and maur_pa committed Jan 7, 2022
1 parent 078a3a3 commit 21629f2
Show file tree
Hide file tree
Showing 4 changed files with 571 additions and 0 deletions.
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() {

}

}

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());
}
}
}
Loading

0 comments on commit 21629f2

Please sign in to comment.