![]() ![]() ![]() ![]() ![]() |
|
微波射频仿真设计 |
|
首页 >> Ansoft Designer >> Ansoft Designer在线帮助文档 |
Nexxim Simulator > API Functions for All Model TypesParameter Declaration Each C model declares its model parameters or properties as private objects. For example: private: // parameters double R; NOTE: In the code template files, the private parameter declarations appear after the public functions. Get Model Attribute This function returns a bitwise combination of model attributes that characterize the information in the C model file. The syntax is: unsigned int get_model_attribute(); The function should return the model type ORed with other attributes as appropriate. Model types are: ANALOG_VI_MODEL S_PARAMETER_MODEL Y_PARAMETER_MODEL Other attributes are: HAS_DERIVATIVES // The model computes derivatives HAS_NOISE_SRC // The model includes noise sources SUBSTRATE_REQUIRED // The model requires a substrate For example: unsigned int get_model_attribute() Get Node Count This function should return the number of nodes in the model. The syntax is: int get_node_count(); For example: int get_node_count() Get Node Name This function returns a node name in the model each time it is called. The syntax is: char* get_node_name(int index); If no names are provided, a default naming system (node_0, node_1, ...) is used. For example: char* get_node_name(int index) { static char* node_names[] = {"pos", "neg"}; return node_names[index]; } Nexxim uses the return from get_node_count to set the zero-based index values. Set Parameter This function sets a model parameter to the value set by the user in the schematic. The return value is a flag indicating success or error. The syntax is: int set_parameter(char* name, double value); This example shows the available flags. int set_parameter(char* param_name, double value) { if (caseinsensitive_compare(param_name,"R")) { param_name=value; return PARAMETER_SET; } return INVALID_PARAMETER; } Validate Instance This function should check parameter ranges and return a flag indicating that the model is valid or invalid. The syntax is: int validate_instance(); This example shows the available flags. int validate_instance() { if (R<0 || R>1e100) if (R == 0.0) return INVALID_PARAMETER; // Resistor can't be zero for this implementation } return PARAMETERS_VALIDATED; } Set Substrate Information This function is called to write information about the substrate to models that require it. Nexxim calls this routine when the attributes reutrned by the set_model_attribute function include SUBSTRATE_REQUIRED. The syntax is: int set_substrate_info( char* name, int type, double h, double b,
double bl, { if (!m_substrate_info) m_substrate_info = new udm_substrate_info;
m_substrate_info->name = name; m_substrate_info->type = type; m_substrate_info->h = h; m_substrate_info->b = b; m_substrate_info->bl = bl; m_substrate_info->er = er; m_substrate_info->tand = tand; m_substrate_info->hu = hu; m_substrate_info->met1 = met1; m_substrate_info->t1 = t1; m_substrate_info->met2 = met2; m_substrate_info->t2 = t2; m_substrate_info->met3 = met3; m_substrate_info->t3 = t3; m_substrate_info->rgh = rgh; m_substrate_info->msat = msat; m_substrate_info->mrem = mrem; m_substrate_info->tanm = tanm;
return UDM_SUCCESS; } Error Post This function may be used by the model to display messages. The syntax is: void error_post(int severity, std::string const& message) The severity argument uses one of the predefined tokens: trace_msg_level status_msg_level warning_msg_level error_msg_level For example: error_post(warning_msg_level, "Resistor value cannot be zero for this model");
HFSS视频教程 ADS视频教程 CST视频教程 Ansoft Designer 中文教程 |
Copyright © 2006 - 2013 微波EDA网, All Rights Reserved 业务联系:mweda@163.com |