aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/modelica_model.rs45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/modelica_model.rs b/src/modelica_model.rs
index 40b83d6..54363c8 100644
--- a/src/modelica_model.rs
+++ b/src/modelica_model.rs
@@ -2,7 +2,6 @@
extern crate modelica_parser;
use std::clone::Clone;
-use std::collections::HashMap;
use std::collections::HashSet;
use std::iter::FromIterator;
@@ -13,8 +12,6 @@ use errors::Result;
/// Helpers
pub trait ModelicaModelExt {
- fn get_constant_vars(&self) -> HashMap<String, Option<Expr>>;
- fn get_free_vars(&self) -> HashSet<String>;
fn solve_for(&self,
indep_vars: Vec<String>,
dep_vars: Vec<String>)
@@ -22,48 +19,6 @@ pub trait ModelicaModelExt {
}
impl ModelicaModelExt for ModelicaModel {
- fn get_constant_vars(&self) -> HashMap<String, Option<Expr>> {
- let mut binds = HashMap::new();
- // XXX: actually implement this...
- for c in &self.components {
- match c.prefix {
- Some(ComponentPrefix::Constant) => {
- binds.insert(c.name.clone(), Some(Expr::Integer(123)));
- }
- Some(ComponentPrefix::Parameter) => {
- binds.insert(c.name.clone(), Some(Expr::Float(4.56)));
- }
- _ => (),
- }
- }
- binds
- }
-
- // This crude function finds "unbound" variables: those which are not constants, parameters, or
- // the sole element on the LHS of an equation.
- // Bugs:
- // if a var is on LHS and RHS of same equation
- fn get_free_vars(&self) -> HashSet<String> {
- // Start with components, and remove constants and parameters
- let vars = self.components.iter().filter(|v| match v.prefix {
- Some(ComponentPrefix::Constant) |
- Some(ComponentPrefix::Parameter) => false,
- _ => true,
- });
-
- // Remove LHS (bound) vars
- let mut outputs = vec![];
- for eq in self.equations.iter() {
- // TODO:
- if let Expr::Ident(ref symb) = eq.lhs {
- outputs.push(symb.to_string());
- }
- }
- let vars = vars.filter(|v| !outputs.contains(&v.name));
-
- vars.map(|c| c.name.clone()).collect()
- }
-
// V variables
// Q constants (become kwargs)
// P bound vars (independent, inputs/passed, become like constants)