예제 #1
0
 public JsonResult Simulate(SimulateModel model)
 {
     if (model != null && model.SimViewChanges != null)
     {
         report.UpdateSimLiquidate(model);
     }
     return(Json("", JsonRequestBehavior.AllowGet));
 }
예제 #2
0
 public SimuMoniValueModel(
     SimulateVariableUnit _svunit,
     SimulateModel _smodel)
 {
     svunit = _svunit;
     smodel = _smodel;
     svunit.ValueChanged += OnValueChanged;
 }
예제 #3
0
 public SimulateMonitorManager(
     MainMonitor _mmonitor, SimulateModel _smodel)
 {
     mmonitor              = _mmonitor;
     mmonitor.Manager      = this;
     smodel                = _smodel;
     smodel.SimulateStart += OnSimulateStart;
     smodel.SimulateAbort += OnSimulateAbort;
 }
예제 #4
0
 public SimuViewNetworkModel(SimuViewDiagramModel parent, int number)
 {
     InitializeComponent();
     this._parent   = parent;
     this._root     = parent.Root;
     NetworkNumber  = number;
     this._elements = new SortedDictionary <IntPoint, SimuViewBaseModel>(new IntPointComparer());
     this._vlines   = new SortedDictionary <IntPoint, SimuViewVLineModel>(new IntPointComparer());
     //Setup(lchart);
 }
예제 #5
0
 public SimuViewDiagramModel(SimulateModel root, string name)
 {
     InitializeComponent();
     this._root   = root;
     LadderName   = name;
     this.Loaded += (sender, e) =>
     {
         Focus();
         Keyboard.Focus(this);
     };
     InitAll();
     ClearAll();
 }
예제 #6
0
 public void UpdateSimLiquidate(SimulateModel model)
 {
     try
     {
         foreach (var item in model.SimViewChanges)
         {
             dbEntity.UpdateSimLiquidate(item.RecordId, item.Status);
         }
     }
     catch (Exception ex)
     {
     }
 }
예제 #7
0
 public SimuViewAllDiaModel(SimulateModel parent)
 {
     InitializeComponent();
     this._parent = parent;
     MainRoutineExpander.Content = parent.MainRoutine;
     foreach (SimuViewDiagramModel svdmodel in parent.SubRoutines)
     {
         Expander  expander = new Expander();
         TextBlock tblock   = new TextBlock();
         tblock.FontSize  = 16;
         tblock.Name      = svdmodel.Name;
         expander.Header  = tblock;
         expander.Content = svdmodel;
     }
 }
예제 #8
0
 static public int Close()
 {
     if (smodel != null)
     {
         smodel.Dispose();
         smodel = null;
     }
     if (smmanager != null)
     {
         smmanager.Abort();
         smmanager = null;
     }
     if (pmodel != null)
     {
         pmodel.LadderMode = LadderMode.Edit;
         SimuBrpoWindow bpwindow = pmodel.IFacade.BPWindow;
         bpwindow.Unroute(pmodel);
         bpwindow.SModel   = null;
         bpwindow.SManager = null;
         pmodel            = null;
     }
     return(CLOSE_OK);
 }
예제 #9
0
        static public SimuViewBaseModel Create(SimulateModel parent, string text)
        {
            string[]          texts    = text.Split(' ');
            string            inst     = texts[0];
            SimuViewBaseModel svbmodel = null;

            switch (inst)
            {
            case "LD":
            case "LDI":
            case "LDIM":
            case "LDIIM":
            case "LDP":
            case "LDF":
                svbmodel = new SimuViewInputModel(parent);
                break;

            case "ALT":
            case "ALTP":
            case "OUT":
            case "OUTIM":
            case "RST":
            case "RSTIM":
            case "SET":
            case "SETIM":
                svbmodel = new SimuViewOutBitModel(parent);
                break;

            default:
                svbmodel = new SimuViewOutRecModel(parent);
                break;
            }

            svbmodel.Setup(text);
            return(svbmodel);
        }
예제 #10
0
 /// <summary>
 /// 初始化构造函数
 /// </summary>
 /// <param name="parent">仿真总模型</param>
 public SimuViewOutBitModel(SimulateModel parent) : base(parent)
 {
     // 初始化子控件
     InitializeComponent();
 }
예제 #11
0
 public SimuViewVLineModel(SimulateModel parent) : base(parent)
 {
     InitializeComponent();
 }
예제 #12
0
 public void BuildRouted(SimulateModel _parent)
 {
     parent = _parent;
 }
예제 #13
0
 public SimuViewBaseModel(SimulateModel parent)
 {
     this._parent = parent;
     _parent.BuildRouted(this);
 }
예제 #14
0
        static public int Simulate(ProjectModel _pmodel)
        {
            pmodel    = _pmodel;
            smodel    = new SimulateModel();
            smmanager = new SimulateMonitorManager(_pmodel.MMonitorManager.MMWindow, smodel);
            Setup(pmodel.MainRoutine);
            foreach (LadderDiagramViewModel lvdmodel in pmodel.SubRoutines)
            {
                Setup(lvdmodel);
            }
            int ret = GenerateHelper.GenerateSimu(pmodel);

            switch (ret)
            {
            case SimulateDllModel.LOADDLL_OK:
                smodel.ShowWindow();
                pmodel.LadderMode = LadderMode.Simulate;
                smmanager.Initialize();
                SimuBrpoWindow bpwindow = pmodel.IFacade.BPWindow;
                bpwindow.Route(pmodel);
                bpwindow.SModel   = smodel;
                bpwindow.SManager = smodel.SManager;
                smodel.Initialize();
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_DLLFILE:
                LocalizedMessageBox.Show("Error : 找不到生成的dll文件\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_GETBIT:
                LocalizedMessageBox.Show("Error : 找不到入口GetBit\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_GETWORD:
                LocalizedMessageBox.Show("Error : 找不到入口GetWord\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_GETDWORD:
                LocalizedMessageBox.Show("Error : 找不到入口GetDWord\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_GETFLOAT:
                LocalizedMessageBox.Show("Error : 找不到入口GetFloat\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_GETFEQ:
                LocalizedMessageBox.Show("Error : 找不到入口GetFeq\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_SETBIT:
                LocalizedMessageBox.Show("Error : 找不到入口SetBit\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_SETWORD:
                LocalizedMessageBox.Show("Error : 找不到入口SetWord\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_SETDWORD:
                LocalizedMessageBox.Show("Error : 找不到入口SetDWord\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_SETFLOAT:
                LocalizedMessageBox.Show("Error : 找不到入口SetFloat\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_SETFEQ:
                LocalizedMessageBox.Show("Error : 找不到入口SetFeq\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_BEFORERUNLADDER:
                LocalizedMessageBox.Show("Error : 找不到入口BeforeRunLadder\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_AFTERRUNLADDER:
                LocalizedMessageBox.Show("Error : 找不到入口AfterRunLadder\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_INITRUNLADDER:
                LocalizedMessageBox.Show("Error : 找不到入口InitRunLadder\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNNT_FOUND_GETCLOCK:
                LocalizedMessageBox.Show("Error : 找不到入口GetClock\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_INITCLOCK:
                LocalizedMessageBox.Show("Error : 找不到入口InitClock\r\n", LocalizedMessageIcon.Error);
                break;

            case SimulateDllModel.LOADDLL_CANNOT_FOUND_SETCLOCKRATE:
                LocalizedMessageBox.Show("Error : 找不到入口SetClockRate\r\n", LocalizedMessageIcon.Error);
                break;

            default:
                LocalizedMessageBox.Show("Error : 发生未知错误\r\n", LocalizedMessageIcon.Error);
                break;
            }
            return(ret);
        }