本文整理汇总了C#中Port.setIdRef方法的典型用法代码示例。如果您正苦于以下问题:C# Port.setIdRef方法的具体用法?C# Port.setIdRef怎么用?C# Port.setIdRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Port
的用法示例。
在下文中一共展示了Port.setIdRef方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static int Main(string[] args)
{
int retval = 0;
SBMLNamespaces sbmlns = new SBMLNamespaces(3, 1, "comp", 1);
// create the document
SBMLDocument document = new SBMLDocument(sbmlns);
// create the Model
Model model = document.createModel();
// create a replacement parameter
Parameter parameter = model.createParameter();
parameter.setId("x");
parameter.setConstant(true);
// create a parameter to be a conversion factor
Parameter param2 = model.createParameter();
param2.setId("x_conv");
param2.setMetaId("_110013");
param2.setConstant(true);
// create a parameter to be a conversion factor
Parameter param3 = model.createParameter();
param3.setId("lcf");
param3.setConstant(true);
// Convert parameter to the plugin version so we can add the new attributes and replacements to it.
CompSBasePlugin splugin = (CompSBasePlugin) (parameter.getPlugin("comp"));
// Add a replaced element.
ReplacedElement rep1 = splugin.createReplacedElement();
int rv = rep1.setSubmodelRef("submod1");
rv = rep1.setConversionFactor("x_conv");
rv = rep1.setIdRef("param1");
// Add a second replaced element in a different way.
ReplacedElement rep2 = new ReplacedElement();
rv = rep2.setSubmodelRef("submod2");
rv = rep2.setDeletion("del1");
rv = splugin.addReplacedElement(rep2);
//Now create a replaced element that points into a submodel.
rep2.unsetDeletion();
rep2.setIdRef("submod2");
SBaseRef sbr5 = rep2.createSBaseRef();
sbr5.setIdRef("submodelG");
SBaseRef sbr6 = sbr5.createSBaseRef();
sbr6.setIdRef("buriedElement");
splugin.addReplacedElement(rep2);
// Create a submodel
CompModelPlugin mplugin = (CompModelPlugin) (model.getPlugin("comp"));
CompSBMLDocumentPlugin compdoc = (CompSBMLDocumentPlugin) (document.getPlugin("comp"));
compdoc.setRequired(true);
ModelDefinition moddef1 = compdoc.createModelDefinition();
moddef1.setId("Mod1");
Parameter m1param1 = moddef1.createParameter();
m1param1.setId("param1");
m1param1.setConstant(true);
Parameter m1param2 = moddef1.createParameter();
m1param2.setId("param2");
m1param2.setConstant(false);
m1param2.setValue(3.2);
ModelDefinition moddef2 = new ModelDefinition();
moddef2.setId("Mod2");
Parameter subparam2 = moddef2.createParameter();
subparam2.setId("subparam2");
subparam2.setConstant(false);
compdoc.addModelDefinition(moddef2);
ExternalModelDefinition extmod1 = compdoc.createExternalModelDefinition();
extmod1.setId("ExtMod1");
extmod1.setSource("urn:miriam:biomodels.db:BIOMD0000000127");
ExternalModelDefinition extmod2 = new ExternalModelDefinition();
extmod2.setId("ExtMod2");
extmod2.setSource("otherfile.xml");
extmod2.setModelRef("modelnamethere");
extmod2.setMd5("406022s908ge74sklj");
compdoc.addExternalModelDefinition(extmod2);
Submodel submod1 = mplugin.createSubmodel();
submod1.setId("submod1");
submod1.setModelRef("Mod1");
Deletion del1 = submod1.createDeletion();
del1.setId("deletionA");
del1.setIdRef("param2");
Submodel submod2 = new Submodel();
submod2.setId("submod2");
submod2.setModelRef("ExtMod1");
submod2.setSubstanceConversionFactor("subcf");
submod2.setTimeConversionFactor("tcf");
submod2.setExtentConversionFactor("xtf");
Deletion del2 = new Deletion();
del2.setId("deletionB");
del2.setMetaIdRef("_0010110");
//.........这里部分代码省略.........
示例2: Main
private static int Main(string[] args)
{
var retval = 0;
var sbmlns = new SBMLNamespaces(3, 1, "comp", 1);
// create the document
var document = new SBMLDocument(sbmlns);
//Define the external model definition
var compdoc = (CompSBMLDocumentPlugin)(document.getPlugin("comp"));
compdoc.setRequired(true);
var extmod = compdoc.createExternalModelDefinition();
extmod.setId("ExtMod1");
extmod.setSource("enzyme_model.xml");
extmod.setModelRef("enzyme");
//Define the 'simple' model
var mod1 = compdoc.createModelDefinition();
mod1.setId("simple");
var comp = mod1.createCompartment();
comp.setSpatialDimensions(3);
comp.setConstant(true);
comp.setId("comp");
comp.setSize(1L);
var spec = new Species(sbmlns);
//We have to construct it this way because we get the comp plugin from it later.
spec.setCompartment("comp");
spec.setHasOnlySubstanceUnits(false);
spec.setConstant(false);
spec.setBoundaryCondition(false);
spec.setId("S");
spec.setInitialConcentration(5);
mod1.addSpecies(spec);
spec.setId("D");
spec.setInitialConcentration(10);
mod1.addSpecies(spec);
var rxn = new Reaction(3, 1);
rxn.setReversible(true);
rxn.setFast(false);
rxn.setId("J0");
var sr = new SpeciesReference(3, 1);
sr.setConstant(true);
sr.setStoichiometry(1);
sr.setSpecies("S");
rxn.addReactant(sr);
sr.setSpecies("D");
rxn.addProduct(sr);
mod1.addReaction(rxn);
var mod1plug = (CompModelPlugin)(mod1.getPlugin("comp"));
var port = new Port();
port.setId("S_port");
port.setIdRef("S");
mod1plug.addPort(port);
var port2 = mod1plug.createPort();
port2.setId("D_port");
port2.setIdRef("D");
port.setId("comp_port");
port.setIdRef("comp");
mod1plug.addPort(port);
port.setId("J0_port");
port.setIdRef("J0");
mod1plug.addPort(port);
// create the Model
var model = document.createModel();
model.setId("complexified");
// Set the submodels
var mplugin = (CompModelPlugin)(model.getPlugin("comp"));
var submod1 = mplugin.createSubmodel();
submod1.setId("A");
submod1.setModelRef("ExtMod1");
var submod2 = mplugin.createSubmodel();
submod2.setId("B");
submod2.setModelRef("simple");
var del = submod2.createDeletion();
del.setPortRef("J0_port");
// Synchronize the compartments
var mcomp = model.createCompartment();
mcomp.setSpatialDimensions(3);
mcomp.setConstant(true);
mcomp.setId("comp");
mcomp.setSize(1L);
var compartplug = (CompSBasePlugin)(mcomp.getPlugin("comp"));
var re = new ReplacedElement();
re.setIdRef("comp");
re.setSubmodelRef("A");
compartplug.addReplacedElement(re);
re.setSubmodelRef("B");
re.unsetIdRef();
re.setPortRef("comp_port");
//.........这里部分代码省略.........