예제 #1
0
        /// <summary>
        /// Populate editable fields from name and value vectors
        /// specific to the Heston extended process.
        /// </summary>
        /// <param name="stocProcess">
        /// The stochastic process which is being referenced to.
        /// </param>
        /// <param name="estimate">
        /// The estimation result which contains values and names of parameters.
        /// It will be searched for S0, kappa, theta, sigma, V0 and rho.
        /// </param>
        public void Populate(IStochasticProcess stocProcess, EstimationResult estimate)
        {
            bool found;

            this.S0    = new ModelParameter(PopulateHelper.GetValue("S0", estimate.Names, estimate.Values, out found), this.S0.Description);
            this.k     = new ModelParameter(PopulateHelper.GetValue("kappa", estimate.Names, estimate.Values, out found), this.k.Description);
            this.theta = new ModelParameter(PopulateHelper.GetValue("theta", estimate.Names, estimate.Values, out found), this.theta.Description);
            this.sigma = new ModelParameter(PopulateHelper.GetValue("sigma", estimate.Names, estimate.Values, out found), this.sigma.Description);
            this.V0    = new ModelParameter(PopulateHelper.GetValue("V0", estimate.Names, estimate.Values, out found), this.V0.Description);

            int            index = stocProcess.NoiseIndex;
            ProjectProcess prj   = stocProcess.Context as ProjectProcess;

            // Update the correlation matrix.
            prj.Processes.r.Set(index, index + 1, (RightValue)PopulateHelper.GetValue("rho", estimate.Names, estimate.Values, out found));
            bool errors = RetrieveCurve(stocProcess.Context, false);

            if (!errors)
            {
                this.zrCurve.Expr = (estimate.Objects[0] as Matrix).ToArray();
                this.dyCurve.Expr = (estimate.Objects[1] as Matrix).ToArray();
                //Calibrator assumes dividend yield is a step constant function, the simulation model must be coherent with that assumption.
                (this.dyCurve as PFunction).m_Function.iType = DVPLUtils.EInterpolationType.ZERO_ORDER_LEFT;
            }
        }
예제 #2
0
 static internal object ToResponse(this ProjectProcess process)
 {
     return(new {
         uid = process.UniqueID,
         name = process.Name,
         startActivity = process.StartActivity.ToResponse()
     });
 }
예제 #3
0
        public static ProjectProcess GetProcess(Project project, string processUniqueID)
        {
            Assertion.Require(project, "project");
            Assertion.Require(processUniqueID, "processUniqueID");

            ProjectProcess process = ProcessesCheckList(project).Find(x => x.UniqueID == processUniqueID);

            return(process);
        }
예제 #4
0
        static public FixedList <ProjectProcess> ProcessesCheckList(Project project)
        {
            Assertion.Require(project, "project");

            FixedList <ProjectProcess> list = ProjectProcess.GetList(project);

            list.Sort((x, y) => x.StartActivity.Position.CompareTo(y.StartActivity.Position));

            return(list);
        }
 /// <summary>
 /// Удаление запросов на опрос процессов
 /// </summary>
 private void RemoveReadItems()
 {
     if (_IsReading)
     {
         for (int i = 0; i < this.dgProcess.Rows.Count; i++)
         {
             ProjectProcess m_p = this._solution.GetProcessByName((string)this.dgProcess.Rows[i].Cells[0].Value);
             try { _engine.RemoveReadItem(m_p.Address + 4, MemoryType.XRAM, this.dgProcess.Rows[i]); }
             catch { }
         }
         _IsReading = false;
     }
 }
 /// <summary>
 /// Составление запросов на опрос процессов
 /// </summary>
 private void AddedReadItems()
 {
     if (!_IsReading)
     {
         for (int i = 0; i < this.dgProcess.Rows.Count; i++)
         {
             ProjectProcess m_p = this._solution.GetProcessByName((string)this.dgProcess.Rows[i].Cells[0].Value);
             //_engine.AddReadItem(_engine.Parameters.ProcessorType == ProcessorType.MB90F347 ? (m_p.Address + 6) : (m_p.Address + 5), MemoryType.XRAM, _engine.Parameters.ProcessorType == ProcessorType.MB90F347 ? 4 : 2, this.dgProcess.Rows[i], null, CallBack);
             _engine.AddReadItem(m_p.Address + 4, MemoryType.XRAM, 4, this.dgProcess.Rows[i], null, CallBack);
         }
         _IsReading = true;
     }
 }
예제 #7
0
        /// <summary>
        /// Populate editable fields from name and value vectors
        /// specific to the Heston extended process.
        /// </summary>
        /// <param name="stocProcess">
        /// The stochastic process which is being referenced to.
        /// </param>
        /// <param name="estimate">
        /// The estimation result which contains values and names of parameters.
        /// It will be searched for S0, kappa, theta, sigma, V0, r, q and rho.
        /// </param>
        public void Populate(IStochasticProcess stocProcess, EstimationResult estimate)
        {
            bool found;

            this.S0    = new ModelParameter(PopulateHelper.GetValue("S0", estimate.Names, estimate.Values, out found), this.S0.Description);
            this.k     = new ModelParameter(PopulateHelper.GetValue("kappa", estimate.Names, estimate.Values, out found), this.k.Description);
            this.theta = new ModelParameter(PopulateHelper.GetValue("theta", estimate.Names, estimate.Values, out found), this.theta.Description);
            this.sigma = new ModelParameter(PopulateHelper.GetValue("sigma", estimate.Names, estimate.Values, out found), this.sigma.Description);
            this.V0    = new ModelParameter(PopulateHelper.GetValue("V0", estimate.Names, estimate.Values, out found), this.V0.Description);
            this.r     = new ModelParameter(PopulateHelper.GetValue("r", estimate.Names, estimate.Values, out found), this.r.Description);
            this.q     = new ModelParameter(PopulateHelper.GetValue("q", estimate.Names, estimate.Values, out found), this.q.Description);

            int            index = stocProcess.NoiseIndex;
            ProjectProcess prj   = stocProcess.Context as ProjectProcess;

            // Updates the correlation.
            prj.Processes.r.Set(index, index + 1, (RightValue)PopulateHelper.GetValue("rho", estimate.Names, estimate.Values, out found));
        }
예제 #8
0
 public static void Main(string[] args)
 {
     ProjectProcess.Run(args);
 }
예제 #9
0
        internal override void GatherCompileInfo(App mainAppWithInfo)
        {
            ProjectProcess c;

            c = new ProjectProcess();
            if (!CompileProcess.CanOperate(mainAppWithInfo.TempPath))
            {
                string tempPath = Path.GetFullPath(Path.Combine(Path.GetTempPath(), "LuaSTG Editor/"));
                if (!Directory.Exists(tempPath))
                {
                    Directory.CreateDirectory(tempPath);
                }
                c.currentTempPath = tempPath;
            }
            else
            {
                c.currentTempPath = mainAppWithInfo.TempPath;
            }
            CompileProcess = c;

            c.projLuaPath = c.currentTempPath + "_editor_output.lua";

            c.source          = this;
            c.rootLuaPath     = c.currentTempPath + "root.lua";
            c.rootZipPackPath = c.currentTempPath + "pack.bat";

            c.projPath = "";
            if (!string.IsNullOrEmpty(DocPath))
            {
                c.projPath = Path.GetDirectoryName(DocPath);
            }

            c.projMetaPath = DocPath + ".meta";

            c.rootCode = "Include\'THlib.lua\'\nInclude\'_editor_output.lua\'";

            c.zipExePath    = mainAppWithInfo.ZipExecutablePath;
            c.luaSTGExePath = mainAppWithInfo.LuaSTGExecutablePath;

            if (!mainAppWithInfo.IsEXEPathSet)
            {
                throw new EXEPathNotSetException();
            }

            c.projName = Path.GetFileNameWithoutExtension(RawDocName);

            //Find mod name
            foreach (TreeNode t in TreeNodes[0].Children)
            {
                if (t is ProjSettings)
                {
                    if (!string.IsNullOrEmpty(t.attributes[0].AttrInput))
                    {
                        c.projName = t.attributes[0].AttrInput;
                    }
                    break;
                }
            }

            c.luaSTGFolder  = Path.GetDirectoryName(c.luaSTGExePath);
            c.targetZipPath = c.luaSTGFolder + "\\mod\\" + c.projName + ".zip";

            foreach (IDocumentWithMeta idwm in referencedDoc)
            {
                if (idwm is PlainDocumentData pdd)
                {
                    pdd.GatherCompileInfo(mainAppWithInfo);
                    c.fileProcess.Add(pdd.CompileProcess as PartialProjectProcess);
                    //MessageBox.Show(pdd.CompileProcess.GetType().ToString());
                }
                else if (idwm is VirtualDoc vd)
                {
                    string s = vd.DocPath;
                    //try
                    {
                        DocumentData newDoc = GetNewByExtension(Path.GetExtension(s), -1
                                                                , Path.GetFileNameWithoutExtension(s), s, true);
                        TreeNode t = newDoc.CreateNodeFromFile(s);
                        newDoc.TreeNodes.Add(t);
                        (newDoc as PlainDocumentData).parentProj = this;
                        newDoc.GatherCompileInfo(mainAppWithInfo);
                        c.fileProcess.Add(newDoc.CompileProcess as PartialProjectProcess);
                        //MessageBox.Show(newDoc.CompileProcess.GetType().ToString());
                    }
                    //catch { }
                }
            }
        }
예제 #10
0
 public Task <bool> UpdateProjectProcessStep(string projectProcessId, string processStepId, ProjectProcess projectProcess)
 {
     throw new NotImplementedException();
 }
예제 #11
0
 public Task <bool> AddProjectProcess(string projectId, ProjectProcess projectProcess)
 {
     throw new NotImplementedException();
 }