/// <summary> /// Gets the default properties for a transport protocol /// </summary> /// <remarks> /// Each transport protocol supported by the ADK is represented by a class /// that implements the Transport interface. Transports are identified by /// a string such as "http" or "https". Like Zones, each Transport instance /// is associated with a set of properties specific to the transport /// protocol. Such properties may include IP address, port, SSL security /// attributes, and so on. The default properties for a given transport /// protocol may be obtained by calling this method. /// </remarks> /// <param name="protocol"></param> /// <returns>The default properties for the specified protocol</returns> /// <exception cref="AdkTransportException">is thrown if the protocol is not supported /// by the ADK</exception> public TransportProperties GetDefaultTransportProperties(String protocol) { // Already initialized? if (fDefaultTransportProps == null) { fDefaultTransportProps = new List <TransportProperties>(); } else { foreach (TransportProperties props in fDefaultTransportProps) { if (props.Protocol.Equals(protocol)) { return(props); } } } // Didn't find the transport properties above. Create a new one and return it TransportPlugin tp = Adk.GetTransportProtocol(protocol); if (tp == null) { throw new AdkTransportException("The requested transport protocol: '" + protocol + "' is not supported by this instance of the ADK", null); } TransportProperties properties = tp.CreateProperties(); properties.Defaults(null); fDefaultTransportProps.Add(properties); return(properties); }
public ITransport GetTransport(String protocol) { if (protocol == null) { throw new ArgumentException("Protocol cannot be null"); } protocol = protocol.ToLower(); foreach (ITransport trans in fTransports) { if (trans.Protocol.Equals(protocol)) { return(trans); } } // No transport has been created for this protocol yet. Create // new one using the TransportPlugin TransportPlugin tp = Adk.GetTransportProtocol(protocol); TransportProperties defs = GetDefaultTransportProperties(protocol); ITransport transport = tp.NewInstance(defs); fTransports.Add(transport); return(transport); }
void SaveConfiguration() { SelectedConnection.Name = NameText.Text; TransportProperties.SaveConfiguration(); ModemProperties.SaveConfiguration(); EmulatorProperties.SaveConfiguration(); }
private SteelFlowProjectFile() : base() { inletNames = new List <string>(); upfaceNames = new List <string>(); symNames = new List <string>(); outletNames = new List <string>(); wallNames = new List <string>(); U = new FieldFile("U", Dimension.U, new InternalField(new VectorVar(0.0, 0.0, 0.0, true))); p = new FieldFile("p", Dimension.P, new InternalField(new ScalerVar(0, true))); k = new FieldFile("k", Dimension.K, new InternalField(new ScalerVar(0.001, true))); nut = new FieldFile("nut", Dimension.NU, new InternalField(new ScalerVar(0.0, true))); epsilon = new FieldFile("epsilon", Dimension.EPSILON, new InternalField(new ScalerVar(0.1, true))); this.Fields.AddRange(new FieldFile[] { U, p, k, nut, epsilon }); TransportProperties.AddPropertie("nu", new ScalerVar(Material.DynamicViscosity / Material.Density, Dimension.NU)); TurbulenceProperties.Model = new KEpsilon(); Ddt ddtSteady = new Ddt(Ddt.DdtTypes.steadyState); Interpolation ipLinear = new Interpolation(Interpolation.InterpolationTypes.linear); Interpolation ipUpwind = new Interpolation(Interpolation.InterpolationTypes.upwind); Grad gdGaussLinear = new Grad(Grad.GradTypes.Gauss, ipLinear); Grad gdGaussUpwind = new Grad(Grad.GradTypes.Gauss, ipUpwind); Div dvGaussUpwind = new Div(Div.DivTypes.Gauss, ipUpwind); Div dvGaussLinear = new Div(Div.DivTypes.Gauss, ipLinear); SnGrad sgLimitedCorrected = new SnGrad(SnGrad.SnGradTypes.limited, "corrected 0.33"); Laplacian lpGaussLinear = new Laplacian(Laplacian.LaplacianTypes.Gauss, ipLinear, sgLimitedCorrected); FvSchemes.AddDdtSchemes(ddtSteady); FvSchemes.AddGradSchemes(gdGaussLinear); FvSchemes.AddDivSchemes(dvGaussLinear); FvSchemes.AddDivSchemes("div(phi,U)", dvGaussUpwind); FvSchemes.AddDivSchemes("div(phi,k)", dvGaussUpwind); FvSchemes.AddDivSchemes("div(phi,epsilon)", dvGaussUpwind); FvSchemes.AddLaplacianSchemes(lpGaussLinear); FvSchemes.AddInterpolationSchemes(ipLinear); FvSchemes.AddSnGradSchemes(sgLimitedCorrected); Simple simple = new Simple(); simple.residual.SetResidual("p", 1e-4); simple.residual.SetResidual("U", 1e-4); simple.residual.SetResidual("\"(k|omega|epsilon)\"", 1e-4); FvSolution.Solution = simple; FvSolution.Relaxation.AddFieldFactor("p", 0.3); FvSolution.Relaxation.AddEquationFactor("U", 0.7); FvSolution.Relaxation.AddEquationFactor("\"(k|omega|epsilon).*\"", 0.7); GAMG gamgP = new GAMG("p", 1e-6, 0.1, Solver.SmootherTypes.GaussSeidel); SmootherSolver ssOther = new SmootherSolver("\"(U|k|omega|epsilon)\"", 1e-5, 0.1, Solver.SmootherTypes.GaussSeidel); GAMG gamgOther = new GAMG("\"(U|k|omega|epsilon)\"", 1e-6, 0.1, Solver.SmootherTypes.GaussSeidel); FvSolution.AddSolver(gamgP); FvSolution.AddSolver(ssOther); }
/// <summary> /// Initializes the enabled agent transports /// </summary> /// <param name="agent"></param> /// <exception cref="AdkTransportException">If the ADK is configured improperly</exception> public void Activate(Agent agent) { // Initialize each transport supported by the ADK foreach (String protocol in Adk.TransportProtocols) { TransportProperties tp = GetDefaultTransportProperties(protocol); if (tp.Enabled) { ITransport transport = GetTransport(protocol); transport.Activate(agent); } } }
public ProjectFile() { fields = new List <FieldFile>(); boundaryNames = new List <string>(); otherFiles = new List <FoamFile>(); controlDict = new ControlDict(); transportProperties = new TransportProperties(); turbulenceProperties = new TurbulenceProperties(new KEpsilon()); material = new Material("Steel"); material.Density = 6940.0; material.DynamicViscosity = 0.006293; fvSchemes = new FvSchemes(); fvSolution = new FvSolution(new OpenCFD.Solutions.Simple()); }
public override ITransport NewInstance(TransportProperties props) { return new HttpTransport((HttpProperties)props); }
/// <summary> Applies <c><transport></c> elements to the Agent. /// /// This method selects the <c><transport></c> child of the root /// <c><agent></c> with the <i>enabled</i> attribute set to true. /// More than one transport may be enabled; if more than one is enabled the last /// definition is considered the agent's default transport protocol. The /// <c><property></c> elements are then assigned to the agent's /// default transport properties for this protocol. /// /// /// </summary> /// <param name="agent">The Agent to apply the transport properties to /// </param> /// <param name="overwrite">When true, properties defined in the configuration file /// replace properties of the same name that are already defined in the /// agent's default transport properties /// </param> public virtual void ApplyTransports(Agent agent, bool overwrite) { // // Enumerate all <transport> elements of the root; ignore elements // where the 'enabled' attribute is set to false // if (RootNode != null) { foreach (XmlElement n in RootNode.SelectNodes(XmlConstants.TRANSPORT_ELEMENT)) { string proto = n.GetAttribute(XmlConstants.PROTOCOL); // Get default properties for this transport protocol TransportProperties tp = agent.GetDefaultTransportProperties(proto); if (tp == null) { throw new AdkConfigException("Transport protocol not supported: " + proto); } Boolean isEnabled = XmlUtils.IsElementEnabled(n); if (isEnabled) { String prev = agent.Properties.GetProperty(AgentProperties.PROP_MESSAGING_TRANSPORT); if (prev == null) { if ((Adk.Debug & AdkDebugFlags.Properties) != 0) { Agent.Log.Info("Configuration file selecting " + proto.ToUpperInvariant() + " as the default transport protocol"); } agent.Properties.TransportProtocol = proto; } } tp.Enabled = isEnabled; // // Enumerate all <property> elements of this <transport> ... // foreach (XmlElement prop in n.SelectNodes(AdkXmlConstants.Property.ELEMENT)) { string nam = prop.GetAttribute(AdkXmlConstants.Property.NAME); string val = prop.GetAttribute(AdkXmlConstants.Property.VALUE); if (tp.Contains(nam)) { if (overwrite) { if ((Adk.Debug & AdkDebugFlags.Properties) != 0) { Agent.Log.Debug ("Configuration file overwriting " + proto.ToUpper() + " transport property: " + nam + " = " + val); } tp[nam] = val; } } else { if ((Adk.Debug & AdkDebugFlags.Properties) != 0) { Agent.Log.Debug ("Setting " + proto.ToUpper() + " transport property from configuration file: " + nam + " = " + val); } tp[nam] = val; } } } } }
/// <summary> /// Creates a new instance of this transport /// </summary> /// <param name="props">The Transport properties to use for this transport</param> /// <returns></returns> public abstract ITransport NewInstance(TransportProperties props);
public override ITransport NewInstance(TransportProperties props) { return(new HttpTransport((HttpsProperties)props)); }
/// <summary> /// Creates in instance of the transport /// </summary> /// <param name="props"></param> protected internal TransportImpl(TransportProperties props) { fProps = props; }
public InMemoryTransport(TransportProperties props):base(props) { // TODO Auto-generated constructor stub }
/// <summary> /// Creates in instance of the transport /// </summary> /// <param name="props"></param> protected internal TransportImpl( TransportProperties props ) { fProps = props; }
/// <summary> /// Creates a new instance of this transport /// </summary> /// <param name="props">The Transport properties to use for this transport</param> /// <returns></returns> public abstract ITransport NewInstance( TransportProperties props );
public override ITransport NewInstance(TransportProperties props) { return new InMemoryTransport(props); }