public DecisionsFramework.Design.Flow.FlowStep ConvertStep(ConversionData allConvertData, ConvertedStep stepToConvert) { SystemUserContext suc = new SystemUserContext(); using (UserContextHolder.Register(suc)) { LinkedFlowStep lfs = new LinkedFlowStep(); // Get name of flow to run / id of flow to run. StepInput flowId = stepToConvert.StepProperties.FirstOrDefault(x => x.Name == "EmbeddedFlowId"); //string flowId = flowName.ConstantValue; //foreach (Flow cf in allConvertData.ConvertedFlows) //{ // if (cf.Name == flowName.ConstantValue) // { // flowId = cf.Id; // } //} lfs.RegistrationId = flowId.ConstantValue; return(new FlowStep(lfs)); } }
public void Export(SDProject sdProject, string outputPath) { _docCount = sdProject.DocumentationLanguages.Count; _docIndex = 0; foreach (var docLanguage in sdProject.DocumentationLanguages) { StepInput.InitStepinput(sdProject, Path.Combine(outputPath, docLanguage), docLanguage, _localController.GetLocalStringsOrDefault <HtmlStrings>(docLanguage), _htmlStrings, _htmlConfig); var steps = new List <StepBase>(); steps.Add(new PreStep(0, 5)); steps.Add(new CopyThemeStep(5, 25)); steps.Add(new CreateDataStep(25, 100)); foreach (var step in steps) { ExecuteOnStepProgress(step.StepRange.ProgressStart); step.OnStepMessage += ExecuteOnStepMessage; step.OnStepProgress += ExecuteOnStepProgress; step.RunStep(); ExecuteOnStepProgress(step.StepRange.ProgressEnd); } _docIndex++; } }
internal static SDProject ParseProject() { var testProjectPath = Path.Combine( Path.GetDirectoryName(Assembly.GetAssembly(typeof(Regression1)).Location), "..", "..", "..", "SharpDox.TestProject", "SharpDox.TestProject.csproj"); var coreConfig = Mock.Of <ICoreConfigSection>( c => c.InputFile == testProjectPath && c.ProjectName == "TestProject" && c.DocLanguage == "en" && c.ExcludedIdentifiers == new ObservableCollection <string>()); var configController = Mock.Of <IConfigController>( c => c.GetConfigSection <ICoreConfigSection>() == coreConfig); var stepInput = new StepInput(configController, new NRefactoryParser(Mock.Of <ParserStrings>()), new SDBuildStrings(), null); var config = new List <StepBase>(); var checkConfig = new CheckConfigStep(stepInput, 0, 15); config.Add(new ParseProjectStep(stepInput, 0, 50)); config.Add(new ParseCodeStep(stepInput, 50, 100)); var sdProject = new SDProject(); foreach (var step in config) { sdProject = step.RunStep(sdProject); } return(sdProject); }
private StepInput GetStepInputFromString(string inputStr) { float converToNumber = 0; bool isNumber = float.TryParse(inputStr, out converToNumber); StepInput newStepInput = new StepInput(); if (isNumber) { newStepInput.inputType = InputType.Number; newStepInput.InputData = converToNumber; } else { if (inputStr == "+") { newStepInput.inputType = InputType.Add; } else if (inputStr == "-") { newStepInput.inputType = InputType.Minus; } else if (inputStr == "*") { newStepInput.inputType = InputType.Multiply; } else if (inputStr == "/") { newStepInput.inputType = InputType.Devide; } } return(newStepInput); }
private void StepInputCalculate() { if (StepInputNeedsToRecalculate) { if (StepInput == null) { StepInput = new List <double>(); } StepInput.Clear(); //DateTime time = DateTime.Now; foreach (double item in TimeIntervals) { if (item < StepAmplitudeChangeTime) { StepInput.Add(0.0); } else if (item >= StepAmplitudeChangeTime) { StepInput.Add(StepAmplitude); } } //_tStepInput = (DateTime.Now - time).TotalMilliseconds; } }
public void Export(SDProject sdProject, string outputPath) { _docCount = sdProject.DocumentationLanguages.Count; _docIndex = 0; foreach (var targetFx in sdProject.GetAllAvailableTargetFxs()) { if (ApiEmpty(sdProject, targetFx)) { continue; } foreach (var docLanguage in sdProject.DocumentationLanguages) { StepInput.InitStepinput(sdProject, targetFx, Path.Combine(outputPath, docLanguage), docLanguage, _localController.GetLocalStringsOrDefault <ChmStrings>(docLanguage), _chmStrings, _chmConfig); var steps = new List <StepBase>(); steps.Add(new CopyStep(0, 10)); steps.Add(new TemplateStep(10, 50)); steps.Add(new CompileStep(50, 90)); steps.Add(new SaveAndCleanStep(90, 100)); foreach (var step in steps) { ExecuteOnStepProgress(step.StepRange.ProgressStart); step.OnStepMessage += ExecuteOnStepMessage; step.OnStepProgress += ExecuteOnStepProgress; step.RunStep(); } _docIndex++; } } }
public override StepInput[] GetInputs(IOrchestrationComponent component) { StepInput arrayToMerge = VVDTUtility.ConvertArrayBuilderDataType(((BuildTextFromElements)component).Values); return(new StepInput[1] { arrayToMerge }); }
public override StepInput[] GetInputs(IOrchestrationComponent component) { StepInput dateValue = VVDTUtility.ConvertVariableOrValueDataTypeToInputMapping(((ToShortDateString)component).date, "Date"); return(new StepInput[1] { dateValue }); }
public override StepInput[] GetInputs(IOrchestrationComponent component) { StepInput logText = VVDTUtility.ConvertAsciiMergeDataTypeToInputMapping(((CreateLogEntryComponent)component).LogEntryText, "Value"); return(new StepInput[1] { logText }); }
public static IInputMapping ConvertStepInputToInputMapping(StepInput stepInput, string inputDataName, bool ifMergeUseHTML = false) { //Convert Select Value if (stepInput.MappingType == InputMappingType.SelectValue) { return(new SelectValueInputMapping() { InputDataName = inputDataName, DataPath = stepInput.SelectValuePathName }); } //Convert Merge Text if (stepInput.MappingType == InputMappingType.MergeText) { if (ifMergeUseHTML) { return(new MergeStringInputMapping() { InputDataName = inputDataName, MergeResultType = MergeDataType.Html, MergeString = stepInput.ConstantValue }); } else { return(new MergeStringInputMapping() { InputDataName = inputDataName, MergeResultType = MergeDataType.PlainText, MergeString = stepInput.ConstantValue }); } } //Convert Array Builder if (stepInput.MappingType == InputMappingType.ArrayBuilder) { List <IInputMapping> toIM = new List <IInputMapping>(); int counter = -1; foreach (StepInput si in stepInput.ArrayParts) { counter = counter + 1; string inDataName = string.Format("Item {0}", counter); toIM.Add(ConvertStepInputToInputMapping(si, inDataName, false)); } return(new ArrayInputMapping() { InputDataName = inputDataName, SubMappings = toIM.ToArray() }); } //Convert Constant - We tried everything else so this must be constant else { return(new ConstantInputMapping() { InputDataName = inputDataName, Value = stepInput.ConstantValue }); } }
public void Input(string inputStr) { StepInput newStepInput = GetStepInputFromString(inputStr); if (stepInputList.Count > 0) { int lastIndex = stepInputList.Count - 1; if (stepInputList[lastIndex].inputType == InputType.Number) { if (newStepInput.inputType == InputType.Number) { if (newStepInput.InputData != 0) { stepInputList[lastIndex].InputData *= 10; stepInputList[lastIndex].InputData += newStepInput.InputData; } else { stepInputList[lastIndex].InputData *= 10; } } else { stepInputList.Add(newStepInput); } if (OnInput != null) { OnInput(stepInputList[lastIndex].InputData.ToString()); } } else { if (newStepInput.inputType != InputType.Number) { stepInputList[lastIndex].inputType = newStepInput.inputType; } else { stepInputList.Add(newStepInput); } if (OnInput != null) { OnInput(newStepInput.InputData.ToString()); } } } else { stepInputList.Add(newStepInput); if (OnInput != null) { OnInput(newStepInput.InputData.ToString()); } } }
public override StepInput[] GetInputs(IOrchestrationComponent component) { StepInput input1 = VVDTUtility.ConvertVariableOrValueDataTypeToInputMapping(((CompareNumbersRule)component).Value1, "value1"); StepInput input2 = VVDTUtility.ConvertVariableOrValueDataTypeToInputMapping(((CompareNumbersRule)component).Value2, "value2"); return(new StepInput[] { input1, input2 }); }
public static StepInput ConvertHTMLMergeDataTypeToInputMapping(HTMLMergeDataType var, string newVariableName) { StepInput result = new StepInput() { MappingType = InputMappingType.MergeText, ConstantValue = CleanUpProjectPropertyReferenceInText(var.PreMergedData), Name = newVariableName }; return(result); }
public void ShouldThrowExceptionWhenNameInputIsMissing() { const InputType unexpectedInputType = (InputType)(-1); var incorrectStepInput = new StepInput(unexpectedInputType); Action act = () => _subject.Execute(new List <StepInput> { incorrectStepInput }); act.Should().Throw <NullReferenceException>().WithMessage("StepInput hasn't been correctly set!"); }
public static StepInput ConvertAsciiMergeDataTypeToInputMapping(AsciiMergeDataType var, string newVariableName) { StepInput result = new StepInput() { MappingType = InputMappingType.MergeText, ConstantValue = CleanUpAsciiMergeText(var.PreMergedData), Name = newVariableName }; return(result); }
public override StepInput[] GetInputs(IOrchestrationComponent component) { StepInput dateFormat = VVDTUtility.ConvertVariableOrValueDataTypeToInputMapping(((ConvertStringToDate)component).ExactDatetimeFormat, "DateFormat"); return(new StepInput[2] { new StepInput() { Name = "InputVariableName", MappingType = InputMappingType.SelectValue, SelectValuePathName = ((ConvertStringToDate)component).InputVariableName }, dateFormat }); }
public static List <StepBase> StructureParseConfig(IConfigController configController, ICodeParser codeParser, SDBuildStrings sdBuildStrings, IExporter[] allExporters) { var stepInput = new StepInput(configController, codeParser, sdBuildStrings, allExporters); var config = new List <StepBase>(); config.Add(new CheckConfigStep(stepInput, 0, 15)); config.Add(new ParseProjectStep(stepInput, 15, 25)); config.Add(new StructeParseCodeStep(stepInput, 25, 100)); return(config); }
//public override string ConvertPath(string originalPath) //{ // if (originalPath.Equals("no match", StringComparison.OrdinalIgnoreCase)) // { // return "No Matches"; // } // return originalPath; //} public override StepInput[] GetInputs(IOrchestrationComponent component) { MatchesRule comp = (MatchesRule)component; StepInput[] results = new StepInput[1]; results[0] = new StepInput(); results[0].Name = "String to Match"; results[0].MappingType = InputMappingType.SelectValue; results[0].SelectValuePathName = comp.CompareToVariable; return(results); }
public override StepInput[] GetInputs(IOrchestrationComponent component) { StepInput varNameToTest = new StepInput() { Name = ((VariableExistsRule)component).VariableName, MappingType = InputMappingType.SelectValue }; return(new StepInput[1] { varNameToTest }); }
public override StepInput[] GetInputs(IOrchestrationComponent component) { string arrayName = ((IndexOfItemInCollection)component).ArrayVariableName; StepInput itemItself = VVDTUtility.ConvertVariableOrValueDataTypeToInputMapping(((IndexOfItemInCollection)component).Item, "Item"); return(new StepInput[2] { new StepInput() { Name = "ArrayVariableName", MappingType = InputMappingType.SelectValue, SelectValuePathName = arrayName }, itemItself }); }
public override StepInput[] GetInputs(IOrchestrationComponent component) { StepInput si = new StepInput(); si.ConstantValue = ((InsertDataComponent)component).Value.ToString(); si.FullTypeName = ((InsertDataComponent)component).DataType.FullName; si.Name = ((InsertDataComponent)component).VariableName; si.MappingType = InputMappingType.Constant; return(new StepInput[1] { si }); }
public void TestCamSpeedMatch() { StepInput i = new StepInput() { chunks = new System.Collections.Generic.List <string>() { "cam", "speed=180" } }; bool match = CameraTarget.IsMatch(i); Assert.IsTrue(match); }
public void ShouldReturnStepOutputWithEmptyIncorrectStepsInputsForCorrectStepInput() { const string nameValue = "Test name value"; var name = new StepInput(InputType.Name) { Value = nameValue }; var stepOutput = _subject.Execute(new List <StepInput> { name }); stepOutput.IncorrectInputsTypes.Should().BeEmpty(); }
public override StepInput[] GetInputs(IOrchestrationComponent component) { //if (((EqualsRule)component).DataType StepInput input1 = new StepInput() { Name = "value1", SelectValuePathName = ((EqualsRule)component).VariableName }; VariableOrValueDataType var = ((EqualsRule)component).CompareTo; StepInput input2 = VVDTUtility.ConvertVariableOrValueDataTypeToInputMapping(var, "value2"); return(new StepInput[] { input1, input2 }); }
public void ShouldReturnStepOutputWithExpectedIncorrectInputTypesForEmptyStepInput() { const string nameValue = ""; var name = new StepInput(InputType.Name) { Value = nameValue }; var expectedIncorrectStepInputTypes = new List <InputType> { InputType.Name }; var stepOutput = _subject.Execute(new List <StepInput> { name }); stepOutput.IncorrectInputsTypes.Should().BeEquivalentTo(expectedIncorrectStepInputTypes); }
public override StepInput[] GetProperties(IOrchestrationComponent component) { StepInput logType = new StepInput() { ConstantValue = ((CreateLogEntryComponent)component).LogEntryLevel.ToString(), Name = "Type" }; StepInput logCat = new StepInput() { ConstantValue = "Process Log", Name = "Category" }; return(new StepInput[2] { logType, logCat }); }
public override StepInput[] GetInputs(IOrchestrationComponent component) { StepInput fromAddy = VVDTUtility.ConvertVariableOrValueDataTypeToInputMapping(((SendEmailComponent)component).FromAddress, "From"); StepInput toAddresses = VVDTUtility.ConvertArrayBuilderDataType(((SendEmailComponent)component).ToAddresses); toAddresses.Name = "To"; StepInput subject = VVDTUtility.ConvertAsciiMergeDataTypeToInputMapping(((SendEmailComponent)component).Subject, "Subject"); StepInput body = VVDTUtility.ConvertHTMLMergeDataTypeToInputMapping(((SendEmailComponent)component).HtmlContent, "Body"); return(new StepInput[4] { fromAddy, toAddresses, subject, body }); }
// Solve the Jacobians stored in the simulation context public static void SolveJacobians(ref NativeStream.Reader jacobiansReader, NativeSlice <MotionVelocity> motionVelocities, float timeStep, int numIterations, ref NativeStream.Writer collisionEventsWriter, ref NativeStream.Writer triggerEventsWriter) { float invNumIterations = math.rcp(numIterations); float invTimeStep = timeStep > 0.0f ? 1.0f / timeStep : 0.0f; for (int solverIterationId = 0; solverIterationId < numIterations; solverIterationId++) { var stepInput = new StepInput { InvNumSolverIterations = invNumIterations, IsLastIteration = solverIterationId == numIterations - 1, Timestep = timeStep, InvTimestep = invTimeStep }; Solve(motionVelocities, ref jacobiansReader, ref collisionEventsWriter, ref triggerEventsWriter, 0, stepInput); } }
public async Task <Step> PostNewStep(StepInput stepInput, string username = null, string password = null) { using (HttpClient client = new HttpClient(clientHandler)) { client.BaseAddress = new Uri(_url); AuthorizeClientWithUser(client, username, password); var response = await client.PostAsync("/api/steps", new StringContent(JsonConvert.SerializeObject(stepInput), Encoding.UTF8, "application/json")); var contents = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { return(JObject.Parse(contents)["result"].ToObject <Step>()); } else { throw new Exception("Error sending Workflow template request, returned with error " + response.StatusCode); } } }
public static StepInput ConvertVariableOrValueDataTypeToInputMapping(VariableOrValueDataType var, string newVariableName) { StepInput result = new StepInput(); if (var != null) { if (var.IsFilledIn()) { if (var.IsConstant()) { result.MappingType = InputMappingType.Constant; result.Name = newVariableName; result.ConstantValue = var.DefaultValue.ToString(); return(result); } else { // It's probably a variable or a merge if (var.HasMergeData) { result.MappingType = InputMappingType.MergeText; result.ConstantValue = var.StringMerge.PreMergedData; result.Name = newVariableName; return(result); } else { // It's just a variable result.MappingType = InputMappingType.SelectValue; result.Name = newVariableName; result.SelectValuePathName = var.Variables[0].ToString(); return(result); } } } } return(null); }
// Observations are never used. // public IEnumerable<StepOutput<GPSFilter2DSample>> Filter(IEnumerable<GPSObservation> samples, IEnumerable<GPSFilter2DInput> inputs) // { // return samples.Select(s => Filter(s, i)); // } private StepOutput<Matrix> CalculateNext(StepInput<Matrix> prev, GPSObservation observation, GPSFilter2DInput input) { TimeSpan time = observation.Time; TimeSpan timeDelta = time - _prevEstimate.Time; UpdateMatrices(time, timeDelta); Matrix u = ToInputMatrix(input); // Ref equations: http://en.wikipedia.org/wiki/Kalman_filter#The_Kalman_filter // Calculate the state and the output Matrix x = A*prev.X + B*u + w; Matrix z = H*x + v; //ToOutputMatrix(observation) + v;//H * x + v; // Predictor equations Matrix PriX = A*prev.PostX + B*u; // n by 1 Matrix AT = Matrix.Transpose(A); Matrix PriP = A*prev.PostP*AT + Q; // n by n Matrix residual = z - H*PriX; Matrix residualP = H*PriP*Matrix.Transpose(H) + R; Matrix residualPInv = residualP.Inverse(); // Corrector equations Matrix K = PriP*Matrix.Transpose(H)*residualPInv; // n by m // TODO Temp, experimenting with skipping measurements // compileerror // k[PositionY, PositionY] = 1.0; // k[VelocityY, VelocityY] = 1.0; // k[AccelerationY, AccelerationY] = 1.0; Matrix PostX = PriX + K*residual; // n by 1 Matrix PostP = (I - K*H)*PriP; // n by n return new StepOutput<Matrix> { K = K, PriX = PriX, PriP = PriP, PostX = PostX, PostP = PostP, PostXError = PostX - x, PriXError = PriX - x, X = x, Z = z, W = w, V = v, Time = time, }; }
public StepOutput<GPSINSOutput> Filter(GPSINSObservation obs, GPSINSInput input) { var inputFromPrev = new StepInput<Matrix>(_prevEstimate); StepOutput<Matrix> result = CalculateNext(inputFromPrev, obs, input); _prevEstimate = result; return ToFilterResult(result); }
/// <summary></summary> /// <param name="x0">Initial system state</param> /// <param name="postX0">Initial guess of system state</param> /// <param name="postP0">Initial guess of a posteriori covariance</param> /// <returns></returns> private StepOutput<Matrix> GetInitialEstimate(Matrix x0, Matrix postX0, Matrix postP0) { var startingCondition = new StepInput<Matrix>(x0, postX0, postP0); // TODO Is it ok to use an observation for the initial state in this manner? var observation = new GPSINSObservation { GPSPosition = GetPosition(x0), Time = _startTime }; return CalculateNext(startingCondition, observation, new GPSINSInput()); }
private StepOutput<Matrix> CalculateNext(StepInput<Matrix> prev, GPSINSObservation observation, GPSINSInput input) { TimeSpan time = observation.Time; TimeSpan timeDelta = time - _prevEstimate.Time; // Note: Use 0.0 and not 0 in order to use the correct constructor! // If no GPS update is available, then use a zero matrix to ignore the values in the observation. H = observation.GotGPSUpdate ? Matrix.Identity(m, n) : new Matrix(m, n, 0.0); HT = Matrix.Transpose(H); UpdateTimeVaryingMatrices(timeDelta); Matrix u = ToInputMatrix(input, time); // Ref equations: http://en.wikipedia.org/wiki/Kalman_filter#The_Kalman_filter // Calculate the state and the output Matrix x = A*prev.X + B*u; // +w; noise is already modelled in input data Matrix z = ToObservationMatrix(observation); //H * x + v;// m by 1 // Predictor equations Matrix PriX = A*prev.PostX + B*u; // n by 1 Matrix PriP = A*prev.PostP*AT + Q; // n by n Matrix residual = z - H*PriX; // m by 1 Matrix residualP = H*PriP*HT + R; // m by m // If residualP is zero matrix then set its inverse to zero as well. // This occurs if all observation standard deviations are zero // and this workaround will cause the Kalman gain to trust the process model entirely. Matrix residualPInv = Matrix.AlmostEqual(residualP, _zeroMM) // m by m ? _zeroMM : residualP.Inverse(); // Corrector equations Matrix K = PriP*Matrix.Transpose(H)*residualPInv; // n by m Matrix PostX = PriX + K*residual; // n by 1 Matrix PostP = (I - K*H)*PriP; // n by n var tmpPosition = new Vector3((float)PostX[0, 0], (float)PostX[1, 0], (float)PostX[2, 0]); // var tmpPrevPosition = new Vector3((float)prev.PostX[0, 0], (float)prev.PostX[1, 0], (float)prev.PostX[2, 0]); // Vector3 positionChange = tmpPosition - tmpPrevPosition; Vector3 gpsPositionTrust = new Vector3((float)K[0, 0], (float)K[1, 1], (float)K[2, 2]); Vector3 gpsVelocityTrust = new Vector3((float)K[3, 3], (float)K[4, 4], (float)K[5, 5]); // // Matrix tmpPriPGain = A*Matrix.Identity(10,10)*AT + Q; var tmpVelocity = new Vector3((float)x[3, 0], (float)x[4, 0], (float)x[5, 0]); var tmpAccel = new Vector3((float)x[6, 0], (float)x[7, 0], (float)x[8, 0]); return new StepOutput<Matrix> { K = K, PriX = PriX, PriP = PriP, PostX = PostX, PostP = PostP, PostXError = PostX - x, PriXError = PriX - x, X = x, Z = z, W = w, V = v, Time = time, }; }