pub struct Conversation {
pub rm: RmSession,
pub cem: CemSession,
pub now: Timestamp,
/* private fields */
}testing only.Expand description
A Resource Manager and a Customer Energy Manager, talking to each other.
Fields§
§rm: RmSessionThe resource’s side.
cem: CemSessionThe manager’s side.
now: TimestampThe virtual clock.
Implementations§
Source§impl Conversation
impl Conversation
Sourcepub fn new(
rm_config: RmConfig,
details: ResourceManagerDetails,
cem_config: CemConfig,
) -> Self
pub fn new( rm_config: RmConfig, details: ResourceManagerDetails, cem_config: CemConfig, ) -> Self
A conversation between the given two configurations.
Sourcepub fn battery() -> Self
pub fn battery() -> Self
A conversation with a 20 kWh home battery, the FRBC example implementation.
Sourcepub fn pump(&mut self)
pub fn pump(&mut self)
Deliver everything either side wants to send, until neither has anything left.
Bounded, so a session that answers its own answers cannot hang a test.
§Panics
When the conversation does not settle within a thousand rounds, which means one of the engines is acknowledging acknowledgements.
Sourcepub fn advance_silently(&mut self, by: Duration)
pub fn advance_silently(&mut self, by: Duration)
Move the clock forward without delivering anything, so that a message can be dropped on the floor.
Sourcepub fn drop_rm_traffic(&mut self)
pub fn drop_rm_traffic(&mut self)
Throw away everything the Resource Manager is trying to say, as a lost connection would.
Sourcepub fn drop_cem_traffic(&mut self)
pub fn drop_cem_traffic(&mut self)
Throw away everything the manager is trying to say.
Sourcepub fn transcript(&self) -> &[TranscriptEntry]
pub fn transcript(&self) -> &[TranscriptEntry]
Everything that has crossed the wire.
Sourcepub fn flow(&self) -> Vec<(Direction, MessageKind)>
pub fn flow(&self) -> Vec<(Direction, MessageKind)>
Every message type that has crossed, in order.
Sourcepub fn flow_without_acks(&self) -> Vec<(Direction, MessageKind)>
pub fn flow_without_acks(&self) -> Vec<(Direction, MessageKind)>
Every message type that has crossed, ignoring the acknowledgements.
Sourcepub fn take_rm_events(&mut self) -> Vec<RmEvent>
pub fn take_rm_events(&mut self) -> Vec<RmEvent>
Everything the Resource Manager has reported, clearing the list.
Sourcepub fn take_cem_events(&mut self) -> Vec<CemEvent>
pub fn take_cem_events(&mut self) -> Vec<CemEvent>
Everything the manager has reported, clearing the list.
Sourcepub fn first_instruction(&mut self) -> Option<Instructed>
pub fn first_instruction(&mut self) -> Option<Instructed>
The first instruction the Resource Manager was handed, if any.
Sourcepub fn assert_no_refusals(&self)
pub fn assert_no_refusals(&self)
Assert that nothing was refused. The message names what was.
§Panics
When either side refused a message.