1 Star 4 Fork 1

NEVSTOP-LAB / Communicable-State-Machine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
VI Description(EN).md 35.78 KB
一键复制 编辑 原始数据 按行查看 历史
NEVSTOP 提交于 2024-01-09 22:00 . Dev20240109 (#233)

CSM API

Template Palette

CSM - No-Event Structure Template.vi

Template for building CSM Module without User Interface.

Inputs:

  • Name("" to use uuid): Module Name
    • If Input is "", an uuid will be used for module name. The module is marked as stand-alone mode and will not be included in module list.
    • If Input end with '#', the module will worked in worker mode. Modules with the same name will shared the same message queue. Any external message will be processed by one of the modules, depends on who is free.
    • Otherwise, the input string will be used as module name, which should be unique in system. CSM will go to "Critical Error" state if duplicated module name is used in system.

Outputs:

  • N/A

CSM - With Event Structure Template.vi

Template for building CSM Module with User Interface. Event Structure is included in template for processing user operations.

Inputs:

  • Name("" to use uuid): Module Name
    • If Input is "", an uuid will be used for module name. The module is marked as stand-alone mode and will not be included in module list.
    • Fi Input end with '#', the module will worked in worker mode. Modules with the same name will shared the same message queue. Any external message will be processed by one of the modules, depending who is free.
    • Otherwise, the input string will be used as module name, which should be unique in system. CSM will go to "Critical Error" state if duplicated module name is used in system.

Outputs:

  • N/A

CSM - With Event Structure Template - Tiny.vi

Template for building CSM Module without User Interface.

Inputs:

  • Name("" to use uuid): Module Name
    • If Input is "", an uuid will be used for module name. The module is marked as stand-alone mode and will not be included in module list.
    • Fi Input end with '#', the module will worked in worker mode. Modules with the same name will shared the same message queue. Any external message will be processed by one of the modules, depends on who is free.
    • Otherwise, the input string will be used as module name, which should be unique in system. CSM will go to "Critical Error" state if duplicated module name is used in system.

Outputs:

  • N/A

Basics APIs

Parse State Queue++.vi

Parses the CSM state queue and returns the current state that will execute next with the associated arguments.

Inputs:

  • State Queue: The entire state queue is wired to this input. This should come from the main CSM shift register.
  • Error In (no error): The error cluster from the CSM is wired to this input. If an error occurs and appears on this input, the current state output returns the "Error Handler" state.
  • Name("" to use uuid): Module Name
    • If Input is "", an uuid will be used for module name. The module is marked as stand-alone mode and will not be included in module list.
    • Fi Input end with '#', the module will worked in worker mode. Modules with the same name will shared the same message queue. Any external message will be processed by one of the modules, depends on who is free.
    • Otherwise, the input string will be used as module name, which should be unique in system. CSM will go to "Critical Error" state if duplicated module name is used in system.
  • Response Timeout(5000ms): The timeout of waiting for response of sync-call from outside.
  • Dequeue Timeout(0ms): The timeout of checking CSM message queue.
  • Response Arguments: The response arguments from last state. It should come from the CSM shift register.

Outputs:

  • Remaining States: Returns all the next states that should execute after the current state completes. These should be passed through the current state in the state machine. These can also be modified or augmented within the current state if necessary.
  • Arguments: Returns any argument(s) that may be used in the current state string. These arguments come after the ">>" characters. Note: The arguments variable must not contain any unprintable characters like linefeed or carriage return.
  • Current State: The state to be processed
  • Name Used: The actual name assigned to this CSM module
  • Argument - State: If any core error occurs, this is the source state name
  • From Who: If Current State is called by outside, this is the source CSM module name.

Build State String with Arguments++.vi

Builds a state string that contains arguments for the CSM.

For Example:

For local CSM, Target Module ("") is empty.

  If State = A and no argument, then <b>State with Arguments</b> = A
  If State = A and Arguments = B then <b>State with Arguments</b> = A >> B

For sending message to other CSM, suppose Target Module ("") is "Target"

  • For Sync-Call:

       If State = A and no argument, then <b>State with Arguments</b> = A -@target
       If State = A and Arguments = B then <b>State with Arguments</b> = A >> B -@target
  • For Async-Call:

       If State = A and no argument, then <b>State with Arguments</b> = A ->target
       If State = A and Arguments = B then <b>State with Arguments</b> = A >> B ->target

Inputs:

  • State: The State or message string
  • Arguments (""): The argument for State
  • Target Module (""): The target CSM module for the message to be sent to.
  • Sync-Call(-@) T By Default/Async-Call(->) F: For sync call, use "TRUE"; For Async call, use "FALSE"

Outputs:

  • State with Arguments: String stands for state with arguments

Build Message with Arguments++.vi

Builds a message that contains arguments for CSM. This VI will parse "State with Arguments" for message type, message string, arguments and target module from input State with Arguments and replace corresponding parts in the message with input values. Different message type symbol(->|,->,-@) will be used in different Polymorphic Vi instance.

Polymorphic Option:

  • Build Message with Arguments(Auto Check).vi
  • Build Asynchronous Message with Arguments.vi
  • Build No-Reply Asynchronous Message with Arguments.vi
  • Build Synchronous Message with Arguments.vi

Inputs:

  • State with Arguments: Input Message which might contain Arguments or target Module
  • Arguments (""): The arguments which will be used to replace arguments in State with Arguments. if empty, no arguments will be included in output strings.
  • Target Module (""): The target which will be used to replace target in State with Arguments. if empty, target in State with Arguments will be used.

Outputs:

  • State with Arguments: String stands for state with arguments

Inputs:

Outputs:

Build Message with Arguments(Auto Check).vi

Builds a message that contains arguments for CSM. This VI will parse "State with Arguments" for message type, message string, arguments and target module from input State with Arguments and replace corresponding parts in the message with input values. The message type from input State with Arguments will be used.

For Example:

If State with Arguments input is "API: DoSth" Arguments ("") input is "Arguments" Target Module ("") input is "Callee" Then result string is "API: DoSth >> Arguments" as no message symbol is detected.

If State with Arguments input is "API: DoSth >> Arguments -> Callee" Arguments ("") input is "NewArguments" Target Module ("") input is "" Then result string is "API: DoSth >> NewArguments -> Callee"

If State with Arguments input is "API: DoSth >> Arguments -> Callee" Arguments ("") input is "NewArguments" Target Module ("") input is "NewCallee" Then result string is "API: DoSth >> NewArguments -> NewCallee"

If State with Arguments input is "API: DoSth >> Arguments -> Callee" Arguments ("") input is "" Target Module ("") input is "NewCallee" Then result string is "API: DoSth -> NewCallee"

If State with Arguments input is "API: DoSth >> Arguments -@ Callee" Arguments ("") input is "NewArguments" Target Module ("") input is "" Then result string is "API: DoSth >> NewArguments -@ Callee"

Inputs:

  • State with Arguments: Input Message which might contain Arguments or target Module
  • Arguments (""): The arguments which will be used to replace arguments in State with Arguments. if empty, no arguments will be included in output strings.
  • Target Module (""): The target which will be used to replace target in State with Arguments. if empty, target in State with Arguments will be used.

Outputs:

  • State with Arguments: String stands for state with arguments

Build Asynchronous Message with Arguments.vi

Builds a message that contains arguments for CSM. This VI will parse "State with Arguments" for message string, arguments and target module from input State with Arguments and replace corresponding parts in the message with input values with async-message symbol "->" if Target Module ("") is specified.

For Example:

If State with Arguments input is "API: DoSth" Arguments ("") input is "Arguments" Target Module ("") input is "Callee" Then result string is "API: DoSth >> Arguments -> Callee". It's different with Build Message with Arguments(Auto Check).vi. . Message Type Symbol is replaced with "->".

If State with Arguments input is "API: DoSth >> Arguments -> Callee" Arguments ("") input is "NewArguments" Target Module ("") input is "" Then result string is "API: DoSth >> NewArguments -> Callee"

If State with Arguments input is "API: DoSth >> Arguments -> Callee" Arguments ("") input is "NewArguments" Target Module ("") input is "NewCallee" Then result string is "API: DoSth >> NewArguments -> NewCallee"

If State with Arguments input is "API: DoSth >> Arguments -> Callee" Arguments ("") input is "" Target Module ("") input is "NewCallee" Then result string is "API: DoSth -> NewCallee"

If State with Arguments input is "API: DoSth >> Arguments -@ Callee" Arguments ("") input is "NewArguments" Target Module ("") input is "" Then result string is "API: DoSth >> NewArguments -> Callee". Message Type Symbol is replaced with "->".

Inputs:

  • State with Arguments: Input Message which might contain Arguments or target Module
  • Arguments (""): The arguments which will be used to replace arguments in State with Arguments. if empty, no arguments will be included in output strings.
  • Target Module (""): The target which will be used to replace target in State with Arguments. if empty, target in State with Arguments will be used.

Outputs:

  • State with Arguments: String stands for state with arguments

Build No-Reply Asynchronous Message with Arguments.vi

Builds a message that contains arguments for CSM. This VI will parse "State with Arguments" for message string, arguments and target module from input State with Arguments and replace corresponding parts in the message with input values with No-Reply async-message symbol "->|" if Target Module ("") is specified.

For Example:

If State with Arguments input is "API: DoSth" Arguments ("") input is "Arguments" Target Module ("") input is "Callee" Then result string is "API: DoSth >> Arguments ->| Callee". It's different with Build Message with Arguments(Auto Check).vi. Message Type Symbol is replaced with "->|".

If State with Arguments input is "API: DoSth >> Arguments -> Callee" Arguments ("") input is "NewArguments" Target Module ("") input is "" Then result string is "API: DoSth >> NewArguments ->| Callee". Message Type Symbol is replaced with "->|".

If State with Arguments input is "API: DoSth >> Arguments -> Callee" Arguments ("") input is "NewArguments" Target Module ("") input is "NewCallee" Then result string is "API: DoSth >> NewArguments ->| NewCallee". Message Type Symbol is replaced with "->|".

If State with Arguments input is "API: DoSth >> Arguments -> Callee" Arguments ("") input is "" Target Module ("") input is "NewCallee" Then result string is "API: DoSth ->| NewCallee". Message Type Symbol is replaced with "->|".

If State with Arguments input is "API: DoSth >> Arguments -@ Callee" Arguments ("") input is "NewArguments" Target Module ("") input is "" Then result string is "API: DoSth >> NewArguments ->| Callee". Message Type Symbol is replaced with "->|".

Inputs:

  • State with Arguments: Input Message which might contain Arguments or target Module
  • Arguments (""): The arguments which will be used to replace arguments in State with Arguments. if empty, no arguments will be included in output strings.
  • Target Module (""): The target which will be used to replace target in State with Arguments. if empty, target in State with Arguments will be used.

Outputs:

  • State with Arguments: String stands for state with arguments

Build Synchronous Message with Arguments.vi

Builds a message that contains arguments for CSM. This VI will parse "State with Arguments" for message string, arguments and target module from input State with Arguments and replace corresponding parts in the message with input values with sync-message symbol "-@" if Target Module ("") is specified.

For Example:

If State with Arguments input is "API: DoSth" Arguments ("") input is "Arguments" Target Module ("") input is "Callee" Then result string is "API: DoSth >> Arguments ->| Callee". It's different with Build Message with Arguments(Auto Check).vi. Message Type Symbol is replaced with "-@".

If State with Arguments input is "API: DoSth >> Arguments -> Callee" Arguments ("") input is "NewArguments" Target Module ("") input is "" Then result string is "API: DoSth >> NewArguments ->| Callee". Message Type Symbol is replaced with "-@".

If State with Arguments input is "API: DoSth >> Arguments -> Callee" Arguments ("") input is "NewArguments" Target Module ("") input is "NewCallee" Then result string is "API: DoSth >> NewArguments -@ NewCallee". Message Type Symbol is replaced with "-@".

If State with Arguments input is "API: DoSth >> Arguments -> Callee" Arguments ("") input is "" Target Module ("") input is "NewCallee" Then result string is "API: DoSth -@ NewCallee". Message Type Symbol is replaced with "-@".

If State with Arguments input is "API: DoSth >> Arguments -@ Callee" Arguments ("") input is "NewArguments" Target Module ("") input is "" Then result string is "API: DoSth >> NewArguments -@ Callee".

Inputs:

  • State with Arguments: Input Message which might contain Arguments or target Module
  • Arguments (""): The arguments which will be used to replace arguments in State with Arguments. if empty, no arguments will be included in output strings.
  • Target Module (""): The target which will be used to replace target in State with Arguments. if empty, target in State with Arguments will be used.

Outputs:

  • State with Arguments: String stands for state with arguments

Build Interrupt Status Message.vi

Builds a message that contains arguments for CSM. This VI will parse "State with Arguments" for message type, message string, arguments and target module from input State with Arguments and replace corresponding parts in the message with input values. The message type from input State with Arguments will be used. For Example: If State with Arguments input is "API: DoSth" Then result string is "API: DoSth >> Arguments" as no message symbol is detected. If State with Arguments input is "API: DoSth >> Arguments -> Callee" Then result string is "API: DoSth >> NewArguments -> Callee" If State with Arguments input is "API: DoSth >> Arguments -> Callee" Then result string is "API: DoSth >> NewArguments -> NewCallee" If State with Arguments input is "API: DoSth >> Arguments -> Callee" Then result string is "API: DoSth -> NewCallee" If State with Arguments input is "API: DoSth >> Arguments -@ Callee" Then result string is "API: DoSth >> NewArguments -@ Callee"

  • State with Arguments: Input Message which might contain Arguments or target Module
  • Arguments (""): The arguments which will be used to replace arguments in State with Arguments. if empty, no arguments will be included in output strings.
  • Target Module (""): The target which will be used to replace target in State with Arguments. if empty, target in State with Arguments will be used.
  • State with Arguments: String stands for state with arguments

Inputs:

  • State with Arguments:
  • Arguments (""):

Outputs:

  • State with Arguments:

Build Normal Status Message.vi

Builds a message that contains arguments for CSM. This VI will parse "State with Arguments" for message type, message string, arguments and target module from input State with Arguments and replace corresponding parts in the message with input values. The message type from input State with Arguments will be used. For Example: If State with Arguments input is "API: DoSth" Then result string is "API: DoSth >> Arguments" as no message symbol is detected. If State with Arguments input is "API: DoSth >> Arguments -> Callee" Then result string is "API: DoSth >> NewArguments -> Callee" If State with Arguments input is "API: DoSth >> Arguments -> Callee" Then result string is "API: DoSth >> NewArguments -> NewCallee" If State with Arguments input is "API: DoSth >> Arguments -> Callee" Then result string is "API: DoSth -> NewCallee" If State with Arguments input is "API: DoSth >> Arguments -@ Callee" Then result string is "API: DoSth >> NewArguments -@ Callee"

  • State with Arguments: Input Message which might contain Arguments or target Module
  • Arguments (""): The arguments which will be used to replace arguments in State with Arguments. if empty, no arguments will be included in output strings.
  • Target Module (""): The target which will be used to replace target in State with Arguments. if empty, target in State with Arguments will be used.
  • State with Arguments: String stands for state with arguments

Inputs:

  • State with Arguments:
  • Arguments (""):

Outputs:

  • State with Arguments:

Build Register Status Message.vi

Builds register status message. The message looks like: [source-state]@[source-module] >> [response-message]@[response-module] -> For examples: DownloadFinished@Downloader >> StartPlay@Player -> DownloadFinished@Downloader >> StartPlay -> // response-module is current module DownloadFinished@Downloader -> // response-module is current module. response-message is DownloadFinished DownloadFinished@* >> StartPlay@Player -> // Any Module's DownloadFinished is registered to Player's StartPlay state.

Inputs:

  • Source CSM Name (* as Default):
  • CSM Name:
  • Status:
  • Response Message (if "", same as Source Message):

Outputs:

  • State with Arguments:

Build Unregister Status Message.vi

Builds unregister status message. The message looks like: [source-state]@[source-module] >> [response-module] -> For examples: DownloadFinished@Downloader >> StartPlay -> DownloadFinished@Downloader ->

Inputs:

  • Source CSM Name (* as Default):
  • CSM Name:
  • Status:

Outputs:

  • State with Arguments:

Add State(s) to Queue By BOOL++.vi

Depending on the High Priority and Bool input, this VI generates a concatenated state of TRUE/False and Remaining States. The High Priority input determines if the TRUE or False string concatenates before/after the remaining states. The Bool input determines whether TRUE or False string to be concatenated.

Inputs:

  • State Queue(""): The entire state queue is wired to this input.
  • TRUE(""): State to insert when Bool is True.
  • False(""): State to insert when Bool is False.
  • Bool: Flag for choosing State String connected to TRUE terminal or False terminal.
  • High Priority(FALSE): If True, The state will be inserted to the top of the State Queue(""). If False, It's appended to the tail.

Outputs:

  • State Queue Out: Returns all the next states that should execute after the current state completes.

Add State(s) to Queue By BOOL(Element).vi

Depending on the High Priority and Bool input, this VI generates a concatenated state of TRUE/False and Remaining States. The High Priority input determines if the TRUE or False string concatenates before/after the remaining states. The Bool input determines whether TRUE or False string to be concatenated.

Inputs:

  • State Queue(""): The entire state queue is wired to this input.
  • TRUE(""): State to insert when Bool is True.
  • False(""): State to insert when Bool is False.
  • Bool: Flag for choosing State String connected to TRUE terminal or False terminal.
  • High Priority(FALSE): If True, The state will be inserted to the top of the State Queue(""). If False, It's appended to the tail.

Outputs:

  • State Queue Out: Returns all the next states that should execute after the current state completes.

Add State(s) to Queue By BOOL(Array Left).vi

Depending on the High Priority and Bool input, this VI generates a concatenated state of TRUE/False and Remaining States. The High Priority input determines if the TRUE or False string concatenates before/after the remaining states. The Bool input determines whether TRUE or False string to be concatenated.

Inputs:

  • State Queue(""): The entire state queue is wired to this input.
  • TRUE(""): State to insert when Bool is True.
  • False(""): State to insert when Bool is False.
  • Bool: Flag for choosing State String connected to TRUE terminal or False terminal.
  • High Priority(FALSE): If True, The state will be inserted to the top of the State Queue(""). If False, It's appended to the tail.

Outputs:

  • State Queue Out: Returns all the next states that should execute after the current state completes.

Add State(s) to Queue By BOOL(Array Right).vi

Depending on the High Priority and Bool input, this VI generates a concatenated state of TRUE/False and Remaining States. The High Priority input determines if the TRUE or False string concatenates before/after the remaining states. The Bool input determines whether TRUE or False string to be concatenated.

Inputs:

  • State Queue(""): The entire state queue is wired to this input.
  • TRUE(""): State to insert when Bool is True.
  • False(""): State to insert when Bool is False.
  • Bool: Flag for choosing State String connected to TRUE terminal or False terminal.
  • High Priority(FALSE): If True, The state will be inserted to the top of the State Queue(""). If False, It's appended to the tail.

Outputs:

  • State Queue Out: Returns all the next states that should execute after the current state completes.

Add State(s) to Queue By BOOL(Array All).vi

Depending on the High Priority and Bool input, this VI generates a concatenated state of TRUE/False and Remaining States. The High Priority input determines if the TRUE or False string concatenates before/after the remaining states. The Bool input determines whether TRUE or False string to be concatenated.

Inputs:

  • State Queue(""): The entire state queue is wired to this input.
  • TRUE(""): State to insert when Bool is True.
  • False(""): State to insert when Bool is False.
  • Bool: Flag for choosing State String connected to TRUE terminal or False terminal.
  • High Priority(FALSE): If True, The state will be inserted to the top of the State Queue(""). If False, It's appended to the tail.

Outputs:

  • State Queue Out: Returns all the next states that should execute after the current state completes.

CSM - Broadcast Status Change.vi

Broadcast the status change to system. The CSM Module who registered the status will receive the status change.

Inputs:

  • Status with Arguments: Status with arguments to publish
  • State Queue(""): The entire state queue is wired to this input.
  • Broadcast(T): Trigger for broadcast or not.

Outputs:

  • Remaining States: Returns all the next states that should execute after the current state completes.

Arguments

CSM - Make String Arguments Safe.vi

'->','->|','-@','-&','<-" are key words in CSM, which should not be included in arguments. You can use this vi to make your arguments safe.

Inputs:

  • Argument String: Arguments might include '->','->|','-@','-&','<-".

Outputs:

  • Safe Argument String: Arguments safe for CSM.

CSM - Revert Arguments-Safe String.vi

'->','->|','-@','-&','<-" are key words in CSM, which should not be included in arguments. You can use CSM Make String Arguments Safe.vi to make your arguments safe. This VI is used for converting the safe arguments back to the origin string.

Inputs:

  • Safe Argument String: Arguments safe for CSM.

Outputs:

  • Origin Argument String: Origin arguments might include '->','->|','-@','-&','<-".

CSM - Convert Data to HexStr.vi

Convert complex argument(variant) to hex string, which could be safely used as state argument without broking the string queue logic.

Inputs:

  • Variant: Complex data in variant format.

Outputs:

  • HEX String (0-9,A-F): Hex String, which contains no invisible string following CSM's rule

CSM - Convert HexStr to Data.vi

Convert hex string arguments back to variant.

Inputs:

  • HEX String: Hex String, which contains no invisible string following CSM's rule

Outputs:

  • Variant: Complex data in variant format.
  • error out: Error output

Advance APIs

CSM - Start Async Call.vi

VI snippet for dropping start async call template code from LabVIEW Quick Drop.

Inputs:

  • N/A

Outputs:

  • N/A

CSM - Synchronized Call.vi

VI snippet for dropping sync call template code from LabVIEW Quick Drop.

Inputs:

  • N/A

Outputs:

  • N/A

CSM - Mark As Worker Module.vi

Append '#' to CSM Name, to mark this module is a worker, who shares the same message queue with workers with the same name. A real name with uuid generated will be assigned to this CSM module.

Inputs:

  • CSM Name: CSM module name.

Outputs:

  • CSM Name(marked as worker): CSM module name with '#' appended.

CSM - Compact Multiple States.vi

Compact multiple states to a single string for input.

Inputs:

  • States in Lines: Multiple states as string array.

Outputs:

  • States: State String contains all the input state(s)

CSM - Check If Module Exists.vi

Check if module with specified name exists.

Inputs:

  • CSM Name: CSM Module Name
  • Error in: Error cluster

Outputs:

  • Exist?: Return True if specified module exists.
  • CSM Name(dup): Return CSM Name
  • Error out: Error cluster

CSM - List Modules.vi

List all CSM Modules alive in system.

Inputs:

  • Exclude Standalone CSM(T): 'TRUE' to exclude standalone CSM module, and 'FALSE' to include them.
  • Error in: Error cluster

Outputs:

  • Module Names: Module Names
  • Error out: Error cluster

CSM - Module Status.vi

Get the CSM+ Module Status

Inputs:

  • CSM Name: CSM module name.
  • Error in: Error cluster

Outputs:

  • Mode: Return the mode of CSM Module. It might be "Stand-alone", "CSM" or "Action Worker".
  • #As Worker: Number of the workers if module in "Action Worker" mode.
  • #msg to be processed: The number of message in CSM Message Queue.
  • CSM Name(dup): Return CSM Name
  • Error out: Error cluster

CSM - Register Status Change.vi

Register for notification of other CSM Module's status change. If "Response Message" is not connected or "" is the input, the same state name will be used for acting message.

Inputs:

  • CSM Name: CSM Module name.
  • Source CSM Name ('' as Default): CSM who generates the status. You can use '' for all modules generated the same Status
  • Status: The status string
  • Response Message (if "", same as Source Message): After registered, If status change, this message will be received.
  • Priority(T:As Status,F:As Interrupt): The Response Message will be inserted to the front of state queue if it's False, otherwise it wil be append to the tail.
  • Error in: Error cluster

Outputs:

  • CSM Name(dup): Return CSM Name
  • Error out: Error cluster

CSM - Unregister Status Change.vi

Unregister the notification of other CSM Module's status change.

Inputs:

  • CSM Name: CSM Module name.
  • Source CSM Name: CSM who generates the status. You can use '*' for all modules generated the same Status
  • Status: The status string
  • Error in: Error cluster

Outputs:

  • CSM Name(dup): return CSM Name
  • Error out: Error cluster

CSM - Get New State Notifier Event.vi

Inputs:

  • Name("" to use uuid) in: CSM module name
  • Error in: Error cluster

Outputs:

  • New State Notifier Event: User event to break CSM module from waiting in event structure when message is received.
  • Error out: Error cluster

Non-CSM Support

CSM - Post Message.vi

Post a message to CSM specified.

Inputs:

  • Target Module:Target CSM Module name.
  • State: Message to post.
  • Arguments (""): Argument of the message.
  • Error In (no error): Error cluster

Outputs:

  • error out: Error cluster

CSM - Send Message and Wait for Reply.vi

Send a message to CSM specified and wait for the reply with timeout.

Inputs:

  • Target Module: Target CSM Module name.
  • State: Message to send
  • Arguments (""): Argument of the message.
  • Response Timeout(5000ms): Timeout for waiting the response.
  • Error In (no error): Error cluster

Outputs:

  • Arguments: Response returned.
  • error out: Error cluster

CSM - Status Change Event.vi

Obtain CSM Global Log Event Reference.

  • Error in: Error cluster
  • CSM Global Log Event: User event reference for CSM global log.
  • Error out: Error cluster

Inputs:

  • Error in:
  • Name("" to use uuid) in:

Outputs:

  • Error out:
  • Status Change Event:

CSM - Destroy Status Change Event.vi

Release CSM Global Log Event Reference.

  • CSM Global Log Event:
  • Error in: Error cluster
  • Error out: Error cluster

Inputs:

  • Error in:
  • Status Change Event:

Outputs:

  • Error out:

Side-Loop Support

CSM - Request CSM to Post Message.vi

Request CSM to Post a message to CSM specified. This is usually used in sub-loops with a CSM for acting as a holistic module.

Inputs:

  • Status: Message to post.
  • Arguments (""): Argument of the message.
  • Target Module:Target CSM Module name.
  • Module Name:Host Module Name
  • Error In (no error): Error cluster

Outputs:

  • error out: Error cluster

CSM - Request CSM to Broadcast Status Change.vi

Request CSM to publish status change to CSM specified. This is usually used in sub-loops with a CSM for acting as a holistic module.

Inputs:

  • Status: status to broadcast.
  • Arguments (""): Argument of the status.
  • Module Name:Host Module Name
  • Broadcast(T): Trigger for broadcast or not.
  • Error In (no error): Error cluster

Outputs:

  • error out: Error cluster

CSM - Module Turns Invalid.vi

Check if CSM module is not valid any more. This is usually used in sub-loops with a CSM for acting as a holistic module. It's used for exit condition of the sub-loops.

Inputs:

  • CSM Name: Host Module Name

Outputs:

  • Turn Invalid(Exit)?: CSM Module turns invalid

Global Log Event

CSM - Global Log Event.vi

Obtain CSM Global Log Event Reference.

Inputs:

  • Error in: Error cluster

Outputs:

  • CSM Global Log Event: User event reference for CSM global log.
  • Error out: Error cluster

CSM - Destroy Global Log Event.vi

Release CSM Global Log Event Reference.

Inputs:

  • CSM Global Log Event:
  • Error in: Error cluster

Outputs:

  • Error out: Error cluster

CSM - Generate User Global Log.vi

Inputs:

  • Error in:
  • From Who:
  • ModuleName:
  • Log:
  • Arguments:

Outputs:

  • error out:

Utility VIs

Build Error Cluster.vi

Creates an error cluster, building the source string from the calling VIs call chain in a standard LabVIEW fashion. Builds source string as: "Calling VI in Calling VI's Caller->Calling VI's Caller's Caller->etc...->etc..." Optional 'String to Prepend to source ("")' string input is used to add extra descriptive info to the source string. This string, if present, will be enclosed in parenthesis and prepended to the source string.

Inputs:

  • code: error code
  • String to Prepend to source (""): error string

Outputs:

  • error out: Error cluster

Build Internal State String.vi

Build a state string that contains arguments for the CSM.

Inputs:s

  • State: The State or message string
  • Arguments (""): The argument for State
  • Arg-State (""): Why this message is sent here
  • Source (""): Who sent this message here

Outputs:

  • State with Arguments: String stands for state with arguments

String History Cacher.vi

Return the String Cache containing length number of characters, including the new input String.

Inputs:

  • String: History item string
  • length: max history length of cache.
  • Include Timestamp(F): Include timestamp in the from of every line or not

Outputs:

  • String Cache: The history string

Timeout Selector.vi

Used in User Event Template VI.

Inputs:

  • Timeout Expected: Expected timeout
  • Remaining States: If any remaining states left, output will be 0, otherwise, output is the expected value.

Outputs:

  • Timeout: timeout will be used.

Trim Both Whitespace.vi

Removes all ASCII white space (spaces, tabs, carriage returns, and linefeed) from the beginning, end, or both ends of string. The Trim Whitespace VI does not remove double byte characters.

Inputs:

  • string

Outputs:

  • trimmed string

uuid.vi

Generate Universally Unique Identifier(UUID) according to the standard methods. For example:

 - 59703F3AD837
 - 106A470BA5EC
 - 9B781DB313AF

Inputs:

  • N/A

Outputs:

  • UUID: Generated UUID

CSM - Broadcast Message Type.ctl

Broadcast Message Type definition.

  • Interrupt: High Priority
  • Status: Normal Priority

CSM - Message Type.ctl

Message Type definition.

  • Async: Async Message (->)
  • Async without Reply: Async Message without reply (->|)
  • Sync: Sync Message (-@)

Global Log To String.vi

Inputs:

  • Log:

Outputs:

  • String:
1
https://gitee.com/NEVSTOP-LAB/Communicable-State-Machine.git
git@gitee.com:NEVSTOP-LAB/Communicable-State-Machine.git
NEVSTOP-LAB
Communicable-State-Machine
Communicable-State-Machine
main

搜索帮助