The Analysis Plugins execute using two main steps.
-
Configuration
-
Analysis
As the developer you are responsible for implementing these two steps. These steps are exposed using interfaces by way of C++ base classes. All you need to do is follow the example in the sample plugin found at: "$(ProgramFiles)\HyperX\Code\AnalysisPlugins.zip".
Configuration
The configuration is set up at the beginning of the analysis process. It is used to define global Plugin options and configuration.
As the developer you are responsible for implementing the ConfigurationBase class.
Analysis
The Plugin Package is called repeatedly for each Zone and for each load case.
As the developer you are responsible for implementing the PluginPackageBase class. It is responsible for running each Plugin in the Package and populating the results data.
ConfigurationBase is the interface used to configuration the Package (name, units, etc), Plugins, and user defined Analysis Settings.
An implementation of ConfigurationBase is provided in the source code.
The number of Analysis Details stored must be constant for each Plugin. For example, for stiffener crippling you may wish to output data for each object of the stiffener (foot, web, cap). However, the number of objects is dependent on the concept (I-concepts have a foot, web, and cap, T-concepts have only a foot and web). In this case you must defined details for all 3 objects regardless of the concept type. The sample Plugin has an example of this scenario.
Virtual Methods
|
Virtual Method |
Parameters |
Return Type |
Description |
|---|---|---|---|
|
Configure |
Returns the configuration the plugin package. |
Example Implementation
The ConfigurationBase interface is implemented in the Configuration class in HsConfiguration.h/.cpp.
HsConfiguration.h - Read only
/*
Configuration Header
Do not modify this code.
*/
#pragma once
#include <hs.h>
//
// Configuration class.
// Do not modify this code.
//
class Configuration : public hs::ConfigurationBase
{
public:
Configuration() :
hs::ConfigurationBase() { }
virtual hs::PackageConfiguration Configure() override;
};
// Links the configuration class to the C API. Do not modify.
USER_CONFIGURATION(Configuration)
HsConfiguration.cpp (see also User Defined Analysis Details).
/*
Configuration Implementation
Modify the Configure() method to define the plugin package configuration.
Terminology
-----------
Package = The binary DLL file.
Plugin = Each analysis (MS) in the package.
GUID = (G)lobally (U)nique (Id)entife
How to Use GUIDs
----------------
GUIDs are used to establish identity in the HyperSizer database.
By using GUIDs, you can rename a plugin or package entity and retain your old results.
GUIDs can be generated using other programs.
1) Online - https://www.guidgenerator.com/online-guid-generator.aspx.
2) Visual Studio - Tools | Create GUID
*/
#include "HsConfiguration.h"
#include "CoreAnalysis.h"
#include "Ids.h"
hs::PackageConfiguration Configuration::Configure()
{
//
// Create a new package configuration.
// Modify the various attributes.
//
auto config = hs::PackageConfiguration();
config.Name("Sample Plugin Package");
config.Version("1.0");
config.GUID("0af0975a-79ee-4650-b4a4-6cd186588af8"); // See 'How to Use GUIDs' above.
config.Description("Stiffened panel plugins to demonstrate the analysis plugin API.");
config.Force(ForceUnits::LB);
config.Length(LengthUnits::IN);
config.Mass(MassUnits::LB);
config.Temperature(TemperatureUnits::Fahrenheit);
//
// Create the plugins.
// Follow the existing pattern.
//
// 1) Each plugin has a name, version, ID, GUID, and category.
// Modify the PluginId enumeration in Configuration.h for the ID.
// See 'How to Use GUIDs' at the top of the file for information on the GUID field.
// 2) Each plugin is either concept-based (e.g. column buckling) or object-based (e.g. max strain).
// Use the AddConcept() and AddObject() methods respectively to define the relevant concepts/objects.
// 3) Define the analysis details for reporting.
// Use the AddDetail() method.
// Define your own details for each plugin.
//
// Column Buckling.
config.AddPlugin(hs::Plugin()
.Name("Column Buckling")
.Version("1.0")
.Id(PluginId::ColumnBuckling)
.GUID("25552272-b074-4f3b-b1de-672bf4bfd2ad")
.Category(hs::AnalysisCategory::BucklingPanel)
.AddConcept(hs::ConceptUniaxial::Ipanel)
.AddConcept(hs::ConceptUniaxial::Jpanel)
.AddConcept(hs::ConceptUniaxial::Tpanel)
.AddConcept(hs::ConceptUniaxial::Zpanel)
.AddConcept(hs::ConceptUniaxial::Cpanel)
.AddConcept(hs::ConceptUniaxial::Bpanel)
.AddDetails(ColumnBuckling::Details())); // Assigning the Details. See also Creating User Stress Reports
// And so on for the other analysis plugins
//
// Create the user constants.
// Follow the same patten as the plugins.
// Be sure to specify a default value (numeric or text).
//
config.AddUserConstant(hs::UserConstantDefinition()
.Name("c_fixity")
.Id(UserConstantId::ColumnFixity)
.GUID("3730e880-cc72-4850-a2fb-7dec1ba99150")
.Description("Fixity coefficient for Euler buckling. 1.0 = Simple, 4.0 = Fixed.")
.DefaultValue(1.7));
return config;
}
PluginPackageBase defines the main analysis interface. The user is responsible for implementing this interface. However, the sample implementation shown below (and included in the API) is designed to be used without modification.
PluginPackageBase has a single virtual method, Analyze, which is called by HyperX.
|
Method |
Access |
Parameters |
Return Type |
Description |
|---|---|---|---|---|
|
|
|
Runs each Plugin in the Package. Populates a list of results. Users are responsible for the implementation. |
The analysis input PanelBeamState is stored as a protected field.
|
Fields |
Access |
Type |
Description |
|---|---|---|---|
|
|
|
Contains all analysis input: geometry, allowables, loads, Analysis Settings, and analysis flags. |
Example Implementation
The PluginPackageBase interface is implemented in the PluginPackage class in HsAnalysis.h/.cpp.
HsAnalysis.h - Read only
/*
Plugin Package Header
This class is called from the HyperSizer analysis process.
The plugin package inherits from PluginPackageBase.
You are responsible for implementing the Analyze() method (in the corresponding *.cpp file).
Do not modify this file.
*/
#pragma once
#include <hs.h>
class PluginPackage : public hs::PluginPackageBase
{
public:
PluginPackage(hs::PanelBeamState state) :
hs::PluginPackageBase(state) { }
// Override this method from PluginPackageBase.
virtual hs::ResultList Analyze() override;
};
// Links the plugin package class to the C API. Do not modify.
USER_PLUGIN_PACKAGE(PluginPackage)
HsAnalysis.cpp
/*
Plugin Package Implementation
This class is called from the HyperSizer analysis process.
Here you are responsible for implementing the Analyze() method.
Simply return a ResultList instance.
The real analysis work takes place in the classes defined in CoreAnalysis.h/.cpp.
The PluginPackageBase class interface in general and the PanelBeamState variable in particular
are subject to change and tightly coupled to the HyperSizer API.
Separating the plugin API mapping logic from the analysis work helps keep the analysis
implementation clean to deal with future changes to the API.
*/
#include "PluginPackage.h"
#include "CoreAnalysis.h"
hs::ResultList PluginPackage::Analyze()
{
// This is where the interface between the core analysis code should be defined.
// Users are responsible for the implementation.
// The sample plugin package used in the tutorial contains an example.
}
In additional to supplied input data, users can add their own inputs.
User Defined Analysis Settings
User Defined Analysis Settings used to be component settings but now they are settings on Failure Modes. The example below shows an Analysis Setting for a column buckling analysis, "c_fixity":
-
User Defined Analysis Settings are created in the Plugin Package configuration method
-
Values can be numeric data or text.
-
At analysis time, this data is passed into the plugin via the
UserConstantsclass. See UserConstants.
In addition to returning margins of safety, plugins also return custom Analysis Details. These Details are stored with the margin of safety per Zone, per analysis. The code listing below shows how the custom Details are defined. For information about how to view stress reports, see: Stress Reports.
Configuration Code
All aspects of the details of each Plugin are defined in code prior to analysis. Each Detail is assigned a name and units.
Each Detail will represent a column in the final Stress Report. These details are helpful for verifying margins and determining intermediate values of interest. For more information regarding the detail name markup syntax, see: Stress Report Markup Syntax
namespace ColumnBucklingDetails
{
// It is important to declare these as static variables. Otherwise, they will be reinitialized during every
// single plugin call, which is very time consuming.
static const auto NxApp = hs::DetailDefinition("N<x,app>", hs::Units::UnitForce);
static const auto Nxcr = hs::DetailDefinition("N<_x,cr>", hs::Units::UnitForce);
static const auto D11sym = hs::DetailDefinition("D<_11,sym>", hs::Units::DTerm);
static const auto cFixity = hs::DetailDefinition("c<_fixity>", hs::Units::NoneReal);
static const auto L = hs::DetailDefinition("L", hs::Units::Length);
static const auto Leff = hs::DetailDefinition("L<_eff>", hs::Units::Length);
}
hs::DetailDefinitionList ColumnBucklingDetails()
{
return hs::DetailDefinitionList
{
ColumnBucklingDetails::NxApp,
ColumnBucklingDetails::Nxcr,
ColumnBucklingDetails::D11sym,
ColumnBucklingDetails::cFixity,
ColumnBucklingDetails::L,
ColumnBucklingDetails::Leff,
}
}
Assigning the details to a plugin:
auto columnBuckling = hs::Plugin()
.Name("Column Buckling")
.Version("1.0")
.Id(PluginId::ColumnBuckling)
.GUID("25552272-b074-4f3b-b1de-672bf4bfd2ad")
.Category(hs::AnalysisCategory::BucklingPanel)
.AddConcept(hs::ConceptUniaxial::Ipanel)
.AddConcept(hs::ConceptUniaxial::Jpanel)
.AddConcept(hs::ConceptUniaxial::Tpanel)
.AddConcept(hs::ConceptUniaxial::Zpanel)
.AddConcept(hs::ConceptUniaxial::Cpanel)
.AddConcept(hs::ConceptUniaxial::Bpanel)
.AddDetails(ColumnBuckling::Details()); // Assigning the Details
config.AddPlugin(columnBuckling);
Analysis Code
During analysis, results are stored. These consist of both margins of safety and user-defined Details.
// Do calculations for column buckling. c_fixity = ... L = ... D11sym = ... NxApp = ... L_eff = ... Nx_cr = ... MS = ... // Store the results. auto results = hs::ResultList(); // Storage for margins auto details = hs::DetailList(); // Storage for analysis details results.Add(hs::AnalysisResult(PluginId::ColumnBuckling, MS)); details.Add(ColumnBucklingDetails::cFixity, c_fixity); details.Add(ColumnBucklingDetails::L, L); details.Add(ColumnBucklingDetails::D11sym, D11_sym); details.Add(ColumnBucklingDetails::NxApp, Nx_app); details.Add(ColumnBucklingDetails::Leff, L_eff); details.Add(ColumnBucklingDetails::Nxcr, Nx_cr); // Add all analysis details. results.Add(details);
Adding a new version of the Plugin API is a fairly straightforward process. For users transitioning plugins from a previous version of HyperSizer Pro to their current version of HyperX, first copy the zipped folder from the install directory containing the Plugin API ($(ProgramFiles)\HyperX\Code\AnalysisPlugins.zip). Unzip this folder and copy the API folder (e.g. hs_{versionYear}_1_8) to the location of your current HyperSizer Pro API.
Open your Plugin project in Visual Studio. Right-click on the project and select "Properties". Navigate to Configuration Properties | C/C++ | General, and beside Additional Include Directories update the folder name to match the new API.
Build the project. If you encounter compilation errors, please refer to the API Release Notes, as breaking changes might have been made between older and current versions of the API.