public override void Start() { PDP.Load8(0200); PDP.Toggle8(0000); StartAndWaitForCompletion(); }
public void LoadTape() { PDP.Clear(); PDP.LoadPaperTape(File.ReadAllBytes(TapeName)); PDP.Clear(); }
public void Initialize() { LoggingLevel = new LoggingLevelSwitch(Serilog.Events.LogEventLevel.Information); Log.Logger = new LoggerConfiguration() .WriteTo.Console(restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Information, outputTemplate: "[{Level:u3}] {Message:lj}{NewLine}{Exception}") .WriteTo.File("test.log", outputTemplate: "[{Level:u3}] {Message:lj}{NewLine}{Exception}") .MinimumLevel.ControlledBy(LoggingLevel) .CreateLogger(); PDP = new PDP(); }
public override void Start() { PDP.Load8(0200); PDP.Toggle8(7777); PDP.Continue(); Assert.AreEqual(0147.ToDecimal(), PDP.Processor.Registers.PC.Address); StartAndWaitForCompletion(); }
public override void Start() { PDP.Load8(0200); PDP.Continue(); Assert.IsTrue(PDP.Processor.Teleprinter.Printout.Contains("EA8-E EXT MEM ADDR TEST")); Assert.IsTrue(PDP.Processor.Teleprinter.Printout.Contains("SETUP SR & CONT")); PDP.Toggle8(0007); StartAndWaitForCompletion(); }
public void TestHelloWorld() { PDP.Load8(0200); PDP.Deposit8(7200); PDP.Deposit8(7100); PDP.Deposit8(1220); PDP.Deposit8(3010); PDP.Deposit8(7000); PDP.Deposit8(1410); PDP.Deposit8(7450); PDP.Deposit8(7402); //5577 PDP.Deposit8(4212); PDP.Deposit8(5204); PDP.Deposit8(0000); PDP.Deposit8(6046); PDP.Deposit8(6041); PDP.Deposit8(5214); PDP.Deposit8(7200); PDP.Deposit8(5612); PDP.Deposit8(0220); PDP.Deposit8(0110); PDP.Deposit8(0105); PDP.Deposit8(0114); PDP.Deposit8(0114); PDP.Deposit8(0117); PDP.Deposit8(0040); PDP.Deposit8(0127); PDP.Deposit8(0117); PDP.Deposit8(0122); PDP.Deposit8(0114); PDP.Deposit8(0104); PDP.Deposit8(0041); PDP.Deposit8(0000); //pdp.Load8(0177); //pdp.Deposit8(7600); //PDP.DumpMemory(); PDP.Clear(); PDP.Load8(0200); PDP.Continue(); Assert.AreEqual("HELLO WORLD!", PDP.Processor.Teleprinter.Printout); Log.Information(PDP.Processor.Teleprinter.Printout); }
protected void StartAndWaitForCompletion() { PDP.Continue(waitForHalt: false); var sw = new Stopwatch(); sw.Start(); var done = false; var failed = false; var timeout = false; while (!timeout && !done && !failed && PDP.Running) { done = ExpectedOutput.Any() && ExpectedOutput.All(x => PDP.Processor.Teleprinter.Printout.Contains(x)); failed = UnexpectedOutput.Any(x => PDP.Processor.Teleprinter.Printout.Contains(x)); timeout = sw.Elapsed > MaxRunningTime; Thread.Sleep(200); } if (!ExpectHLT) { Assert.IsTrue(PDP.Running); } PDP.Halt(); Assert.IsFalse(failed); if (!ExpectedOutput.Any()) { Assert.IsFalse(done); Assert.IsTrue(timeout); } else { Assert.IsTrue(done); Assert.IsFalse(timeout); } PDP.Halt(); }
public void TestIAC() { var length = 10; PDP.Load8(0200); for (int i = 0; i < length; i++) { PDP.Deposit8(7001); } PDP.Deposit8(7402); PDP.Load8(0200); PDP.Continue(); Assert.IsTrue(PDP.Processor.Registers.AC.Accumulator == length); }
public void TestPaging() { PDP.Load8(0200); PDP.Deposit8(7300); PDP.Deposit8(1205); PDP.Deposit8(1206); PDP.Deposit8(3207); PDP.Deposit8(7402); PDP.Deposit8(0002); PDP.Deposit8(0003); PDP.Load8(0200); PDP.Continue(); PDP.Load8(0207); PDP.Exam(); Assert.AreEqual(5u, PDP.Processor.Registers.AC.Accumulator); }
public void TestAddition() { PDP.Load8(0000); PDP.Deposit8(7300); PDP.Deposit8(1005); PDP.Deposit8(1006); PDP.Deposit8(3007); PDP.Deposit8(7402); PDP.Deposit8(0002); PDP.Deposit8(0003); PDP.Load8(0000); PDP.Continue(); PDP.Load8(0007); PDP.Exam(); Assert.AreEqual(5u, PDP.Processor.Registers.AC.Accumulator); }
public int sceNetAdhocPdpDelete(PDP PDP, int unk1) { PDP.RemoveUid(InjectContext); return 0; }
public int sceNetAdhocPdpDelete(PDP PDP, int unk1) { PDP.RemoveUid(InjectContext); return(0); }
public int sceNetAdhocPdpRecv(PDP PDP, byte *srcMacAddr, ushort *port, void *data, void *dataLength, uint timeout, int nonblock) { //throw(new NotImplementedException()); return(0); }
public int sceNetAdhocPdpSend(PDP PDP, byte *destMacAddr, ushort port, void *data, uint len, uint timeout, int nonblock) { throw new NotImplementedException(); }
public int sceNetAdhocPdpSend(PDP PDP, byte* destMacAddr, ushort port, void* data, uint len, uint timeout, int nonblock) { throw (new NotImplementedException()); }
public void TestMethod1() { string accessToken = System.Configuration.ConfigurationManager.AppSettings["accessToken"]; string email = System.Configuration.ConfigurationManager.AppSettings["email"]; string password = System.Configuration.ConfigurationManager.AppSettings["password"]; #region VRP VRP vrp = new VRP(); /*Add Visits */ var visit = new Visits() { Location = new Location { Name = "6800 Cambie", Lat = 49.227107, Lng = -123.1163085, }, Start = "8:00", End = "16:00", Duration = 10, }; vrp.addVisit("order_1", visit); var visit2 = new Visits() { Location = new Location { Name = "6800 Cambie", Lat = 49.227107, Lng = -123.1163085, }, Start = "9:00", End = "16:00", Duration = 10, }; vrp.addVisit("order_2", visit2); /*Add Vehicle */ var vehicle = new Vehicle() { StartLocation = new Location { Id = "depot", Lat = 49.2553636, Lng = -123.0873365, }, EndLocation = new Location { Id = "depot", Lat = 49.2553636, Lng = -123.0873365, }, }; vrp.addVehicle("vehicle_1", vehicle); /*Add Option */ vrp.addOption("traffic", "slow"); vrp.addOption("shortest_distance", true); #endregion /* ================== */ #region PDP PDP pdp = new PDP(); var pdp_order1 = new VisitsPDP() { Load = 1, Pickup = new Pickup { Location = new LocationPDP { Name = "3780 Arbutus", Lat = 49.2474624, Lng = -123.1532338, }, Start = "9:00", End = "12:00", Duration = 10, }, Dropoff = new Dropoff { Location = new LocationPDP { Name = "6800 Cambie", Lat = 49.227107, Lng = -123.1163085, }, Start = "9:00", End = "12:00", Duration = 10, }, }; pdp.addVisitPDP("pdp_order1", pdp_order1); var pdp_order2 = new VisitsPDP() { Load = 1, Pickup = new Pickup { Location = new LocationPDP { Name = "3780 Arbutus", Lat = 49.2474624, Lng = -123.1532338, }, Start = "9:00", End = "12:00", Duration = 10, }, Dropoff = new Dropoff { Location = new LocationPDP { Name = "800 Robson", Lat = 49.2819229, Lng = -123.1211844, }, Start = "9:00", End = "12:00", Duration = 10, }, }; pdp.addVisitPDP("pdp_order2", pdp_order2); /*Add Vehicle PDP */ var pdp_vehicle_1 = new VehiclePDP() { StartLocation = new LocationPDP { Id = "depot", Name = "800 Kingsway", Lat = 49.2553636, Lng = -123.0873365, }, EndLocation = new LocationPDP { Id = "depot", Name = "800 Kingsway", Lat = 49.2553636, Lng = -123.0873365, }, ShiftStart = "8:00", ShiftEnd = "12:00", Capacity = 2 }; pdp.addVehiclePDP("pdp_vehicle_1", pdp_vehicle_1); var pdp_vehicle_2 = new VehiclePDP() { StartLocation = new LocationPDP { Id = "depot 2", Name = "800 Robson", Lat = 49.2553636, Lng = -123.1211844, }, EndLocation = new LocationPDP { Id = "depot", Name = "800 Kingsway", Lat = 49.2553636, Lng = -123.0873365, }, ShiftStart = "8:00", ShiftEnd = "12:00", Capacity = 1 }; pdp.addVehiclePDP("pdp_vehicle_2", pdp_vehicle_2); #endregion Client client = new Client(); //var login = client.Login(email, password); //if(login["_id"] == null) //{ // Console.WriteLine(JValue.Parse(JsonConvert.SerializeObject(login)).ToString(Formatting.Indented)); // return; //} var pdp_output_long = client.Long_Route_PDP(pdp); var vrp_output_long = client.Long_Route_VRP(vrp); Console.WriteLine(JValue.Parse(JsonConvert.SerializeObject(pdp_output_long)).ToString(Formatting.Indented)); }
//public static List<ErrorData> ErrorList { get; } = new List<ErrorData>(); /* * /// <summary> * /// Gets the can talon. * /// </summary> * /// <param name="id">The identifier.</param> * /// <returns></returns> * public static CanTalonData GetCanTalon(int id) * { * CanTalonData data; * bool retVal = s_canTalon.TryGetValue(id, out data); * if (retVal) * { * //Contains key. Just return it * return data; * } * else * { * //CAN Talon does not exist yet. Return null. * return null; * } * } * * /// <summary> * /// Initializes the can talon. * /// </summary> * /// <param name="id">The identifier.</param> * /// <returns></returns> * public static bool InitializeCanTalon(int id) * { * CanTalonData data; * bool retVal = s_canTalon.TryGetValue(id, out data); * if (retVal) * { * //Contains key. return false saying we did not initialize a new one. * return false; * } * else * { * //Create a new Can Talon data and return true. * data = new CanTalonData(); * s_canTalon.Add(id, data); * OnTalonSRXAddedOrRemoved?.Invoke(id, new TalonSRXEventArgs(true)); * return true; * } * } * * /// <summary> * /// Removes the can talon. * /// </summary> * /// <param name="id">The identifier.</param> * public static void RemoveCanTalon(int id) * { * s_canTalon.Remove(id); * OnTalonSRXAddedOrRemoved?.Invoke(id, new TalonSRXEventArgs(false)); * } * * /// <summary> * /// Gets the PCM. * /// </summary> * /// <param name="id">The identifier.</param> * /// <returns></returns> * public static PCMData GetPCM(int id) * { * PCMData data; * bool retVal = s_pcm.TryGetValue(id, out data); * if (retVal) * { * //Contains key. Just return it * return data; * } * else * { * data = new PCMData(); * s_pcm.Add(id, data); * OnPCMAdded?.Invoke(data, null); * return data; * } * } * * /// <summary> * /// Initializes the PCM. * /// </summary> * /// <param name="id">The identifier.</param> * /// <returns></returns> * public static bool InitializePCM(int id) * { * PCMData data; * bool retVal = s_pcm.TryGetValue(id, out data); * if (retVal) * { * //Contains key. return false saying we did not initialize a new one. * return false; * } * else * { * //Create a new PCM data and return true. * data = new PCMData(); * s_pcm.Add(id, data); * OnPCMAdded?.Invoke(data, null); * return true; * } * } * * /// <summary> * /// Gets the PDP. * /// </summary> * /// <param name="id">The identifier.</param> * /// <returns></returns> * public static PDPData GetPDP(int id) * { * PDPData data; * bool retVal = s_pdp.TryGetValue(id, out data); * if (retVal) * { * //Contains key. Just return it * return data; * } * else * { * data = new PDPData(); * s_pdp.Add(id, data); * OnPDPAdded?.Invoke(data, null); * return data; * } * } * * /// <summary> * /// Initializes a new PDP. * /// </summary> * /// <param name="id">The identifier.</param> * /// <returns>True if new PDP was created, otherwise false</returns> * public static bool InitializePDP(int id) * { * PDPData data; * bool retVal = s_pdp.TryGetValue(id, out data); * if (retVal) * { * //Contains key. return false saying we did not initialize a new one. * return false; * } * else * { * //Create a new PCM data and return true. * data = new PDPData(); * s_pdp.Add(id, data); * OnPDPAdded?.Invoke(data, null); * return true; * } * } * * /// <summary> * /// Occurs on talon SRX added or removed. * /// </summary> * public static event EventHandler<TalonSRXEventArgs> OnTalonSRXAddedOrRemoved; * /// <summary> * /// Occurs when a PCM is added. * /// </summary> * public static event EventHandler OnPCMAdded; * /// <summary> * /// Occurs when a PDP is added. * /// </summary> * public static event EventHandler OnPDPAdded; * */ static SimData() { for (int i = 0; i < HAL_GetNumPCMModules(); i++) { PCM.Add(new HALSimPCMData(i)); } for (int i = 0; i < HAL_GetNumPDPModules(); i++) { PDP.Add(new HALSimPDPData(i)); } for (int i = 0; i < HAL_GetNumAccumulators(); i++) { AnalogGyro.Add(new HALSimAnalogGyroData(i)); } for (int i = 0; i < HAL_GetNumAnalogOutputs(); i++) { AnalogOut.Add(new HALSimAnalogOutData(i)); } for (int i = 0; i < HAL_GetNumAnalogInputs(); i++) { AnalogIn.Add(new HALSimAnalogInData(i)); } for (int i = 0; i < HAL_GetNumAnalogTriggers(); i++) { AnalogTrigger.Add(new HALSimAnalogTriggerData(i)); } for (int i = 0; i < HAL_GetNumDigitalChannels(); i++) { DIO.Add(new HALSimDIOData(i)); } for (int i = 0; i < HAL_GetNumDigitalPWMOutputs(); i++) { DigitalPWM.Add(new HALSimDigitalPWMData(i)); } for (int i = 0; i < 4; i++) { //DigitalGlitchFilter.Add(new DigitalGlitchFilterData()); } for (int i = 0; i < HAL_GetNumPWMChannels(); i++) { PWM.Add(new HALSimPWMData(i)); } for (int i = 0; i < 4; i++) { Relay.Add(new HALSimRelayData(i)); } for (int i = 0; i < 8; i++) { //Counter.Add(new CounterData()); } for (int i = 0; i < 8; i++) { Encoder.Add(new HALSimEncoderData(i)); } for (int i = 0; i < 5; i++) { SPIAccelerometer.Add(new HALSimSPIAccelerometerData(i)); } for (int i = 0; i < 5; i++) { //SPIAccumulator.Add(new SPIAccumulatorData()); } //InitializePDP(0); //ErrorList.Clear(); }
public static void HarvestPassInit(Sites psi, int isp, string stroutputdir, string strHarvestInitFile, PDP pdp) { string harvestFile = ""; string strstandImgMapFile = ""; string strmgtAreaImgMapFile = ""; string strharvestOutputFile1 = ""; string strharvestOutputFile2 = ""; string outputdir; outputdir = string.Format("{0}/{1}", stroutputdir, "Harvest"); Directory.CreateDirectory(outputdir); if (!Directory.Exists(outputdir)) { throw new Exception("Harvest: Can't create the direcory"); } int timber; int harvest; BoundedPocketStandHarvester.pCoresites = psi; BoundedPocketStandHarvester.giRow = BoundedPocketStandHarvester.pCoresites.numRows(); BoundedPocketStandHarvester.giCol = BoundedPocketStandHarvester.pCoresites.numColumns(); BoundedPocketStandHarvester.m_pPDP = pdp; BoundedPocketStandHarvester.numberOfSpecies = isp; StreamReader pfHarvest = new StreamReader(strHarvestInitFile); string instring; string[] sarray; instring = pfHarvest.ReadLine(); timber = int.Parse(instring); instring = pfHarvest.ReadLine(); harvest = int.Parse(instring); if (harvest != 0) { instring = pfHarvest.ReadLine(); sarray = instring.Split('#'); BoundedPocketStandHarvester.iParamstandAdjacencyFlag = int.Parse(sarray[0]); instring = pfHarvest.ReadLine(); sarray = instring.Split('#'); BoundedPocketStandHarvester.iParamharvestDecadeSpan = int.Parse(sarray[0]); instring = pfHarvest.ReadLine(); sarray = instring.Split('#'); BoundedPocketStandHarvester.fParamharvestThreshold = double.Parse(sarray[0]); instring = pfHarvest.ReadLine(); sarray = instring.Split('#'); harvestFile = sarray[0].Substring(0, sarray[0].Length - 1); instring = pfHarvest.ReadLine(); sarray = instring.Split('#'); strstandImgMapFile = sarray[0].Substring(0, sarray[0].Length - 1); instring = pfHarvest.ReadLine(); sarray = instring.Split('#'); strmgtAreaImgMapFile = sarray[0].Substring(0, sarray[0].Length - 1); instring = pfHarvest.ReadLine(); sarray = instring.Split('#'); strharvestOutputFile1 = sarray[0].Substring(0, sarray[0].Length - 1); instring = pfHarvest.ReadLine(); sarray = instring.Split('#'); strharvestOutputFile2 = sarray[0].Substring(0, sarray[0].Length - 1); } pfHarvest.Close(); StreamReader haFile = new StreamReader(harvestFile); Console.WriteLine("Build visitation Map"); BoundedPocketStandHarvester.visitationMap.dim((uint)BoundedPocketStandHarvester.giRow, (uint)BoundedPocketStandHarvester.giCol); BoundedPocketStandHarvester.visitationMap.fill(0); BoundedPocketStandHarvester.standMap.readImg(strstandImgMapFile, BoundedPocketStandHarvester.giRow, BoundedPocketStandHarvester.giCol); BoundedPocketStandHarvester.managementAreaMap.readImg(strmgtAreaImgMapFile, BoundedPocketStandHarvester.giRow, BoundedPocketStandHarvester.giCol); BoundedPocketStandHarvester.pstands = new Stands(); BoundedPocketStandHarvester.pstands.construct(); BoundedPocketStandHarvester.managementAreas.construct(); HEventsmode = BoundedPocketStandHarvester.harvestEvents.Read(haFile); BoundedPocketStandHarvester.managementAreaMap.freeMAPdata(); BoundedPocketStandHarvester.pHarvestsites = new HARVESTSites(BoundedPocketStandHarvester.giRow, BoundedPocketStandHarvester.giCol); string str; str = string.Format("{0}/{1}", outputdir, strharvestOutputFile1); BoundedPocketStandHarvester.harvestOutputFile1_name = str; using (BoundedPocketStandHarvester.harvestOutputFile1 = new StreamWriter(str)) { } str = string.Format("{0}/{1}", outputdir, strharvestOutputFile2); BoundedPocketStandHarvester.harvestOutputFile2_name = str; using (BoundedPocketStandHarvester.harvestOutputFile2 = new StreamWriter(str)) { } haFile.Close(); }
public int sceNetAdhocPdpRecv(PDP PDP, byte *srcMacAddr, ushort *port, void *data, void *dataLength, uint timeout, int nonblock) { //throw(new NotImplementedException()); return 0; }
public dynamic Long_Route_PDP(PDP pdp) { string endpointPath = ""; endpointPath = pdp.getLongRoutingPDP(); // Define your target string url = this.url + "/v" + this.version + endpointPath; // Console.Write(this.token); try { var json = JsonConvert.SerializeObject(pdp); PDPObject root = new PDPObject(); WebRequest myReq = WebRequest.Create(url); myReq.Method = "POST"; myReq.ContentType = "application/json; charset=UTF-8"; myReq.Headers.Add("Authorization:Bearer " + this.token); using (var streamWriter = new StreamWriter(myReq.GetRequestStream())) { streamWriter.Write(json); streamWriter.Flush(); streamWriter.Close(); } var result = ""; using (HttpWebResponse response = myReq.GetResponse() as HttpWebResponse) { int statusCode = (int)response.StatusCode; StreamReader reader = new StreamReader(response.GetResponseStream()); result = reader.ReadToEnd(); } try { dynamic json_string = JsonConvert.DeserializeObject(result); var respone = this.jobPoll(json_string["job_id"].ToString()); List <SolutionPDP> slt = new List <SolutionPDP>(); dynamic responejson = JsonConvert.DeserializeObject(respone.ToString()); dynamic output = JsonConvert.DeserializeObject(respone["output"].ToString()); dynamic dynJson = JsonConvert.DeserializeObject(respone["output"]["solution"].ToString()); //dynamic solution = JsonConvert.DeserializeObject(dynJson.solution.ToString()); foreach (var vehicle_item in dynJson) { List <RoutePDP> d = JsonConvert.DeserializeObject <List <RoutePDP> >(vehicle_item.Value.ToString()); SolutionPDP m = new SolutionPDP(); m.vehicle = vehicle_item.Name; m.route = d; slt.Add(m); } root.status = output.status; root.total_travel_time = output.total_travel_time; root.total_break_time = output.total_break_time; root.total_idle_time = output.total_idle_time; root.num_unserved = output.num_unserved; root.unserved = output.unserved; root.solution = slt; LongResultPDP l = new LongResultPDP(); l.Id = responejson._id; l.Status = responejson.status; l.InputId = responejson.id; l.RequestId = responejson.requestId; l.CreatedAt = responejson.createdAt; l.FinishedAt = responejson.finished_at; l.Output = root; l.FetchedCount = responejson.fetchedCount; return(l); } catch { Console.WriteLine("job Id fail"); return(null); } } catch (WebException ex) { var resp = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd(); dynamic obj = JsonConvert.DeserializeObject(resp); return(obj); //Console.WriteLine(obj); //throw new Exception(ex.Message); } }