Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Information logger #166

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e1104a0
Initial fix and exploration
t-lohse Apr 27, 2023
511db7e
Merge branch 'Ecdar-SW5/main' of github.com:Ecdar/Reveaal into memory…
t-lohse May 6, 2023
8622a2d
Finalized fix
t-lohse May 6, 2023
75aa8c1
Merge branch 'main' of github.com:Ecdar/Reveaal into memory-hogging-fix
t-lohse May 18, 2023
9824297
Minor optimizations
t-lohse May 18, 2023
a730b85
Invariant update
t-lohse May 18, 2023
2621e4f
Removed and refactored some unused and unnecessary functions
t-lohse May 18, 2023
373bee0
Removed additional
t-lohse May 18, 2023
72834a6
Initial impl
t-lohse May 18, 2023
4ae4686
added server check
t-lohse May 18, 2023
f79038c
added server check and impl Display
t-lohse May 18, 2023
acebea0
added server check and impl Display
t-lohse May 18, 2023
95fda46
Fixed test error
t-lohse May 18, 2023
511e371
Updated and added test
t-lohse May 22, 2023
b374069
refactor of module
t-lohse May 22, 2023
37c8f12
Added into
t-lohse May 22, 2023
225a060
Removed commented code
t-lohse May 22, 2023
a611bca
Changed to use lazy_static
t-lohse May 22, 2023
a7a7cd8
Changed to use lazy_static
t-lohse May 22, 2023
9efa8d6
Merge branch 'main' into memory-hogging-fix
t-lohse May 22, 2023
71fe7ed
merge main
t-lohse May 22, 2023
06d46c0
Merge branch 'component-unused-functions' of github.com:Ecdar/Reveaal…
t-lohse May 22, 2023
7b88911
refactored removal of invariants
t-lohse May 25, 2023
f5d1eb6
Added macro tests
t-lohse May 26, 2023
2c648ff
Merged main
t-lohse May 30, 2023
56dff37
Merged main
t-lohse May 30, 2023
ec39f1c
Merged main
t-lohse May 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "Ecdar-ProtoBuf"]
path = Ecdar-ProtoBuf
url = https://github.com/Ecdar/Ecdar-ProtoBuf.git
branch = futureproof2
branch = futureproof1
2 changes: 1 addition & 1 deletion Ecdar-ProtoBuf
Submodule Ecdar-ProtoBuf updated 1 files
+2 −2 query.proto
2 changes: 1 addition & 1 deletion samples/xml/ConsTests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ IO G21 { i?, o! }
IO G22 { o! }
IO G23 { o! }
IO G24 { i?, o! }
IO G25 { i?, o! }</system></nta>
IO G25 { i?, o! }</system></nta>
18 changes: 9 additions & 9 deletions src/DataReader/component_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub struct ComponentContainer {
impl ComponentLoader for ComponentContainer {
fn get_component(&mut self, component_name: &str) -> &Component {
if let Some(component) = self.loaded_components.get(component_name) {
assert_eq!(component_name, component.get_name());
assert_eq!(component_name, component.name);
component
} else {
panic!("The component '{}' could not be retrieved", component_name);
Expand Down Expand Up @@ -161,10 +161,10 @@ impl ComponentContainer {
pub fn from_components(components: Vec<Component>) -> ComponentContainer {
let mut comp_hashmap = HashMap::<String, Component>::new();
for mut component in components {
log::trace!("Adding comp {} to container", component.get_name());
log::trace!("Adding comp {} to container", component.name);
let inputs: Vec<_> = component.get_input_actions();
input_enabler::make_input_enabled(&mut component, &inputs);
comp_hashmap.insert(component.get_name().to_string(), component);
comp_hashmap.insert(component.name.to_string(), component);
}
ComponentContainer::new(Arc::new(comp_hashmap))
}
Expand Down Expand Up @@ -224,7 +224,7 @@ impl ComponentLoader for JsonProjectLoader {
}

if let Some(component) = self.loaded_components.get(component_name) {
assert_eq!(component_name, component.get_name());
assert_eq!(component_name, component.name);
component
} else {
panic!("The component '{}' could not be retrieved", component_name);
Expand All @@ -234,7 +234,7 @@ impl ComponentLoader for JsonProjectLoader {
fn save_component(&mut self, component: Component) {
component_to_json_file(&self.project_path, &component);
self.loaded_components
.insert(component.get_name().clone(), component);
.insert(component.name.clone(), component);
}

fn get_settings(&self) -> &Settings {
Expand Down Expand Up @@ -279,7 +279,7 @@ impl JsonProjectLoader {

let opt_inputs = self
.get_declarations()
.get_component_inputs(component.get_name());
.get_component_inputs(&component.name);
if let Some(inputs) = opt_inputs {
input_enabler::make_input_enabled(&mut component, inputs);
}
Expand All @@ -304,7 +304,7 @@ pub struct XmlProjectLoader {
impl ComponentLoader for XmlProjectLoader {
fn get_component(&mut self, component_name: &str) -> &Component {
if let Some(component) = self.loaded_components.get(component_name) {
assert_eq!(component_name, component.get_name());
assert_eq!(component_name, component.name);
component
} else {
panic!("The component '{}' could not be retrieved", component_name);
Expand Down Expand Up @@ -344,12 +344,12 @@ impl XmlProjectLoader {

let mut map = HashMap::<String, Component>::new();
for mut component in comps {
let opt_inputs = system_declarations.get_component_inputs(component.get_name());
let opt_inputs = system_declarations.get_component_inputs(&component.name);
if let Some(opt_inputs) = opt_inputs {
input_enabler::make_input_enabled(&mut component, opt_inputs);
}

let name = String::from(component.get_name());
let name = String::from(&component.name);
map.insert(name, component);
}

Expand Down
2 changes: 1 addition & 1 deletion src/DataReader/json_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub fn component_to_json_file(project_path: &str, component: &Component) {
"{0}{1}Components{1}{2}.json",
project_path,
std::path::MAIN_SEPARATOR,
component.get_name()
component.name
);
let file = File::create(path).expect("Couldnt open file");

Expand Down
3 changes: 1 addition & 2 deletions src/DataReader/proto_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ mod tests {
"Zones are not equal"
);
assert_eq!(
*state1.get_location(),
*state2.get_location(),
state1.decorated_locations, state2.decorated_locations,
"Location trees are not equal"
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/EdgeEval/constraint_applyer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ fn replace_vars(expr: &ArithExpression, decls: &Declarations) -> Result<ArithExp
)),
ArithExpression::Clock(x) => Ok(ArithExpression::Clock(*x)),
ArithExpression::VarName(name) => {
if let Some(x) = decls.get_clocks().get(name.as_str()).copied() {
if let Some(x) = decls.clocks.get(name.as_str()).copied() {
Ok(ArithExpression::Clock(x))
} else if let Some(x) = decls.get_ints().get(name.as_str()).copied() {
} else if let Some(x) = decls.ints.get(name.as_str()).copied() {
Ok(ArithExpression::Int(x))
} else {
Err(name.to_string())
Expand All @@ -171,7 +171,7 @@ fn get_const(expr: &ArithExpression, decls: &Declarations) -> i32 {
match expr {
ArithExpression::Int(x) => *x,
ArithExpression::Clock(_) => 0,
ArithExpression::VarName(name) => decls.get_ints().get(name).copied().unwrap_or(0),
ArithExpression::VarName(name) => decls.ints.get(name).copied().unwrap_or(0),
ArithExpression::Difference(l, r) => get_const(l, decls) - get_const(r, decls),
ArithExpression::Addition(l, r) => get_const(l, decls) + get_const(r, decls),
ArithExpression::Multiplication(l, r) => get_const(l, decls) * get_const(r, decls),
Expand Down
13 changes: 4 additions & 9 deletions src/ModelObjects/Expressions/arith_expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,20 +392,15 @@ impl ArithExpression {
}

/// Finds the clock names used in the expression
pub fn get_varnames(&self) -> Vec<&str> {
pub fn has_varname(&self, name: &String) -> bool {
match self {
ArithExpression::Difference(a1, a2)
| ArithExpression::Addition(a1, a2)
| ArithExpression::Multiplication(a1, a2)
| ArithExpression::Division(a1, a2)
| ArithExpression::Modulo(a1, a2) => a1
.get_varnames()
.iter()
.chain(a2.get_varnames().iter())
.copied()
.collect(),
ArithExpression::Clock(_) | ArithExpression::Int(_) => vec![],
ArithExpression::VarName(name) => vec![name.as_str()],
| ArithExpression::Modulo(a1, a2) => a1.has_varname(name) || a2.has_varname(name),
ArithExpression::Clock(_) | ArithExpression::Int(_) => false,
ArithExpression::VarName(n) => name == n,
}
}

Expand Down
26 changes: 12 additions & 14 deletions src/ModelObjects/Expressions/bool_expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,25 +396,17 @@ impl BoolExpression {
}

/// Finds the clock names used in the expression
pub fn get_varnames(&self) -> Vec<&str> {
pub fn has_varname(&self, name: &String) -> bool {
match self {
BoolExpression::AndOp(p1, p2) | BoolExpression::OrOp(p1, p2) => p1
.get_varnames()
.iter()
.chain(p2.get_varnames().iter())
.copied()
.collect(),
BoolExpression::AndOp(p1, p2) | BoolExpression::OrOp(p1, p2) => {
p1.has_varname(name) || p2.has_varname(name)
}
BoolExpression::LessEQ(a1, a2)
| BoolExpression::GreatEQ(a1, a2)
| BoolExpression::LessT(a1, a2)
| BoolExpression::GreatT(a1, a2)
| BoolExpression::EQ(a1, a2) => a1
.get_varnames()
.iter()
.chain(a2.get_varnames().iter())
.copied()
.collect(),
BoolExpression::Bool(_) => vec![],
| BoolExpression::EQ(a1, a2) => a1.has_varname(name) || a2.has_varname(name),
BoolExpression::Bool(_) => false,
}
}

Expand Down Expand Up @@ -462,6 +454,12 @@ impl BoolExpression {
}
}

impl Default for BoolExpression {
fn default() -> Self {
BoolExpression::Bool(true)
}
}

fn var_from_naming(
naming: &HashMap<ClockIndex, String>,
index: ClockIndex,
Expand Down
Loading