Skip to main content

Cylinder

Struct Cylinder 

Source
pub struct Cylinder {
Show 20 fields pub id: String, pub key: String, pub a1: f64, pub a2: f64, pub stroke: f64, pub mass: f64, pub payload: f64, pub gravity: f64, pub dead: [f64; 2], pub supply: f64, pub ambient: f64, pub temperature: f64, pub heat_transfer: f64, pub closed_centre: bool, pub switch_time: f64, pub inflow: Flow, pub outflow: [Flow; 2], pub bleed: [Flow; 2], pub cushion: f64, pub load: f64, /* private fields */
}
Expand description

A double-acting cylinder with its valve, throttles and cushions (see the module’s text).

Fields§

§id: String§key: String§a1: f64§a2: f64§stroke: f64§mass: f64§payload: f64§gravity: f64

Gravity’s component against +x per kg, m/s^2 (g sin incline, 0 with effects.gravity off).

§dead: [f64; 2]§supply: f64

Supply and ambient pressure (absolute), Pa; ambient (and supply, and wall) temperature, K.

§ambient: f64§temperature: f64§heat_transfer: f64§closed_centre: bool§switch_time: f64§inflow: Flow

Into a chamber: valve and tube. Out of chamber 1 and 2: valve, tube and that chamber’s throttle; and within the cushion: valve, tube and the bleed.

§outflow: [Flow; 2]§bleed: [Flow; 2]§cushion: f64

Cushion length, m; 0 with effects.cylinder_cushion off.

§load: f64

Implementations§

Source§

impl Cylinder

Source

pub fn from_config( cfg: &Config, id: &str, key: &str, path: &str, h: f64, ) -> Result<Self, ConfigError>

The cylinder id from its table at path, integrated in sub-steps of h seconds: refused where that step would not be stable (error-cylinder-unstable).

Source

pub fn volumes(&self, x: f64) -> [f64; 2]

Source

pub fn gas(&self, s: &[f64]) -> [[f64; 2]; 2]

Pressure and temperature of both chambers at state s (this cylinder’s).

Source

pub fn flows(&self, s: &[f64], spool: f64) -> Flows

The flows at state s with the spool at spool (+1, -1, 0).

Source

pub fn derivatives(&self, s: &[f64], out: &mut [f64])

The rates of this cylinder’s states at s (STATES of each).

Source

pub fn derivatives_with(&self, s: &[f64], spool: f64, out: &mut [f64])

Source

pub fn rest(&self, spool: f64, state: &mut Vec<f64>)

At rest in the end the valve holds it at: the driven chamber at the supply pressure, the other at ambient, the piston pressed into its stop as far as the net force deflects it, the gas at ambient temperature. Appended to state.

Source

pub fn mechanical_energy(&self, s: &[f64]) -> f64

Mechanical energy (kinetic, gravity, the load’s and the atmosphere’s work on the rod, the stops’ springs), J.

Source

pub fn gas_energy(&self, s: &[f64]) -> f64

The gas’s internal energy in both chambers, J.

Source

pub fn load_factor(&self) -> f64

The load over the theoretical force at the supply’s gauge pressure, the worse of the two strokes: what the cylinder has to push against gravity and the load, over p_g A1 extending and p_g A2 retracting.

Source

pub fn command(&mut self, command: f64)

The command of the valve, from the cycle: switches after switch_time where it differs from where the valve goes. A 5/2 valve has no centre: 0 keeps it where it is.

Trait Implementations§

Source§

impl Clone for Cylinder

Source§

fn clone(&self) -> Cylinder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Cylinder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.