• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Product
    • Design UI
    • Develop
    • Analyze and test
    • Deploy
    • Framework and toolbox
    • Compatibility
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - Simulator
  • SimPort
  • 4.11.14

SimPort Class

(CDPSim::SimPort)

The SimPort is a CDPPort which is able to aggregate SimSignals. It can only be added to simulator components. To use it, inherit your class from SimPort and add some SimSignals. More...

Header: #include <DynamicSimComponent/SimPort.h>
Inherits: CDPPort
  • List of all members, including inherited members

Reimplemented Public Functions

virtual void Configure(XMLElementEx *xml) override
virtual void FillNodeChildren(CDP::StudioAPI::NodeStream &serializer) const override
  • 25 public functions inherited from CDPPort
  • 37 public functions inherited from CDPObject
  • 42 public functions inherited from CDPBaseObject
  • 26 public functions inherited from CDP::StudioAPI::CDPNode
  • 22 public functions inherited from CDP::StudioAPI::ICDPNode

Reimplemented Protected Functions

virtual bool HasNamedValueChild(const std::string &name) override
virtual bool IsInputConnection(XMLElementEx *connection) override
  • 5 protected functions inherited from CDPPort
  • 13 protected functions inherited from CDPObject
  • 1 protected function inherited from CDP::StudioAPI::CDPNode

Additional Inherited Members

  • 25 public functions inherited from CDPPort
  • 37 public functions inherited from CDPObject
  • 42 public functions inherited from CDPBaseObject
  • 26 public functions inherited from CDP::StudioAPI::CDPNode
  • 22 public functions inherited from CDP::StudioAPI::ICDPNode
  • 6 static public members inherited from CDPObject
  • 1 static public member inherited from CDPBaseObject
  • 5 protected functions inherited from CDPPort
  • 13 protected functions inherited from CDPObject
  • 1 protected function inherited from CDP::StudioAPI::CDPNode
  • 9 protected variables inherited from CDPObject
  • 10 protected variables inherited from CDPBaseObject

Detailed Description

The SimPort is a CDPPort which is able to aggregate SimSignals. It can only be added to simulator components. To use it, inherit your class from SimPort and add some SimSignals.

Description

The SimPort is used to aggregate multiple SimSignals into a single data structure that can be connected to another SimPort by setting a single Routing. The port allows two-way connection, for that each SimSignal must specify whether they are inputs or outputs of the port.

Usage

To use SimPort:

  • Create a new class and make it inherit from SimPort.
  • Add your SimSignals and register them by calling SimSignal::Create.
  • Make sure the SimSignals have been added to SimPort model in Configure mode and also listed as CDPPort Connections.
  • Make sure the Input flag of every SimSignal is correctly set for each input and output signal.
  • Build the library and use the SimPort from simulator component code as a regular CDPPort is used.

Code

In the class header:

#include <CDPSim/DynamicSimComponent/SimPort.h>
namespace SimLib {
class MySimPort : public CDPSim::SimPort
{
public:
    void Create(const char* shortName, CDPComponent* parent) override;
    CDPSim::SimSignal MySignal;
};
}

In the implementation file:

#include "MySimPort.h"
using namespace SimLib;
void MySimPort::Create(const char* shortName, CDPComponent* parent)
{
    CDPPort::Create(shortName, parent); // Always call base
    MySignal.Create("MySignal", this);
}

To use the created MySimPort, add it to your simulator component.

class MySimComponent : public CDPSim::DynamicSimComponent
{
  ...
  SimLib::MySimPort Port;
};

void MySimComponent::Create(const char* fullName)
{
  CDPSim::DynamicSimComponent::Create(fullName); // Always call base class.
  Port.Create("Port", this);
}

void MySimComponent::EvaluateDiffEquations(double t)
{
  // Use Port.MySignal in your calculations
}

Member Function Documentation

[override virtual] void SimPort::Configure(XMLElementEx *xml)

Reimplemented from CDPObject::Configure().

[override virtual] void SimPort::FillNodeChildren(CDP::StudioAPI::NodeStream &serializer) const

Reimplemented from CDPNode::FillNodeChildren().

Exposes child nodes of this node to StudioAPI.

[override virtual protected] bool SimPort::HasNamedValueChild(const std::string &name)

Reimplemented from CDPPort::HasNamedValueChild().

[override virtual protected] bool SimPort::IsInputConnection(XMLElementEx *connection)

Reimplemented from CDPPort::IsInputConnection().

Override to programmatically determine whether a Connection is input or output.

Base implementation matches Connection input with relevant SimSignal input.

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

    © Copyright 2022 CDP Technologies. Privacy and cookie policy.

    Return to top