Class Diagram Base
classDiagram
I_BaseFB <|-- I_CyclicFB
FB_BaseFB ..|> I_BaseFB
FB_CyclicFB --|> FB_BaseFB
FB_CyclicFB ..|> I_CyclicFB
class I_BaseFB{
<<Interface>>
+BOOL Busy
+BOOL Error
+UDINT ErrorID
}
class I_CyclicFB{
<<Interface>>
+BOOL InitComplete
+CyclicLogic()
}
class FB_BaseFB{
<<Abstract>>
Trace()
TraceWithJson()
Marker()
}
class FB_CyclicFB{
<<Abstract>>
}
Design Notes
Throughout the framework libraries a common pattern is used for initialization routines and how they are called.
Most function blocks will implement I_CyclicFB
by way of inheriting FB_CyclicFB
. The entry point for these function blocks is CyclicLogic()
. FB_CyclicFB
already contains a local variable backing the InitComplete
property: _InitComplete : BOOL
. We can utilize this in our function blocks and assure all necessary initialization steps have been carried out before executing any further code. This can be useful, for example, to make sure pointers are initialized before referencing them. Another example may be waiting for another function block to set a property on our function block--useful when implementing the Observer pattern.
1 2 3 4 5 6 |
|
Class Diagram PackML Base Module
classDiagram
I_PackML_BaseModule --|> I_CyclicFB
I_PackML_BaseModule --|> I_PackML_Control
I_PackML_BaseModule --o TcEventSeverity
I_PackML_BaseModule --o E_AlarmResponse
I_PackML_Control --o E_PMLUnitMode
I_PackML_Control --o E_PMLState
I_PackML_Control --o E_PMLCommand
FB_PackML_BaseModule --|> FB_CyclicFB
FB_PackML_BaseModule ..|> I_PackML_BaseModule
FB_PackML_BaseModule ..|> I_PackML_Control
FB_PackML_BaseModule --o I_PackML_ExternalController
I_PackML_ExternalController --o I_PackML_Control
FB_CyclicFB ..|> I_CyclicFB
class I_PackML_BaseModule{
<<Interface>>
+TcEventSeverity CurrentAlarmSeverity
+BOOL LogModeChanges
+BOOL LogStateChanges
+STRING Name
+ARRAY[0..4] OF E_AlarmResponse ParentResponseDef
}
class I_PackML_Control{
<<Interface>>
+E_PMLUnitMode CurrentMode
+E_PMLState CurrentState
+DINT ModeCommand
+E_PMLCommand StateCommand
+ChangeMode()
+ChangeState()
}
class I_PackML_ExternalController{
<<Interface>>
+I_PackML_Control Control
+ModeChanged()
+StateChanged()
}
class FB_PackML_BaseModule{
<<Abstract>>
#AbortImmediate()
#AbortImmediateError()
#HoldControlled()
#HoleImmediate()
#StopControlled()
#StopImmediate()
#SuspendControlled()
#SuspendImmediate()
#AllowHMIControl()
#BlockHMIControl()
#HMICommunication()
#HMIPermissions()
#ComponentMonitor()
#SubModuleMonitor()
#Aborting()
#Aborted()
#Clearing()
#Completing()
#Complete()
#Execute()
#Holding();
#Held()
#Idle()
#Resetting()
#Starting()
#Stopping()
#Stopped()
#Suspending()
#Suspended()
#Unholding()
#Unsuspending()
#Undefined()
-StateControl()
-ModeControl()
#CreateEvents()
#Initialize() BOOL
#StateComplete()
+RegsterExernalController() BOOL
}
class FB_CyclicFB{
<<SPT Base Types>>
}
class I_CyclicFB{
<<SPT Base Types>>
}
class TcEventSeverity{
<<enumeration>>
Verbose : 0
Info : 1
Warning : 2
Error : 3
Critical : 4
}
class E_AlarmResponse{
<<enumeration>>
Abort_ImmediateError
Abort_Immediate
Stop_Immediate
Stop_Controlled
Hold_Immediate
Hold_Controlled
Suspend_Immediate
Suspend_Controlled
NoResponse
}
class E_PMLUnitMode{
<<enumeration>>
ePMLUnitMode_Invalid
ePMLUnitMode_Production
ePMLUnitMode_Maintenance
ePMLUnitMode_Manual
ePMLUnitMode_UserModeN
}
class E_PMLState{
<<Tc3_PackML_v2>>
}
class E_PMLCommand{
<<Tc3_PackML_v2>>
}