Class TcoContext
Root construction container, provides context information for TcoObjects
declared within its scope.
This function block is abstract
and cannot be instantiated.
Use Run() to run this context, Run
method must be called only once per PLC Task cycle.
Several 'TcoContext' instances can be declared and called inside one TwinCAT PlcTask, but only once per PLC cycle.
The instance should not be accessed from several Twincat PlcTasks.
Default implemenation of the 'TcoContext' allows its child members access properties StartCycleCount
and EndCycleCount, messenger settings, rtc and other information related to the context of the running logic.
tip
A TcoContext
can contain objects, components and PLC logic of one independent station of the machine,
while the another one can cover the same for another station.
tip
TwinCAT PlcTask and TcoTask() refer to two different concepts.
Inheritance
System.Object
TcoContext
Implements
Vortex.Connector.Identity.IVortexIdentity
Vortex.Connector.IVortexObject
Vortex.Connector.ITwinObject
Vortex.Connector.IVortexElement
Vortex.Connector.IVortexOnlineObject
Vortex.Connector.IVortexShadowObject
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: TcoCoreConnector.dll
Syntax
[TypeMetaDescriptor("{attribute addProperty Name \"\" }", "TcoContext", "TcoCore", TypeComplexityEnum.Complex)]
public class TcoContext : IVortexIdentity, IsTcoContext, IsTcoObject, IVortexObject, ITwinObject, IVortexElement, ITcoContext, IShadowTcoContext, IVortexOnlineObject, IVortexShadowObject
Examples
Declaration part of the 'TcoContext' example.
(*
THIS EXAMPLE AIMS TO EXPLAIN WHAT CONTEXT AND IDENITY ARE IN A 'TcoOpen' APPLICATION.
SEE Main() method of this block.
*)
FUNCTION_BLOCK VitoCorleone_Context EXTENDS TcoCore.TcoContext
VAR
(*
Each context member object has it 'context' and assigned when instantiated (at birth)
This is typically done by instantiating the objects with FB_init(ITcoObject) as follows
These are Don Corleone's children. When you look inside definitions you' find
Don Corleone's grand-childrend (whole family shares the same context).
*)
_santino : Santino_Object(THIS^);
_thomas : Thomas_Object(THIS^);
_frederico : Frederico_Object(THIS^);
_michael : Michael_Object(THIS^);
_costanzia : Constanzia_Object(THIS^);
END_VAR
VAR
_donCorleoneContext : ITcoContext;
_isSameContext : BOOL;
_donCorleoneIdentity : ULINT;
_isDifferentIndentity : BOOL;
END_VAR
Implementation part of the 'TcoContext' example.
(*
CONTEXT vs IDENTITY
*)
// In Corleone family they all share the same context that is that of Don Vito Corleone
// Here is the tree of family Corleone
// https://godfather.fandom.com/wiki/Corleone_family
_donCorleoneContext := THIS^.Context;
_isSameContext :=
// Santino
_donCorleoneContext = THIS^._santino.Context
// Santino's kids
AND (THIS^._santino.Context = THIS^._santino._francesca.Context
AND THIS^._santino.Context = THIS^._santino._frank.Context
AND THIS^._santino.Context = THIS^._santino._kathryn.Context
AND THIS^._santino.Context = THIS^._santino._santino.Context)
// Thomas
AND THIS^._santino.Context = THIS^._thomas.Context
// Thomas' kids
AND (THIS^._thomas.Context = THIS^._thomas._andrew.Context
AND THIS^._thomas.Context = THIS^._thomas._christina.Context
AND THIS^._thomas.Context = THIS^._thomas._frank.Context
AND THIS^._thomas.Context = THIS^._thomas._gianna.Context)
// Frederico
AND THIS^._thomas.Context = THIS^._frederico.Context
// Frederico's kids
AND (THIS^._frederico.Context = THIS^._frederico._fredo.Context)
// Michael
AND THIS^._frederico.Context = THIS^._michael.Context
// Michael's kids
AND (THIS^._michael.Context = THIS^._michael._anthony.Context
AND THIS^._michael.Context = THIS^._michael._mary.Context)
// Constanzia
AND THIS^._michael.Context = THIS^._costanzia.Context
// Constanzia's kids
AND (THIS^._costanzia.Context = THIS^._costanzia._michael.Context
AND THIS^._costanzia.Context = THIS^._costanzia._victor.Context);
// However each member of the family has different personal identity and that might
// be source of trouble
_donCorleoneIdentity := THIS^.Identity;
_isDifferentIndentity :=
// Santino
_donCorleoneIdentity <> THIS^._santino.Identity
// Santino's kids
AND (THIS^._santino.Identity <> THIS^._santino._francesca.Identity
AND THIS^._santino.Identity <> THIS^._santino._frank.Identity
AND THIS^._santino.Identity <> THIS^._santino._kathryn.Identity
AND THIS^._santino.Identity <> THIS^._santino._santino.Identity)
// Thomas
AND THIS^._santino.Identity <> THIS^._thomas.Identity
// Thomas' kids
AND (THIS^._thomas.Identity <> THIS^._thomas._andrew.Identity
AND THIS^._thomas.Identity <> THIS^._thomas._christina.Identity
AND THIS^._thomas.Identity <> THIS^._thomas._frank.Identity
AND THIS^._thomas.Identity <> THIS^._thomas._gianna.Identity)
// Frederico
AND THIS^._thomas.Identity <> THIS^._frederico.Identity
// Frederico's kids
AND (THIS^._frederico.Identity <> THIS^._frederico._fredo.Identity)
// Michael
AND THIS^._frederico.Identity <> THIS^._michael.Identity
// Michael's kids
AND (THIS^._michael.Identity <> THIS^._michael._anthony.Identity
AND THIS^._michael.Identity <> THIS^._michael._mary.Identity)
// Constanzia
AND THIS^._michael.Identity <> THIS^._costanzia.Identity
// Constanzia's kids
AND (THIS^._costanzia.Identity <> THIS^._costanzia._michael.Identity
AND THIS^._costanzia.Identity <> THIS^._costanzia._victor.Identity);
// Once the context is asigned (at birth [instantiated]) it cannot be changed,
// an attempt to change the context will result in vendetta.
Constructors
|
Improve this Doc
View Source
TcoContext()
Declaration
|
Improve this Doc
View Source
TcoContext(IVortexObject, String, String)
Declaration
public TcoContext(IVortexObject parent, string readableTail, string symbolTail)
Parameters
Type |
Name |
Description |
Vortex.Connector.IVortexObject |
parent |
|
System.String |
readableTail |
|
System.String |
symbolTail |
|
Fields
|
Improve this Doc
View Source
__endCycleCount
Declaration
OnlinerULInt __endCycleCount
Field Value
Type |
Description |
Vortex.Connector.ValueTypes.OnlinerULInt |
|
|
Improve this Doc
View Source
__Identity
Declaration
Field Value
Type |
Description |
Vortex.Connector.ValueTypes.OnlinerULInt |
|
|
Improve this Doc
View Source
__logger
Declaration
Field Value
|
Improve this Doc
View Source
__messagingLevel
Declaration
OnlinerInt __messagingLevel
Field Value
Type |
Description |
Vortex.Connector.ValueTypes.OnlinerInt |
|
|
Improve this Doc
View Source
__rtc
Declaration
Field Value
|
Improve this Doc
View Source
__settings
Declaration
TcoContextEnvironment __settings
Field Value
|
Improve this Doc
View Source
__startCycleCount
Declaration
OnlinerULInt __startCycleCount
Field Value
Type |
Description |
Vortex.Connector.ValueTypes.OnlinerULInt |
|
|
Improve this Doc
View Source
__timeSychnMessenger
Declaration
TcoMessenger __timeSychnMessenger
Field Value
|
Improve this Doc
View Source
_humanReadable
Declaration
protected string _humanReadable
Field Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
_messages
Declaration
readonly IList<TcoMessage> _messages
Field Value
Type |
Description |
System.Collections.Generic.IList<TcoMessage> |
|
Properties
|
Improve this Doc
View Source
_AttributeName
Declaration
string _AttributeName { }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
_endCycleCount
Declaration
[ReadOnly]
public OnlinerULInt _endCycleCount { get; }
Property Value
Type |
Description |
Vortex.Connector.ValueTypes.OnlinerULInt |
|
|
Improve this Doc
View Source
_Identity
Identity of this TcoContext
.
This variable is used in the higher level applications,
it allows to identify the context in SCADA like applications.
Declaration
[RenderIgnore]
[ReadOnly]
public OnlinerULInt _Identity { get; }
Property Value
Type |
Description |
Vortex.Connector.ValueTypes.OnlinerULInt |
|
|
Improve this Doc
View Source
_logger
Declaration
[RenderIgnore]
public TcoLogger _logger { get; }
Property Value
|
Improve this Doc
View Source
_messagingLevel
Declaration
[EnumeratorDiscriminator(typeof(eMessageCategory))]
public OnlinerInt _messagingLevel { get; }
Property Value
Type |
Description |
Vortex.Connector.ValueTypes.OnlinerInt |
|
|
Improve this Doc
View Source
_rtc
Declaration
[ReadOnly]
public TcoRtc _rtc { get; }
Property Value
|
Improve this Doc
View Source
_settings
Declaration
[RenderIgnore]
public TcoContextEnvironment _settings { get; }
Property Value
|
Improve this Doc
View Source
_startCycleCount
Declaration
[ReadOnly]
public OnlinerULInt _startCycleCount { get; }
Property Value
Type |
Description |
Vortex.Connector.ValueTypes.OnlinerULInt |
|
|
Improve this Doc
View Source
_timeSychnMessenger
Declaration
public TcoMessenger _timeSychnMessenger { get; }
Property Value
|
Improve this Doc
View Source
AttributeName
Declaration
public string AttributeName { get; set; }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Children
Declaration
List<IVortexObject> Children { }
Property Value
Type |
Description |
System.Collections.Generic.List<Vortex.Connector.IVortexObject> |
|
|
Improve this Doc
View Source
Connector
Declaration
protected IConnector Connector { get; set; }
Property Value
Type |
Description |
Vortex.Connector.IConnector |
|
|
Improve this Doc
View Source
HumanReadable
Declaration
public string HumanReadable { get; protected set; }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Identity
Get the identity of this Context.
Declaration
public OnlinerULInt Identity { get; }
Property Value
Type |
Description |
Vortex.Connector.ValueTypes.OnlinerULInt |
|
|
Improve this Doc
View Source
Kids
Declaration
List<IVortexElement> Kids { }
Property Value
Type |
Description |
System.Collections.Generic.List<Vortex.Connector.IVortexElement> |
|
|
Improve this Doc
View Source
LastStartCycleCount
Gets last know value of start cycle counter of this context.
Declaration
public ulong LastStartCycleCount { get; }
Property Value
Type |
Description |
System.UInt64 |
|
|
Improve this Doc
View Source
MessageHandler
Gets 'Message Handler' for this Context.
Declaration
public TcoObjectMessageHandler MessageHandler { get; }
Property Value
|
Improve this Doc
View Source
Messages
Gets the messages that belong to this Context.
Declaration
public IEnumerable<TcoMessage> Messages { get; }
Property Value
Type |
Description |
System.Collections.Generic.IEnumerable<TcoMessage> |
|
|
Improve this Doc
View Source
Parent
Declaration
protected IVortexObject Parent { get; set; }
Property Value
Type |
Description |
Vortex.Connector.IVortexObject |
|
|
Improve this Doc
View Source
StartCycleCount
Declaration
public OnlinerULInt StartCycleCount { get; }
Property Value
Type |
Description |
Vortex.Connector.ValueTypes.OnlinerULInt |
|
|
Improve this Doc
View Source
Symbol
Declaration
public string Symbol { get; protected set; }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
SymbolTail
Declaration
protected string SymbolTail { get; set; }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
ValueTags
Declaration
List<IValueTag> ValueTags { }
Property Value
Type |
Description |
System.Collections.Generic.List<Vortex.Connector.IValueTag> |
|
Methods
|
Improve this Doc
View Source
AddChild(IVortexObject)
Declaration
public void AddChild(IVortexObject vortexObject)
Parameters
Type |
Name |
Description |
Vortex.Connector.IVortexObject |
vortexObject |
|
|
Improve this Doc
View Source
AddKid(IVortexElement)
Declaration
public void AddKid(IVortexElement vortexElement)
Parameters
Type |
Name |
Description |
Vortex.Connector.IVortexElement |
vortexElement |
|
|
Improve this Doc
View Source
AddMessage(TcoMessage)
Adds message to the queue of the messages of this Context.
Declaration
public void AddMessage(TcoMessage message)
Parameters
Type |
Name |
Description |
TcoMessage |
message |
Message to add.
|
|
Improve this Doc
View Source
AddValueTag(IValueTag)
Declaration
public void AddValueTag(IValueTag valueTag)
Parameters
Type |
Name |
Description |
Vortex.Connector.IValueTag |
valueTag |
|
|
Improve this Doc
View Source
CopyPlainToShadow(PlainTcoContext)
Declaration
public void CopyPlainToShadow(PlainTcoContext source)
Parameters
|
Improve this Doc
View Source
CreatePlainerType()
Declaration
public PlainTcoContext CreatePlainerType()
Returns
|
Improve this Doc
View Source
CreatePlainerType(PlainTcoContext)
Declaration
protected PlainTcoContext CreatePlainerType(PlainTcoContext cloned)
Parameters
Returns
|
Improve this Doc
View Source
FlushOnlineToPlain(PlainTcoContext)
Declaration
public void FlushOnlineToPlain(PlainTcoContext source)
Parameters
|
Improve this Doc
View Source
FlushOnlineToShadow()
Declaration
public void FlushOnlineToShadow()
|
Improve this Doc
View Source
FlushPlainToOnline(PlainTcoContext)
Declaration
public void FlushPlainToOnline(PlainTcoContext source)
Parameters
|
Improve this Doc
View Source
FlushShadowToOnline()
Declaration
public void FlushShadowToOnline()
|
Improve this Doc
View Source
GetChildren()
Declaration
public IEnumerable<IVortexObject> GetChildren()
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Vortex.Connector.IVortexObject> |
|
|
Improve this Doc
View Source
GetConnector()
Declaration
public IConnector GetConnector()
Returns
Type |
Description |
Vortex.Connector.IConnector |
|
|
Improve this Doc
View Source
GetKids()
Declaration
public IEnumerable<IVortexElement> GetKids()
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Vortex.Connector.IVortexElement> |
|
|
Improve this Doc
View Source
GetParent()
Declaration
public IVortexObject GetParent()
Returns
Type |
Description |
Vortex.Connector.IVortexObject |
|
|
Improve this Doc
View Source
GetSymbolTail()
Declaration
public string GetSymbolTail()
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
GetValueTags()
Declaration
public IEnumerable<IValueTag> GetValueTags()
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Vortex.Connector.IValueTag> |
|
|
Improve this Doc
View Source
LazyOnlineToShadow()
Declaration
public void LazyOnlineToShadow()
|
Improve this Doc
View Source
LazyShadowToOnline()
Declaration
public void LazyShadowToOnline()
|
Improve this Doc
View Source
PexConstructor(IVortexObject, String, String)
Declaration
void PexConstructor(IVortexObject parent, string readableTail, string symbolTail)
Parameters
Type |
Name |
Description |
Vortex.Connector.IVortexObject |
parent |
|
System.String |
readableTail |
|
System.String |
symbolTail |
|
|
Improve this Doc
View Source
PexConstructorParameterless()
Declaration
void PexConstructorParameterless()
|
Improve this Doc
View Source
PexPreConstructor(IVortexObject, String, String)
Declaration
void PexPreConstructor(IVortexObject parent, string readableTail, string symbolTail)
Parameters
Type |
Name |
Description |
Vortex.Connector.IVortexObject |
parent |
|
System.String |
readableTail |
|
System.String |
symbolTail |
|
|
Improve this Doc
View Source
PexPreConstructorParameterless()
Declaration
void PexPreConstructorParameterless()
Explicit Interface Implementations
|
Improve this Doc
View Source
IShadowTcoContext._endCycleCount
Declaration
[ReadOnly]
IShadowULInt IShadowTcoContext._endCycleCount { get; }
Returns
Type |
Description |
Vortex.Connector.ValueTypes.Shadows.IShadowULInt |
|
|
Improve this Doc
View Source
IShadowTcoContext._Identity
Declaration
[RenderIgnore]
[ReadOnly]
IShadowULInt IShadowTcoContext._Identity { get; }
Returns
Type |
Description |
Vortex.Connector.ValueTypes.Shadows.IShadowULInt |
|
|
Improve this Doc
View Source
IShadowTcoContext._logger
Declaration
[RenderIgnore]
IShadowTcoLogger IShadowTcoContext._logger { get; }
Returns
|
Improve this Doc
View Source
IShadowTcoContext._messagingLevel
Declaration
[EnumeratorDiscriminator(typeof(eMessageCategory))]
IShadowInt IShadowTcoContext._messagingLevel { get; }
Returns
Type |
Description |
Vortex.Connector.ValueTypes.Shadows.IShadowInt |
|
|
Improve this Doc
View Source
IShadowTcoContext._rtc
Declaration
[ReadOnly]
IShadowTcoRtc IShadowTcoContext._rtc { get; }
Returns
|
Improve this Doc
View Source
IShadowTcoContext._settings
Declaration
[RenderIgnore]
IShadowTcoContextEnvironment IShadowTcoContext._settings { get; }
Returns
|
Improve this Doc
View Source
IShadowTcoContext._startCycleCount
Declaration
[ReadOnly]
IShadowULInt IShadowTcoContext._startCycleCount { get; }
Returns
Type |
Description |
Vortex.Connector.ValueTypes.Shadows.IShadowULInt |
|
|
Improve this Doc
View Source
IShadowTcoContext._timeSychnMessenger
Declaration
IShadowTcoMessenger IShadowTcoContext._timeSychnMessenger { get; }
Returns
|
Improve this Doc
View Source
ITcoContext._endCycleCount
Declaration
[ReadOnly]
IOnlineULInt ITcoContext._endCycleCount { get; }
Returns
Type |
Description |
Vortex.Connector.ValueTypes.Online.IOnlineULInt |
|
|
Improve this Doc
View Source
ITcoContext._Identity
Declaration
[RenderIgnore]
[ReadOnly]
IOnlineULInt ITcoContext._Identity { get; }
Returns
Type |
Description |
Vortex.Connector.ValueTypes.Online.IOnlineULInt |
|
|
Improve this Doc
View Source
ITcoContext._logger
Declaration
[RenderIgnore]
ITcoLogger ITcoContext._logger { get; }
Returns
|
Improve this Doc
View Source
ITcoContext._messagingLevel
Declaration
[EnumeratorDiscriminator(typeof(eMessageCategory))]
IOnlineInt ITcoContext._messagingLevel { get; }
Returns
Type |
Description |
Vortex.Connector.ValueTypes.Online.IOnlineInt |
|
|
Improve this Doc
View Source
ITcoContext._rtc
Declaration
[ReadOnly]
ITcoRtc ITcoContext._rtc { get; }
Returns
|
Improve this Doc
View Source
ITcoContext._settings
Declaration
[RenderIgnore]
ITcoContextEnvironment ITcoContext._settings { get; }
Returns
|
Improve this Doc
View Source
ITcoContext._startCycleCount
Declaration
[ReadOnly]
IOnlineULInt ITcoContext._startCycleCount { get; }
Returns
Type |
Description |
Vortex.Connector.ValueTypes.Online.IOnlineULInt |
|
|
Improve this Doc
View Source
ITcoContext._timeSychnMessenger
Declaration
ITcoMessenger ITcoContext._timeSychnMessenger { get; }
Returns
Implements
Vortex.Connector.Identity.IVortexIdentity
Vortex.Connector.IVortexObject
Vortex.Connector.ITwinObject
Vortex.Connector.IVortexElement
Vortex.Connector.IVortexOnlineObject
Vortex.Connector.IVortexShadowObject
See Also