Skip to content

Feat/fix alicat multidrop - #2

Open
senslab-MarkHawkins wants to merge 5 commits into
AFRL-ARES:Developfrom
senslab-MarkHawkins:feat/fix_alicat_multidrop
Open

Feat/fix alicat multidrop#2
senslab-MarkHawkins wants to merge 5 commits into
AFRL-ARES:Developfrom
senslab-MarkHawkins:feat/fix_alicat_multidrop

Conversation

@senslab-MarkHawkins

Copy link
Copy Markdown

Alicat devices are designed to have multiple devices sharing a single serial port. This fix implements a simple registry to allow multiple devices to share the same connection. Also updated the device so that livedata update is treated as a query instead of listening to a transaction stream. Included notes on implementation if use of transaction stream needed to be restored.

{
private readonly List<char> _unusedIds;
//simple registry to manage instances of seriaport resources across multiple mfcs
static Dictionary<string, MassFlowControllerConnection> _connections = new Dictionary<string, MassFlowControllerConnection>();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if you could elaborate on what you wanted to implement this to address. Typically we don't expect the driver to care about it's connection in relation to any others (maintaining the idea that the driver itself would only really care about it's own connection). It's true that the MFC's can share a serial connection, and we account for that in ARES by allowing devices of the same class (i.e. Alicat MFC's) to share the same resource with a unique identifier. For the MFC's this is the Id list that use a single capital letter (A, B, C...). Unless there's something critical this provides, I would say this is best left at the ARES level rather than the driver level itself.

_serialConnection = new MassFlowControllerConnection(serialInfo.PortName);
_serialConnection = MassFlowControllerConnection.GetMassFlowControllerConnection(serialInfo.PortName);

_stateWatchers = new CompositeDisposable

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the motivation here, but this should theoretically not be an issue on the current system. When receiving data that needs to be parsed, we have dedicated response parser classes that handle breaking down the serialized data. In the case of this stream, we're only going to get this processed response (the "LiveDataResponse" class) in the event that parser deemed it a valid response to parse. You can find that logic under "Commands/Responses/Parsers/LiveDataParser.cs". Based on that, I don't think this change is necessary, you shouldn't see the system processing any additional data from MFC's other than the one you told the driver to care about. If you are, then perhaps there's another bug happening under the hood we can dig out.

private void UpdateLiveData(LiveDataResponse liveResponse)
{
_liveData = liveResponse;
/// check on id is required if _statewatcher is used in order to avoid updating the state with a response from a different MFC than the one that is being watched

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comment above talks about this point I believe

var flowVal = StandardVolumeFlow.From(numericNum, unit);
// must be converted to match setpoint units, otherwise may cause issues when calculating newsetpoint
// dataFrameFormat.MaxVal = flowVal.StandardLitersPerMinute.ToString();
dataFrameFormat.MaxVal = flowVal.As((StandardVolumeFlowUnit)dataFrameFormat.Unit).ToString();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, was this change inspired by an issue you saw in lab?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants