Managed material is provided by a material management software but must be updated as it is used until it can be updated again.
Manager material is set from an associated location which I set by a material management program.
The location table is
|Reserved||Material Reserved by this controller|
|NewReserves||Newly Reserved Amounts|
|MatlRqst||Material Requested by this controller|
|MatlUsed||Material Used by this controller|
|EstAmount||Estimated Material from EQC Less New Reserves|
|LastEstAmount||Amount Last Estimated from Interface. Used to detect a change to clear out MatlUsed.|
|Sts.Amount||Amount of assigned Material|
|Sts.Reserved||Material Reserved by EMs|
|iSts.EstAmount||Amount Estimated in Vessel based on known Amount less Reserved|
|iSts.Reserved||Amount Reserved for this PRC|
|iSts.MatlRqstAck||Amount of Material Requested by specific controller|
Amount of Assigned Material
Periodically Set by Material Manager whenever a change is detected to distributed amount
Keeps a running tally of Amount by subtracting Vessel.i.MatlUsed
Material Used by a completed EM and is sent once to the Vessel Interface to be added to the current Vessel.i.MatlUsed and then subtracted from the current Vessel.Sts.Amount.
This would be easier if I can trust the message instruction and just send as used but if two EMs both right then the 2nd will win unless the message is handled in the interface, or just add new Used to current Used until current used is cleared. If message is lost then it will appear to have more than it does but that will be corrected on the next location update which should come soon.
Continue subtracting MatlUsed from Sts.Amount until an update amount is recongnized,
Problem is that I need to know when the Vessel has responded with the MatlUsed because until then the PRC needs to subtract the MatlUsed from the current Vessel.EstAmount.
Amount of material less reserved amount.
Location.Amount -> Vessel.Sts.Amount – Vessel.i.MatlUsed -> Vessel.Sts.Amount – Vessel.i.MatlRqst[ctrlID] – Vessel.iSts.EstAmount
Vessel.i.MatlUsed = Sum of all Received MatlUsed commands
Clear Vessel.i.MatlUsed when Vessel.Sts.Amount is updated from Location
Vessel.i.MatlRqst[ctrlID] is current requests for material from all controllers. An EM will request prior and during its operation. The request will be moved to the Used once the EM is complete. The request is also a sum of all active EMs.
Vessel.iSts.Reserved = the amount requested for this controller.
PRC must subtract the difference of its Requests and the Reserved from the EstAmount.
Set Locations.VesselID, .MaterialID, .Class, .Type
Periodically Set Locations.Amount with distributed amount
Previous amount is stored in LastAmount tag to detect a change.
Periodically Check for updated Locations.Amount and update Vessels.Sts.Amount
On MatlUsedAck clear Control Material Used
Before starting EM make sure SP < EstAmount
After monitor SP < Amount
|SP <= EstAmount|
|Add SP to previous EM SP and Set in VES_EQCTRL.MatlRqst (This is how much material is needed to complete all additions)|
|Wait for VES_EQSTS.MatlProm >= MatlRqst (This means the EQC has reserved the requested amount and there is enough to start)|
|Continue to add SP to previous EM SP as VES_EQCTRL.MatlRqst|
|Fault if SP < Amount|
|Set PV to VES_EQCTRL.MatlUsed and keep until acknowledged (VES_EQSTS.MatlUsedAck is true, verify it is false before setting)|
|This method will prevent using a vessel without enough material but will delay the start until a MSG Read/write cycle to ack the promissed amount.|
|To expedite the promissed request the message could be priority sent along with a priority response.|
|This should be done along with acquiring CMs since it has to wait for communications on that too. However, that will be a little too late on not having enough material.|
Reserves,NewReserves Cleared continuously in Unit:Vessel
EstAmount = Vessel.EstAmount – MatlUsed – NewReserves
ACM EstAmount = EstAmount – NewReserves
Not so fast, how is this going to work with everything distributed?