pub struct PywrModel {
pub metadata: Metadata,
pub timestepper: Timestepper,
pub scenarios: Option<Vec<Scenario>>,
pub network: PywrNetwork,
}
Fields§
§metadata: Metadata
§timestepper: Timestepper
§scenarios: Option<Vec<Scenario>>
§network: PywrNetwork
Implementations§
Source§impl PywrModel
impl PywrModel
Sourcepub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, PywrSchemaError>
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, PywrSchemaError>
Load a PywrNetwork from a file path
Sourcepub fn get_node_by_name(&self, name: &str) -> Option<&Node>
pub fn get_node_by_name(&self, name: &str) -> Option<&Node>
Sourcepub fn get_node_index_by_name(&self, name: &str) -> Option<usize>
pub fn get_node_index_by_name(&self, name: &str) -> Option<usize>
Return a node’s index from its name. If no node with that name exists return None
.
Sourcepub fn get_parameter_by_name(&self, name: &str) -> Option<&Parameter>
pub fn get_parameter_by_name(&self, name: &str) -> Option<&Parameter>
Sourcepub fn get_parameter_index_by_name(&self, name: &str) -> Option<usize>
pub fn get_parameter_index_by_name(&self, name: &str) -> Option<usize>
Return a parameter’s index from its name. If no parameter with that name exists
return None
.
Sourcepub fn get_parameter(&self, idx: usize) -> Option<&Parameter>
pub fn get_parameter(&self, idx: usize) -> Option<&Parameter>
Sourcepub fn resource_paths(&self) -> HashSet<PathBuf>
pub fn resource_paths(&self) -> HashSet<PathBuf>
Return all of the model’s resource paths
Sourcepub fn node_resource_paths(&self) -> HashSet<PathBuf>
pub fn node_resource_paths(&self) -> HashSet<PathBuf>
Return the model’s node resource paths
Note that this will include resource paths for any parameters defined inline within the nodes.
Sourcepub fn parameter_resource_paths(&self) -> HashSet<PathBuf>
pub fn parameter_resource_paths(&self) -> HashSet<PathBuf>
Return the model’s parameter resource paths
Sourcepub fn table_resource_paths(&self) -> HashSet<PathBuf>
pub fn table_resource_paths(&self) -> HashSet<PathBuf>
Return the model’s table resource paths
Sourcepub fn update_resource_paths(&mut self, new_paths: &HashMap<PathBuf, PathBuf>)
pub fn update_resource_paths(&mut self, new_paths: &HashMap<PathBuf, PathBuf>)
Update resource paths
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PywrModel
impl<'de> Deserialize<'de> for PywrModel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PywrModel
impl RefUnwindSafe for PywrModel
impl Send for PywrModel
impl Sync for PywrModel
impl Unpin for PywrModel
impl UnwindSafe for PywrModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more