| | standard library package StateSpaceRepresentation { |
| | doc |
| | |
| | |
| | |
| | |
| |
|
| | private import ISQ::DurationValue; |
| | private import Quantities::VectorQuantityValue; |
| | private import VectorCalculations::*; |
| |
|
| | abstract attribute def StateSpace :> VectorQuantityValue; |
| | abstract attribute def Input :> VectorQuantityValue; |
| | abstract attribute def Output :> VectorQuantityValue; |
| |
|
| | abstract calc def GetNextState { |
| | in input: Input; |
| | in stateSpace: StateSpace; |
| | in timeStep: DurationValue; |
| | return : StateSpace; |
| | } |
| | abstract calc def GetOutput { |
| | in input: Input; |
| | in stateSpace: StateSpace; |
| | return : Output; |
| | } |
| | |
| | abstract action def StateSpaceEventDef { |
| | doc |
| | |
| | |
| | |
| | } |
| | action def ZeroCrossingEventDef :> StateSpaceEventDef; |
| |
|
| | item def StateSpaceItem { |
| | doc |
| | |
| | |
| | |
| | } |
| |
|
| | abstract action def StateSpaceDynamics { |
| | doc |
| | |
| | |
| | |
| | |
| | |
| | in attribute input: Input; |
| |
|
| | abstract calc getNextState: GetNextState; |
| | abstract calc getOutput: GetOutput; |
| | attribute stateSpace: StateSpace; |
| |
|
| | out attribute output: Output = getOutput(input, stateSpace); |
| | } |
| |
|
| | abstract attribute def StateDerivative :> VectorQuantityValue { |
| | doc |
| | |
| | |
| | |
| | |
| | ref stateSpace: StateSpace; |
| | constraint { stateSpace.order == order } |
| | } |
| |
|
| | abstract calc def GetDerivative { |
| | doc |
| | |
| | |
| | |
| | |
| | in input: Input; |
| | in stateSpace: StateSpace; |
| | return : StateDerivative; |
| | } |
| | |
| | abstract calc def Integrate { |
| | doc |
| | |
| | |
| | |
| | |
| | |
| | in getDerivative: GetDerivative; |
| | in input: Input; |
| | in initialState: StateSpace; |
| | in timeInterval: DurationValue; |
| | return result: StateSpace; |
| | } |
| | |
| | abstract action def ContinuousStateSpaceDynamics :> StateSpaceDynamics { |
| | doc |
| | |
| | |
| | |
| | |
| | |
| | abstract calc getDerivative: GetDerivative; |
| | calc :>> getNextState: GetNextState { |
| | |
| | calc integrate: Integrate { |
| | in getDerivative = ContinuousStateSpaceDynamics::getDerivative; |
| | in input = GetNextState::input; |
| | in initialState = GetNextState::stateSpace; |
| | in timeInterval = GetNextState::timeStep; |
| | } |
| | return result = integrate.result; |
| | } |
| |
|
| | event occurrence zeroCrossingEvents[0..*] : ZeroCrossingEventDef { |
| | |
| | } |
| | } |
| |
|
| | abstract calc def GetDifference { |
| | doc |
| | |
| | |
| | |
| | |
| | |
| | in input: Input; |
| | in stateSpace: StateSpace; |
| | return : StateSpace; |
| | } |
| | |
| | abstract action def DiscreteStateSpaceDynamics :> StateSpaceDynamics { |
| | doc |
| | |
| | |
| | |
| | |
| | |
| | abstract calc getDifference: GetDifference; |
| | calc :>> getNextState: GetNextState { |
| | attribute diff: StateSpace = getDifference(input, stateSpace); |
| | return result = stateSpace + diff; |
| | } |
| | } |
| | } |
| |
|