VeraGridEngine.Utils packageο
Subpackagesο
- VeraGridEngine.Utils.Filtering package
- Submodules
- VeraGridEngine.Utils.Filtering.filtering module
- VeraGridEngine.Utils.Filtering.objects_filtering module
- VeraGridEngine.Utils.Filtering.results_table_filtering module
- VeraGridEngine.Utils.Filtering.timeseries_filtering module
- Module contents
- VeraGridEngine.Utils.GeographicalMethods package
- VeraGridEngine.Utils.MIP package
- Subpackages
- Submodules
- VeraGridEngine.Utils.MIP.gslv_interface module
LpModelLpModel.INFINITYLpModel.OPTIMALLpModel.add_bin()LpModel.add_cst()LpModel.add_int()LpModel.add_var()LpModel.fobj_value()LpModel.get_dual_value()LpModel.get_value()LpModel.is_mip()LpModel.minimize()LpModel.modelLpModel.resultLpModel.save_model()LpModel.set_var_bounds()LpModel.solve()LpModel.status2string()LpModel.sum()
get_available_mip_solvers()
- VeraGridEngine.Utils.MIP.mip_interface_template module
AbstractLpModelAbstractLpModel.INFINITYAbstractLpModel.OPTIMALAbstractLpModel.add_bin()AbstractLpModel.add_cst()AbstractLpModel.add_int()AbstractLpModel.add_var()AbstractLpModel.fobj_value()AbstractLpModel.get_dual_value()AbstractLpModel.get_value()AbstractLpModel.is_mip()AbstractLpModel.loggerAbstractLpModel.minimize()AbstractLpModel.model_as_string()AbstractLpModel.nameAbstractLpModel.originally_infeasibleAbstractLpModel.relaxed_slacksAbstractLpModel.save_model()AbstractLpModel.set_var_bounds()AbstractLpModel.solve()AbstractLpModel.solver_typeAbstractLpModel.status2string()AbstractLpModel.sum()
- VeraGridEngine.Utils.MIP.ortools_interface module
OrToolsLpModelOrToolsLpModel.INFEASIBLEOrToolsLpModel.INFINITYOrToolsLpModel.NOT_SOLVEDOrToolsLpModel.OPTIMALOrToolsLpModel.add_bin()OrToolsLpModel.add_cst()OrToolsLpModel.add_int()OrToolsLpModel.add_var()OrToolsLpModel.fobj_value()OrToolsLpModel.get_dual_value()OrToolsLpModel.get_value()OrToolsLpModel.is_mip()OrToolsLpModel.minimize()OrToolsLpModel.modelOrToolsLpModel.model_as_string()OrToolsLpModel.pass_through_file()OrToolsLpModel.save_model()OrToolsLpModel.set_var_bounds()OrToolsLpModel.solve()OrToolsLpModel.solverOrToolsLpModel.status2string()OrToolsLpModel.sum()
get_ortools_available_mip_solvers()get_solver_params_string()
- VeraGridEngine.Utils.MIP.pulp_interface module
PulpLpModelPulpLpModel.INFEASIBLEPulpLpModel.INFINITYPulpLpModel.NOT_SOLVEDPulpLpModel.OPTIMALPulpLpModel.add_bin()PulpLpModel.add_cst()PulpLpModel.add_int()PulpLpModel.add_var()PulpLpModel.fobj_value()PulpLpModel.get_dual_value()PulpLpModel.get_solver()PulpLpModel.get_value()PulpLpModel.is_mip()PulpLpModel.minimize()PulpLpModel.modelPulpLpModel.model_as_string()PulpLpModel.save_model()PulpLpModel.set_var_bounds()PulpLpModel.solve()PulpLpModel.status2string()PulpLpModel.sum()
add_pulp_variable()get_infeasible_status()get_lp_var_value()get_model_constraint_by_name()get_model_constraint_items()get_not_solved_status()get_optimal_status()get_pulp_available_mip_solvers()make_highs_solver()make_pulp_expression()normalize_solve_status()
- VeraGridEngine.Utils.MIP.selected_interface module
- Module contents
- VeraGridEngine.Utils.NumericalMethods package
- Submodules
- VeraGridEngine.Utils.NumericalMethods.MVRSM_mo_pareto module
MVRSM_mo_pareto()SurrogateModelSurrogateModel.PSurrogateModel.WSurrogateModel.augmented_Tchebycheff()SurrogateModel.augmented_Tchebycheff_jac()SurrogateModel.bSurrogateModel.boundsSurrogateModel.cSurrogateModel.g()SurrogateModel.g_jac()SurrogateModel.g_scalarize()SurrogateModel.g_scalarize_jac()SurrogateModel.g_scalarize_max()SurrogateModel.g_scalarize_max_jac()SurrogateModel.init()SurrogateModel.mSurrogateModel.minimum()SurrogateModel.n_objSurrogateModel.phi()SurrogateModel.phi_deriv()SurrogateModel.scratchSurrogateModel.update()
get_norm_factors()inv_normalize_md()inv_scale()normalize_md()relu()relu_deriv()scale()
- VeraGridEngine.Utils.NumericalMethods.MVRSM_mo_scaled module
- VeraGridEngine.Utils.NumericalMethods.MVRSM_original module
- VeraGridEngine.Utils.NumericalMethods.autodiff module
- VeraGridEngine.Utils.NumericalMethods.common module
- VeraGridEngine.Utils.NumericalMethods.emt_sparse_solver_loader module
- VeraGridEngine.Utils.NumericalMethods.emt_sparse_solver_registry module
- VeraGridEngine.Utils.NumericalMethods.emt_sparse_superlu_backend module
- VeraGridEngine.Utils.NumericalMethods.external_sparse_solver_interface module
SparseLinearFactorizationHandleSparseLinearSolverBackendSparseLinearSolverBackend.analyze()SparseLinearSolverBackend.factorize()SparseLinearSolverBackend.get_backend_stats()SparseLinearSolverBackend.get_name()SparseLinearSolverBackend.get_solver_type()SparseLinearSolverBackend.is_available()SparseLinearSolverBackend.refactor_numeric()SparseLinearSolverBackend.requires_csc()SparseLinearSolverBackend.supports_numeric_refactorization()SparseLinearSolverBackend.supports_symbolic_analysis_reuse()
SparseLinearSolverBackendProvider
- VeraGridEngine.Utils.NumericalMethods.ips module
IpsFunctionReturnIpsFunctionReturn.GIpsFunctionReturn.GxIpsFunctionReturn.GxxIpsFunctionReturn.HIpsFunctionReturn.HxIpsFunctionReturn.HxxIpsFunctionReturn.SIpsFunctionReturn.SfIpsFunctionReturn.StIpsFunctionReturn.compare()IpsFunctionReturn.fIpsFunctionReturn.fxIpsFunctionReturn.fxxIpsFunctionReturn.get_data()IpsFunctionReturn.get_headers()
IpsSolutioncalc_ccond()calc_error()calc_feascond()calc_gradcond()calc_ocond()interior_point_solver()max_abs()split()step_calculation()
- VeraGridEngine.Utils.NumericalMethods.iwamoto module
- VeraGridEngine.Utils.NumericalMethods.levenberg_marquadt module
- VeraGridEngine.Utils.NumericalMethods.newton_raphson module
- VeraGridEngine.Utils.NumericalMethods.newton_raphson_ode module
- VeraGridEngine.Utils.NumericalMethods.non_dominated_sorting module
- VeraGridEngine.Utils.NumericalMethods.nsga3 module
- VeraGridEngine.Utils.NumericalMethods.numerical_stability module
- VeraGridEngine.Utils.NumericalMethods.powell module
- VeraGridEngine.Utils.NumericalMethods.sparse_solve module
- VeraGridEngine.Utils.NumericalMethods.weldorf_online_stddev module
- Module contents
- VeraGridEngine.Utils.Sparse package
- Submodules
- VeraGridEngine.Utils.Sparse.csc module
- VeraGridEngine.Utils.Sparse.csc2 module
CSCCxCSCcsc_add_cx2()csc_add_cx3()csc_add_ff()csc_add_ff2()csc_cumsum_i()csc_matvec_cx()csc_matvec_ff()csc_multiply_cx()csc_multiply_ff()csc_multiply_ff2()csc_scatter_cx()csc_scatter_f()csc_spalloc_cx()csc_spalloc_f()csc_stack_2d_ff()diagc()diags()extend()is_valid_for_super_lu()mat_to_scipy()pack_3_by_4()pack_4_by_4()scipy_to_cxmat()scipy_to_mat()sp_slice()sp_slice_cols()sp_slice_rows()sp_transpose()spfactor()spsolve_csc()
- VeraGridEngine.Utils.Sparse.csc_numba module
binary_find()coo_to_csc()csc_add_ff()csc_cumsum_i()csc_diagonal()csc_diagonal_from_array()csc_diagonal_from_complex_array()csc_diagonal_from_number()csc_mat_vec_ff()csc_multiply_ff()csc_norm()csc_scatter_f()csc_scatter_ff()csc_spalloc_f()csc_sprealloc_f()csc_stack_2d_ff_col_major()csc_stack_2d_ff_row_major()csc_stack_3_by_4_ff()csc_stack_4_by_4_ff()csc_sub_matrix()csc_sub_matrix_cols()csc_sub_matrix_old()csc_sub_matrix_rows()csc_to_csr()csc_to_dense()csc_transpose()dense_to_csc_numba()diag_positions()find_islands()get_sparse_array_numba()ialloc()sp_submat_c_numba()xalloc()
- VeraGridEngine.Utils.Sparse.sparse_array module
SparseArraySparseArray.at()SparseArray.clear()SparseArray.copy()SparseArray.create()SparseArray.create_from_array()SparseArray.create_from_dict()SparseArray.default_valueSparseArray.dtypeSparseArray.fill()SparseArray.get_map()SparseArray.get_sparse_representation()SparseArray.get_sparsity()SparseArray.info()SparseArray.insert()SparseArray.resample()SparseArray.resize()SparseArray.set_data()SparseArray.set_sparse_data_from_data()SparseArray.size()SparseArray.slice()SparseArray.toarray()
SparseObjectArraycheck_type()
- VeraGridEngine.Utils.Sparse.utils module
- Module contents
- VeraGridEngine.Utils.SugiyamaLayered package
- Subpackages
- VeraGridEngine.Utils.SugiyamaLayered.Phases package
- Submodules
- VeraGridEngine.Utils.SugiyamaLayered.Phases.components module
- VeraGridEngine.Utils.SugiyamaLayered.Phases.crossing_minimization module
- VeraGridEngine.Utils.SugiyamaLayered.Phases.cycle_breaking module
- VeraGridEngine.Utils.SugiyamaLayered.Phases.edge_routing module
- VeraGridEngine.Utils.SugiyamaLayered.Phases.labels module
- VeraGridEngine.Utils.SugiyamaLayered.Phases.layering module
- VeraGridEngine.Utils.SugiyamaLayered.Phases.long_edges module
- VeraGridEngine.Utils.SugiyamaLayered.Phases.node_placement module
- Module contents
- VeraGridEngine.Utils.SugiyamaLayered.Phases package
- Submodules
- VeraGridEngine.Utils.SugiyamaLayered.engine module
- VeraGridEngine.Utils.SugiyamaLayered.json_codec module
- VeraGridEngine.Utils.SugiyamaLayered.model module
SugiyamaEdgeSugiyamaEdgeSectionSugiyamaGraphSugiyamaGraph.all_nodes()SugiyamaGraph.all_ports()SugiyamaGraph.append_child()SugiyamaGraph.append_edge()SugiyamaGraph.append_label()SugiyamaGraph.childrenSugiyamaGraph.clear_children()SugiyamaGraph.clear_edges()SugiyamaGraph.clear_labels()SugiyamaGraph.clone_shallow()SugiyamaGraph.edgesSugiyamaGraph.heightSugiyamaGraph.labelsSugiyamaGraph.node_by_id()SugiyamaGraph.port_by_id()SugiyamaGraph.width
SugiyamaLabelSugiyamaNodeSugiyamaNode.append_child()SugiyamaNode.append_label()SugiyamaNode.append_port()SugiyamaNode.childrenSugiyamaNode.clear_children()SugiyamaNode.clear_labels()SugiyamaNode.clear_ports()SugiyamaNode.heightSugiyamaNode.iter_descendants()SugiyamaNode.labelsSugiyamaNode.parentSugiyamaNode.portsSugiyamaNode.set_children()SugiyamaNode.widthSugiyamaNode.xSugiyamaNode.y
SugiyamaPortSugiyamaPrimitive
- VeraGridEngine.Utils.SugiyamaLayered.options module
ConsiderModelOrderStrategyCrossingMinimizationStrategyCycleBreakingStrategyEdgeRoutingModeFixedAlignmentLayeringStrategyLayoutAlgorithmLayoutDirectionNodePlacementStrategyOptionDefinitionPortAlignmentPortConstraintPortSideSelfLoopDistributionSugiyamaOptionResolverbuild_default_option_registry()coerce_enum_value()
- VeraGridEngine.Utils.SugiyamaLayered.pipeline module
LayoutContextLayoutPhaseBaseLayoutPhaseStateLayoutPhaseState.componentsLayoutPhaseState.dag_predecessorsLayoutPhaseState.dag_successorsLayoutPhaseState.edge_pathsLayoutPhaseState.expanded_edgesLayoutPhaseState.expanded_layersLayoutPhaseState.expanded_nodesLayoutPhaseState.expanded_predecessorsLayoutPhaseState.expanded_successorsLayoutPhaseState.feedback_edgesLayoutPhaseState.flat_edgesLayoutPhaseState.layer_ofLayoutPhaseState.layer_xLayoutPhaseState.long_edgesLayoutPhaseState.node_orderLayoutPhaseState.order_in_layerLayoutPhaseState.ordered_layersLayoutPhaseState.oriented_edgesLayoutPhaseState.reversed_edgesLayoutPhaseState.skipped_edgesLayoutPhaseState.topological_orderLayoutPhaseState.virtual_positionsLayoutPhaseState.y_of_node
LayoutPipelinePhaseTimingPipelineReport
- Module contents
PipelineReportSugiyamaEdgeSugiyamaEdgeSectionSugiyamaGraphSugiyamaGraph.all_nodes()SugiyamaGraph.all_ports()SugiyamaGraph.append_child()SugiyamaGraph.append_edge()SugiyamaGraph.append_label()SugiyamaGraph.childrenSugiyamaGraph.clear_children()SugiyamaGraph.clear_edges()SugiyamaGraph.clear_labels()SugiyamaGraph.clone_shallow()SugiyamaGraph.edgesSugiyamaGraph.heightSugiyamaGraph.labelsSugiyamaGraph.node_by_id()SugiyamaGraph.port_by_id()SugiyamaGraph.width
SugiyamaLabelSugiyamaLayeredPythonEngineSugiyamaNodeSugiyamaNode.append_child()SugiyamaNode.append_label()SugiyamaNode.append_port()SugiyamaNode.childrenSugiyamaNode.clear_children()SugiyamaNode.clear_labels()SugiyamaNode.clear_ports()SugiyamaNode.heightSugiyamaNode.iter_descendants()SugiyamaNode.labelsSugiyamaNode.parentSugiyamaNode.portsSugiyamaNode.set_children()SugiyamaNode.widthSugiyamaNode.xSugiyamaNode.y
SugiyamaOptionResolverSugiyamaPortSugiyamaPrimitivebuild_default_option_registry()graph_from_sugiyama_json()graph_to_sugiyama_json()
- Subpackages
- VeraGridEngine.Utils.Symbolic package
- Subpackages
- Submodules
- VeraGridEngine.Utils.Symbolic.block module
BlockBlock.E()Block.V()Block.add()Block.algebraic_eqsBlock.algebraic_varsBlock.api_obj_mappingBlock.boolean_guardsBlock.check_empty()Block.check_valid_init_method()Block.childrenBlock.compare()Block.connect()Block.connection_intentsBlock.copy()Block.diagramBlock.diff_init_eqsBlock.diff_varsBlock.differential_eqsBlock.discrete_eqsBlock.dynamic_model_contractBlock.empty()Block.event_dictBlock.external_mappingBlock.find_var_in_block()Block.find_var_in_equations()Block.get_all_blocks()Block.get_all_equations_list()Block.get_all_vars()Block.get_vars()Block.in_varsBlock.inequalitiesBlock.init_eqsBlock.init_valuesBlock.is_decomposableBlock.is_eq_decomposable()Block.jmarti_fit_bundleBlock.jmarti_runtime_dataBlock.merge_incoming_block()Block.modal_template_configBlock.modal_template_kindBlock.mode_dictBlock.model_family_nameBlock.nameBlock.out_varsBlock.parametersBlock.parse()Block.post_init_seed_eqsBlock.procedural_logicBlock.reconstruct_procedural_logic_entries()Block.reformulated_varsBlock.remove()Block.serialize_procedural_logic_entries()Block.set_name()Block.set_parameter_in_model()Block.state_eqsBlock.state_varsBlock.to_dict()Block.tpe_uidBlock.uidBlock.unify_blocks()Block.update_equations()Block.update_equations_bulk()Block.update_model()Block.update_model_bulk()Block.update_variables()Block.update_variables_bulk()Block.var_mappingBlock.vars_glob_name2uid
DynamicModelContractDynamicModelContract.dgs_elmgenstat_runtime_adapterDynamicModelContract.dgs_elmsvs_remote_voltage_var_uidDynamicModelContract.dgs_elmsvs_runtime_adapterDynamicModelContract.dgs_elmsym_active_base_factor_var_uidDynamicModelContract.dgs_elmsym_angular_frequency_var_uidDynamicModelContract.dgs_elmsym_excitation_gain_var_uidDynamicModelContract.dgs_elmsym_network_angle_anchorDynamicModelContract.dgs_elmsym_rated_field_voltage_var_uidDynamicModelContract.dgs_elmsym_reference_speed_var_uidDynamicModelContract.dgs_elmsym_rotor_angle_var_uidDynamicModelContract.dgs_elmsym_round_rotorDynamicModelContract.dgs_elmsym_runtime_adapterDynamicModelContract.dgs_elmsym_runtime_adapter_pendingDynamicModelContract.dgs_elmsym_speed_var_uidDynamicModelContract.dgs_equipment_owned_signal_namesDynamicModelContract.dgs_explicit_initialization_uidsDynamicModelContract.dgs_logical_actuator_root_idDynamicModelContract.dgs_open_resistance_ohmDynamicModelContract.dgs_open_standard_regc_current_pllDynamicModelContract.dgs_open_standard_regc_voltage_sourceDynamicModelContract.emt_internal_grounding_linkDynamicModelContract.emt_terminal_current_contributionsDynamicModelContract.explicit_init_excluded_var_namesDynamicModelContract.explicit_init_override_init_exprsDynamicModelContract.rms_conduction_status_var_uidDynamicModelContract.rms_ideal_ac_connectorDynamicModelContract.rms_ideal_transformerDynamicModelContract.rms_physical_measurement_pointDynamicModelContract.rms_terminal_power_contributionsDynamicModelContract.rms_topology_constraint_status_var_uidDynamicModelContract.runtime_equipment_shell_sync_namesDynamicModelContract.runtime_equipment_shell_sync_var_uidsDynamicModelContract.runtime_measurement_shell_sync_namesDynamicModelContract.skip_device_local_explicit_initDynamicModelContract.startup_final_init_replay_var_namesDynamicModelContract.startup_initial_reduced_polish_var_namesDynamicModelContract.startup_ordered_shell_sync_namesDynamicModelContract.to_data()
EmtTerminalCurrentContributionRmsPhysicalMeasurementPointRmsPhysicalMeasurementPoint.get_meter_kind()RmsPhysicalMeasurementPoint.get_output_signal_names()RmsPhysicalMeasurementPoint.get_output_var_uids()RmsPhysicalMeasurementPoint.get_source_fid()RmsPhysicalMeasurementPoint.get_target_fid()RmsPhysicalMeasurementPoint.get_terminal_side()RmsPhysicalMeasurementPoint.to_data()
RmsTerminalPowerContributionbuild_name_to_var_lookup()build_name_to_vars_lookup()collect_rms_physical_measurement_points()compare_blocks_structurally()compare_n_blocks_structurally()dynamic_model_contract_from_data()emt_terminal_current_contribution_from_data()find_connections()find_connections_pf()find_matching_dynamic_connection_intent()find_name_in_block()has_emt_internal_grounding_link()normalize_dynamic_connection_intents()normalize_event_parameter_initialization()refresh_block_tree_var_name_mappings()rehash_block_tree_var_keyed_dicts()rehash_block_var_keyed_dicts()rms_physical_measurement_point_from_data()rms_terminal_power_contribution_from_data()upsert_dynamic_connection_intent()validate_dynamic_model_contract()validate_emt_terminal_current_contributions()validate_rms_terminal_power_contributions()variables_in_corresponding_attributes()
- VeraGridEngine.Utils.Symbolic.block_helpers module
- VeraGridEngine.Utils.Symbolic.bus_emt_template module
BusEmtTemplateBusEmtTemplate.CLASS_NON_EDITABLE_PROPERTIESBusEmtTemplate.CLASS_PROPERTIES_WITH_PROFILEBusEmtTemplate.CLASS_PROPERTY_DECLARATIONSBusEmtTemplate.CLASS_PROPERTY_LISTBusEmtTemplate.CLASS_REGISTERED_PROPERTIESBusEmtTemplate.blockBusEmtTemplate.tpeBusEmtTemplate.v_ABusEmtTemplate.v_BBusEmtTemplate.v_CBusEmtTemplate.v_DCBusEmtTemplate.v_N
get_bus_emt_algebraic_vars()get_bus_emt_template()get_bus_mask()
- VeraGridEngine.Utils.Symbolic.bus_rms_template module
- VeraGridEngine.Utils.Symbolic.compare_expressions_structure module
- VeraGridEngine.Utils.Symbolic.compiled_functions module
- VeraGridEngine.Utils.Symbolic.diagnostic module
Array1DNewtonDiagnosticsConfigNewtonDiagnosticsConfig.backtracking_betaNewtonDiagnosticsConfig.backtracking_max_iterNewtonDiagnosticsConfig.backtracking_min_alphaNewtonDiagnosticsConfig.compute_dense_condNewtonDiagnosticsConfig.dense_cond_max_nNewtonDiagnosticsConfig.dense_cond_warnNewtonDiagnosticsConfig.enable_backtrackingNewtonDiagnosticsConfig.enable_fallbackNewtonDiagnosticsConfig.enable_index1_checkNewtonDiagnosticsConfig.index1_fail_pivot_ratioNewtonDiagnosticsConfig.index1_max_block_nNewtonDiagnosticsConfig.index1_warn_pivot_ratioNewtonDiagnosticsConfig.log_levelNewtonDiagnosticsConfig.max_newton_step_infNewtonDiagnosticsConfig.step_norm_explode
NewtonSolveContextNewtonSolveContext.cond_estNewtonSolveContext.failure_msgNewtonSolveContext.index1_pivot_ratioNewtonSolveContext.methodNewtonSolveContext.newton_iterNewtonSolveContext.phaseNewtonSolveContext.res_norm_infNewtonSolveContext.solverNewtonSolveContext.step_idxNewtonSolveContext.step_norm2NewtonSolveContext.step_norm_infNewtonSolveContext.tNewtonSolveContext.used_fallback
NewtonTraceCollectordense_lstsq_fallback()maybe_apply_backtracking()maybe_check_index1()sparse_lsqr_fallback()with_newton_diagnostics()
- VeraGridEngine.Utils.Symbolic.dynamic_connection_intent module
ConnectionIntentBlockConnectionIntentVariableDynamicConnectionIntentDynamicConnectionIntent.copy()DynamicConnectionIntent.get_direction()DynamicConnectionIntent.get_internal_block_uid()DynamicConnectionIntent.get_internal_variable_uid()DynamicConnectionIntent.get_origin()DynamicConnectionIntent.get_root_reference()DynamicConnectionIntent.has_same_identity()DynamicConnectionIntent.is_suppressed()DynamicConnectionIntent.set_internal_variable_uid()DynamicConnectionIntent.set_root_reference()DynamicConnectionIntent.set_suppressed()
DynamicConnectionIntentDirectionDynamicConnectionIntentOrigindynamic_connection_intent_from_dict()dynamic_connection_intent_to_dict()is_legacy_suppressed_connection_intent_tombstone()reconcile_dynamic_connection_intent_target()
- VeraGridEngine.Utils.Symbolic.equation_decomposer module
- VeraGridEngine.Utils.Symbolic.explicit_initialization_symbolic module
RmsSingleEquationCompilerSymbolicVectorSingleEquationCompileradd_direct_algebraic_init_dependencies()add_items()apply_sampled_procedural_initializers()build_explicit_external_uid_values()build_explicit_init_graph()build_init_dict()build_rms_single_equation_compiler()build_symbolic_vector_single_equation_compiler()build_uid_bindings()collect_direct_algebraic_initializers()compile_single_explicit_equation()evaluate_explicit_init_equation()evaluate_single_equation_fn()init_explicit_common()solve_self_implicit()store_resolved_event_parameter()
- VeraGridEngine.Utils.Symbolic.jit_compiler module
- Module: JIT Equation Compiler & Numerical Discretization Engine
ADVisitorBDF2MethodBackwardEulerMethodContinuousMethodDerivativeFunctionWrapperDiscretizationMethodEagerEquationCompilerEagerKernelKindEmptySparseJacobianEvaluatorEmptyVecSparseJacobianEvaluatorEquationCompilerEquationCompiler.METHODSEquationCompiler.compile()EquationCompiler.compile_ad_kernel()EquationCompiler.diff_var_mapEquationCompiler.diff_vars_objsEquationCompiler.param_mapEquationCompiler.parameters_objsEquationCompiler.strategyEquationCompiler.var_mapEquationCompiler.variables_objsEquationCompiler.visitor
EventParameterFunctionWrapperGeneratedKernelCacheGeneratedKernelCacheEntryMatrixVectorizedCompilerMatrixVectorizedVisitorRMSCompilerRMSCompilerVecSparseJacobianEvaluatorVecWrapperSparseJacobianEvaluatorWrapperSubexpressionAnalyzerSubexpressionAnalyzer.analyze()SubexpressionAnalyzer.expr_complexitySubexpressionAnalyzer.expr_countsSubexpressionAnalyzer.expr_objectsSubexpressionAnalyzer.hash_expr()SubexpressionAnalyzer.memo_canonicalSubexpressionAnalyzer.memo_complexitySubexpressionAnalyzer.thresholdSubexpressionAnalyzer.visited_traversal
SymbolicToPythonVisitorSymbolicToPythonVisitor.OP_PRECEDENCESymbolicToPythonVisitor.analyzerSymbolicToPythonVisitor.cse_mapSymbolicToPythonVisitor.diff_var_mapSymbolicToPythonVisitor.generic_visit()SymbolicToPythonVisitor.in_cse_defSymbolicToPythonVisitor.methodSymbolicToPythonVisitor.param_mapSymbolicToPythonVisitor.var_mapSymbolicToPythonVisitor.visit()SymbolicToPythonVisitor.visit_binop()SymbolicToPythonVisitor.visit_const()SymbolicToPythonVisitor.visit_diffvar()SymbolicToPythonVisitor.visit_func()SymbolicToPythonVisitor.visit_unop()SymbolicToPythonVisitor.visit_var()
TrapezoidalMethod
- VeraGridEngine.Utils.Symbolic.latex_printer module
- VeraGridEngine.Utils.Symbolic.lp_model module
- VeraGridEngine.Utils.Symbolic.symbolic module
BinOpCmpOpComparisonConstExprFuncFunc2SharedVarReferenceTypeUnOpVarabs()acos()asin()atan()atan2()cos()cosh()diff()eval_uid()exp()expression2numba()f_exc()find_vars_order()get_expression_vars()get_namespace()get_symbolic_parser_function_arity()get_symbolic_parser_function_names()hard_sat()heaviside()heaviside_num()log()piecewise()rand()safe_divide()sin()sinh()sqrt()string_to_symbolic()symbolic_to_string()tan()
- VeraGridEngine.Utils.Symbolic.symbolic_io module
BlockParserBlockSaverblock_deep_copy()compare_blocks()connections_to_dict()duplicate_block()duplicate_condition()duplicate_const()duplicate_expr()duplicate_required_var()duplicate_var()expr_list_to_list()expr_to_dict()infer_persisted_main_block_uids()normalize_persisted_block_uid()normalize_persisted_blocks()parse_expr()parse_expr_list()register_persisted_block_tree()symbolic_objects_to_dict()
- VeraGridEngine.Utils.Symbolic.symbolic_ml module
exponential_ml()ml_f_exc()ml_hard_sat()ml_hard_sat_sigmoid()ml_heaviside()ml_heaviside_sigmoid()ml_max()ml_piecewise()ml_piecewise_aux()ml_positive_part()ml_positive_part_alt()ml_smooth_hard_sat()ml_smooth_sqrt()ml_soft_sign()ml_three_phase_carrier_pwm_direct()ml_three_phase_carrier_pwm_direct_params()mti_hard_sat()mti_three_phase_carrier_pwm_direct()mti_three_phase_carrier_pwm_direct_params()mti_three_phase_carrier_pwm_internal_carrier_params()mti_three_phase_carrier_pwm_scheduled_params()park_transform()smooth_hard_sat()trig_transform()trig_transform_diff()
- VeraGridEngine.Utils.Symbolic.templates_common_functions module
EmtBusShellSyncResultattach_emt_model_to_buses()cleanup_connected_emt_models_for_bus()connect_bus_variables_emt()connect_bus_variables_rms()connect_injection_emt()connect_line_emt_from()connect_line_emt_to()connect_line_phasor_rms_from()connect_line_phasor_rms_to()connect_line_rms_from()connect_line_rms_to()connect_models()connect_models_power_flow()connect_pending_injection_bus_variables_emt()connect_vsc_emt_from()connect_vsc_emt_to()emt_bus_shell_matches_grid_topology()ensure_bus_emt_model_matches_grid_mask()initialize_bus_emt_from_grid_with_fallback()initialize_bus_emt_from_local_device_context()normalize_branch_rms_root_contract_from()normalize_branch_rms_root_contract_to()normalize_rms_root_contract()normalize_single_bus_rms_root_contract()reconcile_saved_emt_model_against_current_topology()reconnect_registered_emt_models_for_bus()register_connected_emt_model()register_saved_emt_model_vars_for_device()rematerialize_saved_dynamic_connection_intents()seed_branch_template_derived_dynamic_connection_intents()seed_template_derived_dynamic_connection_intents()set_emt_model()set_rms_model()synchronize_emt_bus_shell_with_grid()synchronize_saved_emt_root_contract_from_bus()synchronize_saved_emt_root_contract_identity()synchronize_saved_emt_root_parameters_from_children()synchronize_saved_rms_root_mappings_from_children()unify_saved_emt_model_root_contract()unregister_connected_emt_model()unregister_connected_emt_model_from_attached_buses()unregister_saved_emt_model_var_connections_for_device()
- VeraGridEngine.Utils.Symbolic.test_symbolic_equivalence module
BinOpConstFuncUnOpVarcanonical()cos()equations_equivalent()equivalent()equivalent_expanded()equivalent_systems()expand()expand_and_canonicalize()run_all_tests()sin()structural_hash()structural_hash_expanded()test_associativity()test_associativity_mult()test_commutativity()test_commutativity_mult()test_complex_expression()test_constant_folding()test_equations_equivalent()test_function_stability()test_neutral_elements()test_polynomial_equivalence()test_power_normalization()test_system_equivalence()test_zero_product()
- VeraGridEngine.Utils.Symbolic.test_variable_alignment module
- VeraGridEngine.Utils.Symbolic.variable_alignment_engine module
- Module contents
- VeraGridEngine.Utils.ThirdParty package
Submodulesο
VeraGridEngine.Utils.charatcter_detection moduleο
- VeraGridEngine.Utils.charatcter_detection.can_decode(data: bytes, encoding: str) bool[source]ο
Check whether a byte sequence can be decoded with a specific encoding.
- Parameters:
data β Raw byte sequence to validate.
encoding β Candidate text encoding.
- Returns:
Truewhen decoding succeeds,Falseotherwise.
- VeraGridEngine.Utils.charatcter_detection.detect_character_encoding(source: str | Path | bytes, fallback_encodings: tuple[str, ...] | None = None) str[source]ο
Detect a text encoding and validate the result by decoding the payload.
The algorithm starts with
chardetbecause it is cheap and already available in the project. The algorithm then validates the detected encoding by actually decoding the full byte sequence. If the detected encoding fails, the algorithm tries a short sequence of explicit fallback encodings that commonly appear in imported text files.- Parameters:
source β File path or raw bytes to inspect.
fallback_encodings β Optional ordered list of fallback encodings.
- Returns:
The first encoding that decodes the full payload.
VeraGridEngine.Utils.compare moduleο
VeraGridEngine.Utils.emt_boundary_update_wrapper moduleο
- class VeraGridEngine.Utils.emt_boundary_update_wrapper.BoundaryUpdateWrapper[source]ο
Bases:
objectLightweight interface for EMT boundary updates and forced events.
The class lives in
VeraGridEngine.Utilsso EMT templates, procedural logic and solver modules can import it statically without pulling one heavy solver or simulation package__init__into the import graph.
VeraGridEngine.Utils.procedural_logic moduleο
- class VeraGridEngine.Utils.procedural_logic.AnalogFlipFlopLogic(output_var_name: str, input_expr: Expr | Comparison, set_expr: Expr | Comparison, reset_expr: Expr | Comparison, name: str = '')[source]ο
Bases:
ProceduralLogicBaseStore an analog value when a set/reset latch enters the high state.
- bind(problem: ProceduralProblem) None[source]ο
Resolve the runtime output slot and reset the analog latch state.
- Parameters:
problem β Bound EMT problem.
- Returns:
None
- held_valueο
- initializedο
- input_exprο
- logic_tpe = 'analog_flipflop'ο
- output_idxο
- output_var_nameο
- remap(var_mapping: Dict[Expr | str, Expr]) AnalogFlipFlopLogic[source]ο
Clone the logic under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped analog flip-flop logic.
- reset_exprο
- set_exprο
- stateο
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Apply analog set/reset semantics and update the held value.
- Parameters:
t β Current solver time.
x β Accepted state vector.
params β Runtime parameter vector.
- Returns:
None
- class VeraGridEngine.Utils.procedural_logic.BlockProceduralLogicUpdater(problem: ProceduralProblem, logic_entries: List[ProceduralLogicBase])[source]ο
Bases:
BoundaryUpdateWrapperBoundary updater that delegates runtime decisions to block-attached procedural logic entries.
- get_next_forced_event_time(t_prev: float, t_target: float) float | None[source]ο
Return the earliest forced event requested by any procedural logic entry.
- Parameters:
t_prev β Previous solver time.
t_target β Nominal target time.
- Returns:
Earliest event in the interval, if any.
- initialize_modes(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Initialize retained procedural mode outputs at startup.
The generic EMT runtime-parameter initialization seeds
mode_dictvalues before the procedural layer is active. For procedural outputs such as sampled values and saturations, the correct startup value is the value produced by the procedural logic itself when evaluated at the initialized operating point. This startup pass applies the same update logic once after the continuous initialization has populated the state, algebraic, and differential guesses, so retained mode outputs start from the exact operating-point sample that the runtime layer will hold.- Parameters:
t β Startup simulation time.
x β Initialized state/algebraic vector.
params β Runtime parameter vector updated in place.
- Returns:
None
- logic_entriesο
- problemο
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Forward one runtime update to all procedural logic entries.
- Parameters:
t β Current solver time.
x β Accepted state vector.
params β Runtime parameter vector.
- Returns:
None
- class VeraGridEngine.Utils.procedural_logic.ConditionalDiagnosticLogic(condition_expr: Expr | Comparison, message: str, initialization_only: bool, name: str = '')[source]ο
Bases:
ProceduralLogicBasePreserve one conditional source-model diagnostic declaratively.
The entry deliberately owns no presentation side effect. Solver or UI code may later consume the typed condition and exact message according to its logging policy without making import-time data executable.
- Parameters:
condition_expr β Boolean expression that activates the diagnostic.
message β Exact source diagnostic text.
initialization_only β Whether PowerFactory evaluates it only during initialization.
name β Optional diagnostic display name.
- condition_expr: Expr | Comparisonο
- initialization_only: boolο
- logic_tpe = 'conditional_diagnostic'ο
- message: strο
- remap(var_mapping: Dict[Expr | str, Expr]) ConditionalDiagnosticLogic[source]ο
Clone the diagnostic under a symbolic variable mapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped diagnostic declaration.
- class VeraGridEngine.Utils.procedural_logic.DelayedSwitchEventLogic(output_var_name: str, guard_expr: Expr | Comparison, trigger_expr: Expr | Comparison, delay_expr: Expr | Comparison, target_device_idtag: str, target_switch_idtag: str, target_terminal_index: int, initial_closed: bool, command_closed: bool, name: str = '')[source]ο
Bases:
ProceduralLogicBaseApply one delayed switch command on a guarded rising trigger edge.
- bind(problem: ProceduralProblem) None[source]ο
Resolve the local switch-position mode and clear runtime state.
- Parameters:
problem β Bound RMS or EMT problem.
- Returns:
None.
- command_closed: boolο
- delay_expr: Expr | Comparisonο
- fired: boolο
- get_next_forced_event_time(t_prev: float, t_target: float) float | None[source]ο
Return the exact delayed command boundary inside the next step.
- Parameters:
t_prev β Previous solver time.
t_target β Nominal target time.
- Returns:
Pending event time inside the interval, if any.
- guard_expr: Expr | Comparisonο
- initial_closed: boolο
- initialized: boolο
- logic_tpe = 'delayed_switch_event'ο
- output_idx: intο
- output_var_name: strο
- pending_event_time: float | Noneο
- remap(var_mapping: Dict[Expr | str, Expr]) DelayedSwitchEventLogic[source]ο
Clone the event under one symbolic variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped switch event.
- state: floatο
- target_device_idtag: strο
- target_switch_idtag: strο
- target_terminal_index: intο
- trigger_expr: Expr | Comparisonο
- trigger_was_high: boolο
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Detect a guarded rising edge and apply its delayed command once.
- Parameters:
t β Current accepted solver time.
x β Current accepted state vector.
params β Runtime parameter vector updated in place.
- Returns:
None.
- class VeraGridEngine.Utils.procedural_logic.DelayedThresholdLatchLogic(monitored_var_name: str, mode_var_name: str, threshold: float, delay: float, reset_delay: float | None = None, name: str = '')[source]ο
Bases:
ProceduralLogicBaseComparator + timer + latch procedural logic for runtime modes.
The logic watches one state variable, arms a timer when a threshold is crossed, applies a mode change after a delay, and optionally resets after a second delay.
- bind(problem: ProceduralProblem) None[source]ο
Resolve the monitored state and runtime mode indices.
- Parameters:
problem β Bound EMT problem.
- Returns:
None
- delayο
- get_next_forced_event_time(t_prev: float, t_target: float) float | None[source]ο
Return the next exact trip or reset event inside one solver step.
- Parameters:
t_prev β Previous solver time.
t_target β Nominal target time.
- Returns:
First pending event in the interval, if any.
- get_trace_arrays() Tuple[ndarray, ndarray, ndarray, ndarray, ndarray, ndarray][source]ο
Return the internal trace arrays as dense numpy arrays.
- Returns:
Tuple with times, measurements, comparator, timer, latch, and mode traces.
- last_t_prev: float | Noneο
- logic_tpe = 'delayed_threshold_latch'ο
- mode_idxο
- mode_var_nameο
- monitored_idxο
- monitored_var_nameο
- pending_reset_time: float | Noneο
- pending_trip_time: float | Noneο
- pickup_time: float | Noneο
- remap(var_mapping: Dict[Expr | str, Expr]) DelayedThresholdLatchLogic[source]ο
Clone the logic under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped delayed-threshold latch logic.
- reset_applied_solver_time: float | Noneο
- reset_applied_time: float | Noneο
- reset_delayο
- thresholdο
- trace_comparator: List[float]ο
- trace_latched: List[float]ο
- trace_measure: List[float]ο
- trace_mode: List[float]ο
- trace_t: List[float]ο
- trace_timer_armed: List[float]ο
- trip_applied_solver_time: float | Noneο
- trip_applied_time: float | Noneο
- trippedο
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Advance the delayed-threshold latch logic and tracing state.
- Parameters:
t β Current solver time.
x β Accepted state vector.
params β Runtime parameter vector.
- Returns:
None
- class VeraGridEngine.Utils.procedural_logic.FixedSampleLogic(output_var_name: str, condition_expr: Expr | Comparison, name: str = '')[source]ο
Bases:
ProceduralLogicBaseRetain the initial truth value of one condition in a runtime mode variable.
- bind(problem: ProceduralProblem) None[source]ο
Resolve the runtime output slot for this logic entry.
- Parameters:
problem β Bound EMT problem.
- Returns:
None
- condition_exprο
- initializedο
- logic_tpe = 'fixed_sample'ο
- output_idxο
- output_var_nameο
- remap(var_mapping: Dict[Expr | str, Expr]) FixedSampleLogic[source]ο
Clone the logic under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped fixed-sample logic.
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Sample the condition once and keep it fixed afterward.
- Parameters:
t β Current solver time.
x β Accepted state vector.
params β Runtime parameter vector.
- Returns:
None
- class VeraGridEngine.Utils.procedural_logic.FlipFlopLogic(output_var_name: str, set_expr: Expr | Comparison, reset_expr: Expr | Comparison, name: str = '')[source]ο
Bases:
ProceduralLogicBaseStore a binary set/reset latch in a runtime mode variable.
- bind(problem: ProceduralProblem) None[source]ο
Resolve the runtime output slot for the latch state.
- Parameters:
problem β Bound EMT problem.
- Returns:
None
- initializedο
- logic_tpe = 'flipflop'ο
- output_idxο
- output_var_nameο
- remap(var_mapping: Dict[Expr | str, Expr]) FlipFlopLogic[source]ο
Clone the logic under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped flip-flop logic.
- reset_exprο
- set_exprο
- stateο
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Apply set/reset semantics and write the resulting latch state.
- Parameters:
t β Current solver time.
x β Accepted state vector.
params β Runtime parameter vector.
- Returns:
None
- class VeraGridEngine.Utils.procedural_logic.GradientLimiterLogic(output_var_name: str, source_expr: Expr | Comparison | float | int | bool, lower_rate_expr: Expr | Comparison | float | int | bool, upper_rate_expr: Expr | Comparison | float | int | bool, name: str = '')[source]ο
Bases:
ProceduralLogicBaseClamp the rate of change of one procedural value between lower and upper slopes.
- bind(problem: ProceduralProblem) None[source]ο
Bind the gradient-limited output and reset its runtime state.
- Parameters:
problem β Runtime problem that owns variables and parameter indices.
- Returns:
None.
- held_valueο
- initializedο
- last_time: float | Noneο
- logic_tpe = 'gradient_limiter'ο
- lower_rate_exprο
- output_idxο
- output_var_nameο
- remap(var_mapping: Dict[Expr | str, Expr]) GradientLimiterLogic[source]ο
Clone one logic entry under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped procedural logic entry.
- source_exprο
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Update mode or event parameters before the Newton step.
- Parameters:
t β Current solver time.
x β Current accepted state.
params β Runtime parameter vector to mutate in place.
- Returns:
None
- upper_rate_exprο
- class VeraGridEngine.Utils.procedural_logic.HardSaturationLogic(output_var_name: str, u_expr: Expr | Comparison, u_min_expr: Expr | Comparison, u_max_expr: Expr | Comparison, name: str = '')[source]ο
Bases:
ProceduralLogicBaseSample one input and apply hard saturation to a runtime mode variable.
- bind(problem: ProceduralProblem) None[source]ο
Bind the saturation output and numeric evaluators to a problem.
- Parameters:
problem β Runtime problem that owns variables and parameter indices.
- Returns:
None.
- logic_tpe = 'hard_saturation'ο
- output_idxο
- output_var_nameο
- remap(var_mapping: Dict[Expr | str, Expr]) HardSaturationLogic[source]ο
Clone one logic entry under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped procedural logic entry.
- u_exprο
- u_max_exprο
- u_min_exprο
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Update mode or event parameters before the Newton step.
- Parameters:
t β Current solver time.
x β Current accepted state.
params β Runtime parameter vector to mutate in place.
- Returns:
None
- class VeraGridEngine.Utils.procedural_logic.MovingAverageLogic(output_var_name: str, source_expr: Expr | Comparison | float | int | bool, delay_expr: Expr | Comparison | float | int | bool, window_expr: Expr | Comparison | float | int | bool, name: str = '')[source]ο
Bases:
ProceduralLogicBaseBuffer-based moving average with optional delay before the averaging window.
- bind(problem: ProceduralProblem) None[source]ο
Bind the moving-average output and reset its sample history.
- Parameters:
problem β Runtime problem that owns variables and parameter indices.
- Returns:
None.
- delay_exprο
- history: List[Tuple[float, float]]ο
- logic_tpe = 'moving_average'ο
- output_idxο
- output_var_nameο
- remap(var_mapping: Dict[Expr | str, Expr]) MovingAverageLogic[source]ο
Clone one logic entry under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped procedural logic entry.
- source_exprο
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Update mode or event parameters before the Newton step.
- Parameters:
t β Current solver time.
x β Current accepted state.
params β Runtime parameter vector to mutate in place.
- Returns:
None
- window_exprο
- class VeraGridEngine.Utils.procedural_logic.PickupDropoffLogic(output_var_name: str, bool_expr: Expr | Comparison, pickup_delay_expr: Expr | Comparison, drop_delay_expr: Expr | Comparison, name: str = '', output_var_uid: int | None = None)[source]ο
Bases:
ProceduralLogicBaseImplement a delayed pickup/dropoff relay with retained binary state.
- bind(problem: ProceduralProblem) None[source]ο
Resolve the runtime output slot and clear the relay timers.
- Parameters:
problem β Bound EMT problem.
- Returns:
None
- bool_exprο
- drop_delay_exprο
- drop_started_at: float | Noneο
- get_next_forced_event_time(t_prev: float, t_target: float) float | None[source]ο
Return the next exact pickup or dropoff event inside one step.
- Parameters:
t_prev β Previous solver time.
t_target β Nominal target time.
- Returns:
First pending relay event in the interval, if any.
- initializedο
- logic_tpe = 'pickup_dropoff'ο
- output_idxο
- output_var_nameο
- output_var_uid: int | Noneο
- pending_drop_time: float | Noneο
- pending_pickup_time: float | Noneο
- pickup_delay_exprο
- pickup_started_at: float | Noneο
- remap(var_mapping: Dict[Expr | str, Expr]) PickupDropoffLogic[source]ο
Clone the logic under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped pickup/dropoff logic.
- stateο
- class VeraGridEngine.Utils.procedural_logic.ProceduralLogicBase(name: str = '')[source]ο
Bases:
ProceduralLogicEntryContract[Expr]Base class for procedural logic objects attached to symbolic blocks.
Procedural logic is evaluated outside the compiled residual kernels and is intended to drive runtime modes, retained flags, timers, or event scheduling in a structured way.
- bind(problem: ProceduralProblem) None[source]ο
Bind the logic to a concrete EMT problem.
- Parameters:
problem β EMT problem owning the block and variable maps.
- Returns:
None
- evaluate_numeric_expression(expr: Expr | Comparison | float | int | bool, t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) float[source]ο
Evaluate a procedural expression against the accepted EMT state.
- Parameters:
expr β Expression or comparison to evaluate.
t β Current solver time.
x β Accepted state vector.
params β Runtime parameter vector.
- Returns:
Numeric value of the expression.
- get_next_forced_event_time(t_prev: float, t_target: float) float | None[source]ο
Return the next exact event time inside the interval if known.
- Parameters:
t_prev β Previous solver time.
t_target β Nominal target time.
- Returns:
Event time or None.
- logic_tpe = 'base'ο
- nameο
- remap(var_mapping: Dict[Expr | str, Expr]) ProceduralLogicBase[source]ο
Clone one logic entry under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped procedural logic entry.
- to_data() Dict[str, object][source]ο
Return the version-independent declarative logic representation.
- Returns:
Typed declarative logic data.
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Update mode or event parameters before the Newton step.
- Parameters:
t β Current solver time.
x β Current accepted state.
params β Runtime parameter vector to mutate in place.
- Returns:
None
- class VeraGridEngine.Utils.procedural_logic.ProceduralLogicCodec(*args, **kwargs)[source]ο
Bases:
ProceduralLogicCodecContract[Expr]Reconstruct procedural state machines at an explicit parse boundary.
- class VeraGridEngine.Utils.procedural_logic.ProceduralNumericEvaluator(logic: ProceduralLogicBase, expression: Expr | Comparison | float | int | bool)[source]ο
Bases:
objectEvaluate one procedural expression against an accepted solver snapshot.
- Parameters:
logic β Bound procedural state machine that owns sample-time rules.
expression β Declarative expression evaluated by the wrapper.
- class VeraGridEngine.Utils.procedural_logic.ProceduralProblem(*args, **kwargs)[source]ο
Bases:
ProtocolDeclare the EMT surface required by procedural runtime logic.
- property event_params_values: ndarray[tuple[Any, ...], dtype[float64]]ο
Return the current mutable runtime-parameter vector.
- Returns:
Runtime values updated by procedural boundary logic.
- get_var_idx(variable: Var) int[source]ο
Return the compiled index for one symbolic variable.
- Parameters:
variable β Symbolic variable whose solver-vector index is needed.
- Returns:
Zero-based index in the compiled solver vector.
- get_x0() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Return the current initialization vector.
- property glob_time: Varο
Return the symbolic variable representing global solver time.
- Returns:
Canonical symbolic solver-time variable.
- property sys_block: Blockο
Return the canonical root block compiled by the runtime problem.
- Returns:
Root block owning all attached procedural declarations.
- property uid2idx_event_params: Dict[int, int]ο
Return mutable runtime-parameter indexes keyed by symbolic UID.
- Returns:
Runtime-parameter indexes keyed by stable symbolic UID.
- property uid2idx_params: Dict[int, int]ο
Return constant-parameter indexes keyed by symbolic UID.
- Returns:
Constant-parameter indexes keyed by stable symbolic UID.
- property uid2idx_vars: Dict[int, int]ο
Return compiled state-variable indexes keyed by symbolic UID.
- Returns:
State-vector indexes keyed by stable symbolic UID.
- class VeraGridEngine.Utils.procedural_logic.ResetOnRisingEdgeLogic(target_var_name: str, reset_expr: Expr | Comparison, value_expr: Expr | Comparison, name: str = '')[source]ο
Bases:
ProceduralLogicBaseApply one value reset on the rising edge of a procedural condition.
- bind(problem: ProceduralProblem) None[source]ο
Resolve whether the reset target is a state variable or a runtime parameter.
- Parameters:
problem β Bound EMT problem.
- Returns:
None
- initializedο
- last_reset_highο
- logic_tpe = 'reset_on_rising_edge'ο
- remap(var_mapping: Dict[Expr | str, Expr]) ResetOnRisingEdgeLogic[source]ο
Clone the logic under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped reset logic.
- reset_exprο
- target_param_idxο
- target_state_idxο
- target_var_nameο
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Apply the reset value only on the rising edge of the reset condition.
- Parameters:
t β Current solver time.
x β Accepted state vector.
params β Runtime parameter vector.
- Returns:
None
- value_exprο
- class VeraGridEngine.Utils.procedural_logic.SampledValueLogic(output_var_name: str, source_expr: Expr | Comparison, name: str = '', output_var_uid: int | None = None)[source]ο
Bases:
ProceduralLogicBaseSample one expression at each accepted step and store it in a runtime mode variable.
- bind(problem: ProceduralProblem) None[source]ο
Resolve the runtime output slot for this sampled value.
- Parameters:
problem β Bound EMT problem.
- Returns:
None
- logic_tpe = 'sampled_value'ο
- output_idx: intο
- output_var_name: strο
- output_var_uid: int | Noneο
- remap(var_mapping: Dict[Expr | str, Expr]) SampledValueLogic[source]ο
Clone the logic under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped sampled-value logic.
- source_expr: Expr | Comparisonο
- class VeraGridEngine.Utils.procedural_logic.StartupHandoverLogic(mode_var_name: str, enable_time_var_name: str, on_value_var_name: str | None = None, name: str = '')[source]ο
Bases:
ProceduralLogicBaseOne-shot startup handover for hybrid EMT converter models.
The logic keeps one retained runtime mode at
0during the averaged-startup interval and flips it to1exactly att_enable. This lets the DAE stay continuous before the handover while still forcing an exact solver split when the switched bridge becomes electrically active.- bind(problem: ProceduralProblem) None[source]ο
Resolve the retained mode and enable-time runtime indices.
- Parameters:
problem β Bound EMT problem.
- Returns:
None.
- enable_time_idxο
- enable_time_var_nameο
- get_next_forced_event_time(t_prev: float, t_target: float) float | None[source]ο
Return the exact startup-handover time when it falls inside one solver step.
- Parameters:
t_prev β Previous solver time.
t_target β Nominal target time.
- Returns:
Exact handover time or
None.
- logic_tpe = 'startup_handover'ο
- mode_idxο
- mode_var_nameο
- on_value_idxο
- on_value_var_nameο
- remap(var_mapping: Dict[Expr | str, Expr]) StartupHandoverLogic[source]ο
Clone the logic under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped startup-handover logic.
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Update the retained startup mode from the current solver time.
- Parameters:
t β Current solver time.
x β Accepted state vector.
params β Runtime parameter vector.
- Returns:
None.
- class VeraGridEngine.Utils.procedural_logic.ThreePhaseCarrierPwmLogic(mod_a_var_name: str, mod_b_var_name: str, mod_c_var_name: str, gate_a_mode_var_name: str, gate_b_mode_var_name: str, gate_c_mode_var_name: str, omega_sw_var_name: str, carrier_phase_var_name: str, name: str = '')[source]ο
Bases:
ProceduralLogicBaseRegularly sampled three-phase carrier PWM logic.
The logic samples the modulation references at each carrier half-period, computes the exact gate transitions inside that interval, and stores the gate values as retained runtime modes. The symbolic DAE therefore sees piecewise constant gate parameters instead of symbolic comparator expressions.
- bind(problem: ProceduralProblem) None[source]ο
Resolve the variable indices and initialize the first PWM interval.
- Parameters:
problem β Bound EMT problem.
- Returns:
None.
- carrier_phase_idxο
- carrier_phase_var_nameο
- current_gateο
- gate_a_idxο
- gate_a_mode_var_nameο
- gate_b_idxο
- gate_b_mode_var_nameο
- gate_c_idxο
- gate_c_mode_var_nameο
- get_next_forced_event_time(t_prev: float, t_target: float) float | None[source]ο
Return the next PWM gate transition or carrier-boundary event.
- Parameters:
t_prev β Previous solver time.
t_target β Nominal target time.
- Returns:
Earliest event in the interval, if any.
- initializedο
- interval_end_time: float | Noneο
- last_omega_sw: float | Noneο
- logic_tpe = 'three_phase_carrier_pwm'ο
- mod_a_idxο
- mod_a_var_nameο
- mod_b_idxο
- mod_b_var_nameο
- mod_c_idxο
- mod_c_var_nameο
- omega_sw_idxο
- omega_sw_var_nameο
- pending_transition_gateο
- pending_transition_timeο
- remap(var_mapping: Dict[Expr | str, Expr]) ThreePhaseCarrierPwmLogic[source]ο
Clone the PWM logic under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped PWM logic.
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Advance the PWM gate states from the accepted modulation references.
- Parameters:
t β Current solver time.
x β Accepted EMT state vector.
params β Runtime parameter vector.
- Returns:
None.
- class VeraGridEngine.Utils.procedural_logic.ThreePhaseCarrierSampledModulationLogic(mod_a_var_name: str, mod_b_var_name: str, mod_c_var_name: str, sample_a_mode_var_name: str, sample_b_mode_var_name: str, sample_c_mode_var_name: str, omega_sw_var_name: str, carrier_phase_var_name: str, name: str = '')[source]ο
Bases:
ProceduralLogicBaseRegular-sampled three-phase modulation holder using carrier half-period boundaries.
The sampling instants intentionally follow
ThreePhaseCarrierPwmLogicso a symbolic soft comparator can consume the same heldm_a/m_b/m_cvalues as the procedural PWM scheduler.- bind(problem: ProceduralProblem) None[source]ο
Resolve modulation, sampled-mode and carrier parameter indices.
- Parameters:
problem β Concrete EMT problem.
- Returns:
None.
- carrier_phase_idxο
- carrier_phase_var_nameο
- get_next_forced_event_time(t_prev: float, t_target: float) float | None[source]ο
Force a solver event at each carrier half-period boundary.
- Parameters:
t_prev β Previous accepted solver time.
t_target β Nominal target time.
- Returns:
Next half-period boundary if it lies inside the step.
- initializedο
- interval_end_timeο
- logic_tpe = 'three_phase_carrier_sampled_modulation'ο
- mod_a_idxο
- mod_a_var_nameο
- mod_b_idxο
- mod_b_var_nameο
- mod_c_idxο
- mod_c_var_nameο
- omega_sw_idxο
- omega_sw_var_nameο
- remap(var_mapping: Dict[Expr | str, Expr]) ThreePhaseCarrierSampledModulationLogic[source]ο
Clone this logic under a variable-name remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped sampled-modulation logic.
- sample_a_idxο
- sample_a_mode_var_nameο
- sample_b_idxο
- sample_b_mode_var_nameο
- sample_c_idxο
- sample_c_mode_var_nameο
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Sample modulation at initialization and at carrier half-period boundaries.
- Parameters:
t β Current solver time.
x β Accepted EMT state vector.
params β Runtime parameter vector to mutate.
- Returns:
None.
- class VeraGridEngine.Utils.procedural_logic.TimeDelayLogic(output_var_name: str, source_expr: Expr | Comparison | float | int | bool, delay_expr: Expr | Comparison | float | int | bool, name: str = '')[source]ο
Bases:
ProceduralLogicBaseSample one input and expose its delayed value through a runtime mode variable.
- bind(problem: ProceduralProblem) None[source]ο
Bind the delayed output and reset its sample history.
- Parameters:
problem β Runtime problem that owns variables and parameter indices.
- Returns:
None.
- delay_exprο
- history: List[Tuple[float, float]]ο
- logic_tpe = 'time_delay'ο
- output_idxο
- output_var_nameο
- remap(var_mapping: Dict[Expr | str, Expr]) TimeDelayLogic[source]ο
Clone one logic entry under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped procedural logic entry.
- source_exprο
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Update mode or event parameters before the Newton step.
- Parameters:
t β Current solver time.
x β Current accepted state.
params β Runtime parameter vector to mutate in place.
- Returns:
None
- class VeraGridEngine.Utils.procedural_logic.ValveStateLogic(mode_var_name: str, valve_type_var_name: str, gate_var_name: str, antiparallel_var_name: str, voltage_eps_var_name: str, current_eps_var_name: str, valve_voltage_var_name: str, valve_current_var_name: str, name: str = '')[source]ο
Bases:
ProceduralLogicBaseRetained conduction-state logic for generic EMT valve blocks.
The logic updates a single retained runtime mode that encodes the active path:
+1: forward conduction0: blocked state-1: reverse conduction through the antiparallel path
- antiparallel_idxο
- antiparallel_var_nameο
- bind(problem: ProceduralProblem) None[source]ο
Resolve the runtime and algebraic indices required by the valve logic.
- Parameters:
problem β Bound EMT problem.
- Returns:
None.
- current_eps_idxο
- current_eps_var_nameο
- gate_idxο
- gate_var_nameο
- logic_tpe = 'valve_state'ο
- mode_idxο
- mode_var_nameο
- remap(var_mapping: Dict[Expr | str, Expr]) ValveStateLogic[source]ο
Clone the valve logic under a variable remapping.
- Parameters:
var_mapping β Variable substitution map.
- Returns:
Remapped valve logic.
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Update the retained conduction-path mode from the accepted EMT state.
- Parameters:
t β Current solver time.
x β Accepted EMT state vector.
params β Flat runtime parameter vector.
- Returns:
None.
- valve_current_idxο
- valve_current_var_nameο
- valve_type_idxο
- valve_type_var_nameο
- valve_voltage_idxο
- valve_voltage_var_nameο
- voltage_eps_idxο
- voltage_eps_var_nameο
- VeraGridEngine.Utils.procedural_logic.aflipflop(x: Expr | Comparison, boolset: Expr | Comparison, boolreset: Expr | Comparison, output: Var | str, name: str = '') AnalogFlipFlopLogic[source]ο
Build the procedural equivalent of PowerFactory
aflipflop.- Parameters:
x β Analog expression to store while the internal state is high.
boolset β Set condition.
boolreset β Reset condition.
output β Runtime mode variable receiving the held analog value.
name β Optional logic name.
- Returns:
Analog flip-flop procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.bool_and(*args: Expr | Comparison | float | int) Expr[source]ο
Build the boolean AND of one or more procedural expressions.
- Parameters:
args β Boolean-like expressions encoded as 0/1 values.
- Returns:
Expression equal to 1.0 only when all inputs are true.
- VeraGridEngine.Utils.procedural_logic.bool_eor(left: Expr | Comparison | float | int, right: Expr | Comparison | float | int) Expr[source]ο
Build the exclusive-OR of two procedural expressions.
- Parameters:
left β Left boolean-like expression.
right β Right boolean-like expression.
- Returns:
Expression equal to 1.0 only when exactly one input is true.
- VeraGridEngine.Utils.procedural_logic.bool_nand(*args: Expr | Comparison | float | int) Expr[source]ο
Build the boolean NAND of one or more procedural expressions.
- Parameters:
args β Boolean-like expressions encoded as 0/1 values.
- Returns:
Expression equal to the negated AND of the inputs.
- VeraGridEngine.Utils.procedural_logic.bool_nor(*args: Expr | Comparison | float | int) Expr[source]ο
Build the boolean NOR of one or more procedural expressions.
- Parameters:
args β Boolean-like expressions encoded as 0/1 values.
- Returns:
Expression equal to the negated OR of the inputs.
- VeraGridEngine.Utils.procedural_logic.bool_not(arg: Expr | Comparison | float | int) Expr[source]ο
Build the boolean NOT of one procedural expression.
- Parameters:
arg β Boolean-like expression encoded as 0/1.
- Returns:
Expression equal to 1.0 when the input is false.
- VeraGridEngine.Utils.procedural_logic.bool_or(*args: Expr | Comparison | float | int) Expr[source]ο
Build the boolean OR of one or more procedural expressions.
- Parameters:
args β Boolean-like expressions encoded as 0/1 values.
- Returns:
Expression equal to 1.0 when at least one input is true.
- VeraGridEngine.Utils.procedural_logic.build_boundary_updater_from_block(problem: ProceduralProblem) BlockProceduralLogicUpdater | None[source]ο
Build an isolated runtime updater from the logic attached to
problem.sys_block.The block hierarchy is canonical persistent model data. Runtime binding must therefore target reconstructed entries so solver-owned objects, such as progress signals, cannot become reachable from the persistent model.
- Parameters:
problem β EMT problem containing the root block.
- Returns:
Boundary updater or None.
- VeraGridEngine.Utils.procedural_logic.build_procedural_logic_entry(data: Dict[str, object]) ProceduralLogicBase[source]ο
Deserialize one procedural logic entry.
- Parameters:
data β Serialized logic config.
- Returns:
Procedural logic object.
- VeraGridEngine.Utils.procedural_logic.clone_procedural_logic_entries(entries: Iterable[ProceduralLogicEntryContract[Expr]], var_mapping: Dict[Expr | str, Expr]) List[ProceduralLogicEntryContract[Expr]][source]ο
Clone procedural logic entries under a variable remapping.
- Parameters:
entries β Source procedural logic entries.
var_mapping β Mapping from old variables/names to remapped expressions.
- Returns:
Remapped procedural logic entries.
- VeraGridEngine.Utils.procedural_logic.delay(input_expr: Expr | Comparison | float | int | bool, T: Expr | Comparison | float | int | bool, output: Var | str, name: str = '') TimeDelayLogic[source]ο
Build the procedural equivalent of PowerFactory
delay.- Parameters:
input_expr β Source expression to be delayed.
T β Delay in seconds.
output β Runtime mode variable receiving the delayed value.
name β Optional logic name.
- Returns:
Time-delay procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.fixed_sample(output: Var | str, when: Expr | Comparison, name: str = '') FixedSampleLogic[source]ο
Build a fixed-sample selector that stores a boolean condition at initialization.
- Parameters:
output β Runtime mode variable receiving the retained value.
when β Condition sampled at initialization time.
name β Optional logic name.
- Returns:
Fixed-sample procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.flipflop(boolset: Expr | Comparison, boolreset: Expr | Comparison, output: Var | str, name: str = '') FlipFlopLogic[source]ο
Build the procedural equivalent of PowerFactory
flipflop.- Parameters:
boolset β Set condition.
boolreset β Reset condition.
output β Runtime mode variable storing the logical state.
name β Optional logic name.
- Returns:
Flip-flop procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.gradlim_const(input_expr: Expr | Comparison | float | int | bool, gradmin: Expr | Comparison | float | int | bool, gradmax: Expr | Comparison | float | int | bool, output: Var | str, name: str = '') GradientLimiterLogic[source]ο
Build the procedural equivalent of PowerFactory
gradlim_const.- Parameters:
input_expr β Source expression to be rate-limited.
gradmin β Lower slope limit.
gradmax β Upper slope limit.
output β Runtime mode variable receiving the limited value.
name β Optional logic name.
- Returns:
Gradient-limiter procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.hard_saturation(output: Var | str, u: Expr | Comparison, u_min: Expr | Comparison, u_max: Expr | Comparison, name: str = '') HardSaturationLogic[source]ο
Build one procedural hard-saturation entry updated outside Newton residuals.
- Parameters:
output β Runtime mode variable receiving saturated value.
u β Unsaturated input expression.
u_min β Lower saturation bound.
u_max β Upper saturation bound.
name β Optional logic name.
- Returns:
Hard-saturation procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.ifelse(boolexpr: Expr | Comparison | float | int, when_true: Expr | Comparison | float | int, when_false: Expr | Comparison | float | int) Expr[source]ο
Reject equation-level ifelse usage in the public procedural API.
- Parameters:
boolexpr β Switching condition.
when_true β Value chosen for the true branch.
when_false β Value chosen for the false branch.
- Returns:
Never returns because public equation-level selection is blocked.
- VeraGridEngine.Utils.procedural_logic.lastvalue(input_expr: Expr | Comparison, output: Var | str, name: str = '') SampledValueLogic[source]ο
Build the procedural equivalent of PowerFactory
lastvalue.- Parameters:
input_expr β Source expression to be sampled.
output β Runtime mode variable receiving the sampled value.
name β Optional logic name.
- Returns:
Sampled-value procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.movingavg(input_expr: Expr | Comparison | float | int | bool, Tdel: Expr | Comparison | float | int | bool, Tlength: Expr | Comparison | float | int | bool, output: Var | str, name: str = '') MovingAverageLogic[source]ο
Build the procedural equivalent of PowerFactory
movingavg.- Parameters:
input_expr β Source expression to be averaged.
Tdel β Delay before the averaging window.
Tlength β Averaging window length in seconds.
output β Runtime mode variable receiving the averaged value.
name β Optional logic name.
- Returns:
Moving-average procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.picdro(boolexpr: Expr | Comparison, Tpick: Expr | Comparison, Tdrop: Expr | Comparison, output: Var | str, name: str = '') PickupDropoffLogic[source]ο
Build the procedural equivalent of PowerFactory
picdro.- Parameters:
boolexpr β Relay driving condition.
Tpick β Pickup delay.
Tdrop β Dropoff delay.
output β Runtime mode variable storing the relay state.
name β Optional logic name.
- Returns:
Pickup/dropoff procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.picdro_const(boolexpr: Expr | Comparison, Tpick: Expr | Comparison, Tdrop: Expr | Comparison, output: Var | str, name: str = '') PickupDropoffLogic[source]ο
Build the procedural equivalent of PowerFactory
picdro_const.- Parameters:
boolexpr β Relay driving condition.
Tpick β Pickup delay.
Tdrop β Dropoff delay.
output β Runtime mode variable storing the relay state.
name β Optional logic name.
- Returns:
Pickup/dropoff procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.pickup_dropoff(output: Var | str, boolexpr: Expr | Comparison, Tpick: Expr | Comparison, Tdrop: Expr | Comparison, name: str = '') PickupDropoffLogic[source]ο
Build a pickup/dropoff relay-style procedural logic entry.
- Parameters:
output β Runtime mode variable storing the relay state.
boolexpr β Pickup/reset driving condition.
Tpick β Pickup delay.
Tdrop β Dropoff delay.
name β Optional logic name.
- Returns:
Pickup/dropoff procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.procedural_logic_entry_to_dict(entry: ProceduralLogicBase) Dict[str, object][source]ο
Serialize one procedural logic entry.
- Parameters:
entry β Procedural logic entry.
- Returns:
Serialized logic dictionary.
- VeraGridEngine.Utils.procedural_logic.procedural_logic_from_dict(entries: List[Dict[str, object] | ProceduralLogicBase]) List[ProceduralLogicBase][source]ο
Deserialize a list of procedural logic entries.
- Parameters:
entries β Serialized entries.
- Returns:
Procedural logic objects.
- VeraGridEngine.Utils.procedural_logic.procedural_logic_to_dict(entries: List[ProceduralLogicBase]) List[Dict[str, object]][source]ο
Serialize a list of procedural logic entries.
- Parameters:
entries β Logic entries.
- Returns:
Serialized representation.
- VeraGridEngine.Utils.procedural_logic.reset(var: Var | str, rst: Expr | Comparison, val: Expr | Comparison, name: str = '') ResetOnRisingEdgeLogic[source]ο
Build the procedural equivalent of PowerFactory
reset.- Parameters:
var β Target runtime/state variable name.
rst β Reset trigger condition.
val β Value applied on the rising edge.
name β Optional logic name.
- Returns:
Reset-on-rising-edge procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.sampled_value(output: Var | str, source: Expr | Comparison, name: str = '') SampledValueLogic[source]ο
Build a sampled runtime value updated outside the Newton residual.
- Parameters:
output β Runtime mode variable receiving the sampled value.
source β Source expression to be evaluated at the accepted sample time.
name β Optional logic name.
- Returns:
Sampled-value procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.select(boolexpr: Expr | Comparison | float | int, when_true: Expr | Comparison | float | int, when_false: Expr | Comparison | float | int) Expr[source]ο
Reject equation-level select usage in the public procedural API.
- Parameters:
boolexpr β Switching condition.
when_true β Value chosen for the true branch.
when_false β Value chosen for the false branch.
- Returns:
Never returns because public equation-level selection is blocked.
- VeraGridEngine.Utils.procedural_logic.selfix(boolexpr: Expr | Comparison, output: Var | str, name: str = '') FixedSampleLogic[source]ο
Build the procedural equivalent of PowerFactory
selfix.- Parameters:
boolexpr β Condition sampled at initialization time.
output β Runtime mode variable receiving the retained value.
name β Optional logic name.
- Returns:
Fixed-sample procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.selfix_const(boolexpr: Expr | Comparison, output: Var | str, name: str = '') FixedSampleLogic[source]ο
Build the procedural equivalent of PowerFactory
selfix_const.- Parameters:
boolexpr β Condition sampled at initialization time.
output β Runtime mode variable receiving the retained value.
name β Optional logic name.
- Returns:
Fixed-sample procedural logic entry.
- VeraGridEngine.Utils.procedural_logic.startup_handover(mode: Var | str, t_enable: Var | str, name: str = '', on_value: Var | str | None = None) StartupHandoverLogic[source]ο
Build one exact-time startup-handover logic entry.
- Parameters:
mode β Retained mode variable that becomes
1after the handover time.t_enable β Runtime parameter storing the switching-enable time.
name β Optional logic name.
on_value β Optional runtime parameter whose value is copied after handover.
- Returns:
Startup-handover procedural logic entry.
VeraGridEngine.Utils.progress_bar moduleο
- VeraGridEngine.Utils.progress_bar.print_progress_bar(iteration: int, total: int, length=40, txt='')[source]ο
Simple text progress bar :param iteration: current iteration (1 based) :param total: total progress :param length: length of the bar in characters :param txt: text to print at the end of the progress bar
VeraGridEngine.Utils.rms_models_types moduleο
- VeraGridEngine.Utils.rms_models_types.build_equivalence_classes_dict(grid: MultiCircuit) Tuple[Dict[int, List[int]], Dict[int, List[List[int]]], Dict[int, List[int]], Dict[int, List[int]]][source]ο
this functions receives the grid and return a dictionary with clases of equivalence of the dynamic models and a dictionary with clases of equivalence of their variables. :param grid: :type grid: :return: Tuple of:
Dict with new uid as keys and lists of equivalent block uids as values
Dict with representative uid as keys and lists of lists of equivalent variable uids as values
Dict with representative uid as keys and lists of all block uids composing that model (including children)
Dict with representative uid as keys and lists of all block uids in the reference class (equivalent blocks and their children recursively, plus the representative and its children)
- Return type:
VeraGridEngine.Utils.scores moduleο
- class VeraGridEngine.Utils.scores.TechnoEconomicScores[source]ο
Bases:
objectInvestmentScores
- arr() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Return multidimensional metrics for the optimization.
CAPEX and OPEX are reported as two separate entries, matching the objective formulation documented in investment_optimization.md, so that the search sees the investment cost and the operational cost as two independent magnitudes.
- Returns:
array of 6 values: losses, overload, voltage module, voltage angle, CAPEX and OPEX
- capex_score: floatο
- property financial_score: floatο
Get the financial score: CAPEX + OPEX :return: float
- losses_score: floatο
- opex_score: floatο
- overload_score: floatο
- property tech_scoreο
- voltage_angle_score: floatο
- voltage_module_score: floatο
- VeraGridEngine.Utils.scores.get_overload_score(loading: ndarray[tuple[Any, ...], dtype[complex128]], branches_cost: ndarray[tuple[Any, ...], dtype[float64]], threshold=1.0) float[source]ο
Compute overload score by multiplying the loadings above 100% by the associated branch cost. :param loading: load results :param branches_cost: all branch elements from studied grid :param threshold: threshold for overload :return: sum of all costs associated to branch overloads
- VeraGridEngine.Utils.scores.get_voltage_module_score(voltage: ndarray[tuple[Any, ...], dtype[complex128]], vm_cost: ndarray[tuple[Any, ...], dtype[float64]], vm_max: ndarray[tuple[Any, ...], dtype[float64]], vm_min: ndarray[tuple[Any, ...], dtype[float64]]) float[source]ο
Compute voltage module score by multiplying the voltages outside limits by the associated bus costs. :param voltage: voltage results :param vm_cost: Vm cost array :param vm_max: maximum voltage :param vm_min: minimum voltage :return: sum of all costs associated to voltage module deviation
- VeraGridEngine.Utils.scores.get_voltage_phase_score(voltage: ndarray[tuple[Any, ...], dtype[complex128]], va_cost: ndarray[tuple[Any, ...], dtype[float64]], va_max: ndarray[tuple[Any, ...], dtype[float64]], va_min: ndarray[tuple[Any, ...], dtype[float64]]) float[source]ο
Compute voltage phase score by multiplying the phases outside limits by the associated bus costs. :param voltage: voltage results :param va_cost: array of bus angles costs :param va_max: maximum voltage angles :param va_min: minimum voltage angles :return: sum of all costs associated to voltage module deviation