1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | // tell it what datatype it should carry (which may NOT change during it's use), // provide a proces value // a timestamp. // // Example // MyMetric : FB_Metric; // MyMetric.Name := "Bool/B1"; // Choose a name which (static) // MyMetric.Value := MyProcesValue(); // Provide a process value. Any proces value changes are detected and signaled for sending automaticly, you don't have to do anything special! // MyMetric.TimeStamp := Time.Now(); // Provide a timestamp% {attribute 'call_after_init'} itfMetricOwner : IMetricOwner; // if this is a pool Metric, it will be set by the primary node. if not then attach it yourself to the correct Owner END_VAR VAR_OUTPUT {attribute 'no_copy'} itfMetric : IMetric := THIS^; _NotifyThem : BOOL := FALSE; // TRUE if the Value is changed in regard of the previous stored value // IElement _itfPrev : IElement; _itfNext : IElement; _itfList : IList; // IPropertyOwner _Properties : LIST; // OF FB_Property //IValue _dataType : MetricDataType := MetricDataType.Unknown; _uLint : ULINT; _lReal : LREAL; _WSTRING : WSTRING(gc_sparkplug.supported_string_lengths); //BYTES VALUE IS NOT IMPLEMENTED IF THIS^.itfMetricOwner <> 0 THEN itfMetricOwner.RegisterMetric( THIS^ ); ELSIF THIS^.itfPrimaryHost <> 0 THEN IF __QUERYPOINTER( itfPrimaryHost, pPrimary ) THEN pPrimary^.RegisterMetric( THIS^ ); END_IF END_IF |