Comparison of integration in the two Scope versions

The differences between the old and new Scope View Control API are compared in the following comparison.

The basic methods of creating a YT chart are compared.

Loading a configuration

scopeViewControl.LoadScopeConfig(@"C:\temp\Scope YT Project.tcscope");
scopeViewControl.Operating.StartRecord();

//Project Panel
scopeProjectPanel.ScopeProject = ScopeProject.LoadScopeProject(@"C:\temp\YT Scope Project.svproj");
scopeProjectPanel.ScopeProject.StartRecord();
//Chart Panel
ScopeProject scopeProject = ScopeProject.LoadScopeProject(@"C:\temp\YT Scope Project.svproj");
chartPanel.ModelChart = scopeProject.SubMember.OfType<Chart>().First();
scopeProject.StartRecord();

The method of loading a configuration has been pulled out of the control in the new version and can be found in the ScopeProject, which can now be reached via a property in the control.

Apart from the control, which can display an entire project and displays the charts in a sanddock, there is now also an option to use a control for a single chart. This is displayed, for example, in the code under the comment "Chart Panel".

Creating a configuration in the code

ScopeViewControlChart chart_old       = scopeViewControl.NewChart(scopeDisplayModes.XT);
ScopeViewControlYAxis axis_old        = chart_old.NewAxis();
ScopeViewControlChannel channel_old   = axis_old.NewChannel();
ScopeProject scopeProject_new = new ScopeProject();
Chart chart_new               = new YTChart();
AxisGroup axisGroup_new       = new AxisGroup();
Channel channel_new = new Channel();
AcquisitionInterpreter acquisitionInterpreter_new = new AcquisitionInterpreter();
AdsAcquisition adsAcquisition_new = new AdsAcquisition();

scopeProject_new.AddMember(chart_new);
chart_new.AddMember(axisGroup_new);
axisGroup_new.AddMember(channel_new);
channel_new.AddMember(acquisitionInterpreter_new);
acquisitionInterpreter_new.AddMember(adsAcquisition_new);

The creation of a configuration in the C# code has passed from the static framework into a dynamic sequence. The methods to create a further object on the hierarchically higher object and to add it no longer exist. Now all objects can be created separately and added using the "AddMember" method.

Care should be taken here that the hierarchy is maintained as in the sample. It is possible not to create individual hierarchy steps. This will then be done automatically. (Example: adding an acquisition to an AxisGroup causes a channel and an AcquisitionInterpreter object to be created).

The objects are always added in the "SubMember" list of the superordinate object. If a search is carried out for an object later on, one can simply run recursively through the lists in order to get from the project object to the acquisition.

Adapting the style

channel_old.Style.ScaleFactor = 2;
channel_old.Style.Offset      = 2;
channel_old.Style.LineColor   = Color.Red;
channel_old.Style.MarkColor   = Color.DarkRed;
channel_old.Style.LineWidth   = 2;
acquisitionInterpreter_new.ScaleFactor = 2;
acquisitionInterpreter_new.Offset      = 2;
SeriesStyle seriesStyle                = channel_new.Style.SubMember.OfType<SeriesStyle>().First();
seriesStyle.DisplayColor               = Color.Green;
seriesStyle.MarkColor                  = Color.DarkRed;
seriesStyle.LineWidth                  = 2;

Properties that influence the values of a channel have been moved from the Channel.Style into the AcquisitionInterpreter.

Other style properties that define the style of a graph can be found in the SeriesStyle class. This class is a SubMember of the ChannelStyle class, which can in turn be found in the SubMembers of a channel.

The style classes have the following structure:

Overview of the various style hierarchies. The subordinate classes are always located in the SubMember lists of the superordinate class.

Chart

AxisGroup

Axis

Channel

Adapting the acquisition

channel_old.Acquisition.AmsNetId      = new AmsNetId("172.17.61.30.1.1");
channel_old.Acquisition.TargetPort    = 851;
channel_old.Acquisition.IsSymbolBased = true;
channel_old.Acquisition.SymbolName    = "Variables.fSine";
channel_old.Acquisition.DataType      = Scope2DataType.REAL64;
channel_old.Acquisition.SampleTime    = (uint)TimeSpan.TicksPerMillisecond;
adsAcquisition_new.AmsNetIdString    = "172.17.61.30.1.1";
adsAcquisition_new.TargetPort        = 851;
adsAcquisition_new.IsSymbolBased     = true;
adsAcquisition_new.SymbolName        = "Variables.fSine";
adsAcquisition_new.DataType          = Scope2DataType.REAL64;
adsAcquisition_new.SampleTime        = (uint)TimeSpan.TicksPerMillisecond;

Nothing has changed in the configuration of the acquisition.

Controlling the recording

//Start Record
scopeViewControl.Operating.StartRecord();
scopeViewControl.Operating.StartAllDisplays();
//Stop Record
scopeViewControl.Operating.StopRecord();

//Save SVD
scopeViewControl.Operating.SaveData("ExportData.svd");
//Start Record
scopeProject.StartRecord();
foreach(Chart chart in scopeProject.SubMember.OfType<Chart>())
{
    chart.StartDisplay();
}

//Stop Record
scopeProject.StopRecord();

//Save SVD
scopeProject.SaveData("ExportData.svdx");

The functions for handling an exception have been moved from the Operating object directly into the ScopeProject class.

A chart is started directly via the StartDisplay method and no longer via the Operating class.

When saving, note that the extension of the new data format is "svdx" and no longer "svd".