abstract class Quartz::MultiComponent::Component
- Quartz::MultiComponent::Component
- Quartz::Model
- Reference
- Object
Included Modules
Defined in:
quartz/multi_component/component.crConstant Summary
-
STATE_CHECKS =
{state_complete: false}
Constructors
Class Method Summary
- .check(*attributes : Symbol, **kwargs)
-
.check_with(klass : Verifiers::RuntimeValidator.class, **kwargs)
Passes the model off to the class or classes specified and allows them to add errors based on more complex conditions.
-
.check_with(klass : Verifiers::EachChecker.class, *attributes : Symbol, **kwargs)
Passes the model off to the class or classes specified and allows them to add errors based on more complex conditions.
- .clear_verifiers
-
.precision_level : Scale
The precision associated with the model.
-
.precision_level=(precision_level : Scale)
The precision associated with the model.
- .verifiers
Instance Method Summary
-
#__initialize_state__(processor)
Used internally by the simulator :nodoc:
- #__parent__=(parent : MultiComponent::Model)
-
#confluent_transition(messages : Hash(InputPort, Array(Any))) : Hash(Name, Any)?
This is the default definition of the confluent transition.
-
#elapsed : Duration
This attribute is updated automatically along simulation and represents the elapsed time since the last transition.
-
#elapsed=(elapsed : Duration)
This attribute is updated automatically along simulation and represents the elapsed time since the last transition.
- #influencees : Array(Quartz::MultiComponent::Component)
- #influencers : Array(Quartz::MultiComponent::Component)
- #input_port(port)
-
#internal_transition : Hash(Name, Any)?
Internal transition function (δint), called when the model should be activated, e.g when
#elapsed
reaches#time_advance
-
#model_precision : Scale
Returns the precision associated with the class.
- #output_port(port)
-
#reaction_transition(states)
TODO doc
-
#time_advance : Duration
Time advance function (ta), called after each transition to give a chance to self to be active.
Macro Summary
-
precision(scale = "base")
Defines the precision level associated to this class of models.
Instance methods inherited from module Quartz::Stateful
initial_state
initial_state,
initial_state=(state : Quartz::State)
initial_state=,
state
state,
state=(state : Quartz::State)
state=
Instance methods inherited from module Quartz::Verifiable
clear_errors
clear_errors,
errors
errors,
invalid?(context : Symbol? = nil) : Bool
invalid?,
valid?(context : Symbol? = nil) : Bool
valid?
Instance methods inherited from module Quartz::Observable
add_observer(observer : Observer)
add_observer,
count_observers
count_observers,
delete_observer(observer : Observer) : Bool
delete_observer,
notify_observers(info = nil)
notify_observers
Instance methods inherited from module Quartz::Schedulable
imaginary_phase : Duration
imaginary_phase,
imaginary_phase=(imaginary_phase : Duration)
imaginary_phase=,
imaginary_precision : Scale
imaginary_precision,
imaginary_precision=(imaginary_precision : Scale)
imaginary_precision=,
inspect(io)
inspect,
planned_phase : Duration
planned_phase,
planned_phase=(planned_phase : Duration)
planned_phase=,
planned_precision : Scale
planned_precision,
planned_precision=(planned_precision : Scale)
planned_precision=
Instance methods inherited from class Quartz::Model
accept(visitor : Visitor)
accept,
accept_children(visitor)
accept_children,
after_initialize
after_initialize,
inspect(io)
inspect,
name : Name
name,
name=(name : Name)
name=,
processor : Processor?
processor,
processor=(processor : Processor?)
processor=,
processor? : Processor | Nil?
processor?,
to_s(io)
to_s
Constructor methods inherited from class Quartz::Model
new(name : Name)
new
Instance methods inherited from class Reference
==(other : Quartz::Any)
==
Instance methods inherited from class Object
===(other : Quartz::Any)
===
Constructor Detail
Class Method Detail
Passes the model off to the class or classes specified and allows them to add errors based on more complex conditions.
class MyModel
include Quartz::Verifiable
check_with MyVerifier
end
class MyVerifier < Quartz::Verifiers::RuntimeChecker
def validate(model)
if some_test
model.errors.add(:phase, "This model state is invalid")
end
end
# ...
end
Passes the model off to the class or classes specified and allows them to add errors based on more complex conditions.
class MyModel
include Quartz::Verifiable
check_with MyVerifier
end
class MyVerifier < Quartz::Verifiers::EachChecker
def check_each(model, attribute, value)
if some_test
model.errors.add(attribute, "This model attribute is invalid")
end
end
# ...
end
The precision associated with the model.
Instance Method Detail
This is the default definition of the confluent transition. Here the internal transition is allowed to occur and this is followed by the effect of the external transition on the resulting state.
Override this method to obtain a different behavior. For example, the opposite order of effects (external transition before internal transition). Of course you can override without reference to the other transitions.
This attribute is updated automatically along simulation and represents the elapsed time since the last transition.
This attribute is updated automatically along simulation and represents the elapsed time since the last transition.
Internal transition function (δint), called when the model should be
activated, e.g when #elapsed
reaches #time_advance
Override this method to implement the appropriate behavior of your model.
Time advance function (ta), called after each transition to give a chance to self to be active.
Override this method to implement the appropriate behavior of your model.
Example:
def time_advance
Quartz.infinity
end
Macro Detail
Defines the precision level associated to this class of models.
Usage:
precision
must receive a scale unit. The scale unit can be specified
with a constant expression (e.g. 'kilo'), with a Scale
struct or with
a number literal.
precision Scale.::KILO
precision -8
precision femto
If specified with a constant expression, the unit argument can be a string literal, a symbol literal or a plain name.
precision kilo
precision "kilo"
precision :kilo
Example
class MyModel < Quartz::AtomicModel
precision femto
end
Is the same as writing:
class MyModel < Quartz::AtomicModel
self.precision = Scale::FEMTO
end
Or the same as:
class MyModel < Quartz::AtomicModel; end
MyModel.precision = Scale::FEMTO